2015-11-07 02:17:45 +08:00
|
|
|
//===--------------------- SIFrameLowering.h --------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H
|
|
|
|
|
|
|
|
#include "AMDGPUFrameLowering.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
2016-12-10 06:06:55 +08:00
|
|
|
|
2016-09-01 05:52:21 +08:00
|
|
|
class SIInstrInfo;
|
|
|
|
class SIMachineFunctionInfo;
|
|
|
|
class SIRegisterInfo;
|
|
|
|
class SISubtarget;
|
2015-11-07 02:17:45 +08:00
|
|
|
|
|
|
|
class SIFrameLowering final : public AMDGPUFrameLowering {
|
|
|
|
public:
|
|
|
|
SIFrameLowering(StackDirection D, unsigned StackAl, int LAO,
|
|
|
|
unsigned TransAl = 1) :
|
|
|
|
AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
|
2016-12-10 06:06:55 +08:00
|
|
|
~SIFrameLowering() override = default;
|
2015-11-07 02:17:45 +08:00
|
|
|
|
2017-05-18 05:56:25 +08:00
|
|
|
void emitEntryFunctionPrologue(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB) const;
|
2015-12-01 05:15:53 +08:00
|
|
|
void emitPrologue(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB) const override;
|
2016-06-24 14:30:11 +08:00
|
|
|
void emitEpilogue(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB) const override;
|
2017-03-11 03:39:07 +08:00
|
|
|
int getFrameIndexReference(const MachineFunction &MF, int FI,
|
|
|
|
unsigned &FrameReg) const override;
|
2015-12-01 05:15:53 +08:00
|
|
|
|
2017-09-14 07:47:01 +08:00
|
|
|
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
|
|
|
|
RegScavenger *RS = nullptr) const override;
|
|
|
|
|
2015-11-07 02:17:45 +08:00
|
|
|
void processFunctionBeforeFrameFinalized(
|
|
|
|
MachineFunction &MF,
|
|
|
|
RegScavenger *RS = nullptr) const override;
|
2016-06-25 11:11:28 +08:00
|
|
|
|
2017-08-02 03:54:18 +08:00
|
|
|
MachineBasicBlock::iterator
|
|
|
|
eliminateCallFramePseudoInstr(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI) const override;
|
|
|
|
|
2016-06-25 11:11:28 +08:00
|
|
|
private:
|
2017-02-19 02:29:53 +08:00
|
|
|
void emitFlatScratchInit(const SISubtarget &ST,
|
2016-09-01 05:52:21 +08:00
|
|
|
MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB) const;
|
|
|
|
|
|
|
|
unsigned getReservedPrivateSegmentBufferReg(
|
|
|
|
const SISubtarget &ST,
|
|
|
|
const SIInstrInfo *TII,
|
|
|
|
const SIRegisterInfo *TRI,
|
|
|
|
SIMachineFunctionInfo *MFI,
|
|
|
|
MachineFunction &MF) const;
|
|
|
|
|
2017-04-26 07:40:57 +08:00
|
|
|
std::pair<unsigned, unsigned> getReservedPrivateSegmentWaveByteOffsetReg(
|
2016-09-01 05:52:21 +08:00
|
|
|
const SISubtarget &ST,
|
|
|
|
const SIInstrInfo *TII,
|
|
|
|
const SIRegisterInfo *TRI,
|
|
|
|
SIMachineFunctionInfo *MFI,
|
|
|
|
MachineFunction &MF) const;
|
|
|
|
|
2016-06-25 11:11:28 +08:00
|
|
|
/// \brief Emits debugger prologue.
|
|
|
|
void emitDebuggerPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const;
|
2017-06-27 01:53:59 +08:00
|
|
|
|
2017-09-29 17:49:35 +08:00
|
|
|
// Emit scratch setup code for AMDPAL or Mesa, assuming ResourceRegUsed is set.
|
|
|
|
void emitEntryFunctionScratchSetup(const SISubtarget &ST, MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB, SIMachineFunctionInfo *MFI,
|
|
|
|
MachineBasicBlock::iterator I, unsigned PreloadedPrivateBufferReg,
|
|
|
|
unsigned ScratchRsrcReg) const;
|
|
|
|
|
2017-06-27 01:53:59 +08:00
|
|
|
public:
|
|
|
|
bool hasFP(const MachineFunction &MF) const override;
|
|
|
|
bool hasSP(const MachineFunction &MF) const;
|
2015-11-07 02:17:45 +08:00
|
|
|
};
|
|
|
|
|
2016-12-10 06:06:55 +08:00
|
|
|
} // end namespace llvm
|
2015-11-07 02:17:45 +08:00
|
|
|
|
2016-12-10 06:06:55 +08:00
|
|
|
#endif // LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H
|