LLVM 20.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 RegAllocFilterFunc F=nullptr) | |
virtual | ~RegAllocBase ()=default |
void | init (VirtRegMap &vrm, LiveIntervals &lis, LiveRegMatrix &mat) |
bool | shouldAllocateRegister (Register Reg) |
Get whether a given register should be allocated. | |
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 |
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 62 of file RegAllocBase.h.
|
inlineprotected |
Definition at line 84 of file RegAllocBase.h.
|
protectedvirtualdefault |
|
inlineprotectedvirtual |
Method called when the allocator is about to remove a LiveInterval.
Reimplemented in llvm::RAGreedy.
Definition at line 131 of file RegAllocBase.h.
Referenced by allocatePhysRegs().
|
protected |
Definition at line 85 of file RegAllocBase.cpp.
References aboutToRemoveInterval(), assert(), llvm::LiveRegMatrix::assign(), llvm::VirtRegMap::assignVirt2Phys(), llvm::dbgs(), dequeue(), 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(), llvm::LiveRegMatrix::invalidateVirtRegs(), llvm::Register::isVirtual(), LIS, LLVM_DEBUG, Matrix, MI, MRI, llvm::LiveInterval::reg(), llvm::MachineRegisterInfo::reg_instructions(), 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 174 of file RegAllocBase.cpp.
References assert(), llvm::dbgs(), enqueueImpl(), llvm::VirtRegMap::hasPhys(), LLVM_DEBUG, llvm::printReg(), llvm::LiveInterval::reg(), shouldAllocateRegister(), 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 58 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 165 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 82 of file RegAllocBase.h.
Referenced by postOptimization().
|
protected |
Definition at line 69 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), init(), postOptimization(), and llvm::RAGreedy::runOnMachineFunction().
|
protected |
Definition at line 70 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), llvm::RegAllocEvictionAdvisor::canReassign(), init(), llvm::RegAllocEvictionAdvisor::isUnusedCalleeSavedReg(), and llvm::RAGreedy::runOnMachineFunction().
|
protected |
Definition at line 67 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), getInstReadLaneMask(), llvm::RegAllocEvictionAdvisor::getOrderLimit(), hasTiedDef(), init(), readsLaneSubset(), and shouldAllocateRegister().
|
protected |
Definition at line 71 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), llvm::RegAllocEvictionAdvisor::canAllocatePhysReg(), llvm::RegAllocEvictionAdvisor::canReassign(), llvm::RegAllocEvictionAdvisor::getOrderLimit(), init(), and llvm::RegAllocEvictionAdvisor::isUnusedCalleeSavedReg().
Definition at line 128 of file RegAllocBase.h.
Definition at line 127 of file RegAllocBase.h.
|
protected |
Definition at line 66 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), assignedRegPartiallyOverlaps(), llvm::RegAllocEvictionAdvisor::canAllocatePhysReg(), llvm::RegAllocEvictionAdvisor::canReassign(), enqueue(), getInstReadLaneMask(), getNumAllocatableRegsForConstraints(), llvm::RegAllocEvictionAdvisor::getOrderLimit(), init(), readsLaneSubset(), llvm::RAGreedy::runOnMachineFunction(), and shouldAllocateRegister().
|
static |
VerifyEnabled - True when -verify-regalloc is given.
Definition at line 135 of file RegAllocBase.h.
Referenced by llvm::RAGreedy::runOnMachineFunction().
|
protected |
Definition at line 68 of file RegAllocBase.h.
Referenced by allocatePhysRegs(), assignedRegPartiallyOverlaps(), llvm::RegAllocEvictionAdvisor::canReassign(), enqueue(), init(), and llvm::RAGreedy::runOnMachineFunction().