45 #ifndef __CPU__REG_CLASS_HH__ 46 #define __CPU__REG_CLASS_HH__ 52 #include "arch/registers.hh" 53 #include "config/the_isa.hh" 97 : regClass(reg_class), regIdx(reg_idx), elemIdx(elem_idx),
101 "Creating vector physical index w/o element index");
104 "Creating non-vector physical index w/ element index");
114 return !(*
this==that);
123 regIdx < that.
index() ||
198 panic(
"Trying to flatten a register without class!");
237 numPinnedWritesToComplete(0)
243 :
RegId(_regClass, _regIdx), flatIdx(_flatIdx),
244 numPinnedWritesToComplete(0), pinned(false)
250 :
RegId(_regClass, _regIdx, elem_idx), flatIdx(flat_idx),
251 numPinnedWritesToComplete(0), pinned(false)
329 pinned = (numWrites != 0);
340 return numPinnedWritesToComplete;
345 numPinnedWritesToComplete = numWrites;
362 const size_t flat_index =
static_cast<size_t>(reg_id.
flatIndex());
363 const size_t class_num =
static_cast<size_t>(reg_id.
regClass);
365 const size_t shifted_class_num = class_num << (
sizeof(
RegIndex) << 3);
369 const size_t concatenated_hash = flat_index | shifted_class_num;
374 static_assert(
sizeof(
RegIndex) <
sizeof(
size_t),
375 "sizeof(RegIndex) should be less than sizeof(size_t)");
377 return concatenated_hash;
382 #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.
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.
constexpr unsigned NumVecElemPerVecReg
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.