62 #define DEBUG_TYPE "si-fix-sgpr-live-ranges"
77 const char *getPassName()
const override {
78 return "SI Fix SGPR live ranges";
92 "SI Fix SGPR Live Ranges",
false,
false)
98 char SIFixSGPRLiveRanges::
ID = 0;
103 return new SIFixSGPRLiveRanges();
113 std::vector<std::pair<unsigned, LiveRange *>> SGPRLiveRanges;
121 unsigned Def = MO.getReg();
124 SGPRLiveRanges.push_back(
127 SGPRLiveRanges.push_back(
152 if (NCDTerm != NCD->
end() && NCDTerm->getOpcode() == AMDGPU::SI_ELSE) {
156 NCD = PDT->findNearestCommonDominator(*NCD->succ_begin(),
157 *(++NCD->succ_begin()));
159 assert(SuccA && SuccB);
160 for (std::pair<unsigned, LiveRange*> RegLR : SGPRLiveRanges) {
161 unsigned Reg = RegLR.first;
171 if ((!LiveInToA && !LiveInToB) ||
172 (LiveInToA && LiveInToB))
177 DEBUG(
dbgs() <<
"Possible SGPR conflict detected " <<
" in " << *LR <<
178 " BB#" << SuccA->getNumber() <<
", BB#" <<
180 " with NCD = " << NCD->getNumber() <<
'\n');
185 TII->
get(AMDGPU::SGPR_USE))
187 DEBUG(NCD->getFirstNonPHI()->dump());
unsigned succ_size() const
Interface definition for SIRegisterInfo.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
int getNumber() const
getNumber - MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a M...
iterator getFirstTerminator()
getFirstTerminator - returns an iterator to the first terminator instruction of this basic block...
static bool isVirtualRegister(unsigned Reg)
isVirtualRegister - Return true if the specified register number is in the virtual register namespace...
bool isLiveInToMBB(const LiveRange &LR, const MachineBasicBlock *mbb) const
This class represents the liveness of a register, stack slot, etc.
void initializeSIFixSGPRLiveRangesPass(PassRegistry &)
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
const TargetRegisterClass * getRegClass(unsigned Reg) const
getRegClass - Return the register class of the specified virtual register.
bool isSGPRClass(const TargetRegisterClass *RC) const
Reg
All possible values of the reg field in the ModR/M byte.
TargetInstrInfo - Interface to description of machine instruction set.
bundle_iterator< MachineInstr, instr_iterator > iterator
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.
MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL, const MCInstrDesc &MCID)
BuildMI - Builder interface.
succ_iterator succ_begin()
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
INITIALIZE_PASS_BEGIN(SIFixSGPRLiveRanges, DEBUG_TYPE,"SI Fix SGPR Live Ranges", false, false) INITIALIZE_PASS_END(SIFixSGPRLiveRanges
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
MachineOperand class - Representation of each machine instruction operand.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
LiveInterval & getInterval(unsigned Reg)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
const TargetRegisterClass * getPhysRegClass(unsigned Reg) const
Return the 'base' register class for this register.
Representation of each machine instruction.
Interface definition for SIInstrInfo.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
char & SIFixSGPRLiveRangesID
virtual const TargetInstrInfo * getInstrInfo() const
BasicBlockListType::iterator iterator
FunctionPass * createSIFixSGPRLiveRangesPass()
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
LiveRange & getRegUnit(unsigned Unit)
getRegUnit - Return the live range for Unit.