forked from OSchip/llvm-project
parent
8c220defa8
commit
1239d2d7ff
llvm/lib/Target/PowerPC
|
@ -464,36 +464,37 @@ PPC32TargetLowering::LowerCallTo(SDOperand Chain,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<SDOperand, SDOperand>
|
std::pair<SDOperand, SDOperand>
|
||||||
PPC32TargetLowering::LowerVAStart(SDOperand Chain, SelectionDAG &DAG, SDOperand Dest) {
|
PPC32TargetLowering::LowerVAStart(SDOperand Chain, SelectionDAG &DAG,
|
||||||
//vastart just returns the address of the VarArgsFrameIndex slot.
|
SDOperand Dest) {
|
||||||
return std::make_pair(DAG.getFrameIndex(VarArgsFrameIndex, MVT::i32), Chain);
|
// vastart just stores the address of the VarArgsFrameIndex slot into the
|
||||||
|
// memory location argument.
|
||||||
|
SDOperand FR = DAG.getFrameIndex(VarArgsFrameIndex, MVT::i32);
|
||||||
|
SDOperand Result = DAG.getNode(ISD::STORE, MVT::Other, Chain, FR, Dest,
|
||||||
|
DAG.getSrcValue(NULL));
|
||||||
|
return std::make_pair(Result, Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<SDOperand,SDOperand> PPC32TargetLowering::
|
std::pair<SDOperand,SDOperand> PPC32TargetLowering::
|
||||||
LowerVAArgNext(SDOperand Chain, SDOperand VAList,
|
LowerVAArgNext(SDOperand Chain, SDOperand VAArgOp,
|
||||||
const Type *ArgTy, SelectionDAG &DAG) {
|
const Type *ArgTy, SelectionDAG &DAG) {
|
||||||
// FIXME: THIS IS BROKEN!!!
|
|
||||||
|
|
||||||
bool isVANext = true;
|
|
||||||
|
|
||||||
|
|
||||||
MVT::ValueType ArgVT = getValueType(ArgTy);
|
MVT::ValueType ArgVT = getValueType(ArgTy);
|
||||||
SDOperand Result;
|
|
||||||
if (!isVANext) {
|
SDOperand VAList =
|
||||||
Result = DAG.getLoad(ArgVT, DAG.getEntryNode(), VAList,
|
DAG.getLoad(MVT::i32, Chain, VAArgOp, DAG.getSrcValue(NULL));
|
||||||
DAG.getSrcValue(NULL));
|
SDOperand Result = DAG.getLoad(ArgVT, VAList.getValue(1), VAList,
|
||||||
} else {
|
DAG.getSrcValue(NULL));
|
||||||
unsigned Amt;
|
unsigned Amt;
|
||||||
if (ArgVT == MVT::i32 || ArgVT == MVT::f32)
|
if (ArgVT == MVT::i32 || ArgVT == MVT::f32)
|
||||||
Amt = 4;
|
Amt = 4;
|
||||||
else {
|
else {
|
||||||
assert((ArgVT == MVT::i64 || ArgVT == MVT::f64) &&
|
assert((ArgVT == MVT::i64 || ArgVT == MVT::f64) &&
|
||||||
"Other types should have been promoted for varargs!");
|
"Other types should have been promoted for varargs!");
|
||||||
Amt = 8;
|
Amt = 8;
|
||||||
}
|
|
||||||
Result = DAG.getNode(ISD::ADD, VAList.getValueType(), VAList,
|
|
||||||
DAG.getConstant(Amt, VAList.getValueType()));
|
|
||||||
}
|
}
|
||||||
|
VAList = DAG.getNode(ISD::ADD, VAList.getValueType(), VAList,
|
||||||
|
DAG.getConstant(Amt, VAList.getValueType()));
|
||||||
|
Chain = DAG.getNode(ISD::STORE, MVT::Other, Chain,
|
||||||
|
VAList, VAArgOp, DAG.getSrcValue(NULL));
|
||||||
return std::make_pair(Result, Chain);
|
return std::make_pair(Result, Chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue