diff options
author | Dan Gohman <gohman@apple.com> | 2009-01-26 22:22:31 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-01-26 22:22:31 +0000 |
commit | 92f4f16a19c8d5edafad700a22e76eb2f22b4b31 (patch) | |
tree | 6306359f110f764371aedcf268049e6e710e8b56 /lib | |
parent | 609eef258fb9cb2491109abf12d4c307e05294ae (diff) | |
download | external_llvm-92f4f16a19c8d5edafad700a22e76eb2f22b4b31.zip external_llvm-92f4f16a19c8d5edafad700a22e76eb2f22b4b31.tar.gz external_llvm-92f4f16a19c8d5edafad700a22e76eb2f22b4b31.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/TargetMachine.cpp | 7 | ||||
-rw-r--r-- | lib/Target/X86/X86RegisterInfo.cpp | 12 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index a1d6fa7..fd577c7 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -40,6 +40,7 @@ namespace llvm { bool VerboseAsm; bool DisableJumpTables; bool StrongPHIElim; + bool DisableRedZone; } static cl::opt<bool, true> PrintCode("print-machineinstrs", @@ -164,6 +165,12 @@ EnableStrongPHIElim(cl::Hidden, "strong-phi-elim", cl::location(StrongPHIElim), cl::init(false)); +static cl::opt<bool, true> +DisableRedZoneOption("disable-red-zone", + cl::desc("Do not emit code that uses the red zone."), + cl::location(DisableRedZone), + cl::init(true)); + //--------------------------------------------------------------------------- // TargetMachine Class // diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index a0d8b58..08746f2 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/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) |