implement vaarg. Varargs now should work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24986 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-12-23 06:37:38 +00:00
parent c4769bb529
commit 74fa64b072
2 changed files with 26 additions and 4 deletions

View File

@ -578,8 +578,19 @@ LowerVAStart(SDOperand Chain, SDOperand VAListP, Value *VAListV,
std::pair<SDOperand,SDOperand> SparcV8TargetLowering::
LowerVAArg(SDOperand Chain, SDOperand VAListP, Value *VAListV,
const Type *ArgTy, SelectionDAG &DAG) {
assert(0 && "Unimp");
abort();
// Load the pointer out of the valist.
SDOperand Ptr = DAG.getLoad(MVT::i32, Chain,
VAListP, DAG.getSrcValue(VAListV));
MVT::ValueType ArgVT = getValueType(ArgTy);
SDOperand Val = DAG.getLoad(ArgVT, Ptr.getValue(1),
Ptr, DAG.getSrcValue(NULL));
// Increment the pointer.
Ptr = DAG.getNode(ISD::ADD, MVT::i32, Ptr,
DAG.getConstant(MVT::getSizeInBits(ArgVT)/8, MVT::i32));
// Store it back to the valist.
Chain = DAG.getNode(ISD::STORE, MVT::Other, Chain, Ptr,
VAListP, DAG.getSrcValue(VAListV));
return std::make_pair(Val, Chain);
}
std::pair<SDOperand, SDOperand> SparcV8TargetLowering::

View File

@ -578,8 +578,19 @@ LowerVAStart(SDOperand Chain, SDOperand VAListP, Value *VAListV,
std::pair<SDOperand,SDOperand> SparcV8TargetLowering::
LowerVAArg(SDOperand Chain, SDOperand VAListP, Value *VAListV,
const Type *ArgTy, SelectionDAG &DAG) {
assert(0 && "Unimp");
abort();
// Load the pointer out of the valist.
SDOperand Ptr = DAG.getLoad(MVT::i32, Chain,
VAListP, DAG.getSrcValue(VAListV));
MVT::ValueType ArgVT = getValueType(ArgTy);
SDOperand Val = DAG.getLoad(ArgVT, Ptr.getValue(1),
Ptr, DAG.getSrcValue(NULL));
// Increment the pointer.
Ptr = DAG.getNode(ISD::ADD, MVT::i32, Ptr,
DAG.getConstant(MVT::getSizeInBits(ArgVT)/8, MVT::i32));
// Store it back to the valist.
Chain = DAG.getNode(ISD::STORE, MVT::Other, Chain, Ptr,
VAListP, DAG.getSrcValue(VAListV));
return std::make_pair(Val, Chain);
}
std::pair<SDOperand, SDOperand> SparcV8TargetLowering::