26class MCRegAliasIteratorImpl {
29 const MCRegisterInfo *MCRI;
32 MCRegUnitRootIterator RRI;
33 MCSuperRegIterator SI;
36 MCRegAliasIteratorImpl(MCRegister Reg,
const MCRegisterInfo *MCRI)
37 : Reg(Reg), MCRI(MCRI) {
40 for (RI = MCRegUnitIterator(Reg, MCRI); RI.isValid(); ++RI) {
41 for (RRI = MCRegUnitRootIterator(*RI, MCRI); RRI.isValid(); ++RRI) {
42 for (SI = MCSuperRegIterator(*RRI, MCRI,
true); SI.isValid(); ++SI) {
50 bool isValid()
const {
return RI.isValid(); }
53 assert(SI.isValid() &&
"Cannot dereference an invalid iterator.");
65 SI = MCSuperRegIterator(*RRI, MCRI,
true);
71 RRI = MCRegUnitRootIterator(*RI, MCRI);
72 SI = MCSuperRegIterator(*RRI, MCRI,
true);
76 MCRegAliasIteratorImpl &operator++() {
80 while (
isValid() && *SI == Reg);
87 auto &Aliases = RegAliasesCache[
R.id()];
91 for (MCRegAliasIteratorImpl It(R,
this); It.isValid(); ++It)
92 Aliases.push_back(*It);
95 Aliases.erase(
unique(Aliases), Aliases.end());
97 "MCRegAliasIteratorImpl includes Self!");
102 Aliases.push_back(
R.id());
103 Aliases.shrink_to_fit();
118 "This is not a subregister index");
146 unsigned Size = isEH ? EHL2DwarfRegsSize : L2DwarfRegsSize;
152 if (
I == M+
Size ||
I->FromReg != RegNum)
158 return int64_t(
int(
I->ToReg));
164 unsigned Size = isEH ? EHDwarf2LRegsSize : Dwarf2LRegsSize;
170 if (
I != M +
Size &&
I->FromReg == RegNum)
184 if (std::optional<MCRegister> LRegNum =
getLLVMRegNum(RegNum,
true)) {
186 if (DwarfRegNum == -1)
196 if (
I == L2SEHRegs.end())
return (
int)RegNum;
201 if (L2CVRegs.empty())
204 if (
I == L2CVRegs.end())
220 }
while (*IA < *IB ? ++IA != EA : ++IB != EB);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the DenseMap class.
static bool isValid(const char C)
Returns true if C is a valid mangled character: <0-9a-zA-Z_>.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT, true > const_iterator
MCRegisterClass - Base class of TargetRegisterClass.
bool contains(MCRegister Reg) const
contains - Return true if the specified register is included in this register class.
unsigned getNumSubRegIndices() const
Return the number of sub-register indices understood by the target.
bool regsOverlap(MCRegister RegA, MCRegister RegB) const
Returns true if the two registers are equal or alias each other.
const MCRegisterDesc & get(MCRegister Reg) const
Provide a get method, equivalent to [], but more useful with a pointer to this object.
MCRegister getMatchingSuperReg(MCRegister 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.
int getCodeViewRegNum(MCRegister RegNum) const
Map a target register to an equivalent CodeView register number.
int64_t getDwarfRegNumFromDwarfEHRegNum(uint64_t RegNum) const
Map a target EH register number to an equivalent DWARF register number.
int getSEHRegNum(MCRegister RegNum) const
Map a target register to an equivalent SEH register number.
iterator_range< MCSuperRegIterator > superregs(MCRegister Reg) const
Return an iterator range over all super-registers of Reg, excluding Reg.
const char * getName(MCRegister RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register.
virtual int64_t getDwarfRegNum(MCRegister RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number.
friend class MCRegUnitRootIterator
bool isArtificialRegUnit(MCRegUnit Unit) const
Returns true when the given register unit is considered artificial.
iterator_range< MCSubRegIterator > subregs(MCRegister Reg) const
Return an iterator range over all sub-registers of Reg, excluding Reg.
unsigned getSubRegIndex(MCRegister RegNo, MCRegister SubRegNo) const
For a given register pair, return the sub-register index if the second register is a sub-register of ...
iterator_range< MCRegUnitIterator > regunits(MCRegister Reg) const
Returns an iterator range over all regunits for Reg.
bool isArtificial(MCRegister RegNo) const
Returns true if the given register is artificial, which means it represents a regunit that is not sep...
friend class MCRegUnitIterator
std::optional< MCRegister > getLLVMRegNum(uint64_t RegNum, bool isEH) const
Map a dwarf register back to a target register.
MCRegister getSubReg(MCRegister Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
Wrapper class representing physical registers. Should be passed by value.
static MCRegister from(unsigned Val)
Check the provided unsigned value is a valid MCRegister.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This is an optimization pass for GlobalISel generic memory operations.
APInt operator*(APInt a, uint64_t RHS)
auto unique(Range &&R, Predicate P)
void sort(IteratorTy Start, IteratorTy End)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
@ Sub
Subtraction of integers.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
DwarfLLVMRegPair - Emitted by tablegen so Dwarf<->LLVM reg mappings can be performed with a binary se...