LLVM  8.0.1
Classes | Public Types | Public Member Functions | Friends | List of all members
llvm::MCRegisterInfo Class Reference

MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc objects that represent all of the machine registers that the target has. More...

#include "llvm/MC/MCRegisterInfo.h"

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

Classes

class  DiffListIterator
 DiffListIterator - Base iterator class that can traverse the differentially encoded register and regunit lists in DiffLists. More...
 
struct  DwarfLLVMRegPair
 DwarfLLVMRegPair - Emitted by tablegen so Dwarf<->LLVM reg mappings can be performed with a binary search. More...
 
struct  SubRegCoveredBits
 SubRegCoveredBits - Emitted by tablegen: bit range covered by a subreg index, -1 in any being invalid. More...
 

Public Types

using regclass_iterator = const MCRegisterClass *
 

Public Member Functions

void InitMCRegisterInfo (const MCRegisterDesc *D, unsigned NR, unsigned RA, unsigned PC, const MCRegisterClass *C, unsigned NC, const MCPhysReg(*RURoots)[2], unsigned NRU, const MCPhysReg *DL, const LaneBitmask *RUMS, const char *Strings, const char *ClassStrings, const uint16_t *SubIndices, unsigned NumIndices, const SubRegCoveredBits *SubIdxRanges, const uint16_t *RET)
 Initialize MCRegisterInfo, called by TableGen auto-generated routines. More...
 
void mapLLVMRegsToDwarfRegs (const DwarfLLVMRegPair *Map, unsigned Size, bool isEH)
 Used to initialize LLVM register to Dwarf register number mapping. More...
 
void mapDwarfRegsToLLVMRegs (const DwarfLLVMRegPair *Map, unsigned Size, bool isEH)
 Used to initialize Dwarf register to LLVM register number mapping. More...
 
void mapLLVMRegToSEHReg (unsigned LLVMReg, int SEHReg)
 mapLLVMRegToSEHReg - Used to initialize LLVM register to SEH register number mapping. More...
 
void mapLLVMRegToCVReg (unsigned LLVMReg, int CVReg)
 
unsigned getRARegister () const
 This method should return the register where the return address can be found. More...
 
unsigned getProgramCounter () const
 Return the register which is the program counter. More...
 
const MCRegisterDescoperator[] (unsigned RegNo) const
 
const MCRegisterDescget (unsigned RegNo) const
 Provide a get method, equivalent to [], but more useful with a pointer to this object. More...
 
unsigned getSubReg (unsigned Reg, unsigned Idx) const
 Returns the physical register number of sub-register "Index" for physical register RegNo. More...
 
unsigned getMatchingSuperReg (unsigned Reg, unsigned SubIdx, const MCRegisterClass *RC) const
 Return a super-register of the specified register Reg so its sub-register of index SubIdx is Reg. More...
 
unsigned getSubRegIndex (unsigned RegNo, unsigned SubRegNo) const
 For a given register pair, return the sub-register index if the second register is a sub-register of the first. More...
 
unsigned getSubRegIdxSize (unsigned Idx) const
 Get the size of the bit range covered by a sub-register index. More...
 
unsigned getSubRegIdxOffset (unsigned Idx) const
 Get the offset of the bit range covered by a sub-register index. More...
 
const chargetName (unsigned RegNo) const
 Return the human-readable symbolic target-specific name for the specified physical register. More...
 
unsigned getNumRegs () const
 Return the number of registers this target has (useful for sizing arrays holding per register information) More...
 
unsigned getNumSubRegIndices () const
 Return the number of sub-register indices understood by the target. More...
 
unsigned getNumRegUnits () const
 Return the number of (native) register units in the target. More...
 
int getDwarfRegNum (unsigned RegNum, bool isEH) const
 Map a target register to an equivalent dwarf register number. More...
 
int getLLVMRegNum (unsigned RegNum, bool isEH) const
 Map a dwarf register back to a target register. More...
 
int getLLVMRegNumFromEH (unsigned RegNum) const
 Map a DWARF EH register back to a target register (same as getLLVMRegNum(RegNum, true)) but return -1 if there is no mapping, rather than asserting that there must be one. More...
 
int getDwarfRegNumFromDwarfEHRegNum (unsigned RegNum) const
 Map a target EH register number to an equivalent DWARF register number. More...
 
int getSEHRegNum (unsigned RegNum) const
 Map a target register to an equivalent SEH register number. More...
 
int getCodeViewRegNum (unsigned RegNum) const
 Map a target register to an equivalent CodeView register number. More...
 
regclass_iterator regclass_begin () const
 
regclass_iterator regclass_end () const
 
iterator_range< regclass_iteratorregclasses () const
 
unsigned getNumRegClasses () const
 
const MCRegisterClassgetRegClass (unsigned i) const
 Returns the register class associated with the enumeration value. More...
 
const chargetRegClassName (const MCRegisterClass *Class) const
 
uint16_t getEncodingValue (unsigned RegNo) const
 Returns the encoding for RegNo. More...
 
bool isSubRegister (unsigned RegA, unsigned RegB) const
 Returns true if RegB is a sub-register of RegA. More...
 
bool isSuperRegister (unsigned RegA, unsigned RegB) const
 Returns true if RegB is a super-register of RegA. More...
 
bool isSubRegisterEq (unsigned RegA, unsigned RegB) const
 Returns true if RegB is a sub-register of RegA or if RegB == RegA. More...
 
bool isSuperRegisterEq (unsigned RegA, unsigned RegB) const
 Returns true if RegB is a super-register of RegA or if RegB == RegA. More...
 
bool isSuperOrSubRegisterEq (unsigned RegA, unsigned RegB) const
 Returns true if RegB is a super-register or sub-register of RegA or if RegB == RegA. More...
 

Friends

class MCSubRegIterator
 
class MCSubRegIndexIterator
 
class MCSuperRegIterator
 
class MCRegUnitIterator
 
class MCRegUnitMaskIterator
 
class MCRegUnitRootIterator
 

Detailed Description

MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc objects that represent all of the machine registers that the target has.

As such, we simply have to track a pointer to this array so that we can turn register number into a register descriptor.

Note this class is designed to be a base class of TargetRegisterInfo, which is the interface used by codegen. However, specific targets should never specialize this class. MCRegisterInfo should only contain getters to access TableGen generated physical register data. It must not be extended with virtual methods.

Definition at line 129 of file MCRegisterInfo.h.

Member Typedef Documentation

◆ regclass_iterator

Definition at line 131 of file MCRegisterInfo.h.

Member Function Documentation

◆ get()

const MCRegisterDesc& llvm::MCRegisterInfo::get ( unsigned  RegNo) const
inline

◆ getCodeViewRegNum()

int MCRegisterInfo::getCodeViewRegNum ( unsigned  RegNum) const

◆ getDwarfRegNum()

int MCRegisterInfo::getDwarfRegNum ( unsigned  RegNum,
bool  isEH 
) const

◆ getDwarfRegNumFromDwarfEHRegNum()

int MCRegisterInfo::getDwarfRegNumFromDwarfEHRegNum ( unsigned  RegNum) const

Map a target EH register number to an equivalent DWARF register number.

Definition at line 105 of file MCRegisterInfo.cpp.

References getDwarfRegNum(), and getLLVMRegNumFromEH().

◆ getEncodingValue()

uint16_t llvm::MCRegisterInfo::getEncodingValue ( unsigned  RegNo) const
inline

◆ getLLVMRegNum()

int MCRegisterInfo::getLLVMRegNum ( unsigned  RegNum,
bool  isEH 
) const

◆ getLLVMRegNumFromEH()

int MCRegisterInfo::getLLVMRegNumFromEH ( unsigned  RegNum) const

Map a DWARF EH register back to a target register (same as getLLVMRegNum(RegNum, true)) but return -1 if there is no mapping, rather than asserting that there must be one.

Definition at line 92 of file MCRegisterInfo.cpp.

References llvm::MCRegisterInfo::DwarfLLVMRegPair::FromReg, I, llvm::lower_bound(), Size, and llvm::MCRegisterInfo::DwarfLLVMRegPair::ToReg.

Referenced by getDwarfRegNumFromDwarfEHRegNum(), and printDwarfFileDirective().

◆ getMatchingSuperReg()

unsigned MCRegisterInfo::getMatchingSuperReg ( unsigned  Reg,
unsigned  SubIdx,
const MCRegisterClass RC 
) const

◆ getName()

const char* llvm::MCRegisterInfo::getName ( unsigned  RegNo) const
inline

◆ getNumRegClasses()

unsigned llvm::MCRegisterInfo::getNumRegClasses ( ) const
inline

Definition at line 427 of file MCRegisterInfo.h.

◆ getNumRegs()

unsigned llvm::MCRegisterInfo::getNumRegs ( ) const
inline

Return the number of registers this target has (useful for sizing arrays holding per register information)

Definition at line 377 of file MCRegisterInfo.h.

Referenced by addLiveInRegs(), llvm::MachineFunction::allocateRegMask(), llvm::PPCFrameLowering::assignCalleeSavedSpillSlots(), llvm::ScheduleDAGInstrs::buildSchedGraph(), llvm::calculateDbgEntityHistory(), llvm::CCState::CCState(), llvm::TargetRegisterInfo::checkAllSuperRegsMarked(), llvm::LiveIntervals::checkRegMaskInterference(), llvm::HexagonBlockRanges::computeDeadMap(), llvm::createRegUsageInfoCollector(), CriticalPathStep(), llvm::TargetFrameLowering::determineCalleeSaves(), llvm::mca::RegisterFile::dump(), llvm::HexagonBlockRanges::expandToSubRegs(), llvm::MachineRegisterInfo::freezeReservedRegs(), llvm::rdf::PhysicalRegisterInfo::getAliasSet(), llvm::TargetRegisterInfo::getAllocatableSet(), getCodeViewRegNum(), getDwarfRegNum(), getMOVL(), llvm::rdf::DataFlowGraph::getNextShadow(), llvm::MachineFrameInfo::getPristineRegs(), getSubRegIndex(), llvm::LivePhysRegs::init(), llvm::LiveRegSet::init(), INITIALIZE_PASS(), InstructionStoresToFI(), llvm::MachineOperand::isIdenticalTo(), llvm::LivePhysRegs::LivePhysRegs(), llvm::MachineRegisterInfo::MachineRegisterInfo(), llvm::CriticalAntiDepBreaker::Observe(), llvm::AggressiveAntiDepBreaker::Observe(), llvm::rdf::PhysicalRegisterInfo::PhysicalRegisterInfo(), llvm::PhysicalRegisterUsageInfo::print(), llvm::MachineOperand::print(), printCustomRegMask(), llvm::printReg(), llvm::TargetRegisterInfo::regmaskSubsetEqual(), llvm::InterferenceCache::reinitPhysRegEntries(), llvm::RegisterClassInfo::runOnMachineFunction(), llvm::ExecutionDomainFix::runOnMachineFunction(), llvm::CriticalAntiDepBreaker::StartBlock(), llvm::AggressiveAntiDepBreaker::StartBlock(), and UpdatePredRedefs().

◆ getNumRegUnits()

unsigned llvm::MCRegisterInfo::getNumRegUnits ( ) const
inline

◆ getNumSubRegIndices()

unsigned llvm::MCRegisterInfo::getNumSubRegIndices ( ) const
inline

Return the number of sub-register indices understood by the target.

Index 0 is reserved for the no-op sub-register, while 1 to getNumSubRegIndices() - 1 represent real sub-registers.

Definition at line 384 of file MCRegisterInfo.h.

Referenced by llvm::SplitEditor::dump(), llvm::AVRInstPrinter::getPrettyRegisterName(), getSubReg(), getSubRegIdxOffset(), and getSubRegIdxSize().

◆ getProgramCounter()

unsigned llvm::MCRegisterInfo::getProgramCounter ( ) const
inline

Return the register which is the program counter.

Definition at line 328 of file MCRegisterInfo.h.

Referenced by llvm::MCInstrDesc::mayAffectControlFlow().

◆ getRARegister()

unsigned llvm::MCRegisterInfo::getRARegister ( ) const
inline

This method should return the register where the return address can be found.

Definition at line 323 of file MCRegisterInfo.h.

Referenced by llvm::MipsAsmPrinter::emitFrameDirective(), and getCIEVersion().

◆ getRegClass()

const MCRegisterClass& llvm::MCRegisterInfo::getRegClass ( unsigned  i) const
inline

◆ getRegClassName()

const char* llvm::MCRegisterInfo::getRegClassName ( const MCRegisterClass Class) const
inline

◆ getSEHRegNum()

int MCRegisterInfo::getSEHRegNum ( unsigned  RegNum) const

Map a target register to an equivalent SEH register number.

Returns LLVM register number if there is no equivalent value.

Definition at line 120 of file MCRegisterInfo.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and I.

◆ getSubReg()

unsigned MCRegisterInfo::getSubReg ( unsigned  Reg,
unsigned  Idx 
) const

Returns the physical register number of sub-register "Index" for physical register RegNo.

Return zero if the sub-register does not exist.

Definition at line 32 of file MCRegisterInfo.cpp.

References assert(), getNumSubRegIndices(), llvm::MCRegisterInfo::DiffListIterator::isValid(), and Reg.

Referenced by llvm::ARMBaseInstrInfo::AddDReg(), addExclusiveRegPair(), addSavedGPR(), AddSubReg(), llvm::X86InstrInfo::breakPartialRegDependency(), llvm::AMDGPUDisassembler::convertMIMGInst(), copyHint(), llvm::SparcInstrInfo::copyPhysReg(), llvm::ARMBaseInstrInfo::copyPhysReg(), CriticalPathStep(), definesFullReg(), llvm::X86InstrInfo::expandPostRAPseudo(), GetDSubRegs(), getImplicitSPRUseForDPRUse(), getMatchingSuperReg(), getPairedGPR(), llvm::AVRInstPrinter::getPrettyRegisterName(), llvm::BitTracker::MachineEvaluator::getRegBitWidth(), INITIALIZE_PASS(), llvm::CoalescerPair::isCoalescable(), llvm::AMDGPU::isSGPR(), llvm::MipsSEInstrInfo::loadImmediate(), loadRegPairFromStackSlot(), llvm::rdf::DataFlowGraph::makeRegRef(), llvm::HexagonAsmPrinter::PrintAsmOperand(), llvm::ARMAsmPrinter::PrintAsmOperand(), llvm::ARMInstPrinter::printGPRPairOperand(), llvm::AArch64InstPrinter::printGPRSeqPairsClassOperand(), llvm::ARMAsmPrinter::printOperand(), llvm::AArch64InstPrinter::printVectorList(), llvm::ARMInstPrinter::printVectorListTwo(), llvm::ARMInstPrinter::printVectorListTwoAllLanes(), llvm::ARMInstPrinter::printVectorListTwoSpaced(), llvm::ARMInstPrinter::printVectorListTwoSpacedAllLanes(), llvm::CoalescerPair::setRegisters(), storeRegPairToStackSlot(), llvm::MachineInstr::substituteRegister(), and llvm::MachineOperand::substPhysReg().

◆ getSubRegIdxOffset()

unsigned MCRegisterInfo::getSubRegIdxOffset ( unsigned  Idx) const

Get the offset of the bit range covered by a sub-register index.

If an Offset doesn't make sense (the index isn't continuous, or is used to access sub-registers at different offsets), return -1.

Definition at line 61 of file MCRegisterInfo.cpp.

References assert(), getNumSubRegIndices(), and llvm::MCRegisterInfo::SubRegCoveredBits::Offset.

Referenced by llvm::DwarfExpression::addMachineReg(), getDwarfRegNum(), and llvm::TargetInstrInfo::getStackSlotRange().

◆ getSubRegIdxSize()

unsigned MCRegisterInfo::getSubRegIdxSize ( unsigned  Idx) const

Get the size of the bit range covered by a sub-register index.

If the index isn't continuous, return the sum of the sizes of its parts. If the index is used to access subregisters of different sizes, return -1.

Definition at line 55 of file MCRegisterInfo.cpp.

References assert(), getNumSubRegIndices(), and llvm::MCRegisterInfo::SubRegCoveredBits::Size.

Referenced by llvm::DwarfExpression::addMachineReg(), llvm::TargetInstrInfo::foldMemoryOperand(), and llvm::TargetInstrInfo::getStackSlotRange().

◆ getSubRegIndex()

unsigned MCRegisterInfo::getSubRegIndex ( unsigned  RegNo,
unsigned  SubRegNo 
) const

For a given register pair, return the sub-register index if the second register is a sub-register of the first.

Return zero otherwise.

Definition at line 44 of file MCRegisterInfo.cpp.

References assert(), getNumRegs(), llvm::MCRegisterInfo::DiffListIterator::isValid(), and Reg.

Referenced by llvm::DwarfExpression::addMachineReg(), CriticalPathStep(), getDwarfRegNum(), INITIALIZE_PASS(), isNopCopy(), and llvm::rdf::PhysicalRegisterInfo::mapTo().

◆ InitMCRegisterInfo()

void llvm::MCRegisterInfo::InitMCRegisterInfo ( const MCRegisterDesc D,
unsigned  NR,
unsigned  RA,
unsigned  PC,
const MCRegisterClass C,
unsigned  NC,
const MCPhysReg(*)  RURoots[2],
unsigned  NRU,
const MCPhysReg DL,
const LaneBitmask RUMS,
const char Strings,
const char ClassStrings,
const uint16_t *  SubIndices,
unsigned  NumIndices,
const SubRegCoveredBits SubIdxRanges,
const uint16_t *  RET 
)
inline

Initialize MCRegisterInfo, called by TableGen auto-generated routines.

DO NOT USE.

Definition at line 239 of file MCRegisterInfo.h.

References C, D, NC, RA, and llvm::ARCISD::RET.

◆ isSubRegister()

bool llvm::MCRegisterInfo::isSubRegister ( unsigned  RegA,
unsigned  RegB 
) const
inline

◆ isSubRegisterEq()

bool llvm::MCRegisterInfo::isSubRegisterEq ( unsigned  RegA,
unsigned  RegB 
) const
inline

Returns true if RegB is a sub-register of RegA or if RegB == RegA.

Definition at line 458 of file MCRegisterInfo.h.

Referenced by llvm::MCInstrDesc::hasDefOfPhysReg(), and isMatchingOrAlias().

◆ isSuperOrSubRegisterEq()

bool llvm::MCRegisterInfo::isSuperOrSubRegisterEq ( unsigned  RegA,
unsigned  RegB 
) const
inline

Returns true if RegB is a super-register or sub-register of RegA or if RegB == RegA.

Definition at line 470 of file MCRegisterInfo.h.

◆ isSuperRegister()

bool llvm::MCRegisterInfo::isSuperRegister ( unsigned  RegA,
unsigned  RegB 
) const
inline

◆ isSuperRegisterEq()

bool llvm::MCRegisterInfo::isSuperRegisterEq ( unsigned  RegA,
unsigned  RegB 
) const
inline

Returns true if RegB is a super-register of RegA or if RegB == RegA.

Definition at line 464 of file MCRegisterInfo.h.

Referenced by llvm::MachineOperandIteratorBase::analyzePhysReg().

◆ mapDwarfRegsToLLVMRegs()

void llvm::MCRegisterInfo::mapDwarfRegsToLLVMRegs ( const DwarfLLVMRegPair Map,
unsigned  Size,
bool  isEH 
)
inline

Used to initialize Dwarf register to LLVM register number mapping.

Called by TableGen auto-generated routines. DO NOT USE.

Definition at line 297 of file MCRegisterInfo.h.

References Size.

◆ mapLLVMRegsToDwarfRegs()

void llvm::MCRegisterInfo::mapLLVMRegsToDwarfRegs ( const DwarfLLVMRegPair Map,
unsigned  Size,
bool  isEH 
)
inline

Used to initialize LLVM register to Dwarf register number mapping.

Called by TableGen auto-generated routines. DO NOT USE.

Definition at line 283 of file MCRegisterInfo.h.

References Size.

◆ mapLLVMRegToCVReg()

void llvm::MCRegisterInfo::mapLLVMRegToCVReg ( unsigned  LLVMReg,
int  CVReg 
)
inline

◆ mapLLVMRegToSEHReg()

void llvm::MCRegisterInfo::mapLLVMRegToSEHReg ( unsigned  LLVMReg,
int  SEHReg 
)
inline

mapLLVMRegToSEHReg - Used to initialize LLVM register to SEH register number mapping.

By default the SEH register number is just the same as the LLVM register number. FIXME: TableGen these numbers. Currently this requires target specific initialization code.

Definition at line 313 of file MCRegisterInfo.h.

Referenced by llvm::X86_MC::initLLVMToSEHAndCVRegMapping().

◆ operator[]()

const MCRegisterDesc& llvm::MCRegisterInfo::operator[] ( unsigned  RegNo) const
inline

Definition at line 332 of file MCRegisterInfo.h.

References assert().

◆ regclass_begin()

regclass_iterator llvm::MCRegisterInfo::regclass_begin ( ) const
inline

Definition at line 421 of file MCRegisterInfo.h.

◆ regclass_end()

regclass_iterator llvm::MCRegisterInfo::regclass_end ( ) const
inline

Definition at line 422 of file MCRegisterInfo.h.

◆ regclasses()

iterator_range<regclass_iterator> llvm::MCRegisterInfo::regclasses ( ) const
inline

Definition at line 423 of file MCRegisterInfo.h.

References llvm::make_range().

Friends And Related Function Documentation

◆ MCRegUnitIterator

friend class MCRegUnitIterator
friend

Definition at line 233 of file MCRegisterInfo.h.

◆ MCRegUnitMaskIterator

friend class MCRegUnitMaskIterator
friend

Definition at line 234 of file MCRegisterInfo.h.

◆ MCRegUnitRootIterator

friend class MCRegUnitRootIterator
friend

Definition at line 235 of file MCRegisterInfo.h.

◆ MCSubRegIndexIterator

friend class MCSubRegIndexIterator
friend

Definition at line 231 of file MCRegisterInfo.h.

◆ MCSubRegIterator

friend class MCSubRegIterator
friend

Definition at line 230 of file MCRegisterInfo.h.

◆ MCSuperRegIterator

friend class MCSuperRegIterator
friend

Definition at line 232 of file MCRegisterInfo.h.


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