15 #include "llvm/Config/llvm-config.h" 17 #define DEBUG_TYPE "registerbank" 21 const unsigned RegisterBank::InvalidID = UINT_MAX;
25 const uint32_t *CoveredClasses,
unsigned NumRegClasses)
26 : ID(ID), Name(Name), Size(Size) {
27 ContainedRegClasses.
resize(NumRegClasses);
44 for (
unsigned SubRCId = 0; SubRCId != End; ++SubRCId) {
53 "Size is not big enough for all the subclasses!");
54 assert(
covers(SubRC) &&
"Not all subclasses are covered");
62 return ContainedRegClasses.
test(RC.
getID());
66 return ID != InvalidID && Name !=
nullptr && Size != 0 &&
68 !ContainedRegClasses.
empty();
76 "ID does not uniquely identify a RegisterBank");
77 return &OtherRB ==
this;
80 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 91 OS <<
"(ID:" <<
getID() <<
", Size:" <<
getSize() <<
")\n" 92 <<
"isValid:" <<
isValid() <<
'\n' 93 <<
"Number of Covered register classes: " << ContainedRegClasses.
count()
97 if (!TRI || ContainedRegClasses.
empty())
100 "TRI does not match the initialization process?");
102 OS <<
"Covered register classes:\n";
103 for (
unsigned RCId = 0, End = TRI->
getNumRegClasses(); RCId != End; ++RCId) {
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
This class represents lattice values for constants.
bool empty() const
empty - Tests whether there are no bits in this bitvector.
const char * getName() const
Get a user friendly name of this register bank.
bool test(unsigned Idx) const
unsigned const TargetRegisterInfo * TRI
void print(raw_ostream &OS, bool IsForDebug=false, const TargetRegisterInfo *TRI=nullptr) const
Print the register mask on OS.
const TargetRegisterClass * getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
bool covers(const TargetRegisterClass &RC) const
Check whether this register bank covers RC.
const char * getRegClassName(const TargetRegisterClass *Class) const
Returns the name of the register class.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
unsigned getID() const
Return the register class ID number.
unsigned getNumRegClasses() const
RegisterBank(unsigned ID, const char *Name, unsigned Size, const uint32_t *CoveredClasses, unsigned NumRegClasses)
bool operator==(const RegisterBank &OtherRB) const
Check whether OtherRB is the same as this.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
bool hasSubClassEq(const TargetRegisterClass *RC) const
Returns true if RC is a sub-class of or equal to this class.
size_type count() const
count - Returns the number of bits which are set.
bool isValid() const
Check whether this instance is ready to be used.
void dump(const TargetRegisterInfo *TRI=nullptr) const
Dump the register mask on dbgs() stream.
This class implements the register bank concept.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
size_type size() const
size - Returns the number of bits in this bitvector.
bool verify(const TargetRegisterInfo &TRI) const
Check if this register bank is valid.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getSize() const
Get the maximal size in bits that fits in this register bank.
This class implements an extremely fast bulk output stream that can only output to a stream...
unsigned getRegSizeInBits(const TargetRegisterClass &RC) const
Return the size in bits of a register from class RC.
void setBitsInMask(const uint32_t *Mask, unsigned MaskWords=~0u)
setBitsInMask - Add '1' bits from Mask to this vector.
unsigned getID() const
Get the identifier of this register bank.