[llvm] CodeGen: Add RegisterClass by HwMode (PR #158269)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 19 02:41:39 PDT 2025
================
@@ -43,22 +43,48 @@ class MCInstrInfo {
const ComplexDeprecationPredicate *ComplexDeprecationInfos;
unsigned NumOpcodes; // Number of entries in the desc array
+protected:
+ // Pointer to 2d array [NumHwModes][NumRegClassByHwModes]
+ const int16_t *RegClassByHwModeTables;
+ int16_t NumRegClassByHwModes;
+
public:
/// Initialize MCInstrInfo, called by TableGen auto-generated routines.
/// *DO NOT USE*.
void InitMCInstrInfo(const MCInstrDesc *D, const unsigned *NI, const char *ND,
const uint8_t *DF,
- const ComplexDeprecationPredicate *CDI, unsigned NO) {
+ const ComplexDeprecationPredicate *CDI, unsigned NO,
+ const int16_t *RCHWTables = nullptr,
+ int16_t NumRegClassByHwMode = 0) {
LastDesc = D + NO - 1;
InstrNameIndices = NI;
InstrNameData = ND;
DeprecatedFeatures = DF;
ComplexDeprecationInfos = CDI;
NumOpcodes = NO;
+ RegClassByHwModeTables = RCHWTables;
+ NumRegClassByHwModes = NumRegClassByHwMode;
}
unsigned getNumOpcodes() const { return NumOpcodes; }
+ const int16_t *getRegClassByHwModeTable(unsigned ModeId) const {
+ assert(RegClassByHwModeTables && NumRegClassByHwModes != 0 &&
+ "MCInstrInfo not properly initialized");
----------------
arsenm wrote:
```suggestion
assert(RegClassByHwModeTables && NumRegClassByHwModes != 0 &&
"MCInstrInfo not properly initialized");
```
https://github.com/llvm/llvm-project/pull/158269
More information about the llvm-commits
mailing list