1 //===--------------------- SIFrameLowering.h --------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H 11 #define LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H 12 13 #include "AMDGPUFrameLowering.h" 14 15 namespace llvm { 16 17 class SIInstrInfo; 18 class SIMachineFunctionInfo; 19 class SIRegisterInfo; 20 class SISubtarget; 21 22 class SIFrameLowering final : public AMDGPUFrameLowering { 23 public: 24 SIFrameLowering(StackDirection D, unsigned StackAl, int LAO, 25 unsigned TransAl = 1) : 26 AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {} 27 ~SIFrameLowering() override = default; 28 29 void emitPrologue(MachineFunction &MF, 30 MachineBasicBlock &MBB) const override; 31 void emitEpilogue(MachineFunction &MF, 32 MachineBasicBlock &MBB) const override; 33 34 void processFunctionBeforeFrameFinalized( 35 MachineFunction &MF, 36 RegScavenger *RS = nullptr) const override; 37 38 private: 39 void emitFlatScratchInit(const SISubtarget &ST, 40 MachineFunction &MF, 41 MachineBasicBlock &MBB) const; 42 43 unsigned getReservedPrivateSegmentBufferReg( 44 const SISubtarget &ST, 45 const SIInstrInfo *TII, 46 const SIRegisterInfo *TRI, 47 SIMachineFunctionInfo *MFI, 48 MachineFunction &MF) const; 49 50 unsigned getReservedPrivateSegmentWaveByteOffsetReg( 51 const SISubtarget &ST, 52 const SIInstrInfo *TII, 53 const SIRegisterInfo *TRI, 54 SIMachineFunctionInfo *MFI, 55 MachineFunction &MF) const; 56 57 /// \brief Emits debugger prologue. 58 void emitDebuggerPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const; 59 }; 60 61 } // end namespace llvm 62 63 #endif // LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H 64