class MCRegisterInfo

Declaration

class MCRegisterInfo { /* full declaration omitted */ };

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.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:135

Member Variables

private const llvm::MCRegisterDesc* Desc
private unsigned int NumRegs
private llvm::MCRegister RAReg
private llvm::MCRegister PCReg
private const llvm::MCRegisterClass* Classes
private unsigned int NumClasses
private unsigned int NumRegUnits
private const llvm::MCPhysReg (*)[2] RegUnitRoots
private const llvm::MCPhysReg* DiffLists
private const llvm::LaneBitmask* RegUnitMaskSequences
private const char* RegStrings
private const char* RegClassStrings
private const uint16_t* SubRegIndices
private const llvm::MCRegisterInfo::SubRegCoveredBits* SubRegIdxRanges
private unsigned int NumSubRegIndices
private const uint16_t* RegEncodingTable
private unsigned int L2DwarfRegsSize
private unsigned int EHL2DwarfRegsSize
private unsigned int Dwarf2LRegsSize
private unsigned int EHDwarf2LRegsSize
private const llvm::MCRegisterInfo::DwarfLLVMRegPair* L2DwarfRegs
private const llvm::MCRegisterInfo::DwarfLLVMRegPair* EHL2DwarfRegs
private const llvm::MCRegisterInfo::DwarfLLVMRegPair* Dwarf2LRegs
private const llvm::MCRegisterInfo::DwarfLLVMRegPair* EHDwarf2LRegs
private DenseMap<llvm::MCRegister, int> L2SEHRegs
private DenseMap<llvm::MCRegister, int> L2CVRegs

Method Overview

  • public void InitMCRegisterInfo(const llvm::MCRegisterDesc * D, unsigned int NR, unsigned int RA, unsigned int PC, const llvm::MCRegisterClass * C, unsigned int NC, const llvm::MCPhysReg (*)[2] RURoots, unsigned int NRU, const llvm::MCPhysReg * DL, const llvm::LaneBitmask * RUMS, const char * Strings, const char * ClassStrings, const uint16_t * SubIndices, unsigned int NumIndices, const llvm::MCRegisterInfo::SubRegCoveredBits * SubIdxRanges, const uint16_t * RET)
  • public const llvm::MCRegisterDesc & get(llvm::MCRegister RegNo) const
  • public int getCodeViewRegNum(llvm::MCRegister RegNum) const
  • public int getDwarfRegNum(llvm::MCRegister RegNum, bool isEH) const
  • public int getDwarfRegNumFromDwarfEHRegNum(unsigned int RegNum) const
  • public uint16_t getEncodingValue(llvm::MCRegister RegNo) const
  • public Optional<unsigned int> getLLVMRegNum(unsigned int RegNum, bool isEH) const
  • public llvm::MCRegister getMatchingSuperReg(llvm::MCRegister Reg, unsigned int SubIdx, const llvm::MCRegisterClass * RC) const
  • public const char * getName(llvm::MCRegister RegNo) const
  • public unsigned int getNumRegClasses() const
  • public unsigned int getNumRegUnits() const
  • public unsigned int getNumRegs() const
  • public unsigned int getNumSubRegIndices() const
  • public llvm::MCRegister getProgramCounter() const
  • public llvm::MCRegister getRARegister() const
  • public const llvm::MCRegisterClass & getRegClass(unsigned int i) const
  • public const char * getRegClassName(const llvm::MCRegisterClass * Class) const
  • public int getSEHRegNum(llvm::MCRegister RegNum) const
  • public llvm::MCRegister getSubReg(llvm::MCRegister Reg, unsigned int Idx) const
  • public unsigned int getSubRegIdxOffset(unsigned int Idx) const
  • public unsigned int getSubRegIdxSize(unsigned int Idx) const
  • public unsigned int getSubRegIndex(llvm::MCRegister RegNo, llvm::MCRegister SubRegNo) const
  • public bool isSubRegister(llvm::MCRegister RegA, llvm::MCRegister RegB) const
  • public bool isSubRegisterEq(llvm::MCRegister RegA, llvm::MCRegister RegB) const
  • public bool isSuperOrSubRegisterEq(llvm::MCRegister RegA, llvm::MCRegister RegB) const
  • public bool isSuperRegister(llvm::MCRegister RegA, llvm::MCRegister RegB) const
  • public bool isSuperRegisterEq(llvm::MCRegister RegA, llvm::MCRegister RegB) const
  • public void mapDwarfRegsToLLVMRegs(const llvm::MCRegisterInfo::DwarfLLVMRegPair * Map, unsigned int Size, bool isEH)
  • public void mapLLVMRegToCVReg(llvm::MCRegister LLVMReg, int CVReg)
  • public void mapLLVMRegToSEHReg(llvm::MCRegister LLVMReg, int SEHReg)
  • public void mapLLVMRegsToDwarfRegs(const llvm::MCRegisterInfo::DwarfLLVMRegPair * Map, unsigned int Size, bool isEH)
  • public llvm::MCRegisterInfo::regclass_iterator regclass_begin() const
  • public llvm::MCRegisterInfo::regclass_iterator regclass_end() const
  • public iterator_range<llvm::MCRegisterInfo::regclass_iterator> regclasses() const
  • public bool regsOverlap(llvm::MCRegister RegA, llvm::MCRegister RegB) const
  • public detail::concat_range<const MCPhysReg, iterator_range<mc_subreg_iterator>, iterator_range<mc_superreg_iterator>> sub_and_superregs_inclusive(llvm::MCRegister Reg) const
  • public iterator_range<llvm::MCRegisterInfo::mc_subreg_iterator> subregs(llvm::MCRegister Reg) const
  • public iterator_range<llvm::MCRegisterInfo::mc_subreg_iterator> subregs_inclusive(llvm::MCRegister Reg) const
  • public iterator_range<llvm::MCRegisterInfo::mc_superreg_iterator> superregs(llvm::MCRegister Reg) const
  • public iterator_range<llvm::MCRegisterInfo::mc_superreg_iterator> superregs_inclusive(llvm::MCRegister Reg) const

Methods

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

Description

Initialize MCRegisterInfo, called by TableGen auto-generated routines. *DO NOT USE*.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:353

Parameters

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

const llvm::MCRegisterDesc& get(
    llvm::MCRegister RegNo) const

Description

Provide a get method, equivalent to [], but more useful with a pointer to this object.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:454

Parameters

llvm::MCRegister RegNo

int getCodeViewRegNum(
    llvm::MCRegister RegNum) const

Description

Map a target register to an equivalent CodeView register number.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:529

Parameters

llvm::MCRegister RegNum

int getDwarfRegNum(llvm::MCRegister RegNum,
                   bool isEH) const

Description

Map a target register to an equivalent dwarf register number. Returns -1 if there is no equivalent value. The second parameter allows targets to use different numberings for EH info and debugging info.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:513

Parameters

llvm::MCRegister RegNum
bool isEH

int getDwarfRegNumFromDwarfEHRegNum(
    unsigned int RegNum) const

Description

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:521

Parameters

unsigned int RegNum

uint16_t getEncodingValue(
    llvm::MCRegister RegNo) const

Description

Returns the encoding for RegNo

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:553

Parameters

llvm::MCRegister RegNo

Optional<unsigned int> getLLVMRegNum(
    unsigned int RegNum,
    bool isEH) const

Description

Map a dwarf register back to a target register. Returns None is there is no mapping.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:517

Parameters

unsigned int RegNum
bool isEH

llvm::MCRegister getMatchingSuperReg(
    llvm::MCRegister Reg,
    unsigned int SubIdx,
    const llvm::MCRegisterClass* RC) const

Description

Return a super-register of the specified register Reg so its sub-register of index SubIdx is Reg.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:465

Parameters

llvm::MCRegister Reg
unsigned int SubIdx
const llvm::MCRegisterClass* RC

const char* getName(llvm::MCRegister RegNo) const

Description

Return the human-readable symbolic target-specific name for the specified physical register.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:485

Parameters

llvm::MCRegister RegNo

unsigned int getNumRegClasses() const

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:537

unsigned int getNumRegUnits() const

Description

Return the number of (native) register units in the target. Register units are numbered from 0 to getNumRegUnits() - 1. They can be accessed through MCRegUnitIterator defined below.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:505

unsigned int getNumRegs() const

Description

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:491

unsigned int getNumSubRegIndices() const

Description

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.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:498

llvm::MCRegister getProgramCounter() const

Description

Return the register which is the program counter.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:442

llvm::MCRegister getRARegister() const

Description

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:437

const llvm::MCRegisterClass& getRegClass(
    unsigned int i) const

Description

Returns the register class associated with the enumeration value. See class MCOperandInfo.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:543

Parameters

unsigned int i

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:548

Parameters

const llvm::MCRegisterClass* Class

int getSEHRegNum(llvm::MCRegister RegNum) const

Description

Map a target register to an equivalent SEH register number. Returns LLVM register number if there is no equivalent value.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:525

Parameters

llvm::MCRegister RegNum

llvm::MCRegister getSubReg(llvm::MCRegister Reg,
                           unsigned int Idx) const

Description

Returns the physical register number of sub-register "Index" for physical register RegNo. Return zero if the sub-register does not exist.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:461

Parameters

llvm::MCRegister Reg
unsigned int Idx

unsigned int getSubRegIdxOffset(
    unsigned int Idx) const

Description

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.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:481

Parameters

unsigned int Idx

unsigned int getSubRegIdxSize(
    unsigned int Idx) const

Description

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.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:476

Parameters

unsigned int Idx

unsigned int getSubRegIndex(
    llvm::MCRegister RegNo,
    llvm::MCRegister SubRegNo) const

Description

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:471

Parameters

llvm::MCRegister RegNo
llvm::MCRegister SubRegNo

bool isSubRegister(llvm::MCRegister RegA,
                   llvm::MCRegister RegB) const

Description

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:560

Parameters

llvm::MCRegister RegA
llvm::MCRegister RegB

bool isSubRegisterEq(llvm::MCRegister RegA,
                     llvm::MCRegister RegB) const

Description

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:568

Parameters

llvm::MCRegister RegA
llvm::MCRegister RegB

bool isSuperOrSubRegisterEq(
    llvm::MCRegister RegA,
    llvm::MCRegister RegB) const

Description

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:580

Parameters

llvm::MCRegister RegA
llvm::MCRegister RegB

bool isSuperRegister(llvm::MCRegister RegA,
                     llvm::MCRegister RegB) const

Description

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:565

Parameters

llvm::MCRegister RegA
llvm::MCRegister RegB

bool isSuperRegisterEq(
    llvm::MCRegister RegA,
    llvm::MCRegister RegB) const

Description

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:574

Parameters

llvm::MCRegister RegA
llvm::MCRegister RegB

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

Description

Used to initialize Dwarf register to LLVM register number mapping. Called by TableGen auto-generated routines. *DO NOT USE*.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:411

Parameters

const llvm::MCRegisterInfo::DwarfLLVMRegPair* Map
unsigned int Size
bool isEH

void mapLLVMRegToCVReg(llvm::MCRegister LLVMReg,
                       int CVReg)

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:431

Parameters

llvm::MCRegister LLVMReg
int CVReg

void mapLLVMRegToSEHReg(llvm::MCRegister LLVMReg,
                        int SEHReg)

Description

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.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:427

Parameters

llvm::MCRegister LLVMReg
int SEHReg

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

Description

Used to initialize LLVM register to Dwarf register number mapping. Called by TableGen auto-generated routines. *DO NOT USE*.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:397

Parameters

const llvm::MCRegisterInfo::DwarfLLVMRegPair* Map
unsigned int Size
bool isEH

llvm::MCRegisterInfo::regclass_iterator
regclass_begin() const

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:531

llvm::MCRegisterInfo::regclass_iterator
regclass_end() const

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:532

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

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:533

bool regsOverlap(llvm::MCRegister RegA,
                 llvm::MCRegister RegB) const

Description

Returns true if the two registers are equal or alias each other.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:585

Parameters

llvm::MCRegister RegA
llvm::MCRegister RegB

detail::concat_range<
    const MCPhysReg,
    iterator_range<mc_subreg_iterator>,
    iterator_range<mc_superreg_iterator>>
sub_and_superregs_inclusive(
    llvm::MCRegister Reg) const

Description

Return an iterator range over all sub- and super-registers of \p Reg, including \p Reg.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:338

Parameters

llvm::MCRegister Reg

iterator_range<
    llvm::MCRegisterInfo::mc_subreg_iterator>
subregs(llvm::MCRegister Reg) const

Description

Return an iterator range over all sub-registers of \p Reg, excluding \p Reg.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:309

Parameters

llvm::MCRegister Reg

iterator_range<
    llvm::MCRegisterInfo::mc_subreg_iterator>
subregs_inclusive(llvm::MCRegister Reg) const

Description

Return an iterator range over all sub-registers of \p Reg, including \p Reg.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:316

Parameters

llvm::MCRegister Reg

iterator_range<
    llvm::MCRegisterInfo::mc_superreg_iterator>
superregs(llvm::MCRegister Reg) const

Description

Return an iterator range over all super-registers of \p Reg, excluding \p Reg.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:322

Parameters

llvm::MCRegister Reg

iterator_range<
    llvm::MCRegisterInfo::mc_superreg_iterator>
superregs_inclusive(llvm::MCRegister Reg) const

Description

Return an iterator range over all super-registers of \p Reg, including \p Reg.

Declared at: llvm/include/llvm/MC/MCRegisterInfo.h:330

Parameters

llvm::MCRegister Reg