LLVM API Documentation

Public Types | Public Member Functions | Static Public Attributes
llvm::VirtRegMap Class Reference

#include <VirtRegMap.h>

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

List of all members.

Public Types

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

Public Member Functions

 VirtRegMap ()
bool runOnMachineFunction (MachineFunction &MF) override
void getAnalysisUsage (AnalysisUsage &AU) const override
MachineFunctiongetMachineFunction () const
MachineRegisterInfogetRegInfo () const
const TargetRegisterInfogetTargetRegInfo () const
void grow ()
bool hasPhys (unsigned virtReg) const
 returns true if the specified virtual register is mapped to a physical register
unsigned getPhys (unsigned virtReg) const
 returns the physical register mapped to the specified virtual register
void assignVirt2Phys (unsigned virtReg, unsigned physReg)
 creates a mapping for the specified virtual register to the specified physical register
void clearVirt (unsigned virtReg)
 clears the specified virtual register's, physical register mapping
void clearAllVirt ()
 clears all virtual to physical register mappings
bool hasPreferredPhys (unsigned VirtReg)
 returns true if VirtReg is assigned to its preferred physreg.
bool hasKnownPreference (unsigned VirtReg)
 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.
void setIsSplitFromReg (unsigned virtReg, unsigned SReg)
 records virtReg is a split live interval from SReg.
unsigned getPreSplitReg (unsigned virtReg) const
 returns the live interval virtReg is split from.
unsigned getOriginal (unsigned VirtReg) const
bool isAssignedReg (unsigned virtReg) const
 returns true if the specified virtual register is not mapped to a stack slot or rematerialized.
int getStackSlot (unsigned virtReg) const
 returns the stack slot mapped to the specified virtual register
int assignVirt2StackSlot (unsigned virtReg)
 create a mapping for the specifed virtual register to the next available stack slot
void assignVirt2StackSlot (unsigned virtReg, int frameIndex)
 create a mapping for the specified virtual register to the specified stack slot
void print (raw_ostream &OS, const Module *M=nullptr) const override
void dump () const

Static Public Attributes

static char ID = 0

Detailed Description

Definition at line 32 of file VirtRegMap.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
NO_PHYS_REG 
NO_STACK_SLOT 
MAX_STACK_SLOT 

Definition at line 34 of file VirtRegMap.h.


Constructor & Destructor Documentation

llvm::VirtRegMap::VirtRegMap ( ) [inline]

Definition at line 71 of file VirtRegMap.h.


Member Function Documentation

void llvm::VirtRegMap::assignVirt2Phys ( unsigned  virtReg,
unsigned  physReg 
) [inline]

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

Definition at line 105 of file VirtRegMap.h.

References llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::TargetRegisterInfo::isVirtualRegister(), and NO_PHYS_REG.

Referenced by llvm::RegAllocBase::allocatePhysRegs().

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

Definition at line 102 of file VirtRegMap.cpp.

References llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::TargetRegisterInfo::isVirtualRegister(), and NO_STACK_SLOT.

void VirtRegMap::assignVirt2StackSlot ( unsigned  virtReg,
int  frameIndex 
)

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

Definition at line 110 of file VirtRegMap.cpp.

References llvm::MachineFunction::getFrameInfo(), llvm::MachineFrameInfo::getObjectIndexBegin(), llvm::TargetRegisterInfo::isVirtualRegister(), and NO_STACK_SLOT.

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

void llvm::VirtRegMap::clearVirt ( unsigned  virtReg) [inline]

clears the specified virtual register's, physical register mapping

Definition at line 116 of file VirtRegMap.h.

References llvm::TargetRegisterInfo::isVirtualRegister(), and NO_PHYS_REG.

void VirtRegMap::dump ( ) const

Reimplemented from llvm::Pass.

Definition at line 142 of file VirtRegMap.cpp.

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

void llvm::VirtRegMap::getAnalysisUsage ( AnalysisUsage AU) const [inline, override, virtual]

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

References llvm::AnalysisUsage::setPreservesAll().

unsigned llvm::VirtRegMap::getOriginal ( unsigned  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 151 of file VirtRegMap.h.

References getPreSplitReg().

Referenced by llvm::LiveRangeEdit::createEmptyIntervalFrom(), llvm::LiveRangeEdit::createFrom(), llvm::LiveRangeEdit::eliminateDeadDefs(), and llvm::SplitAnalysis::isOriginalEndpoint().

unsigned llvm::VirtRegMap::getPhys ( unsigned  virtReg) const [inline]
unsigned llvm::VirtRegMap::getPreSplitReg ( unsigned  virtReg) const [inline]

returns the live interval virtReg is split from.

Definition at line 143 of file VirtRegMap.h.

Referenced by getOriginal().

Definition at line 85 of file VirtRegMap.h.

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

int llvm::VirtRegMap::getStackSlot ( unsigned  virtReg) const [inline]

returns the stack slot mapped to the specified virtual register

Definition at line 168 of file VirtRegMap.h.

References llvm::TargetRegisterInfo::isVirtualRegister().

Referenced by isAssignedReg().

void VirtRegMap::grow ( )

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

References llvm::MachineRegisterInfo::getRegAllocationHint(), hasPhys(), Hint(), llvm::TargetRegisterInfo::isPhysicalRegister(), and llvm::TargetRegisterInfo::isVirtualRegister().

bool llvm::VirtRegMap::hasPhys ( unsigned  virtReg) const [inline]

returns true if the specified virtual register is mapped to a physical register

Definition at line 92 of file VirtRegMap.h.

References getPhys(), and NO_PHYS_REG.

Referenced by llvm::RegAllocBase::allocatePhysRegs(), llvm::ARMBaseRegisterInfo::getRegAllocationHints(), and hasKnownPreference().

returns true if VirtReg is assigned to its preferred physreg.

Definition at line 84 of file VirtRegMap.cpp.

References getPhys(), llvm::MachineRegisterInfo::getSimpleHint(), Hint(), and llvm::TargetRegisterInfo::isVirtualRegister().

bool llvm::VirtRegMap::isAssignedReg ( unsigned  virtReg) const [inline]

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

Definition at line 158 of file VirtRegMap.h.

References getStackSlot(), NO_PHYS_REG, and NO_STACK_SLOT.

void VirtRegMap::print ( raw_ostream O,
const Module M = nullptr 
) const [override, virtual]

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

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

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

bool VirtRegMap::runOnMachineFunction ( MachineFunction MF) [override, virtual]

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

Implements llvm::MachineFunctionPass.

Definition at line 56 of file VirtRegMap.cpp.

References getRegInfo(), llvm::HexagonInstrInfo::getRegisterInfo(), and TII.

void llvm::VirtRegMap::setIsSplitFromReg ( unsigned  virtReg,
unsigned  SReg 
) [inline]

records virtReg is a split live interval from SReg.

Definition at line 138 of file VirtRegMap.h.

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


Member Data Documentation

char VirtRegMap::ID = 0 [static]

Definition at line 70 of file VirtRegMap.h.


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