[llvm] [TableGen][GISel] Extract common function for determining MI's regclass (PR #120135)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 17:17:33 PST 2024


================
@@ -34,7 +34,7 @@ def A0  : RegisterClass<"MyTarget", [i32], 32, (add a0)>;
 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_ANYEXT),
 // CHECK-NEXT: // MIs[0] DstI[dst]
 // CHECK-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_s16,
-// CHECK-NEXT: GIM_RootCheckRegBankForClass, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::A0RegClassID),
+// CHECK-NEXT: GIM_RootCheckRegBankForClass, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::A0wRegClassID),
----------------
s-barannikov wrote:

I guess because TableGen cannot infer regbank itself.
There was an [attempt](https://github.com/llvm/llvm-project/commit/a79db96ec0decca4fe45579e039cf5589345b3ed) to do this at tablegen level, but AFAIK it doesn't cover all cases and targets still need to override `getRegBankFromRegClass` in some cases.


https://github.com/llvm/llvm-project/pull/120135


More information about the llvm-commits mailing list