16 #ifndef LLVM_MC_MCREGISTERINFO_H
17 #define LLVM_MC_MCREGISTERINFO_H
65 assert(i <
getNumRegs() &&
"Register number out of range!");
72 unsigned InByte = Reg % 8;
73 unsigned Byte = Reg / 8;
76 return (
RegSet[Byte] & (1 << InByte)) != 0;
80 bool contains(
unsigned Reg1,
unsigned Reg2)
const {
161 unsigned NumRegUnits;
162 const uint16_t (*RegUnitRoots)[2];
164 const char *RegStrings;
165 const uint16_t *SubRegIndices;
169 unsigned NumSubRegIndices;
170 const uint16_t *RegEncodingTable;
173 unsigned L2DwarfRegsSize;
174 unsigned EHL2DwarfRegsSize;
175 unsigned Dwarf2LRegsSize;
176 unsigned EHDwarf2LRegsSize;
208 assert(
isValid() &&
"Cannot move off the end of the list.");
242 const uint16_t (*RURoots)[2],
246 const uint16_t *SubIndices,
249 const uint16_t *RET) {
256 RegStrings = Strings;
258 RegUnitRoots = RURoots;
260 SubRegIndices = SubIndices;
261 NumSubRegIndices = NumIndices;
262 SubRegIdxRanges = SubIdxRanges;
263 RegEncodingTable = RET;
273 EHL2DwarfRegsSize = Size;
276 L2DwarfRegsSize = Size;
287 EHDwarf2LRegsSize = Size;
290 Dwarf2LRegsSize = Size;
300 L2SEHRegs[LLVMReg] = SEHReg;
315 assert(RegNo < NumRegs &&
316 "Attempting to access record for invalid register number!");
354 return RegStrings +
get(RegNo).
Name;
367 return NumSubRegIndices;
406 assert(RegNo < NumRegs &&
407 "Attempting to get encoding for invalid register number!");
408 return RegEncodingTable[RegNo];
444 bool IncludeSelf =
false) {
458 bool IncludeSelf =
false) {
495 assert(Reg &&
"Null register has no regunits");
498 unsigned Scale = RU & 15;
499 unsigned Offset = RU >> 4;
503 init(Reg * Scale, MCRI->DiffLists + Offset);
529 assert(RegUnit < MCRI->getNumRegUnits() &&
"Invalid register unit");
530 Reg0 = MCRI->RegUnitRoots[RegUnit][0];
531 Reg1 = MCRI->RegUnitRoots[RegUnit][1];
546 assert(
isValid() &&
"Cannot move off the end of the list.");
567 : Reg(Reg), MCRI(MCRI), IncludeSelf(IncludeSelf) {
573 if (!(!IncludeSelf && Reg == *SI))
585 assert (SI.
isValid() &&
"Cannot dereference an invalid iterator.");
608 assert(
isValid() &&
"Cannot move off the end of the list.");
610 while (!IncludeSelf &&
isValid() && *SI ==
Reg);
bool isValid() const
Check if the iterator is at the end of the list.
int getDwarfRegNum(unsigned RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number. Returns -1 if there is no equivalent va...
const uint8_t *const RegSet
bool contains(unsigned Reg1, unsigned Reg2) const
contains - Return true if both registers are in this class.
const MCRegisterDesc & get(unsigned RegNo) const
Provide a get method, equivalent to [], but more useful with a pointer to this object.
void operator++()
Pre-increment to move to the next position.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
bool isSubRegister(unsigned RegA, unsigned RegB) const
Returns true if RegB is a sub-register of RegA.
const MCRegisterDesc & operator[](unsigned RegNo) const
unsigned operator*() const
Dereference to get the current root register.
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 ...
bool isSubRegisterEq(unsigned RegA, unsigned RegB) const
Returns true if RegB is a sub-register of RegA or if RegB == RegA.
MCSubRegIterator(unsigned Reg, const MCRegisterInfo *MCRI, bool IncludeSelf=false)
bool isAllocatable() const
unsigned getNumRegs() const
MCRegUnitIterator(unsigned Reg, const MCRegisterInfo *MCRI)
int getSEHRegNum(unsigned RegNum) const
Map a target register to an equivalent SEH register number. Returns LLVM register number if there is ...
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
bool operator<(DwarfLLVMRegPair RHS) const
unsigned getNumSubRegIndices() const
Return the number of sub-register indices understood by the target. Index 0 is reserved for the no-op...
MCRegUnitRootIterator enumerates the root registers of a register unit.
unsigned getProgramCounter() const
Return the register which is the program counter.
MCRegisterClass - Base class of TargetRegisterClass.
const MCPhysReg * iterator
const MCRegisterClass & getRegClass(unsigned i) const
Returns the register class associated with the enumeration value. See class MCOperandInfo.
void mapLLVMRegsToDwarfRegs(const DwarfLLVMRegPair *Map, unsigned Size, bool isEH)
Used to initialize LLVM register to Dwarf register number mapping. Called by TableGen auto-generated ...
unsigned getSubReg(unsigned Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo...
void mapDwarfRegsToLLVMRegs(const DwarfLLVMRegPair *Map, unsigned Size, bool isEH)
Used to initialize Dwarf register to LLVM register number mapping. Called by TableGen auto-generated ...
unsigned getRegister(unsigned i) const
MCRegAliasIterator(unsigned Reg, const MCRegisterInfo *MCRI, bool IncludeSelf)
int getLLVMRegNum(unsigned RegNum, bool isEH) const
Map a dwarf register back to a target register.
const MCPhysReg * const_iterator
const char * getName() const
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...
bool contains(unsigned Reg) const
bool isSuperRegisterEq(unsigned RegA, unsigned RegB) const
Returns true if RegB is a super-register of RegA or if RegB == RegA.
MCSuperRegIterator(unsigned Reg, const MCRegisterInfo *MCRI, bool IncludeSelf=false)
MCRegUnitRootIterator(unsigned RegUnit, const MCRegisterInfo *MCRI)
regclass_iterator regclass_begin() const
DiffListIterator()
Create an invalid iterator. Call init() to point to something useful.
void InitMCRegisterInfo(const MCRegisterDesc *D, unsigned NR, unsigned RA, unsigned PC, const MCRegisterClass *C, unsigned NC, const uint16_t(*RURoots)[2], unsigned NRU, const MCPhysReg *DL, const char *Strings, const uint16_t *SubIndices, unsigned NumIndices, const SubRegCoveredBits *SubIdxRanges, const uint16_t *RET)
Initialize MCRegisterInfo, called by TableGen auto-generated routines. DO NOT USE.
unsigned getNumRegUnits() const
Return the number of (native) register units in the target. Register units are numbered from 0 to get...
bool isSuperRegister(unsigned RegA, unsigned RegB) const
Returns true if RegB is a super-register of RegA.
const uint16_t RegSetSize
unsigned getAlignment() const
unsigned 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...
unsigned operator*() const
Dereference the iterator to get the value at the current position.
unsigned getNumRegClasses() const
unsigned operator*() const
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
const MCRegisterClass * regclass_iterator
void operator++()
Preincrement to move to the next root register.
const char * getName(unsigned RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register...
regclass_iterator regclass_end() const
unsigned getSubRegIdxSize(unsigned Idx) const
Get the size of the bit range covered by a sub-register index. If the index isn't continuous...
unsigned getRARegister() const
This method should return the register where the return address can be found.
void mapLLVMRegToSEHReg(unsigned LLVMReg, int SEHReg)
void init(MCPhysReg InitVal, const MCPhysReg *DiffList)