LLVM 20.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 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 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
 
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 62 of file RegAllocBase.h.

Constructor & Destructor Documentation

◆ RegAllocBase()

llvm::RegAllocBase::RegAllocBase ( const RegAllocFilterFunc  F = nullptr)
inlineprotected

Definition at line 84 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 131 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 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().

◆ 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().

◆ shouldAllocateRegister()

bool llvm::RegAllocBase::shouldAllocateRegister ( Register  Reg)
inlineprotected

Get whether a given register should be allocated.

Definition at line 93 of file RegAllocBase.h.

References MRI, Reg, and TRI.

Referenced by enqueue().

◆ 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 82 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

◆ TimerGroupDescription

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

Definition at line 128 of file RegAllocBase.h.

◆ TimerGroupName

const char RegAllocBase::TimerGroupName = "regalloc"
staticprotected

Definition at line 127 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 135 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: