32 #define DEBUG_TYPE "si-pre-allocate-wwm-regs" 46 std::vector<unsigned> RegsToRewrite;
75 "SI Pre-allocate WWM Registers",
false,
false)
82 char SIPreAllocateWWMRegs::
ID = 0;
87 return new SIPreAllocateWWMRegs();
96 if (!
TRI->isVGPR(*
MRI, Reg))
102 if (VRM->hasPhys(Reg))
107 for (
unsigned PhysReg : RegClassInfo.getOrder(
MRI->getRegClass(Reg))) {
108 if (!
MRI->isPhysRegUsed(PhysReg) &&
110 Matrix->assign(LI, PhysReg);
112 RegsToRewrite.push_back(Reg);
132 if (!VRM->hasPhys(VirtReg))
135 Register PhysReg = VRM->getPhys(VirtReg);
138 PhysReg =
TRI->getSubReg(PhysReg, SubReg);
150 for (
unsigned Reg : RegsToRewrite) {
151 LIS->removeInterval(
Reg);
158 RegsToRewrite.clear();
161 MRI->freezeReservedRegs(MF);
169 TII = ST.getInstrInfo();
173 LIS = &getAnalysis<LiveIntervals>();
174 Matrix = &getAnalysis<LiveRegMatrix>();
175 VRM = &getAnalysis<VirtRegMap>();
177 RegClassInfo.runOnMachineFunction(MF);
179 bool RegsAssigned =
false;
191 if (
MI.getOpcode() == AMDGPU::V_SET_INACTIVE_B32 ||
192 MI.getOpcode() == AMDGPU::V_SET_INACTIVE_B64)
193 RegsAssigned |= processDef(
MI.getOperand(0));
195 if (
MI.getOpcode() == AMDGPU::ENTER_WWM) {
201 if (
MI.getOpcode() == AMDGPU::EXIT_WWM) {
212 RegsAssigned |= processDef(DefOpnd);
Interface definition for SIRegisterInfo.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
No interference, go ahead and assign.
AMDGPU specific subclass of TargetSubtarget.
This class represents lattice values for constants.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
LiveInterval - This class represents the liveness of a register, or stack slot.
unsigned getSubReg() const
unsigned const TargetRegisterInfo * TRI
void setIsRenamable(bool Val=true)
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
INITIALIZE_PASS_BEGIN(SIPreAllocateWWMRegs, DEBUG_TYPE, "SI Pre-allocate WWM Registers", false, false) INITIALIZE_PASS_END(SIPreAllocateWWMRegs
void setReg(Register Reg)
Change the register this operand corresponds to.
SI Pre allocate WWM Registers
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
FunctionPass * createSIPreAllocateWWMRegsPass()
MachineOperand class - Representation of each machine instruction operand.
char & SIPreAllocateWWMRegsID
void setPreservesCFG()
This function should be called by the pass, iff they do not:
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void ReserveWWMRegister(unsigned reg)
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Provides AMDGPU specific target descriptions.
Representation of each machine instruction.
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
Interface definition for SIInstrInfo.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
void setSubReg(unsigned subReg)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Register getReg() const
getReg - Returns the register number.
void initializeSIPreAllocateWWMRegsPass(PassRegistry &)
Wrapper class representing virtual and physical registers.
const SIRegisterInfo * getRegisterInfo() const override