LLVM 17.0.0git
|
RegAllocBase provides the register allocation driver and interface that can be extended to add interesting heuristics. More...
#include "CodeGen/RegAllocBase.h"
Static Public Attributes | |
static bool | VerifyEnabled = false |
VerifyEnabled - True when -verify-regalloc is given. | |
Protected Member Functions | |
RegAllocBase (const RegClassFilterFunc F=allocateAllRegClasses) | |
virtual | ~RegAllocBase ()=default |
void | init (VirtRegMap &vrm, LiveIntervals &lis, LiveRegMatrix &mat) |
void | allocatePhysRegs () |
virtual void | postOptimization () |
virtual Spiller & | spiller ()=0 |
virtual void | enqueueImpl (const LiveInterval *LI)=0 |
enqueue - Add VirtReg to the priority queue of unassigned registers. | |
void | enqueue (const LiveInterval *LI) |
enqueue - Add VirtReg to the priority queue of unassigned registers. | |
virtual const LiveInterval * | dequeue ()=0 |
dequeue - Return the next unassigned register, or NULL. | |
virtual MCRegister | selectOrSplit (const LiveInterval &VirtReg, SmallVectorImpl< Register > &splitLVRs)=0 |
virtual void | aboutToRemoveInterval (const LiveInterval &LI) |
Method called when the allocator is about to remove a LiveInterval. | |
Protected Attributes | |
const TargetRegisterInfo * | TRI = nullptr |
MachineRegisterInfo * | MRI = nullptr |
VirtRegMap * | VRM = nullptr |
LiveIntervals * | LIS = nullptr |
LiveRegMatrix * | Matrix = nullptr |
RegisterClassInfo | RegClassInfo |
const RegClassFilterFunc | ShouldAllocateClass |
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 DeadRemats. | |
Static Protected Attributes | |
static const char | TimerGroupName [] = "regalloc" |
static const char | TimerGroupDescription [] = "Register Allocation" |
RegAllocBase provides the register allocation driver and interface that can be extended to add interesting heuristics.
Register allocators must override the selectOrSplit() method to implement live range splitting. They must also override enqueue/dequeue to provide an assignment order.
Definition at line 61 of file RegAllocBase.h.
|
inlineprotected |
Definition at line 79 of file RegAllocBase.h.
|
protectedvirtualdefault |
|
inlineprotectedvirtual |
Method called when the allocator is about to remove a LiveInterval.
Reimplemented in llvm::RAGreedy.
Definition at line 119 of file RegAllocBase.h.
Referenced by allocatePhysRegs().
|
protected |
Definition at line 84 of file RegAllocBase.cpp.
References aboutToRemoveInterval(), assert(), llvm::LiveRegMatrix::assign(), llvm::VirtRegMap::assignVirt2Phys(), Context, llvm::dbgs(), dequeue(), E, llvm::LLVMContext::emitError(), llvm::ArrayRef< T >::empty(), llvm::LiveRange::empty(), enqueue(), llvm::ArrayRef< T >::front(), llvm::LiveIntervals::getInterval(), llvm::RegisterClassInfo::getOrder(), llvm::MachineRegisterInfo::getRegClass(), llvm::TargetRegisterInfo::getRegClassName(), llvm::LiveIntervals::hasInterval(), llvm::VirtRegMap::hasPhys(), I, llvm::LiveRegMatrix::invalidateVirtRegs(), llvm::Register::isVirtual(), LIS, LLVM_DEBUG, Matrix, MI, MRI, llvm::LiveInterval::reg(), llvm::MachineRegisterInfo::reg_instr_begin(), llvm::MachineRegisterInfo::reg_instr_end(), llvm::MachineRegisterInfo::reg_nodbg_empty(), RegClassInfo, llvm::LiveIntervals::removeInterval(), llvm::report_fatal_error(), selectOrSplit(), TRI, and VRM.
Referenced by llvm::RAGreedy::runOnMachineFunction().
|
protectedpure virtual |
dequeue - Return the next unassigned register, or NULL.
Implemented in llvm::RAGreedy.
Referenced by allocatePhysRegs().
|
protected |
enqueue - Add VirtReg to the priority queue of unassigned registers.
Definition at line 176 of file RegAllocBase.cpp.
References assert(), llvm::dbgs(), enqueueImpl(), llvm::MachineRegisterInfo::getRegClass(), llvm::VirtRegMap::hasPhys(), LLVM_DEBUG, MRI, llvm::printReg(), llvm::LiveInterval::reg(), ShouldAllocateClass, TRI, and VRM.
Referenced by allocatePhysRegs().
|
protectedpure virtual |
enqueue - Add VirtReg to the priority queue of unassigned registers.
Implemented in llvm::RAGreedy.
Referenced by enqueue().
|
protected |
Definition at line 57 of file RegAllocBase.cpp.
References llvm::MachineRegisterInfo::freezeReservedRegs(), llvm::VirtRegMap::getMachineFunction(), llvm::VirtRegMap::getRegInfo(), llvm::VirtRegMap::getTargetRegInfo(), LIS, Matrix, MRI, RegClassInfo, llvm::RegisterClassInfo::runOnMachineFunction(), TRI, and VRM.
Referenced by llvm::RAGreedy::runOnMachineFunction().
|
protectedvirtual |
Definition at line 167 of file RegAllocBase.cpp.
References DeadRemats, LIS, llvm::Spiller::postOptimization(), llvm::LiveIntervals::RemoveMachineInstrFromMaps(), and spiller().
Referenced by llvm::RAGreedy::runOnMachineFunction().
|
protectedpure virtual |
Implemented in llvm::RAGreedy.
Referenced by allocatePhysRegs().
|
protectedpure virtual |
Implemented in llvm::RAGreedy.
Referenced by postOptimization().
|
protected |
Inst which is a def of an original reg and whose defs are already all dead after remat is saved in DeadRemats.
The deletion of such inst is postponed till all the allocations are done, so its remat expr is always available for the remat of all the siblings of the original reg.
Definition at line 77 of file RegAllocBase.h.
Referenced by postOptimization().
|
protected |
Definition at line 68 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), init(), postOptimization(), and llvm::RAGreedy::runOnMachineFunction().
|
protected |
Definition at line 69 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), llvm::RegAllocEvictionAdvisor::canReassign(), init(), llvm::RegAllocEvictionAdvisor::isUnusedCalleeSavedReg(), and llvm::RAGreedy::runOnMachineFunction().
|
protected |
Definition at line 66 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), enqueue(), getInstReadLaneMask(), llvm::RegAllocEvictionAdvisor::getOrderLimit(), hasTiedDef(), init(), and readsLaneSubset().
|
protected |
Definition at line 70 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), llvm::RegAllocEvictionAdvisor::canAllocatePhysReg(), llvm::RegAllocEvictionAdvisor::canReassign(), llvm::RegAllocEvictionAdvisor::getOrderLimit(), init(), and llvm::RegAllocEvictionAdvisor::isUnusedCalleeSavedReg().
|
protected |
Definition at line 71 of file RegAllocBase.h.
Referenced by enqueue().
Definition at line 116 of file RegAllocBase.h.
Definition at line 115 of file RegAllocBase.h.
|
protected |
Definition at line 65 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), assignedRegPartiallyOverlaps(), llvm::RegAllocEvictionAdvisor::canAllocatePhysReg(), llvm::RegAllocEvictionAdvisor::canReassign(), enqueue(), getInstReadLaneMask(), getNumAllocatableRegsForConstraints(), llvm::RegAllocEvictionAdvisor::getOrderLimit(), init(), readsLaneSubset(), and llvm::RAGreedy::runOnMachineFunction().
|
static |
VerifyEnabled - True when -verify-regalloc is given.
Definition at line 123 of file RegAllocBase.h.
Referenced by llvm::RAGreedy::runOnMachineFunction().
|
protected |
Definition at line 67 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), assignedRegPartiallyOverlaps(), llvm::RegAllocEvictionAdvisor::canReassign(), enqueue(), init(), and llvm::RAGreedy::runOnMachineFunction().