diff options
author | Tim Northover <tnorthover@apple.com> | 2014-05-22 13:03:43 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2014-05-22 13:03:43 +0000 |
commit | f9e798ba6a8b0907c58ef3e6733cac4026baaebc (patch) | |
tree | 409722d8641b0dca9e1a450522e1949a6ed834ab /llvm/lib/Target/X86/X86FrameLowering.cpp | |
parent | cc346a92e30b3e0207a98bba471ef5161260249f (diff) | |
download | bcm5719-llvm-f9e798ba6a8b0907c58ef3e6733cac4026baaebc.tar.gz bcm5719-llvm-f9e798ba6a8b0907c58ef3e6733cac4026baaebc.zip |
Segmented stacks: omit __morestack call when there's no frame.
Patch by Florian Zeitz
llvm-svn: 209436
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86FrameLowering.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index 1c1b06623bd..4c1374f70f4 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/lib/Target/X86/X86FrameLowering.cpp @@ -1176,6 +1176,15 @@ X86FrameLowering::adjustForSegmentedStacks(MachineFunction &MF) const { !STI.isTargetWin32() && !STI.isTargetWin64() && !STI.isTargetFreeBSD()) report_fatal_error("Segmented stacks not supported on this platform."); + // Eventually StackSize will be calculated by a link-time pass; which will + // also decide whether checking code needs to be injected into this particular + // prologue. + StackSize = MFI->getStackSize(); + + // Do not generate a prologue for functions with a stack of size zero + if (StackSize == 0) + return; + MachineBasicBlock *allocMBB = MF.CreateMachineBasicBlock(); MachineBasicBlock *checkMBB = MF.CreateMachineBasicBlock(); X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>(); @@ -1200,11 +1209,6 @@ X86FrameLowering::adjustForSegmentedStacks(MachineFunction &MF) const { MF.push_front(allocMBB); MF.push_front(checkMBB); - // Eventually StackSize will be calculated by a link-time pass; which will - // also decide whether checking code needs to be injected into this particular - // prologue. - StackSize = MFI->getStackSize(); - // When the frame size is less than 256 we just compare the stack // boundary directly to the value of the stack pointer, per gcc. bool CompareStackPointer = StackSize < kSplitStackAvailable; |