LLVM: lib/Target/AMDGPU/AMDGPUReserveWWMRegs.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
23
24using namespace llvm;
25
26#define DEBUG_TYPE "amdgpu-reserve-wwm-regs"
27
28namespace {
29
31public:
32 static char ID;
33
35
37
38 StringRef getPassName() const override {
39 return "AMDGPU Reserve WWM Registers";
40 }
41
42 void getAnalysisUsage(AnalysisUsage &AU) const override {
45 }
46};
47
48class AMDGPUReserveWWMRegs {
49public:
51};
52
53}
54
56 "AMDGPU Reserve WWM Registers", false, false)
57
58char AMDGPUReserveWWMRegsLegacy::ID = 0;
59
61
62bool AMDGPUReserveWWMRegsLegacy::runOnMachineFunction(MachineFunction &MF) {
63 return AMDGPUReserveWWMRegs().run(MF);
64}
65
69 AMDGPUReserveWWMRegs().run(MF);
70
71
73}
74
77
81 unsigned Opc = MI.getOpcode();
82 if (Opc != AMDGPU::SI_SPILL_S32_TO_VGPR &&
83 Opc != AMDGPU::SI_RESTORE_S32_FROM_VGPR)
84 continue;
85
86 Register Reg = Opc == AMDGPU::SI_SPILL_S32_TO_VGPR
87 ? MI.getOperand(0).getReg()
88 : MI.getOperand(1).getReg();
89
90 assert(Reg.isPhysical() &&
91 "All WWM registers should have been allocated by now.");
92
95 }
96 }
97
98
99
100
104 MO.setIsRenamable(false);
105 }
106
107
109
111}
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Provides AMDGPU specific target descriptions.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
Definition AMDGPUReserveWWMRegs.cpp:67
Represent the analysis usage information of a pass.
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.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
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 clearNonWWMRegAllocMask()
const ReservedRegSet & getWWMReservedRegs() const
void reserveWWMRegister(Register Reg)
StringRef - Represent a constant reference to a string, i.e.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
char & AMDGPUReserveWWMRegsLegacyID
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager