diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-07-10 17:45:53 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-07-10 17:45:53 +0000 |
commit | 3f0dbab963197cadb32f70e1ee1a106fe35f5c8e (patch) | |
tree | d193668b79f9732c443c51f2080eab246abbf925 /include/llvm/CodeGen | |
parent | 1b8da1d8f14f91b88ff99d3bd5ec4d904cdf21b7 (diff) | |
download | external_llvm-3f0dbab963197cadb32f70e1ee1a106fe35f5c8e.zip external_llvm-3f0dbab963197cadb32f70e1ee1a106fe35f5c8e.tar.gz external_llvm-3f0dbab963197cadb32f70e1ee1a106fe35f5c8e.tar.bz2 |
Add support for dynamic stack realignment in the presence of dynamic allocas on
X86. Basically, this is a reapplication of r158087 with a few fixes.
Specifically, (1) the stack pointer is restored from the base pointer before
popping callee-saved registers and (2) in obscure cases (see comments in patch)
we must cache the value of the original stack adjustment in the prologue and
apply it in the epilogue.
rdar://11496434
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r-- | include/llvm/CodeGen/MachineFrameInfo.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h index 8b958e4..78898a4 100644 --- a/include/llvm/CodeGen/MachineFrameInfo.h +++ b/include/llvm/CodeGen/MachineFrameInfo.h @@ -215,6 +215,10 @@ class MachineFrameInfo { /// just allocate them normally. bool UseLocalStackAllocationBlock; + /// After the stack pointer has been restore from the base pointer we + /// use a cached adjusment. Currently only used for x86. + int64_t BPAdj; + public: explicit MachineFrameInfo(const TargetFrameLowering &tfi) : TFI(tfi) { StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0; @@ -230,6 +234,7 @@ public: LocalFrameSize = 0; LocalFrameMaxAlign = 0; UseLocalStackAllocationBlock = false; + BPAdj = 0; } /// hasStackObjects - Return true if there are any stack objects in this @@ -538,6 +543,16 @@ public: void setCalleeSavedInfoValid(bool v) { CSIValid = v; } + /// setBasePtrStackAdjustment - If we're restoring the stack pointer from the + /// base pointer, due to dynamic stack realignment + VLAs, we cache the + /// number of bytes initially allocated for the stack frame. In obscure + /// cases (e.g., tail calls with byval argument and no stack protector), the + /// stack gets adjusted outside of the prolog, but these shouldn't be + /// considered when restoring from the base pointer. Currently, this is only + /// needed for x86. + void setBasePtrStackAdjustment(int64_t adj) { BPAdj = adj; } + int64_t getBasePtrStackAdjustment() const { return BPAdj; } + /// getPristineRegs - Return a set of physical registers that are pristine on /// entry to the MBB. /// |