Properly generate stack frame
authorAnton Korobeynikov <asl@math.spbu.ru>
Thu, 16 Jul 2009 14:12:36 +0000 (14:12 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Thu, 16 Jul 2009 14:12:36 +0000 (14:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75998 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SystemZ/SystemZRegisterInfo.cpp

index 6e8982d94a9d4c7cc453f565603a5592e26ccfc4..deceb35284ae4c2a5548fbeb2ebafdd9987c84a0 100644 (file)
@@ -193,8 +193,9 @@ void SystemZRegisterInfo::emitPrologue(MachineFunction &MF) const {
   // Get the number of bytes to allocate from the FrameInfo.
   // Note that area for callee-saved stuff is already allocated, thus we need to
   // 'undo' the stack movement.
-  uint64_t StackSize =
-    MFI->getStackSize() - SystemZMFI->getCalleeSavedFrameSize();
+  uint64_t StackSize =  MFI->getStackSize();
+  uint64_t NumBytes = StackSize - SystemZMFI->getCalleeSavedFrameSize();
+  NumBytes -= TFI.getOffsetOfLocalArea();
 
   // Skip the callee-saved push instructions.
   while (MBBI != MBB.end() &&
@@ -205,9 +206,8 @@ void SystemZRegisterInfo::emitPrologue(MachineFunction &MF) const {
   if (MBBI != MBB.end())
     DL = MBBI->getDebugLoc();
 
-  uint64_t NumBytes = StackSize - TFI.getOffsetOfLocalArea();
-
-  if (NumBytes) // adjust stack pointer: R15 -= numbytes
+  // adjust stack pointer: R15 -= numbytes
+  if (StackSize)
     emitSPUpdate(MBB, MBBI, -(int64_t)NumBytes, TII);
 
   if (hasFP(MF)) {