34 #define DEBUG_TYPE "regalloc"
36 STATISTIC(NumNewQueued ,
"Number of new live ranges queued");
42 cl::desc(
"Verify during register allocation"));
53 void RegAllocBase::anchor() {}
70 void RegAllocBase::seedLiveRegs() {
92 DEBUG(
dbgs() <<
"Dropping unused " << *VirtReg <<
'\n');
106 <<
':' << *VirtReg <<
" w=" << VirtReg->weight <<
'\n');
108 VirtRegVec SplitVRegs;
109 unsigned AvailablePhysReg =
selectOrSplit(*VirtReg, SplitVRegs);
111 if (AvailablePhysReg == ~0u) {
125 MI->
emitError(
"inline assembly requires more registers than available");
134 if (AvailablePhysReg)
137 for (VirtRegVec::iterator
I = SplitVRegs.begin(),
E = SplitVRegs.end();
142 DEBUG(
dbgs() <<
"not queueing unused " << *SplitVirtReg <<
'\n');
147 DEBUG(
dbgs() <<
"queuing new interval: " << *SplitVirtReg <<
"\n");
148 assert(!SplitVirtReg->
empty() &&
"expecting non-empty interval");
150 "expect split value in virtual register");
161 DeadInst->eraseFromParent();
bool hasPhys(unsigned virtReg) const
returns true if the specified virtual register is mapped to a physical register
static const char TimerGroupDescription[]
STATISTIC(NumFunctions,"Total number of functions")
void RemoveMachineInstrFromMaps(MachineInstr &MI)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
MachineFunction & getMachineFunction() const
static unsigned index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
LiveInterval - This class represents the liveness of a register, or stack slot.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
virtual unsigned selectOrSplit(LiveInterval &VirtReg, SmallVectorImpl< unsigned > &splitLVRs)=0
void assignVirt2Phys(unsigned virtReg, unsigned physReg)
creates a mapping for the specified virtual register to the specified physical register ...
SmallPtrSet< MachineInstr *, 32 > DeadRemats
Inst which is a def of an original reg and whose defs are already all dead after remat is saved in De...
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
This class is basically a combination of TimeRegion and Timer.
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
void freezeReservedRegs(const MachineFunction &)
freezeReservedRegs - Called by the register allocator to freeze the set of reserved registers before ...
Reg
All possible values of the reg field in the ModR/M byte.
ArrayRef< MCPhysReg > getOrder(const TargetRegisterClass *RC) const
getOrder - Returns the preferred allocation order for RC.
static reg_instr_iterator reg_instr_end()
defusechain_iterator - This class provides iterator support for machine operands in the function that...
void assign(LiveInterval &VirtReg, unsigned PhysReg)
Assign VirtReg to PhysReg.
const char * getRegClassName(const TargetRegisterClass *Class) const
Returns the name of the register class.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
void invalidateVirtRegs()
Invalidate cached interference queries after modifying virtual register live ranges.
void removeInterval(unsigned Reg)
const TargetRegisterInfo & getTargetRegInfo() const
reg_instr_iterator reg_instr_begin(unsigned RegNo) const
void runOnMachineFunction(const MachineFunction &MF)
runOnFunction - Prepare to answer questions about MF.
void init(VirtRegMap &vrm, LiveIntervals &lis, LiveRegMatrix &mat)
static const char TimerGroupName[]
void emitError(StringRef Msg) const
Emit an error referring to the source location of this instruction.
virtual void enqueue(LiveInterval *LI)=0
enqueue - Add VirtReg to the priority queue of unassigned registers.
LiveInterval & getInterval(unsigned Reg)
static cl::opt< bool, true > VerifyRegAlloc("verify-regalloc", cl::location(RegAllocBase::VerifyEnabled), cl::desc("Verify during register allocation"))
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
virtual void aboutToRemoveInterval(LiveInterval &LI)
Method called when the allocator is about to remove a LiveInterval.
Representation of each machine instruction.
static bool VerifyEnabled
VerifyEnabled - True when -verify-regalloc is given.
const TargetRegisterInfo * TRI
virtual void postOptimization()
virtual void postOptimization()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineRegisterInfo & getRegInfo() const
RegisterClassInfo RegClassInfo
bool TimePassesIsEnabled
If the user specifies the -time-passes argument on an LLVM tool command line then the value of this b...
MachineRegisterInfo * MRI
LocationClass< Ty > location(Ty &L)
bool reg_nodbg_empty(unsigned RegNo) const
reg_nodbg_empty - Return true if the only instructions using or defining Reg are Debug instructions...
virtual Spiller & spiller()=0
virtual LiveInterval * dequeue()=0
dequeue - Return the next unassigned register, or NULL.