36 RegInfo &RI = RegInfos[R];
37 if (RI.RegClass !=
nullptr && !BadRC[R]) {
38 if (RC->LaneMask != RI.RegClass->LaneMask) {
40 RI.RegClass =
nullptr;
50 if (UnitInfos[U].
Reg != 0)
61 std::pair<uint32_t, LaneBitmask>
P = *
I;
62 UnitInfo &UI = UnitInfos[
P.first];
77 MaskInfos.resize(RegMasks.
size() + 1);
78 for (
uint32_t M = 1, NM = RegMasks.
size(); M <= NM; ++M) {
82 if (!(MB[
I / 32] & (1u << (
I % 32))))
87 MaskInfos[M].Units = PU.
flip();
96 AliasInfos[U].Regs = AS;
106 std::set<RegisterId> AS;
111 for (
unsigned i = 1, e = TRI.
getNumRegs(); i != e; ++i) {
112 if (MB[i / 32] & (1u << (i % 32)))
127 std::set<RegisterId> Units;
137 if ((M & RR.
Mask).any())
146 for (
unsigned I = 0,
E = (NumRegs + 31) / 32;
I !=
E; ++
I) {
149 C &= maskLeadingOnes<unsigned>(31);
150 if (
I + 1 ==
E && NumRegs % 32 != 0)
151 C &= maskTrailingOnes<unsigned>(NumRegs % 32);
156 unsigned CR = 32 *
I +
T;
171 const RegInfo &RI = RegInfos[R];
181 if (!
A.isReg() || !
B.isReg()) {
183 return A.Reg ==
B.Reg;
187 return A.Mask ==
B.Mask;
193 auto [AReg, AMask] = *AI;
194 auto [BReg, BMask] = *BI;
198 if ((AMask &
A.Mask).any() && (BMask &
B.Mask).any()) {
207 if ((AMask &
A.Mask).none())
209 if ((BMask &
B.Mask).none())
213 return static_cast<int>(AI.
isValid()) ==
static_cast<int>(BI.
isValid());
217 if (!
A.isReg() || !
B.isReg()) {
219 return A.Reg <
B.Reg;
223 return A.Mask <
B.Mask;
224 if (
A.Mask ==
B.Mask)
225 return A.Reg <
B.Reg;
231 auto [AReg, AMask] = *AI;
232 auto [BReg, BMask] = *BI;
236 if ((AMask &
A.Mask).any() && (BMask &
B.Mask).any()) {
245 if ((AMask &
A.Mask).none())
247 if ((BMask &
B.Mask).none())
251 return static_cast<int>(AI.
isValid()) <
static_cast<int>(BI.
isValid());
255 if (
A.Reg == 0 ||
A.isReg()) {
261 }
else if (
A.isUnit()) {
267 const char *Fmt =
Idx < 0x10000 ?
"%04x" :
"%08x";
274 for (
unsigned U :
A.units())
284 std::pair<uint32_t, LaneBitmask>
P = *U;
285 if ((
P.second & RR.
Mask).any())
286 if (Units.
test(
P.first))
295 return T.reset(Units).none();
299 std::pair<uint32_t, LaneBitmask>
P = *U;
300 if ((
P.second & RR.
Mask).any())
301 if (!Units.
test(
P.first))
314 std::pair<uint32_t, LaneBitmask>
P = *U;
315 if ((
P.second & RR.
Mask).any())
340 Units.
reset(RG.Units);
346 T.insert(RR).intersect(*
this);
387 std::pair<uint32_t, LaneBitmask>
P = *
I;
388 if (Units.
test(
P.first))
398 Masks[R.Reg] |= R.Mask;
400 Pos =
End ? Masks.end() : Masks.begin();
401 Index =
End ? Masks.size() : 0;
405 A.getPRI().print(
OS,
A);
413 return OS <<
":*none*";
416 if ((Val & 0xffff) == Val)
417 return OS <<
':' <<
format(
"%04llX", Val);
418 if ((Val & 0xffffffff) == Val)
419 return OS <<
':' <<
format(
"%08llX", Val);
This file implements the BitVector class.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
A common definition of LaneBitmask for use in TableGen and CodeGen.
unsigned const TargetRegisterInfo * TRI
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SI optimize exec mask operations pre RA
bool test(unsigned Idx) const
int find_first() const
find_first - Returns the index of the first set bit, -1 if none of the bits are set.
bool anyCommon(const BitVector &RHS) const
Test if any common bits are set.
int find_next(unsigned Prev) const
find_next - Returns the index of the next set bit following the "Prev" bit.
This class represents an Operation in the Expression.
MCRegAliasIterator enumerates all registers aliasing Reg.
MCRegUnitMaskIterator enumerates a list of register units and their associated lane masks for Reg.
bool isValid() const
Returns true if this iterator is not yet at the end.
MCRegUnitRootIterator enumerates the root registers of a register unit.
unsigned getNumRegUnits() const
Return the number of (native) register units in the target.
const char * getName(MCRegister RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register.
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.
iterator_range< MCSuperRegIterator > superregs_inclusive(MCRegister Reg) const
Return an iterator range over all super-registers of Reg, including Reg.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
static MCRegister from(unsigned Val)
Check the provided unsigned value is a valid MCRegister.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
static int stackSlot2Index(Register Reg)
Compute the frame index from a register value representing a stack slot.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
iterator_range< regclass_iterator > regclasses() const
virtual ArrayRef< const uint32_t * > getRegMasks() const =0
Return all the call-preserved register masks defined for this target.
LaneBitmask reverseComposeSubRegIndexLaneMask(unsigned IdxA, LaneBitmask LaneMask) const
Transform a lanemask given for a virtual register to the corresponding lanemask before using subregis...
LaneBitmask composeSubRegIndexLaneMask(unsigned IdxA, LaneBitmask Mask) const
Transforms a LaneMask computed for one subregister to the lanemask that would have been computed when...
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
raw_ostream & operator<<(raw_ostream &OS, const Print< RegisterRef > &P)
bool disjoint(const std::set< T > &A, const std::set< T > &B)
Printable printRegUnit(unsigned Unit, const TargetRegisterInfo *TRI)
Create Printable object to print register units on a raw_ostream.
Printable PrintLaneMask(LaneBitmask LaneMask)
Create Printable object to print LaneBitmasks on a raw_ostream.
int countr_zero(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
static constexpr LaneBitmask getAll()
constexpr bool none() const
T get(uint32_t Idx) const
const BitVector & getMaskUnits(RegisterId MaskId) const
PhysicalRegisterInfo(const TargetRegisterInfo &tri, const MachineFunction &mf)
void print(raw_ostream &OS, RegisterRef A) const
const TargetRegisterInfo & getTRI() const
const uint32_t * getRegMaskBits(RegisterId R) const
std::set< RegisterId > getAliasSet(RegisterId Reg) const
const BitVector & getUnitAliases(uint32_t U) const
bool equal_to(RegisterRef A, RegisterRef B) const
bool alias(RegisterRef RA, RegisterRef RB) const
RegisterRef mapTo(RegisterRef RR, unsigned R) const
bool less(RegisterRef A, RegisterRef B) const
std::set< RegisterId > getUnits(RegisterRef RR) const
RegisterRef getRefForUnit(uint32_t U) const
ref_iterator(const RegisterAggr &RG, bool End)
RegisterAggr & insert(RegisterRef RR)
RegisterRef clearIn(RegisterRef RR) const
RegisterAggr & clear(RegisterRef RR)
RegisterRef makeRegRef() const
RegisterAggr & intersect(RegisterRef RR)
bool hasAliasOf(RegisterRef RR) const
RegisterRef intersectWith(RegisterRef RR) const
bool hasCoverOf(RegisterRef RR) const
constexpr unsigned idx() const
constexpr bool isReg() const
constexpr bool isMask() const
static constexpr bool isMaskId(unsigned Id)
static constexpr bool isRegId(unsigned Id)
static constexpr bool isUnitId(unsigned Id)