27#define DEBUG_TYPE "amdgpu-reserve-wwm-regs"
40 return "AMDGPU Reserve WWM Registers";
50class AMDGPUReserveWWMRegs {
62 "AMDGPU Reserve WWM Registers",
false,
false)
67char AMDGPUReserveWWMRegsLegacy::ID = 0;
71bool AMDGPUReserveWWMRegsLegacy::runOnMachineFunction(
MachineFunction &MF) {
72 auto &RCI = getAnalysis<MachineRegisterClassInfoWrapperPass>().getRCI();
73 return AMDGPUReserveWWMRegs(RCI).run(MF);
80 AMDGPUReserveWWMRegs(RCI).
run(MF);
91 unsigned Opc =
MI.getOpcode();
92 if (
Opc != AMDGPU::SI_SPILL_S32_TO_VGPR &&
93 Opc != AMDGPU::SI_RESTORE_S32_FROM_VGPR)
97 ?
MI.getOperand(0).getReg()
98 :
MI.getOperand(1).getReg();
100 assert(Reg.isPhysical() &&
101 "All WWM registers should have been allocated by now.");
114 MO.setIsRenamable(
false);
127 RCI.updateReservedRegs(
TRI->getReservedRegs(MF));
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Register const TargetRegisterInfo * TRI
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
Result run(MachineFunction &, MachineFunctionAnalysisManager &)
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
iterator_range< reg_iterator > reg_operands(Register Reg) const
const TargetRegisterInfo * getTargetRegisterInfo() const
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Wrapper class representing virtual and physical registers.
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
void clearPerLaneVGPRAllocMask()
const ReservedRegSet & getWWMReservedRegs() const
void reserveWWMRegister(Register Reg)
Represent a constant reference to a string, i.e.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This is an optimization pass for GlobalISel generic memory operations.
char & AMDGPUReserveWWMRegsLegacyID
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager