41 #ifndef __CPU__REG_CLASS_HH__ 42 #define __CPU__REG_CLASS_HH__ 48 #include "arch/registers.hh" 49 #include "config/the_isa.hh" 93 : regClass(reg_class), regIdx(reg_idx), elemIdx(elem_idx),
97 "Creating vector physical index w/o element index");
100 "Creating non-vector physical index w/ element index");
110 return !(*
this==that);
119 regIdx < that.
index() ||
192 panic(
"Trying to flatten a register without class!");
231 numPinnedWritesToComplete(0)
237 :
RegId(_regClass, _regIdx), flatIdx(_flatIdx),
238 numPinnedWritesToComplete(0), pinned(false)
244 :
RegId(_regClass, _regIdx, elem_idx), flatIdx(flat_idx),
245 numPinnedWritesToComplete(0), pinned(false)
323 pinned = (numWrites != 0);
334 return numPinnedWritesToComplete;
339 numPinnedWritesToComplete = numWrites;
356 const size_t flat_index =
static_cast<size_t>(reg_id.
flatIndex());
357 const size_t class_num =
static_cast<size_t>(reg_id.
regClass);
359 const size_t shifted_class_num = class_num << (
sizeof(
RegIndex) << 3);
363 const size_t concatenated_hash = flat_index | shifted_class_num;
368 static_assert(
sizeof(
RegIndex) <
sizeof(
size_t),
369 "sizeof(RegIndex) should be less than sizeof(size_t)");
371 return concatenated_hash;
376 #endif // __CPU__REG_CLASS_HH__ bool operator!=(const RegId &that) const
#define panic(...)
This implements a cprintf based panic() function.
int getNumPinnedWrites() const
int getNumPinnedWritesToComplete() const
bool isMiscReg() const
true if it is a condition-code physical register.
void setNumPinnedWrites(int numWrites)
bool isCCPhysReg() const
true if it is a condition-code physical register.
RegId(RegClass reg_class, RegIndex reg_idx)
bool isVectorPhysReg() const
true if it is a vector physical register.
void setNumPinnedWritesToComplete(int numWrites)
RegClass
Enumerate the classes of registers.
constexpr unsigned NumVecElemPerVecReg
Overload hash function for BasicBlockRange type.
bool operator<(const PhysRegId &that) const
Explicit forward methods, to prevent comparisons of PhysRegId with RegIds.
RegId(RegClass reg_class, RegIndex reg_idx, ElemIndex elem_idx)
PhysRegId(RegClass _regClass, PhysRegIndex _regIdx, ElemIndex elem_idx, PhysRegIndex flat_idx)
Vector PhysRegId constructor (w/ elemIndex).
static const char * regClassStrings[]
const int NumRegClasses
Number of register classes.
void decrNumPinnedWritesToComplete()
static constexpr size_t Scale
int numPinnedWritesToComplete
void setNumPinnedWrites(int num_writes)
void incrNumPinnedWrites()
bool isCCReg() const
true if it is a condition-code physical register.
bool isVecElem() const
true if it is a condition-code physical register.
void incrNumPinnedWritesToComplete()
const RegIndex & elemIndex() const
Elem accessor.
bool isVecPredPhysReg() const
Vector Register Native Elem lane.
bool isMiscPhysReg() const
true if it is a condition-code physical register.
bool isRenameable()
Return true if this register can be renamed.
size_t operator()(const RegId ®_id) const
short int PhysRegIndex
Physical register index type.
bool operator==(const PhysRegId &that) const
int getNumPinnedWrites() const
bool isFloatPhysReg() const
bool isVecReg() const
true if it is a condition-code physical register.
void decrNumPinnedWrites()
bool isIntPhysReg() const
bool operator!=(const PhysRegId &that) const
const PhysRegIndex & flatIndex() const
Flat index accessor.
friend std::ostream & operator<<(std::ostream &os, const RegId &rid)
static PhysRegId elemId(PhysRegId *vid, ElemIndex elem)
uint16_t ElemIndex
Logical vector register elem index type.
const RegClass & classValue() const
Class accessor.
RegIndex flatIndex() const
Index flattening.
const RegIndex & index() const
Index accessors.
Register ID: describe an architectural register with its class and index.
bool operator<(const RegId &that) const
Order operator.
bool isVecPredReg() const
true if it is a predicate physical register.
bool isRenameable() const
Return true if this register can be renamed.
bool isVectorPhysElem() const
true if it is a vector element physical register.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
bool isFixedMapping() const
Returns true if this register is always associated to the same architectural register.
PhysRegId(RegClass _regClass, PhysRegIndex _regIdx, PhysRegIndex _flatIdx)
Scalar PhysRegId constructor.
bool isZeroReg() const
Check if this is the zero register.
const char * className() const
Return a const char* with the register class name.
bool operator==(const RegId &that) const
#define ILLEGAL_ELEM_INDEX
ElemIndex value that indicates that the register is not a vector.