15 #ifndef LLVM_MC_MCREGISTERINFO_H 16 #define LLVM_MC_MCREGISTERINFO_H 69 unsigned InByte = RegNo % 8;
70 unsigned Byte = RegNo / 8;
71 if (Byte >= RegSetSize)
73 return (RegSet[Byte] & (1 << InByte)) != 0;
155 unsigned NumRegUnits;
160 const char *RegStrings;
161 const char *RegClassStrings;
166 unsigned NumSubRegIndices;
170 unsigned L2DwarfRegsSize;
171 unsigned EHL2DwarfRegsSize;
172 unsigned Dwarf2LRegsSize;
173 unsigned EHDwarf2LRegsSize;
209 assert(isValid() &&
"Cannot move off the end of the list.");
233 template <
class SubT>
236 std::forward_iterator_tag, MCPhysReg> {
246 Iter.
init(Reg, DiffList);
258 End.Iter.List =
nullptr;
263 return Iter.List == Arg.Iter.List;
268 using mc_difflist_iterator::iterator_facade_base::operator++;
270 assert(Iter.List &&
"Cannot increment the end iterator!");
297 MCRI->DiffLists + MCRI->get(Reg).SuperRegs) {}
332 return concat<const MCPhysReg>(subregs_inclusive(Reg), superregs(Reg));
354 const char *ClassStrings,
365 RegUnitMaskSequences = RUMS;
366 RegStrings = Strings;
367 RegClassStrings = ClassStrings;
369 RegUnitRoots = RURoots;
371 SubRegIndices = SubIndices;
372 NumSubRegIndices = NumIndices;
373 SubRegIdxRanges = SubIdxRanges;
374 RegEncodingTable =
RET;
377 EHL2DwarfRegs =
nullptr;
378 EHL2DwarfRegsSize = 0;
379 L2DwarfRegs =
nullptr;
381 EHDwarf2LRegs =
nullptr;
382 EHDwarf2LRegsSize = 0;
383 Dwarf2LRegs =
nullptr;
394 EHL2DwarfRegsSize =
Size;
397 L2DwarfRegsSize =
Size;
408 EHDwarf2LRegsSize =
Size;
411 Dwarf2LRegsSize =
Size;
421 L2SEHRegs[LLVMReg] = SEHReg;
425 L2CVRegs[LLVMReg] = CVReg;
441 "Attempting to access record for invalid register number!");
448 return operator[](RegNo);
469 unsigned getSubRegIdxSize(
unsigned Idx)
const;
474 unsigned getSubRegIdxOffset(
unsigned Idx)
const;
479 return RegStrings +
get(RegNo).
Name;
492 return NumSubRegIndices;
514 int getDwarfRegNumFromDwarfEHRegNum(
unsigned RegNum)
const;
522 int getCodeViewRegNum(
MCRegister RegNum)
const;
527 return make_range(regclass_begin(), regclass_end());
531 return (
unsigned)(regclass_end()-regclass_begin());
537 assert(i < getNumRegClasses() &&
"Register Class ID out of range");
542 return RegClassStrings + Class->
NameIdx;
548 "Attempting to get encoding for invalid register number!");
549 return RegEncodingTable[RegNo];
554 return isSuperRegister(RegB, RegA);
562 return isSuperRegisterEq(RegB, RegA);
568 return RegA == RegB || isSuperRegister(RegA, RegB);
574 return isSubRegisterEq(RegA, RegB) || isSuperRegister(RegA, RegB);
590 bool IncludeSelf =
false) {
608 : SRIter(Reg, MCRI) {
639 bool IncludeSelf =
false) {
677 assert(Reg &&
"Null register has no regunits");
680 unsigned Scale = RU & 15;
681 unsigned Offset = RU >> 4;
685 init(Reg * Scale, MCRI->DiffLists + Offset);
708 : RUIter(Reg, MCRI) {
710 MaskListIter = &MCRI->RegUnitMaskSequences[Idx];
715 return std::make_pair(*RUIter, *MaskListIter);
746 assert(RegUnit < MCRI->getNumRegUnits() &&
"Invalid register unit");
747 Reg0 = MCRI->RegUnitRoots[RegUnit][0];
748 Reg1 = MCRI->RegUnitRoots[RegUnit][1];
763 assert(isValid() &&
"Cannot move off the end of the list.");
785 : Reg(Reg), MCRI(MCRI), IncludeSelf(IncludeSelf) {
790 if (!(!IncludeSelf && Reg == *SI))
800 assert(SI.
isValid() &&
"Cannot dereference an invalid iterator.");
823 assert(isValid() &&
"Cannot move off the end of the list.");
825 while (!IncludeSelf && isValid() && *SI == Reg);
831 #endif // LLVM_MC_MCREGISTERINFO_H
const_iterator end(StringRef path)
Get end iterator over path.
A common definition of LaneBitmask for use in TableGen and CodeGen.
const uint8_t *const RegSet
Wrapper class representing physical registers. Should be passed by value.
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.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
mc_superreg_iterator(MCRegisterInfo::DiffListIterator Iter)
const MCRegisterDesc & operator[](MCRegister RegNo) const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
MCRegister operator*() const
Forward iterator using DiffListIterator.
MCRegister operator*() const
Dereference the iterator to get the value at the current position.
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
const MCPhysReg & operator*() const
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.
regclass_iterator regclass_begin() const
MCRegister advance()
advance - Move to the next list position, return the applied differential.
void mapLLVMRegToCVReg(MCRegister LLVMReg, int CVReg)
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.
MCRegUnitIterator(MCRegister Reg, const MCRegisterInfo *MCRI)
MCRegUnitRootIterator enumerates the root registers of a register unit.
bool contains(MCRegister Reg) const
contains - Return true if the specified register is included in this register class.
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...
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
MCRegisterClass - Base class of TargetRegisterClass.
iterator_range< mc_subreg_iterator > subregs_inclusive(MCRegister Reg) const
Return an iterator range over all sub-registers of Reg, including Reg.
Helper to store a sequence of ranges being concatenated and access them.
mc_difflist_iterator(MCRegisterInfo::DiffListIterator Iter)
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...
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
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...
MCSuperRegIterator(MCRegister Reg, const MCRegisterInfo *MCRI, bool IncludeSelf=false)
void mapLLVMRegToSEHReg(MCRegister LLVMReg, int SEHReg)
mapLLVMRegToSEHReg - Used to initialize LLVM register to SEH register number mapping.
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.
bool operator==(const mc_difflist_iterator &Arg) const
MCRegAliasIterator enumerates all registers aliasing Reg.
static SubT end()
Return an iterator past the last element.
int getCopyCost() const
getCopyCost - Return the cost of copying a value between two registers in this class.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
bool isSuperRegister(MCRegister RegA, MCRegister RegB) const
Returns true if RegB is a super-register of RegA.
bool contains(MCRegister Reg1, MCRegister Reg2) const
contains - Return true if both registers are in this class.
uint16_t getEncodingValue(MCRegister RegNo) const
Returns the encoding for RegNo.
iterator_range< regclass_iterator > regclasses() const
std::pair< unsigned, LaneBitmask > operator*() const
Returns a (RegUnit, LaneMask) pair.
mc_superreg_iterator(MCRegister Reg, const MCRegisterInfo *MCRI)
bool isSuperRegisterEq(MCRegister RegA, MCRegister RegB) const
Returns true if RegB is a super-register of RegA or if RegB == RegA.
MCSubRegIterator enumerates all sub-registers of Reg.
bool isSubRegisterEq(MCRegister RegA, MCRegister RegB) const
Returns true if RegB is a sub-register of RegA or if RegB == RegA.
MCRegAliasIterator(MCRegister Reg, const MCRegisterInfo *MCRI, bool IncludeSelf)
unsigned getNumRegClasses() const
MCSubRegIndexIterator(MCRegister Reg, const MCRegisterInfo *MCRI)
Constructs an iterator that traverses subregisters and their associated subregister indices...
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
bool isValid() const
Returns true if this iterator is not yet at the end.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
MCRegUnitRootIterator(unsigned RegUnit, const MCRegisterInfo *MCRI)
MCRegister getProgramCounter() const
Return the register which is the program counter.
bool isSubRegister(MCRegister RegA, MCRegister RegB) const
Returns true if RegB is a sub-register of RegA.
A range adaptor for a pair of iterators.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
const char * getName(MCRegister RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register...
bool operator<(DwarfLLVMRegPair RHS) const
uint16_t RegUnitLaneMasks
Index into list with lane mask sequences.
regclass_iterator regclass_end() const
iterator_range< mc_superreg_iterator > superregs(MCRegister Reg) const
Return an iterator range over all super-registers of Reg, excluding Reg.
const uint16_t RegSetSize
iterator_range< mc_superreg_iterator > superregs_inclusive(MCRegister Reg) const
Return an iterator range over all super-registers of Reg, including Reg.
MCSubRegIterator(MCRegister Reg, const MCRegisterInfo *MCRI, bool IncludeSelf=false)
unsigned getNumSubRegIndices() const
Return the number of sub-register indices understood by the target.
bool isSuperOrSubRegisterEq(MCRegister RegA, MCRegister RegB) const
Returns true if RegB is a super-register or sub-register of RegA or if RegB == RegA.
void operator++()
Moves to the next position.
const MCRegisterDesc & get(MCRegister RegNo) const
Provide a get method, equivalent to [], but more useful with a pointer to this object.
iterator_range< mc_subreg_iterator > subregs(MCRegister Reg) const
Return an iterator range over all sub-registers of Reg, excluding Reg.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
mc_subreg_iterator(MCRegisterInfo::DiffListIterator Iter)
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.
MCRegister getSubReg() const
Returns current sub-register.
bool isValid() const
Check if the iterator is at the end of the list.
detail::concat_range< const MCPhysReg, iterator_range< mc_subreg_iterator >, iterator_range< mc_superreg_iterator > > sub_and_superregs_inclusive(MCRegister Reg) const
Return an iterator range over all sub- and super-registers of Reg, including Reg. ...
MCRegister getRARegister() const
This method should return the register where the return address can be found.
Forward iterator over all sub-registers.
MCRegUnitMaskIterator(MCRegister Reg, const MCRegisterInfo *MCRI)
Constructs an iterator that traverses the register units and their associated LaneMasks in Reg...
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.
mc_difflist_iterator(MCRegister Reg, const MCPhysReg *DiffList)
Forward iterator over all super-registers.
const MCRegisterClass & getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
mc_subreg_iterator(MCRegister Reg, const MCRegisterInfo *MCRI)