From: Venkatraman Govindaraju Date: Mon, 9 Dec 2013 05:13:25 +0000 (+0000) Subject: [SPARCV9]: Adjust the resultant pointer of DYNAMIC_STACKALLOC with the stack BIAS... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=847b5d976d1b43226604508ededbd648d0752e8a;p=oota-llvm.git [SPARCV9]: Adjust the resultant pointer of DYNAMIC_STACKALLOC with the stack BIAS on sparcV9. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196755 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Sparc/SparcISelLowering.cpp b/lib/Target/Sparc/SparcISelLowering.cpp index 61614888462..64625f70185 100644 --- a/lib/Target/Sparc/SparcISelLowering.cpp +++ b/lib/Target/Sparc/SparcISelLowering.cpp @@ -2304,7 +2304,7 @@ static SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG) { } static SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG, - bool is64Bit) { + const SparcSubtarget *Subtarget) { SDValue Chain = Op.getOperand(0); // Legalize the chain. SDValue Size = Op.getOperand(1); // Legalize the size. EVT VT = Size->getValueType(0); @@ -2317,7 +2317,9 @@ static SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG, // The resultant pointer is actually 16 words from the bottom of the stack, // to provide a register spill area. - unsigned regSpillArea = (is64Bit) ? 128 : 96; + unsigned regSpillArea = Subtarget->is64Bit() ? 128 : 96; + regSpillArea += Subtarget->getStackPointerBias(); + SDValue NewVal = DAG.getNode(ISD::ADD, dl, VT, NewSP, DAG.getConstant(regSpillArea, VT)); SDValue Ops[2] = { NewVal, Chain }; @@ -2644,7 +2646,7 @@ LowerOperation(SDValue Op, SelectionDAG &DAG) const { case ISD::VASTART: return LowerVASTART(Op, DAG, *this); case ISD::VAARG: return LowerVAARG(Op, DAG); case ISD::DYNAMIC_STACKALLOC: return LowerDYNAMIC_STACKALLOC(Op, DAG, - is64Bit); + Subtarget); case ISD::LOAD: return LowerF128Load(Op, DAG); case ISD::STORE: return LowerF128Store(Op, DAG); diff --git a/test/CodeGen/SPARC/2013-05-17-CallFrame.ll b/test/CodeGen/SPARC/2013-05-17-CallFrame.ll index 9c74aa0c7c3..81f586fe8a7 100644 --- a/test/CodeGen/SPARC/2013-05-17-CallFrame.ll +++ b/test/CodeGen/SPARC/2013-05-17-CallFrame.ll @@ -10,7 +10,7 @@ ; SPARC64-LABEL: variable_alloca_with_adj_call_stack ; SPARC64: save %sp, -128, %sp -; SPARC64: add {{.+}}, 128, %o0 +; SPARC64: add {{.+}}, 2175, %o0 ; SPARC64: add %sp, -80, %sp ; SPARC64: call foo ; SPARC64: add %sp, 80, %sp