Emit correct offset for PseudoSourceValue
authorAnton Korobeynikov <asl@math.spbu.ru>
Thu, 16 Jul 2009 13:52:10 +0000 (13:52 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Thu, 16 Jul 2009 13:52:10 +0000 (13:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75946 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SystemZ/SystemZISelLowering.cpp

index c8ad01758cc29f0af4f42274c6083daa6649f8cb..9cff6ea2f0d534d394da2e8200191d35fbefcf5f 100644 (file)
@@ -194,6 +194,9 @@ SDValue SystemZTargetLowering::LowerCCCCallTo(SDValue Op, SelectionDAG &DAG,
   DebugLoc dl = Op.getDebugLoc();
   MachineFunction &MF = DAG.getMachineFunction();
 
+  // Offset to first argument stack slot.
+  const unsigned FirstArgOffset = 160;
+
   // Analyze operands of the call, assigning locations to each operand.
   SmallVector<CCValAssign, 16> ArgLocs;
   CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
@@ -246,14 +249,13 @@ SDValue SystemZTargetLowering::LowerCCCCallTo(SDValue Op, SelectionDAG &DAG,
                               SystemZ::R11D : SystemZ::R15D),
                              getPointerTy());
 
-      SDValue PtrOff =
-        DAG.getNode(ISD::ADD, dl, getPointerTy(),
-                    StackPtr,
-                    DAG.getIntPtrConstant(160+VA.getLocMemOffset()));
+      unsigned Offset = FirstArgOffset + VA.getLocMemOffset();
+      SDValue PtrOff = DAG.getNode(ISD::ADD, dl, getPointerTy(),
+                                   StackPtr,
+                                   DAG.getIntPtrConstant(Offset));
 
       MemOpChains.push_back(DAG.getStore(Chain, dl, Arg, PtrOff,
-                                         PseudoSourceValue::getStack(),
-                                         VA.getLocMemOffset()));
+                                         PseudoSourceValue::getStack(), Offset));
     }
   }