[llvm-commits] [llvm] r76007 - in /llvm/trunk/lib/Target/SystemZ: SystemZInstrInfo.cpp SystemZRegisterInfo.cpp

Anton Korobeynikov asl at math.spbu.ru
Thu Jul 16 07:16:27 PDT 2009


Author: asl
Date: Thu Jul 16 09:16:26 2009
New Revision: 76007

URL: http://llvm.org/viewvc/llvm-project?rev=76007&view=rev
Log:
Another attempt to fix prologue emission

Modified:
    llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp
    llvm/trunk/lib/Target/SystemZ/SystemZRegisterInfo.cpp

Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp?rev=76007&r1=76006&r2=76007&view=diff

==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp Thu Jul 16 09:16:26 2009
@@ -265,9 +265,9 @@
 
 unsigned
 SystemZInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
-                              MachineBasicBlock *FBB,
+                               MachineBasicBlock *FBB,
                             const SmallVectorImpl<MachineOperand> &Cond) const {
-  // FIXME this should probably have a DebugLoc operand
+  // FIXME: this should probably have a DebugLoc operand
   DebugLoc dl = DebugLoc::getUnknownLoc();
   // Shouldn't be a fall through.
   assert(TBB && "InsertBranch must not be told to insert a fallthrough");

Modified: llvm/trunk/lib/Target/SystemZ/SystemZRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZRegisterInfo.cpp?rev=76007&r1=76006&r2=76007&view=diff

==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZRegisterInfo.cpp Thu Jul 16 09:16:26 2009
@@ -143,10 +143,10 @@
   // if yes - mark it as 'callee' saved.
   MachineFrameInfo *FFI = MF.getFrameInfo();
 
-  if (FFI->hasCalls()
-      /* FIXME: function is varargs */
-      /* FIXME: function grabs RA */
-      /* FIXME: function calls eh_return */)
+  if (FFI->hasCalls())
+    /* FIXME: function is varargs */
+    /* FIXME: function grabs RA */
+    /* FIXME: function calls eh_return */
     MF.getRegInfo().setPhysRegUsed(SystemZ::R14D);
 
   if (FFI->hasCalls() ||
@@ -193,9 +193,10 @@
   // 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();
-  uint64_t NumBytes = StackSize - SystemZMFI->getCalleeSavedFrameSize();
-  NumBytes -= TFI.getOffsetOfLocalArea();
+  uint64_t StackSize = MFI->getStackSize();
+  StackSize -= SystemZMFI->getCalleeSavedFrameSize();
+
+  uint64_t NumBytes = StackSize - TFI.getOffsetOfLocalArea();
 
   // Skip the callee-saved push instructions.
   while (MBBI != MBB.end() &&
@@ -207,8 +208,11 @@
     DL = MBBI->getDebugLoc();
 
   // adjust stack pointer: R15 -= numbytes
-  if (StackSize)
+  if (StackSize || MFI->hasCalls()) {
+    assert(MF.getRegInfo().isPhysRegUsed(SystemZ::R15D) &&
+           "Invalid stack frame calculation!");
     emitSPUpdate(MBB, MBBI, -(int64_t)NumBytes, TII);
+  }
 
   if (hasFP(MF)) {
     // Update R11 with the new base value...





More information about the llvm-commits mailing list