LLVM 19.0.0git
Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
llvm::RegAllocBase Class Referenceabstract

RegAllocBase provides the register allocation driver and interface that can be extended to add interesting heuristics. More...

#include "CodeGen/RegAllocBase.h"

Inheritance diagram for llvm::RegAllocBase:
Inheritance graph
[legend]

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 Spillerspiller ()=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 LiveIntervaldequeue ()=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 TargetRegisterInfoTRI = nullptr
 
MachineRegisterInfoMRI = nullptr
 
VirtRegMapVRM = nullptr
 
LiveIntervalsLIS = nullptr
 
LiveRegMatrixMatrix = 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"
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ RegAllocBase()

llvm::RegAllocBase::RegAllocBase ( const RegClassFilterFunc  F = allocateAllRegClasses)
inlineprotected

Definition at line 79 of file RegAllocBase.h.

◆ ~RegAllocBase()

virtual llvm::RegAllocBase::~RegAllocBase ( )
protectedvirtualdefault

Member Function Documentation

◆ aboutToRemoveInterval()

virtual void llvm::RegAllocBase::aboutToRemoveInterval ( const LiveInterval LI)
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().

◆ allocatePhysRegs()

void RegAllocBase::allocatePhysRegs ( )
protected

◆ dequeue()

virtual const LiveInterval * llvm::RegAllocBase::dequeue ( )
protectedpure virtual

dequeue - Return the next unassigned register, or NULL.

Implemented in llvm::RAGreedy.

Referenced by allocatePhysRegs().

◆ enqueue()

void RegAllocBase::enqueue ( const LiveInterval LI)
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().

◆ enqueueImpl()

virtual void llvm::RegAllocBase::enqueueImpl ( const LiveInterval LI)
protectedpure virtual

enqueue - Add VirtReg to the priority queue of unassigned registers.

Implemented in llvm::RAGreedy.

Referenced by enqueue().

◆ init()

void RegAllocBase::init ( VirtRegMap vrm,
LiveIntervals lis,
LiveRegMatrix mat 
)
protected

◆ postOptimization()

void RegAllocBase::postOptimization ( )
protectedvirtual

◆ selectOrSplit()

virtual MCRegister llvm::RegAllocBase::selectOrSplit ( const LiveInterval VirtReg,
SmallVectorImpl< Register > &  splitLVRs 
)
protectedpure virtual

Implemented in llvm::RAGreedy.

Referenced by allocatePhysRegs().

◆ spiller()

virtual Spiller & llvm::RegAllocBase::spiller ( )
protectedpure virtual

Implemented in llvm::RAGreedy.

Referenced by postOptimization().

Member Data Documentation

◆ DeadRemats

SmallPtrSet<MachineInstr *, 32> llvm::RegAllocBase::DeadRemats
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().

◆ LIS

LiveIntervals* llvm::RegAllocBase::LIS = nullptr
protected

◆ Matrix

LiveRegMatrix* llvm::RegAllocBase::Matrix = nullptr
protected

◆ MRI

MachineRegisterInfo* llvm::RegAllocBase::MRI = nullptr
protected

◆ RegClassInfo

RegisterClassInfo llvm::RegAllocBase::RegClassInfo
protected

◆ ShouldAllocateClass

const RegClassFilterFunc llvm::RegAllocBase::ShouldAllocateClass
protected

Definition at line 71 of file RegAllocBase.h.

Referenced by enqueue().

◆ TimerGroupDescription

const char RegAllocBase::TimerGroupDescription = "Register Allocation"
staticprotected

Definition at line 116 of file RegAllocBase.h.

◆ TimerGroupName

const char RegAllocBase::TimerGroupName = "regalloc"
staticprotected

Definition at line 115 of file RegAllocBase.h.

◆ TRI

const TargetRegisterInfo* llvm::RegAllocBase::TRI = nullptr
protected

◆ VerifyEnabled

bool RegAllocBase::VerifyEnabled = false
static

VerifyEnabled - True when -verify-regalloc is given.

Definition at line 123 of file RegAllocBase.h.

Referenced by llvm::RAGreedy::runOnMachineFunction().

◆ VRM

VirtRegMap* llvm::RegAllocBase::VRM = nullptr
protected

The documentation for this class was generated from the following files: