[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAGISel.cpp
Nate Begeman
natebegeman at mac.com
Fri Jan 27 19:14:44 PST 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.279 -> 1.280
SelectionDAGISel.cpp updated: 1.139 -> 1.140
---
Log message:
Implement Promote for VAARG, and allow it to be custom promoted for people
who don't want the default behavior (Alpha).
---
Diffs of the changes: (+32 -1)
LegalizeDAG.cpp | 26 +++++++++++++++++++++++++-
SelectionDAGISel.cpp | 7 +++++++
2 files changed, 32 insertions(+), 1 deletion(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.279 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.280
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.279 Fri Jan 27 18:18:58 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 27 21:14:31 2006
@@ -3209,7 +3209,31 @@
Tmp2 = LegalizeOp(Node->getOperand(1));
Result = DAG.getNode(ISD::SRL, NVT, Tmp1, Tmp2);
break;
-
+
+ case ISD::VAARG:
+ Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
+ Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the pointer.
+ if (TLI.getOperationAction(ISD::VAARG, VT) == TargetLowering::Custom) {
+ Tmp3 = DAG.getVAArg(VT, Tmp1, Tmp2, Node->getOperand(2));
+ Result = TLI.CustomPromoteOperation(Tmp3, DAG);
+ } else {
+ SDOperand VAList = DAG.getLoad(TLI.getPointerTy(), Tmp1, Tmp2,
+ Node->getOperand(2));
+ // Increment the pointer, VAList, to the next vaarg
+ Tmp3 = DAG.getNode(ISD::ADD, TLI.getPointerTy(), VAList,
+ DAG.getConstant(MVT::getSizeInBits(VT)/8,
+ TLI.getPointerTy()));
+ // Store the incremented VAList to the legalized pointer
+ Tmp3 = DAG.getNode(ISD::STORE, MVT::Other, VAList.getValue(1), Tmp3, Tmp2,
+ Node->getOperand(2));
+ // Load the actual argument out of the pointer VAList
+ Result = DAG.getExtLoad(ISD::EXTLOAD, NVT, Tmp3, VAList,
+ DAG.getSrcValue(0), VT);
+ }
+ // Remember that we legalized the chain.
+ AddLegalizedOperand(Op.getValue(1), Result.getValue(1));
+ break;
+
case ISD::LOAD:
Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the pointer.
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.139 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.140
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.139 Fri Jan 27 15:09:21 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Jan 27 21:14:31 2006
@@ -1281,6 +1281,13 @@
return SDOperand();
}
+SDOperand TargetLowering::CustomPromoteOperation(SDOperand Op,
+ SelectionDAG &DAG) {
+ assert(0 && "CustomPromoteOperation not implemented for this target!");
+ abort();
+ return SDOperand();
+}
+
void SelectionDAGLowering::visitFrameReturnAddress(CallInst &I, bool isFrame) {
unsigned Depth = (unsigned)cast<ConstantUInt>(I.getOperand(1))->getValue();
std::pair<SDOperand,SDOperand> Result =
More information about the llvm-commits
mailing list