From 11665a64b055a8962a2dc1d5e787b1fad9d49544 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Thu, 16 Jul 2009 13:52:10 +0000 Subject: [PATCH] Emit correct offset for PseudoSourceValue llvm-svn: 75946 --- llvm/lib/Target/SystemZ/SystemZISelLowering.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp index c8ad01758cc2..9cff6ea2f0d5 100644 --- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp @@ -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 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)); } }