[llvm] [MC] Improve documentation of MCRegister. Lower physical register id to 28 bits. (PR #187150)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 18 16:17:03 PDT 2026
================
@@ -37,29 +37,40 @@ struct MCRegUnitToIndex {
}
};
-/// Wrapper class representing physical registers. Should be passed by value.
+/// Wrapper class representing physical registers and target specific virtual
+// registers. Should be passed by value.
class MCRegister {
friend hash_code hash_value(const MCRegister &);
unsigned Reg;
public:
- constexpr MCRegister(unsigned Val = 0) : Reg(Val) {}
+ constexpr MCRegister(unsigned Val = 0) : Reg(Val) {
+ // N.B. this does not assert `Val == NoRegister || `isPhysicalRegister(Val)`
+ // to avoid paying the compilation/runtime cost for developers of the
+ // compiler and to allow target specific virtual registers.
----------------
topperc wrote:
I've considered adding a second optional bool argument to the constructor the allows opting into target virtual registers. An assert could check that flag. This is assuming that the entry points for virtual register into MCRegister is in a limited number of places.
https://github.com/llvm/llvm-project/pull/187150
More information about the llvm-commits
mailing list