16 #ifndef LLVM_MC_MCREGISTERINFO_H 17 #define LLVM_MC_MCREGISTERINFO_H 71 unsigned InByte = Reg % 8;
72 unsigned Byte = Reg / 8;
73 if (Byte >= RegSetSize)
75 return (RegSet[Byte] & (1 << InByte)) != 0;
79 bool contains(
unsigned Reg1,
unsigned Reg2)
const {
162 unsigned NumRegUnits;
167 const char *RegStrings;
168 const char *RegClassStrings;
169 const uint16_t *SubRegIndices;
173 unsigned NumSubRegIndices;
174 const uint16_t *RegEncodingTable;
177 unsigned L2DwarfRegsSize;
178 unsigned EHL2DwarfRegsSize;
179 unsigned Dwarf2LRegsSize;
180 unsigned EHDwarf2LRegsSize;
213 assert(isValid() &&
"Cannot move off the end of the list.");
253 const char *ClassStrings,
254 const uint16_t *SubIndices,
257 const uint16_t *
RET) {
264 RegUnitMaskSequences = RUMS;
265 RegStrings = Strings;
266 RegClassStrings = ClassStrings;
268 RegUnitRoots = RURoots;
270 SubRegIndices = SubIndices;
271 NumSubRegIndices = NumIndices;
272 SubRegIdxRanges = SubIdxRanges;
273 RegEncodingTable =
RET;
276 EHL2DwarfRegs =
nullptr;
277 EHL2DwarfRegsSize = 0;
278 L2DwarfRegs =
nullptr;
280 EHDwarf2LRegs =
nullptr;
281 EHDwarf2LRegsSize = 0;
282 Dwarf2LRegs =
nullptr;
293 EHL2DwarfRegsSize =
Size;
296 L2DwarfRegsSize =
Size;
307 EHDwarf2LRegsSize =
Size;
310 Dwarf2LRegsSize =
Size;
320 L2SEHRegs[LLVMReg] = SEHReg;
324 L2CVRegs[LLVMReg] = CVReg;
340 "Attempting to access record for invalid register number!");
347 return operator[](RegNo);
353 unsigned getSubReg(
unsigned Reg,
unsigned Idx)
const;
357 unsigned getMatchingSuperReg(
unsigned Reg,
unsigned SubIdx,
363 unsigned getSubRegIndex(
unsigned RegNo,
unsigned SubRegNo)
const;
368 unsigned getSubRegIdxSize(
unsigned Idx)
const;
373 unsigned getSubRegIdxOffset(
unsigned Idx)
const;
378 return RegStrings +
get(RegNo).
Name;
391 return NumSubRegIndices;
408 int getLLVMRegNum(
unsigned RegNum,
bool isEH)
const;
413 int getLLVMRegNumFromEH(
unsigned RegNum)
const;
417 int getDwarfRegNumFromDwarfEHRegNum(
unsigned RegNum)
const;
421 int getSEHRegNum(
unsigned RegNum)
const;
425 int getCodeViewRegNum(
unsigned RegNum)
const;
430 return make_range(regclass_begin(), regclass_end());
434 return (
unsigned)(regclass_end()-regclass_begin());
440 assert(i < getNumRegClasses() &&
"Register Class ID out of range");
445 return RegClassStrings + Class->
NameIdx;
451 "Attempting to get encoding for invalid register number!");
452 return RegEncodingTable[RegNo];
457 return isSuperRegister(RegB, RegA);
461 bool isSuperRegister(
unsigned RegA,
unsigned RegB)
const;
465 return isSuperRegisterEq(RegB, RegA);
471 return RegA == RegB || isSuperRegister(RegA, RegB);
477 return isSubRegisterEq(RegA, RegB) || isSuperRegister(RegA, RegB);
493 bool IncludeSelf =
false) {
505 const uint16_t *SRIndex;
511 : SRIter(Reg, MCRI) {
542 bool IncludeSelf =
false) {
580 assert(Reg &&
"Null register has no regunits");
583 unsigned Scale = RU & 15;
584 unsigned Offset = RU >> 4;
588 init(Reg * Scale, MCRI->DiffLists + Offset);
611 : RUIter(Reg, MCRI) {
613 MaskListIter = &MCRI->RegUnitMaskSequences[Idx];
618 return std::make_pair(*RUIter, *MaskListIter);
649 assert(RegUnit < MCRI->getNumRegUnits() &&
"Invalid register unit");
650 Reg0 = MCRI->RegUnitRoots[RegUnit][0];
651 Reg1 = MCRI->RegUnitRoots[RegUnit][1];
666 assert(isValid() &&
"Cannot move off the end of the list.");
688 : Reg(Reg), MCRI(MCRI), IncludeSelf(IncludeSelf) {
693 if (!(!IncludeSelf && Reg == *SI))
703 assert(SI.
isValid() &&
"Cannot dereference an invalid iterator.");
726 assert(isValid() &&
"Cannot move off the end of the list.");
728 while (!IncludeSelf && isValid() && *SI == Reg);
734 #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.
Compute iterated dominance frontiers using a linear time algorithm.
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.
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.
unsigned getSize() const
Temporary function to allow out-of-tree targets to switch.
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.
const uint16_t PhysRegSize
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.
unsigned getPhysRegSize() const
Return the size of the physical register in bytes.
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())
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
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.