diff options
Diffstat (limited to 'llvm/lib/Target/SystemZ/SystemZFrameLowering.h')
| -rw-r--r-- | llvm/lib/Target/SystemZ/SystemZFrameLowering.h | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZFrameLowering.h b/llvm/lib/Target/SystemZ/SystemZFrameLowering.h index c8312b836e57..6fddb4f81c41 100644 --- a/llvm/lib/Target/SystemZ/SystemZFrameLowering.h +++ b/llvm/lib/Target/SystemZ/SystemZFrameLowering.h @@ -10,6 +10,8 @@ #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H #include "MCTargetDesc/SystemZMCTargetDesc.h" +#include "SystemZInstrBuilder.h" +#include "SystemZMachineFunctionInfo.h" #include "llvm/ADT/IndexedMap.h" #include "llvm/CodeGen/TargetFrameLowering.h" #include "llvm/Support/TypeSize.h" @@ -19,10 +21,26 @@ class SystemZTargetMachine; class SystemZSubtarget; class SystemZFrameLowering : public TargetFrameLowering { +public: + SystemZFrameLowering(StackDirection D, Align StackAl, int LAO, Align TransAl, + bool StackReal); + + static std::unique_ptr<SystemZFrameLowering> + create(const SystemZSubtarget &STI); + + // Override TargetFrameLowering. + bool isFPCloseToIncomingSP() const override { return false; } + bool hasReservedCallFrame(const MachineFunction &MF) const override; + MachineBasicBlock::iterator + eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, + MachineBasicBlock::iterator MI) const override; +}; + +class SystemZELFFrameLowering : public SystemZFrameLowering { IndexedMap<unsigned> RegSpillOffsets; public: - SystemZFrameLowering(); + SystemZELFFrameLowering(); // Override TargetFrameLowering. bool isFPCloseToIncomingSP() const override { return false; } @@ -48,21 +66,14 @@ public: void inlineStackProbe(MachineFunction &MF, MachineBasicBlock &PrologMBB) const override; bool hasFP(const MachineFunction &MF) const override; - bool hasReservedCallFrame(const MachineFunction &MF) const override; StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const override; - MachineBasicBlock::iterator - eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI) const override; // Return the byte offset from the incoming stack pointer of Reg's // ABI-defined save slot. Return 0 if no slot is defined for Reg. Adjust // the offset in case MF has packed-stack. unsigned getRegSpillOffset(MachineFunction &MF, Register Reg) const; - // Get or create the frame index of where the old frame pointer is stored. - int getOrCreateFramePointerSaveIndex(MachineFunction &MF) const; - bool usePackedStack(MachineFunction &MF) const; // Return the offset of the backchain. @@ -70,6 +81,35 @@ public: // The back chain is stored topmost with packed-stack. return usePackedStack(MF) ? SystemZMC::ELFCallFrameSize - 8 : 0; } + + // Get or create the frame index of where the old frame pointer is stored. + int getOrCreateFramePointerSaveIndex(MachineFunction &MF) const; +}; + +class SystemZXPLINKFrameLowering : public SystemZFrameLowering { + IndexedMap<unsigned> RegSpillOffsets; + +public: + SystemZXPLINKFrameLowering(); + + bool + assignCalleeSavedSpillSlots(MachineFunction &MF, + const TargetRegisterInfo *TRI, + std::vector<CalleeSavedInfo> &CSI) const override; + + void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, + RegScavenger *RS) const override; + + bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, + ArrayRef<CalleeSavedInfo> CSI, + const TargetRegisterInfo *TRI) const override; + + void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; + + void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; + + bool hasFP(const MachineFunction &MF) const override; }; } // end namespace llvm |
