summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86RegisterInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-14 20:11:07 +0000
committerChris Lattner <sabre@nondot.org>2004-02-14 20:11:07 +0000
commitf54cd1524dfc949093266ff45d270f59be08f5bf (patch)
treee54c72a4d009f2409f4585d410673480191d75b6 /llvm/lib/Target/X86/X86RegisterInfo.cpp
parent612ce0c47c627f984f00ab56abab118c41278715 (diff)
downloadbcm5719-llvm-f54cd1524dfc949093266ff45d270f59be08f5bf.tar.gz
bcm5719-llvm-f54cd1524dfc949093266ff45d270f59be08f5bf.zip
There is no reason to align the stack pointer if there are no callees of this
function! llvm-svn: 11450
Diffstat (limited to 'llvm/lib/Target/X86/X86RegisterInfo.cpp')
-rw-r--r--llvm/lib/Target/X86/X86RegisterInfo.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp
index 5256ee7d4b0..6fdf80024ee 100644
--- a/llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -190,16 +190,18 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
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);
OpenPOWER on IntegriCloud