summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-01-11 22:14:47 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-01-11 22:14:47 +0000
commit7f4ec8274f339439f10fd80ee7007ff7a84aab1b (patch)
tree447f4cb0235931dd70207df73be01dba22af8eb1 /llvm
parent982493300e26867af6e8c39047a2e7986dbda133 (diff)
downloadbcm5719-llvm-7f4ec8274f339439f10fd80ee7007ff7a84aab1b.tar.gz
bcm5719-llvm-7f4ec8274f339439f10fd80ee7007ff7a84aab1b.zip
Allow custom lowering of DYNAMIC_STACKALLOC.
llvm-svn: 25224
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index fe6c4768175..e62c6d32e8e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -829,7 +829,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
// legalization process more efficient and also makes libcall insertion
// easier.
break;
- case ISD::DYNAMIC_STACKALLOC:
+ 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.
@@ -842,12 +842,25 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
} else
Result = Op.getValue(0);
- // 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);
-
+ switch (TLI.getOperationAction(Node->getOpcode(),
+ Node->getValueType(0))) {
+ default: assert(0 && "This action is not supported yet!");
+ case TargetLowering::Custom: {
+ SDOperand Tmp = TLI.LowerOperation(Result, DAG);
+ if (Tmp.Val) {
+ Result = LegalizeOp(Tmp);
+ }
+ // FALLTHROUGH if the target thinks it is legal.
+ }
+ case TargetLowering::Legal:
+ // Since this op produce 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);
+ }
+ assert(0 && "Unreachable");
+ }
case ISD::TAILCALL:
case ISD::CALL: {
Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
OpenPOWER on IntegriCloud