16 #ifndef LLVM_MC_MCREGISTERINFO_H 17 #define LLVM_MC_MCREGISTERINFO_H 70 unsigned InByte = Reg % 8;
71 unsigned Byte = Reg / 8;
72 if (Byte >= RegSetSize)
74 return (RegSet[Byte] & (1 << InByte)) != 0;
78 bool contains(
unsigned Reg1,
unsigned Reg2)
const {
156 unsigned NumRegUnits;
161 const char *RegStrings;
162 const char *RegClassStrings;
163 const uint16_t *SubRegIndices;
167 unsigned NumSubRegIndices;
168 const uint16_t *RegEncodingTable;
171 unsigned L2DwarfRegsSize;
172 unsigned EHL2DwarfRegsSize;
173 unsigned Dwarf2LRegsSize;
174 unsigned EHDwarf2LRegsSize;
207 assert(isValid() &&
"Cannot move off the end of the list.");
247 const char *ClassStrings,
248 const uint16_t *SubIndices,
251 const uint16_t *
RET) {
258 RegUnitMaskSequences = RUMS;
259 RegStrings = Strings;
260 RegClassStrings = ClassStrings;
262 RegUnitRoots = RURoots;
264 SubRegIndices = SubIndices;
265 NumSubRegIndices = NumIndices;
266 SubRegIdxRanges = SubIdxRanges;
267 RegEncodingTable =
RET;
270 EHL2DwarfRegs =
nullptr;
271 EHL2DwarfRegsSize = 0;
272 L2DwarfRegs =
nullptr;
274 EHDwarf2LRegs =
nullptr;
275 EHDwarf2LRegsSize = 0;
276 Dwarf2LRegs =
nullptr;
287 EHL2DwarfRegsSize =
Size;
290 L2DwarfRegsSize =
Size;
301 EHDwarf2LRegsSize =
Size;
304 Dwarf2LRegsSize =
Size;
314 L2SEHRegs[LLVMReg] = SEHReg;
318 L2CVRegs[LLVMReg] = CVReg;
334 "Attempting to access record for invalid register number!");
341 return operator[](RegNo);
347 unsigned getSubReg(
unsigned Reg,
unsigned Idx)
const;
351 unsigned getMatchingSuperReg(
unsigned Reg,
unsigned SubIdx,
357 unsigned getSubRegIndex(
unsigned RegNo,
unsigned SubRegNo)
const;
362 unsigned getSubRegIdxSize(
unsigned Idx)
const;
367 unsigned getSubRegIdxOffset(
unsigned Idx)
const;
372 return RegStrings +
get(RegNo).
Name;
385 return NumSubRegIndices;
402 int getLLVMRegNum(
unsigned RegNum,
bool isEH)
const;
407 int getLLVMRegNumFromEH(
unsigned RegNum)
const;
411 int getDwarfRegNumFromDwarfEHRegNum(
unsigned RegNum)
const;
415 int getSEHRegNum(
unsigned RegNum)
const;
419 int getCodeViewRegNum(
unsigned RegNum)
const;
424 return make_range(regclass_begin(), regclass_end());
428 return (
unsigned)(regclass_end()-regclass_begin());
434 assert(i < getNumRegClasses() &&
"Register Class ID out of range");
439 return RegClassStrings + Class->
NameIdx;
445 "Attempting to get encoding for invalid register number!");
446 return RegEncodingTable[RegNo];
451 return isSuperRegister(RegB, RegA);
455 bool isSuperRegister(
unsigned RegA,
unsigned RegB)
const;
459 return isSuperRegisterEq(RegB, RegA);
465 return RegA == RegB || isSuperRegister(RegA, RegB);
471 return isSubRegisterEq(RegA, RegB) || isSuperRegister(RegA, RegB);
487 bool IncludeSelf =
false) {
499 const uint16_t *SRIndex;
505 : SRIter(Reg, MCRI) {
536 bool IncludeSelf =
false) {
574 assert(Reg &&
"Null register has no regunits");
577 unsigned Scale = RU & 15;
578 unsigned Offset = RU >> 4;
582 init(Reg * Scale, MCRI->DiffLists + Offset);
605 : RUIter(Reg, MCRI) {
607 MaskListIter = &MCRI->RegUnitMaskSequences[Idx];
612 return std::make_pair(*RUIter, *MaskListIter);
643 assert(RegUnit < MCRI->getNumRegUnits() &&
"Invalid register unit");
644 Reg0 = MCRI->RegUnitRoots[RegUnit][0];
645 Reg1 = MCRI->RegUnitRoots[RegUnit][1];
660 assert(isValid() &&
"Cannot move off the end of the list.");
682 : Reg(Reg), MCRI(MCRI), IncludeSelf(IncludeSelf) {
687 if (!(!IncludeSelf && Reg == *SI))
697 assert(SI.
isValid() &&
"Cannot dereference an invalid iterator.");
720 assert(isValid() &&
"Cannot move off the end of the list.");
722 while (!IncludeSelf && isValid() && *SI == Reg);
728 #endif // LLVM_MC_MCREGISTERINFO_H bool isSuperRegisterEq(unsigned RegA, unsigned RegB) const
Returns true if RegB is a super-register of RegA or if RegB == RegA.
A common definition of LaneBitmask for use in TableGen and CodeGen.
const uint8_t *const RegSet
void operator++()
Pre-increment to move to the next position.
iterator begin() const
begin/end - Return all of the registers in this class.
This class represents lattice values for constants.
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
bool contains(unsigned Reg1, unsigned Reg2) const
contains - Return true if both registers are in this class.
const MCRegisterDesc & operator[](unsigned RegNo) const
unsigned getNumRegUnits() const
Return the number of (native) register units in the target.
unsigned getID() const
getID() - Return the register class ID number.
SI optimize exec mask operations pre RA
MCSubRegIterator(unsigned Reg, const MCRegisterInfo *MCRI, bool IncludeSelf=false)
bool isValid() const
Returns true if this iterator is not yet at the end.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
MCRegUnitMaskIterator enumerates a list of register units and their associated lane masks for Reg...
MCSuperRegIterator enumerates all super-registers of Reg.
bool contains(unsigned Reg) const
contains - Return true if the specified register is included in this register class.
regclass_iterator regclass_begin() const
bool isSubRegister(unsigned RegA, unsigned RegB) const
Returns true if RegB is a sub-register of RegA.
MCRegUnitIterator(unsigned Reg, const MCRegisterInfo *MCRI)
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.
MCRegUnitRootIterator enumerates the root registers of a register unit.
unsigned getSubRegIndex() const
Returns sub-register index of the current sub-register.
unsigned getRegister(unsigned i) const
getRegister - Return the specified register in the class.
DiffListIterator - Base iterator class that can traverse the differentially encoded register and regu...
MCRegUnitMaskIterator(unsigned Reg, const MCRegisterInfo *MCRI)
Constructs an iterator that traverses the register units and their associated LaneMasks in Reg...
MCRegisterClass - Base class of TargetRegisterClass.
unsigned getNumRegs() const
getNumRegs - Return the number of registers in this class.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
const char * getName(unsigned RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register...
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
bool isSuperRegister(unsigned RegA, unsigned RegB) const
Returns true if RegB is a super-register of RegA.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
void operator++()
Moves to the next position.
initializer< Ty > init(const Ty &Val)
unsigned operator*() const
Dereference to get the current root register.
SubRegCoveredBits - Emitted by tablegen: bit range covered by a subreg index, -1 in any being invalid...
unsigned getSubReg() const
Returns current sub-register.
Iterator that enumerates the sub-registers of a Reg and the associated sub-register indices...
void mapLLVMRegsToDwarfRegs(const DwarfLLVMRegPair *Map, unsigned Size, bool isEH)
Used to initialize LLVM register to Dwarf register number mapping.
void mapDwarfRegsToLLVMRegs(const DwarfLLVMRegPair *Map, unsigned Size, bool isEH)
Used to initialize Dwarf register to LLVM register number mapping.
const MCPhysReg * const_iterator
MCRegAliasIterator enumerates all registers aliasing Reg.
int getCopyCost() const
getCopyCost - Return the cost of copying a value between two registers in this class.
MCRegAliasIterator(unsigned Reg, const MCRegisterInfo *MCRI, bool IncludeSelf)
iterator_range< regclass_iterator > regclasses() const
std::pair< unsigned, LaneBitmask > operator*() const
Returns a (RegUnit, LaneMask) pair.
MCSubRegIterator enumerates all sub-registers of Reg.
unsigned getNumRegClasses() const
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
MCRegisterDesc - This record contains information about a particular register.
DwarfLLVMRegPair - Emitted by tablegen so Dwarf<->LLVM reg mappings can be performed with a binary se...
const char * getRegClassName(const MCRegisterClass *Class) const
MCSubRegIndexIterator(unsigned Reg, const MCRegisterInfo *MCRI)
Constructs an iterator that traverses subregisters and their associated subregister indices...
bool isSubRegisterEq(unsigned RegA, unsigned RegB) const
Returns true if RegB is a sub-register of RegA or if RegB == RegA.
const MCRegisterDesc & get(unsigned RegNo) const
Provide a get method, equivalent to [], but more useful with a pointer to this object.
bool isValid() const
Returns true if this iterator is not yet at the end.
MCSuperRegIterator(unsigned Reg, const MCRegisterInfo *MCRI, bool IncludeSelf=false)
bool isSuperOrSubRegisterEq(unsigned RegA, unsigned RegB) const
Returns true if RegB is a super-register or sub-register of RegA or if RegB == RegA.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
unsigned operator*() const
MCRegUnitRootIterator(unsigned RegUnit, const MCRegisterInfo *MCRI)
A range adaptor for a pair of iterators.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
bool operator<(DwarfLLVMRegPair RHS) const
uint16_t RegUnitLaneMasks
Index into list with lane mask sequences.
regclass_iterator regclass_end() const
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
void mapLLVMRegToCVReg(unsigned LLVMReg, int CVReg)
const uint16_t RegSetSize
unsigned getNumSubRegIndices() const
Return the number of sub-register indices understood by the target.
unsigned advance()
advance - Move to the next list position, return the applied differential.
void operator++()
Moves to the next position.
unsigned getRARegister() const
This method should return the register where the return address can be found.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getProgramCounter() const
Return the register which is the program counter.
void operator++()
Preincrement to move to the next root register.
static unsigned getDwarfRegNum(unsigned Reg, const TargetRegisterInfo *TRI)
Go up the super-register chain until we hit a valid dwarf register number.
unsigned operator*() const
Dereference the iterator to get the value at the current position.
bool isValid() const
Check if the iterator is at the end of the list.
const MCPhysReg * iterator
void mapLLVMRegToSEHReg(unsigned LLVMReg, int SEHReg)
mapLLVMRegToSEHReg - Used to initialize LLVM register to SEH register number mapping.
bool isAllocatable() const
isAllocatable - Return true if this register class may be used to create virtual registers.
void init(MCPhysReg InitVal, const MCPhysReg *DiffList)
init - Point the iterator to InitVal, decoding subsequent values from DiffList.
const MCRegisterClass & getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.