[llvm-commits] [llvm] r63056 - in /llvm/trunk: include/llvm/Target/TargetOptions.h lib/Target/TargetMachine.cpp lib/Target/X86/X86RegisterInfo.cpp
Dan Gohman
gohman at apple.com
Mon Jan 26 14:22:32 PST 2009
Author: djg
Date: Mon Jan 26 16:22:31 2009
New Revision: 63056
URL: http://llvm.org/viewvc/llvm-project?rev=63056&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Target/TargetOptions.h
llvm/trunk/lib/Target/TargetMachine.cpp
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
Modified: llvm/trunk/include/llvm/Target/TargetOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=63056&r1=63055&r2=63056&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetOptions.h (original)
+++ llvm/trunk/include/llvm/Target/TargetOptions.h Mon Jan 26 16:22:31 2009
@@ -107,6 +107,10 @@
/// wth earlier copy coalescing.
extern bool StrongPHIElim;
+ /// DisableRedZone - This flag disables use of the "Red Zone" on
+ /// targets which would otherwise have one.
+ extern bool DisableRedZone;
+
} // End llvm namespace
#endif
Modified: llvm/trunk/lib/Target/TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=63056&r1=63055&r2=63056&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/TargetMachine.cpp Mon Jan 26 16:22:31 2009
@@ -40,6 +40,7 @@
bool VerboseAsm;
bool DisableJumpTables;
bool StrongPHIElim;
+ bool DisableRedZone;
}
static cl::opt<bool, true> PrintCode("print-machineinstrs",
@@ -164,6 +165,12 @@
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
//
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=63056&r1=63055&r2=63056&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Mon Jan 26 16:22:31 2009
@@ -721,6 +721,18 @@
// 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)
More information about the llvm-commits
mailing list