diff options
Diffstat (limited to 'lib/Target/WebAssembly/WebAssemblyFrameLowering.h')
| -rw-r--r-- | lib/Target/WebAssembly/WebAssemblyFrameLowering.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/lib/Target/WebAssembly/WebAssemblyFrameLowering.h b/lib/Target/WebAssembly/WebAssemblyFrameLowering.h index fe23e418a3f1..c6fa8261b03f 100644 --- a/lib/Target/WebAssembly/WebAssemblyFrameLowering.h +++ b/lib/Target/WebAssembly/WebAssemblyFrameLowering.h @@ -22,9 +22,10 @@ namespace llvm { class MachineFrameInfo; class WebAssemblyFrameLowering final : public TargetFrameLowering { - public: +public: /// Size of the red zone for the user stack (leaf functions can use this much - /// space below the stack pointer without writing it back to memory). + /// space below the stack pointer without writing it back to __stack_pointer + /// global). // TODO: (ABI) Revisit and decide how large it should be. static const size_t RedZoneSize = 128; @@ -34,9 +35,9 @@ class WebAssemblyFrameLowering final : public TargetFrameLowering { /*TransientStackAlignment=*/16, /*StackRealignable=*/true) {} - MachineBasicBlock::iterator eliminateCallFramePseudoInstr( - MachineFunction &MF, MachineBasicBlock &MBB, - MachineBasicBlock::iterator I) const override; + MachineBasicBlock::iterator + eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, + MachineBasicBlock::iterator I) const override; /// These methods insert prolog and epilog code into the function. void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; @@ -45,13 +46,21 @@ class WebAssemblyFrameLowering final : public TargetFrameLowering { bool hasFP(const MachineFunction &MF) const override; bool hasReservedCallFrame(const MachineFunction &MF) const override; - private: + bool needsPrologForEH(const MachineFunction &MF) const; + + /// Write SP back to __stack_pointer global. + void writeSPToGlobal(unsigned SrcReg, MachineFunction &MF, + MachineBasicBlock &MBB, + MachineBasicBlock::iterator &InsertStore, + const DebugLoc &DL) const; + +private: bool hasBP(const MachineFunction &MF) const; - bool needsSP(const MachineFunction &MF, const MachineFrameInfo &MFI) const; - bool needsSPWriteback(const MachineFunction &MF, - const MachineFrameInfo &MFI) const; + bool needsSPForLocalFrame(const MachineFunction &MF) const; + bool needsSP(const MachineFunction &MF) const; + bool needsSPWriteback(const MachineFunction &MF) const; }; -} // end namespace llvm +} // end namespace llvm #endif |
