LLVM 20.0.0git
Public Member Functions | Static Public Attributes | List of all members
llvm::VirtRegMap Class Reference

#include "llvm/CodeGen/VirtRegMap.h"

Public Member Functions

 VirtRegMap ()
 
 VirtRegMap (const VirtRegMap &)=delete
 
VirtRegMapoperator= (const VirtRegMap &)=delete
 
 VirtRegMap (VirtRegMap &&)=default
 
void init (MachineFunction &MF)
 
MachineFunctiongetMachineFunction () const
 
MachineRegisterInfogetRegInfo () const
 
const TargetRegisterInfogetTargetRegInfo () const
 
void grow ()
 
bool hasPhys (Register virtReg) const
 returns true if the specified virtual register is mapped to a physical register
 
MCRegister getPhys (Register virtReg) const
 returns the physical register mapped to the specified virtual register
 
void assignVirt2Phys (Register virtReg, MCPhysReg physReg)
 creates a mapping for the specified virtual register to the specified physical register
 
bool isShapeMapEmpty () const
 
bool hasShape (Register virtReg) const
 
ShapeT getShape (Register virtReg) const
 
void assignVirt2Shape (Register virtReg, ShapeT shape)
 
void clearVirt (Register virtReg)
 clears the specified virtual register's, physical register mapping
 
void clearAllVirt ()
 clears all virtual to physical register mappings
 
bool hasPreferredPhys (Register VirtReg) const
 returns true if VirtReg is assigned to its preferred physreg.
 
bool hasKnownPreference (Register VirtReg) const
 returns true if VirtReg has a known preferred register.
 
void setIsSplitFromReg (Register virtReg, Register SReg)
 records virtReg is a split live interval from SReg.
 
Register getPreSplitReg (Register virtReg) const
 returns the live interval virtReg is split from.
 
Register getOriginal (Register VirtReg) const
 getOriginal - Return the original virtual register that VirtReg descends from through splitting.
 
bool isAssignedReg (Register virtReg) const
 returns true if the specified virtual register is not mapped to a stack slot or rematerialized.
 
int getStackSlot (Register virtReg) const
 returns the stack slot mapped to the specified virtual register
 
int assignVirt2StackSlot (Register virtReg)
 create a mapping for the specifed virtual register to the next available stack slot
 
void assignVirt2StackSlot (Register virtReg, int SS)
 create a mapping for the specified virtual register to the specified stack slot
 
void print (raw_ostream &OS, const Module *M=nullptr) const
 
void dump () const
 

Static Public Attributes

static constexpr int NO_STACK_SLOT = INT_MAX
 

Detailed Description

Definition at line 34 of file VirtRegMap.h.

Constructor & Destructor Documentation

◆ VirtRegMap() [1/3]

llvm::VirtRegMap::VirtRegMap ( )
inline

Definition at line 67 of file VirtRegMap.h.

◆ VirtRegMap() [2/3]

llvm::VirtRegMap::VirtRegMap ( const VirtRegMap )
delete

◆ VirtRegMap() [3/3]

llvm::VirtRegMap::VirtRegMap ( VirtRegMap &&  )
default

Member Function Documentation

◆ assignVirt2Phys()

void VirtRegMap::assignVirt2Phys ( Register  virtReg,
MCPhysReg  physReg 
)

◆ assignVirt2Shape()

void llvm::VirtRegMap::assignVirt2Shape ( Register  virtReg,
ShapeT  shape 
)
inline

Definition at line 110 of file VirtRegMap.h.

Referenced by getTileShape().

◆ assignVirt2StackSlot() [1/2]

int VirtRegMap::assignVirt2StackSlot ( Register  virtReg)

create a mapping for the specifed virtual register to the next available stack slot

Definition at line 130 of file VirtRegMap.cpp.

References assert(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::Register::isVirtual(), and NO_STACK_SLOT.

◆ assignVirt2StackSlot() [2/2]

void VirtRegMap::assignVirt2StackSlot ( Register  virtReg,
int  SS 
)

create a mapping for the specified virtual register to the specified stack slot

Definition at line 138 of file VirtRegMap.cpp.

References assert(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFrameInfo::getObjectIndexBegin(), llvm::Register::isVirtual(), and NO_STACK_SLOT.

◆ clearAllVirt()

void llvm::VirtRegMap::clearAllVirt ( )
inline

clears all virtual to physical register mappings

Definition at line 124 of file VirtRegMap.h.

References llvm::IndexedMap< T, ToIndexT >::clear(), and grow().

◆ clearVirt()

void llvm::VirtRegMap::clearVirt ( Register  virtReg)
inline

clears the specified virtual register's, physical register mapping

Definition at line 116 of file VirtRegMap.h.

References assert(), and llvm::Register::isVirtual().

Referenced by llvm::LiveRegMatrix::unassign().

◆ dump()

LLVM_DUMP_METHOD void VirtRegMap::dump ( ) const

Definition at line 170 of file VirtRegMap.cpp.

References llvm::dbgs(), and print().

◆ getMachineFunction()

MachineFunction & llvm::VirtRegMap::getMachineFunction ( ) const
inline

◆ getOriginal()

Register llvm::VirtRegMap::getOriginal ( Register  VirtReg) const
inline

getOriginal - Return the original virtual register that VirtReg descends from through splitting.

A register that was not created by splitting is its own original. This operation is idempotent.

Definition at line 154 of file VirtRegMap.h.

References getPreSplitReg().

Referenced by llvm::LiveRangeEdit::createFrom(), llvm::LiveRangeEdit::eliminateDeadDefs(), llvm::SplitEditor::finish(), llvm::SplitAnalysis::isOriginalEndpoint(), llvm::VirtRegAuxInfo::isRematerializable(), and llvm::VirtRegAuxInfo::weightCalcHelper().

◆ getPhys()

MCRegister llvm::VirtRegMap::getPhys ( Register  virtReg) const
inline

◆ getPreSplitReg()

Register llvm::VirtRegMap::getPreSplitReg ( Register  virtReg) const
inline

returns the live interval virtReg is split from.

Definition at line 146 of file VirtRegMap.h.

Referenced by getOriginal().

◆ getRegInfo()

MachineRegisterInfo & llvm::VirtRegMap::getRegInfo ( ) const
inline

Definition at line 79 of file VirtRegMap.h.

References MRI.

Referenced by assignVirt2Phys(), and llvm::RegAllocBase::init().

◆ getShape()

ShapeT llvm::VirtRegMap::getShape ( Register  virtReg) const
inline

◆ getStackSlot()

int llvm::VirtRegMap::getStackSlot ( Register  virtReg) const
inline

returns the stack slot mapped to the specified virtual register

Definition at line 171 of file VirtRegMap.h.

References assert(), and llvm::Register::isVirtual().

Referenced by llvm::LiveDebugVariables::LDVImpl::emitDebugValues(), and isAssignedReg().

◆ getTargetRegInfo()

const TargetRegisterInfo & llvm::VirtRegMap::getTargetRegInfo ( ) const
inline

Definition at line 80 of file VirtRegMap.h.

References TRI.

Referenced by llvm::AllocationOrder::create(), and llvm::RegAllocBase::init().

◆ grow()

void VirtRegMap::grow ( )

◆ hasKnownPreference()

bool VirtRegMap::hasKnownPreference ( Register  VirtReg) const

returns true if VirtReg has a known preferred register.

This returns false if VirtReg has a preference that is a virtual register that hasn't been assigned yet.

Definition at line 121 of file VirtRegMap.cpp.

References llvm::MachineRegisterInfo::getRegAllocationHint(), and hasPhys().

◆ hasPhys()

bool llvm::VirtRegMap::hasPhys ( Register  virtReg) const
inline

◆ hasPreferredPhys()

bool VirtRegMap::hasPreferredPhys ( Register  VirtReg) const

returns true if VirtReg is assigned to its preferred physreg.

Definition at line 112 of file VirtRegMap.cpp.

References getPhys(), llvm::MachineRegisterInfo::getSimpleHint(), llvm::Register::isValid(), and llvm::Register::isVirtual().

◆ hasShape()

bool llvm::VirtRegMap::hasShape ( Register  virtReg) const
inline

◆ init()

void llvm::VirtRegMap::init ( MachineFunction MF)

◆ isAssignedReg()

bool llvm::VirtRegMap::isAssignedReg ( Register  virtReg) const
inline

returns true if the specified virtual register is not mapped to a stack slot or rematerialized.

Definition at line 161 of file VirtRegMap.h.

References getStackSlot(), and NO_STACK_SLOT.

Referenced by llvm::LiveDebugVariables::LDVImpl::emitDebugValues().

◆ isShapeMapEmpty()

bool llvm::VirtRegMap::isShapeMapEmpty ( ) const
inline

◆ operator=()

VirtRegMap & llvm::VirtRegMap::operator= ( const VirtRegMap )
delete

◆ print()

void VirtRegMap::print ( raw_ostream OS,
const Module M = nullptr 
) const

◆ setIsSplitFromReg()

void llvm::VirtRegMap::setIsSplitFromReg ( Register  virtReg,
Register  SReg 
)
inline

records virtReg is a split live interval from SReg.

Definition at line 138 of file VirtRegMap.h.

References getShape(), and hasShape().

Referenced by llvm::LiveRangeEdit::createFrom(), llvm::LiveRangeEdit::eliminateDeadDefs(), and llvm::SplitEditor::finish().

Member Data Documentation

◆ NO_STACK_SLOT

constexpr int llvm::VirtRegMap::NO_STACK_SLOT = INT_MAX
staticconstexpr

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