diff options
author | Derek Schuff <dschuff@google.com> | 2016-11-07 22:00:48 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2016-11-07 22:00:48 +0000 |
commit | 0d41b7b3f3e41442992b605923ff4f0f3a26ce85 (patch) | |
tree | bd906182aa74c5b69eb86c155f5c37a83a026ce7 /llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h | |
parent | d74e1e161dc67c5369df776e2300be365ddd5e90 (diff) | |
download | bcm5719-llvm-0d41b7b3f3e41442992b605923ff4f0f3a26ce85.tar.gz bcm5719-llvm-0d41b7b3f3e41442992b605923ff4f0f3a26ce85.zip |
[WebAssembly] Emit a BasePointer when we have overly-aligned stack objects
Because we shift the stack pointer by an unknown amount, we need an
additional pointer. In the case where we have variable-size objects
as well, we can't reuse the frame pointer, thus three pointers.
Patch by Jacob Gravelle
Differential Revision: https://reviews.llvm.org/D26263
llvm-svn: 286160
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h b/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h index c5702ce11ad..756619bebbe 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h +++ b/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h @@ -46,6 +46,10 @@ class WebAssemblyFunctionInfo final : public MachineFunctionInfo { // TLI::LowerVASTART unsigned VarargVreg = -1U; + // A virtual register holding the base pointer for functions that have + // overaligned values on the user stack. + unsigned BasePtrVreg = -1U; + public: explicit WebAssemblyFunctionInfo(MachineFunction &MF) : MF(MF) {} ~WebAssemblyFunctionInfo() override; @@ -65,6 +69,12 @@ class WebAssemblyFunctionInfo final : public MachineFunctionInfo { } void setVarargBufferVreg(unsigned Reg) { VarargVreg = Reg; } + unsigned getBasePointerVreg() const { + assert(BasePtrVreg != -1U && "Base ptr vreg hasn't been set"); + return BasePtrVreg; + } + void setBasePointerVreg(unsigned Reg) { BasePtrVreg = Reg; } + static const unsigned UnusedReg = -1u; void stackifyVReg(unsigned VReg) { |