summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86RegisterInfo.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-01-26 22:22:31 +0000
committerDan Gohman <gohman@apple.com>2009-01-26 22:22:31 +0000
commitb6d36e1d14edc54d137f6b36c85b042b6dfe17d3 (patch)
treeb3ac7c1dbdb4524c3ddf96f37a175e08ce6e5875 /llvm/lib/Target/X86/X86RegisterInfo.cpp
parentb44ab5f25df06bd511caa2873727a1040d96761c (diff)
downloadbcm5719-llvm-b6d36e1d14edc54d137f6b36c85b042b6dfe17d3.tar.gz
bcm5719-llvm-b6d36e1d14edc54d137f6b36c85b042b6dfe17d3.zip
Implement Red Zone utilization on x86-64. This is currently
disabled by default; I'll enable it when I hook it up with the llvm-gcc flag which controls it. llvm-svn: 63056
Diffstat (limited to 'llvm/lib/Target/X86/X86RegisterInfo.cpp')
-rw-r--r--llvm/lib/Target/X86/X86RegisterInfo.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp
index a0d8b58b789..08746f2ffb4 100644
--- a/llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -721,6 +721,18 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
// Get desired stack alignment
uint64_t MaxAlign = MFI->getMaxAlignment();
+ // If this is x86-64 and the Red Zone is not disabled, if we are a leaf
+ // function, and use up to 128 bytes of stack space, don't have a frame
+ // pointer, calls, or dynamic alloca then we do not need to adjust the
+ // stack pointer (we fit in the Red Zone).
+ if (Is64Bit && !DisableRedZone &&
+ !MFI->hasVarSizedObjects() && // No dynamic alloca.
+ !MFI->hasCalls()) { // No calls.
+ StackSize = std::max((uint64_t)X86FI->getCalleeSavedFrameSize(),
+ StackSize > 128 ? StackSize - 128 : 0);
+ MFI->setStackSize(StackSize);
+ }
+
// Add RETADDR move area to callee saved frame size.
int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta();
if (TailCallReturnAddrDelta < 0)
OpenPOWER on IntegriCloud