[llvm] r196755 - [SPARCV9]: Adjust the resultant pointer of DYNAMIC_STACKALLOC with the stack BIAS on sparcV9.

Venkatraman Govindaraju venkatra at cs.wisc.edu
Sun Dec 8 21:13:25 PST 2013


Author: venkatra
Date: Sun Dec  8 23:13:25 2013
New Revision: 196755

URL: http://llvm.org/viewvc/llvm-project?rev=196755&view=rev
Log:
[SPARCV9]: Adjust the resultant pointer of DYNAMIC_STACKALLOC with the stack BIAS on sparcV9.

Modified:
    llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
    llvm/trunk/test/CodeGen/SPARC/2013-05-17-CallFrame.ll

Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=196755&r1=196754&r2=196755&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Sun Dec  8 23:13:25 2013
@@ -2304,7 +2304,7 @@ static SDValue LowerVAARG(SDValue Op, Se
 }
 
 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(S
 
   // 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
   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);

Modified: llvm/trunk/test/CodeGen/SPARC/2013-05-17-CallFrame.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SPARC/2013-05-17-CallFrame.ll?rev=196755&r1=196754&r2=196755&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SPARC/2013-05-17-CallFrame.ll (original)
+++ llvm/trunk/test/CodeGen/SPARC/2013-05-17-CallFrame.ll Sun Dec  8 23:13:25 2013
@@ -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





More information about the llvm-commits mailing list