diff options
author | Philip Reames <listmail@philipreames.com> | 2014-08-21 22:53:49 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2014-08-21 22:53:49 +0000 |
commit | 2c52c66816b09b00decee0a2e686098d3031e79c (patch) | |
tree | 2999c4cf0b95dc4786eb0308215d1274dc3d9e6e /llvm/lib/Target/X86/X86FrameLowering.cpp | |
parent | b84498497b1c46c19a82f65eafe75a28a17716b1 (diff) | |
download | bcm5719-llvm-2c52c66816b09b00decee0a2e686098d3031e79c.tar.gz bcm5719-llvm-2c52c66816b09b00decee0a2e686098d3031e79c.zip |
Minor refactor to make applying patches from 'Add a "probe-stack" attribute' review thread out of order easier.
llvm-svn: 216241
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86FrameLowering.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index 13ffbdf9871..2dbd407388c 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/lib/Target/X86/X86FrameLowering.cpp @@ -502,6 +502,8 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const { X86FI->setCalleeSavedFrameSize( X86FI->getCalleeSavedFrameSize() - TailCallReturnAddrDelta); + bool UseStackProbe = (STI.isOSWindows() && !STI.isTargetMacho()); + // 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 @@ -675,6 +677,8 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const { // Adjust stack pointer: ESP -= numbytes. + static const size_t PageSize = 4096; + // Windows and cygwin/mingw require a prologue helper routine when allocating // more than 4K bytes on the stack. Windows uses __chkstk and cygwin/mingw // uses __alloca. __alloca and the 32-bit version of __chkstk will probe the @@ -683,7 +687,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const { // responsible for adjusting the stack pointer. Touching the stack at 4K // increments is necessary to ensure that the guard pages used by the OS // virtual memory manager are allocated in correct sequence. - if (NumBytes >= 4096 && STI.isOSWindows() && !STI.isTargetMacho()) { + if (NumBytes >= PageSize && UseStackProbe) { const char *StackProbeSymbol; unsigned CallOp; |