aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-09 19:03:49 +0000
committerChris Lattner <sabre@nondot.org>2005-01-09 19:03:49 +0000
commitfa404e8a76abfdafefb8806b35f596d288609496 (patch)
tree7252979a1f436f8f18c71a567bb336a622d178b3 /lib
parent590d800a12018af782a243cbdd3ac7b31d6d0822 (diff)
Teach legalize to deal with DYNAMIC_STACKALLOC (aka a dynamic llvm alloca)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19415 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 19e70f5927..a81dbee240 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -229,7 +229,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
if (I != LegalizedNodes.end()) return I->second;
}
- SDOperand Tmp1, Tmp2;
+ SDOperand Tmp1, Tmp2, Tmp3;
SDOperand Result = Op;
SDNode *Node = Op.Val;
@@ -307,6 +307,21 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
Result = DAG.getNode(Node->getOpcode(), MVT::Other, Tmp1,
Node->getOperand(1));
break;
+ case ISD::DYNAMIC_STACKALLOC:
+ Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
+ Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the size.
+ Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the alignment.
+ if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1) ||
+ Tmp3 != Node->getOperand(2))
+ Result = DAG.getNode(ISD::DYNAMIC_STACKALLOC, Node->getValueType(0),
+ Tmp1, Tmp2, Tmp3);
+
+ // Since this op produces two values, make sure to remember that we
+ // legalized both of them.
+ AddLegalizedOperand(SDOperand(Node, 0), Result);
+ AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1));
+ return Result.getValue(Op.ResNo);
+
case ISD::CALL:
Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the callee.