From: Evan Cheng Date: Wed, 11 Jan 2006 22:14:47 +0000 (+0000) Subject: Allow custom lowering of DYNAMIC_STACKALLOC. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a7dce3c6c29fb9513d215c1bc44b01865571b4c2;p=oota-llvm.git Allow custom lowering of DYNAMIC_STACKALLOC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25224 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index fe6c4768175..e62c6d32e8e 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/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.