[llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 14 14:12:02 PST 2004


Changes in directory llvm/lib/Target/X86:

X86RegisterInfo.cpp updated: 1.46 -> 1.47

---
Log message:

There is no reason to align the stack pointer if there are no callees of this 
function!


---
Diffs of the changes:  (+12 -10)

Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.46 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.47
--- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.46	Sat Feb 14 13:49:54 2004
+++ llvm/lib/Target/X86/X86RegisterInfo.cpp	Sat Feb 14 14:11:07 2004
@@ -190,16 +190,18 @@
     MBB.insert(MBBI, MI);
 
   } else {
-    // When we have no frame pointer, we reserve argument space for call sites
-    // in the function immediately on entry to the current function.  This
-    // eliminates the need for add/sub ESP brackets around call sites.
-    //
-    NumBytes += MFI->getMaxCallFrameSize();
-
-    // Round the size to a multiple of the alignment (don't forget the 4 byte
-    // offset though).
-    unsigned Align = MF.getTarget().getFrameInfo().getStackAlignment();
-    NumBytes = ((NumBytes+4)+Align-1)/Align*Align - 4;
+    if (MFI->hasCalls()) {
+      // When we have no frame pointer, we reserve argument space for call sites
+      // in the function immediately on entry to the current function.  This
+      // eliminates the need for add/sub ESP brackets around call sites.
+      //
+      NumBytes += MFI->getMaxCallFrameSize();
+      
+      // Round the size to a multiple of the alignment (don't forget the 4 byte
+      // offset though).
+      unsigned Align = MF.getTarget().getFrameInfo().getStackAlignment();
+      NumBytes = ((NumBytes+4)+Align-1)/Align*Align - 4;
+    }
 
     // Update frame info to pretend that this is part of the stack...
     MFI->setStackSize(NumBytes);





More information about the llvm-commits mailing list