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

#include "llvm/CodeGen/VirtRegMap.h"

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

Public Types

enum  { NO_PHYS_REG = 0 , NO_STACK_SLOT = (1L << 30)-1 , MAX_STACK_SLOT = (1L << 18)-1 }
 

Public Member Functions

 VirtRegMap ()
 
 VirtRegMap (const VirtRegMap &)=delete
 
VirtRegMapoperator= (const VirtRegMap &)=delete
 
bool runOnMachineFunction (MachineFunction &MF) override
 runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.
 
void getAnalysisUsage (AnalysisUsage &AU) const override
 getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
 
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 override
 print - Print out the internal state of the pass.
 
void dump () const
 
- Public Member Functions inherited from llvm::MachineFunctionPass
bool doInitialization (Module &) override
 doInitialization - Virtual method overridden by subclasses to do any necessary initialization before any pass is run.
 
- Public Member Functions inherited from llvm::FunctionPass
 FunctionPass (char &pid)
 
PasscreatePrinterPass (raw_ostream &OS, const std::string &Banner) const override
 createPrinterPass - Get a function printer pass.
 
virtual bool runOnFunction (Function &F)=0
 runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
 
void assignPassManager (PMStack &PMS, PassManagerType T) override
 Find appropriate Function Pass Manager or Call Graph Pass Manager in the PM Stack and add self into that manager.
 
PassManagerType getPotentialPassManagerType () const override
 Return what kind of Pass Manager can manage this pass.
 
- Public Member Functions inherited from llvm::Pass
 Pass (PassKind K, char &pid)
 
 Pass (const Pass &)=delete
 
Passoperator= (const Pass &)=delete
 
virtual ~Pass ()
 
PassKind getPassKind () const
 
virtual StringRef getPassName () const
 getPassName - Return a nice clean name for a pass.
 
AnalysisID getPassID () const
 getPassID - Return the PassID number that corresponds to this pass.
 
virtual bool doInitialization (Module &)
 doInitialization - Virtual method overridden by subclasses to do any necessary initialization before any pass is run.
 
virtual bool doFinalization (Module &)
 doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes have run.
 
virtual void print (raw_ostream &OS, const Module *M) const
 print - Print out the internal state of the pass.
 
void dump () const
 
virtual PasscreatePrinterPass (raw_ostream &OS, const std::string &Banner) const =0
 createPrinterPass - Get a Pass appropriate to print the IR this pass operates on (Module, Function or MachineFunction).
 
virtual void assignPassManager (PMStack &, PassManagerType)
 Each pass is responsible for assigning a pass manager to itself.
 
virtual void preparePassManager (PMStack &)
 Check if available pass managers are suitable for this pass or not.
 
virtual PassManagerType getPotentialPassManagerType () const
 Return what kind of Pass Manager can manage this pass.
 
void setResolver (AnalysisResolver *AR)
 
AnalysisResolvergetResolver () const
 
virtual void getAnalysisUsage (AnalysisUsage &) const
 getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job.
 
virtual void releaseMemory ()
 releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed.
 
virtual void * getAdjustedAnalysisPointer (AnalysisID ID)
 getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through multiple inheritance.
 
virtual ImmutablePassgetAsImmutablePass ()
 
virtual PMDataManagergetAsPMDataManager ()
 
virtual void verifyAnalysis () const
 verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information.
 
virtual void dumpPassStructure (unsigned Offset=0)
 
template<typename AnalysisType >
AnalysisType * getAnalysisIfAvailable () const
 getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information that might be around, for example to update it.
 
bool mustPreserveAnalysisID (char &AID) const
 mustPreserveAnalysisID - This method serves the same function as getAnalysisIfAvailable, but works if you just have an AnalysisID.
 
template<typename AnalysisType >
AnalysisType & getAnalysis () const
 getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function.
 
template<typename AnalysisType >
AnalysisType & getAnalysis (Function &F, bool *Changed=nullptr)
 getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function.
 
template<typename AnalysisType >
AnalysisType & getAnalysisID (AnalysisID PI) const
 
template<typename AnalysisType >
AnalysisType & getAnalysisID (AnalysisID PI, Function &F, bool *Changed=nullptr)
 

Static Public Attributes

static char ID = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::Pass
static const PassInfolookupPassInfo (const void *TI)
 
static const PassInfolookupPassInfo (StringRef Arg)
 
static PasscreatePass (AnalysisID ID)
 
- Protected Member Functions inherited from llvm::MachineFunctionPass
 MachineFunctionPass (char &ID)
 
virtual bool runOnMachineFunction (MachineFunction &MF)=0
 runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.
 
void getAnalysisUsage (AnalysisUsage &AU) const override
 getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
 
virtual MachineFunctionProperties getRequiredProperties () const
 
virtual MachineFunctionProperties getSetProperties () const
 
virtual MachineFunctionProperties getClearedProperties () const
 
- Protected Member Functions inherited from llvm::FunctionPass
bool skipFunction (const Function &F) const
 Optional passes call this function to check whether the pass should be skipped.
 

Detailed Description

Definition at line 33 of file VirtRegMap.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NO_PHYS_REG 
NO_STACK_SLOT 
MAX_STACK_SLOT 

Definition at line 35 of file VirtRegMap.h.

Constructor & Destructor Documentation

◆ VirtRegMap() [1/2]

llvm::VirtRegMap::VirtRegMap ( )
inline

Definition at line 74 of file VirtRegMap.h.

◆ VirtRegMap() [2/2]

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

Member Function Documentation

◆ assignVirt2Phys()

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

creates a mapping for the specified virtual register to the specified physical register

Definition at line 85 of file VirtRegMap.cpp.

References assert(), getRegInfo(), llvm::Register::id(), llvm::Register::isPhysicalRegister(), llvm::Register::isVirtual(), and NO_PHYS_REG.

Referenced by llvm::RegAllocBase::allocatePhysRegs(), and llvm::LiveRegMatrix::assign().

◆ assignVirt2Shape()

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

Definition at line 125 of file VirtRegMap.h.

References llvm::Register::id().

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 127 of file VirtRegMap.cpp.

References assert(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::Register::id(), 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 135 of file VirtRegMap.cpp.

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

◆ clearAllVirt()

void llvm::VirtRegMap::clearAllVirt ( )
inline

clears all virtual to physical register mappings

Definition at line 139 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 131 of file VirtRegMap.h.

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

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

◆ dump()

LLVM_DUMP_METHOD void VirtRegMap::dump ( ) const

Definition at line 167 of file VirtRegMap.cpp.

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

◆ getAnalysisUsage()

void llvm::VirtRegMap::getAnalysisUsage ( AnalysisUsage AU) const
inlineoverridevirtual

getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.

For MachineFunctionPasses, calling AU.preservesCFG() indicates that the pass does not modify the MachineBasicBlock CFG.

Reimplemented from llvm::MachineFunctionPass.

Definition at line 82 of file VirtRegMap.h.

References llvm::MachineFunctionPass::getAnalysisUsage(), and llvm::AnalysisUsage::setPreservesAll().

◆ 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 169 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 161 of file VirtRegMap.h.

References llvm::Register::id().

Referenced by getOriginal().

◆ getRegInfo()

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

Definition at line 92 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 187 of file VirtRegMap.h.

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

Referenced by isAssignedReg().

◆ getTargetRegInfo()

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

Definition at line 93 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 118 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 109 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

Definition at line 116 of file VirtRegMap.h.

References getShape(), and llvm::ShapeT::isValid().

Referenced by getTileShape(), and setIsSplitFromReg().

◆ 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 176 of file VirtRegMap.h.

References getStackSlot(), llvm::Register::id(), NO_PHYS_REG, and NO_STACK_SLOT.

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

print - Print out the internal state of the pass.

This is called by Analyze to print out the contents of an analysis. Otherwise it is not necessary to implement this method. Beware that the module pointer MAY be null. This automatically forwards to a virtual function that does not provide the Module* in case the analysis doesn't need it it can just be ignored.

Reimplemented from llvm::Pass.

Definition at line 145 of file VirtRegMap.cpp.

References llvm::MachineRegisterInfo::getNumVirtRegs(), llvm::MachineRegisterInfo::getRegClass(), llvm::TargetRegisterInfo::getRegClassName(), llvm::Register::index2VirtReg(), NO_PHYS_REG, NO_STACK_SLOT, OS, and llvm::printReg().

Referenced by dump(), and llvm::operator<<().

◆ runOnMachineFunction()

bool VirtRegMap::runOnMachineFunction ( MachineFunction MF)
overridevirtual

runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.

Implements llvm::MachineFunctionPass.

Definition at line 63 of file VirtRegMap.cpp.

References MRI, TII, and TRI.

◆ setIsSplitFromReg()

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

records virtReg is a split live interval from SReg.

Definition at line 153 of file VirtRegMap.h.

References getShape(), hasShape(), and llvm::Register::id().

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

Member Data Documentation

◆ ID

char VirtRegMap::ID = 0
static

Definition at line 72 of file VirtRegMap.h.


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