[llvm] CodeGen: Keep reference to TargetRegisterInfo in TargetInstrInfo (PR #158224)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 04:07:36 PDT 2025


================
@@ -1070,8 +1070,8 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
   OS << "namespace llvm {\n";
   OS << "struct " << ClassName << " : public TargetInstrInfo {\n"
      << "  explicit " << ClassName
-     << "(const TargetSubtargetInfo &STI, unsigned CFSetupOpcode = ~0u, "
-        "unsigned CFDestroyOpcode = ~0u, "
+     << "(const TargetSubtargetInfo &STI, const TargetRegisterInfo &TRI, "
----------------
s-barannikov wrote:

IIUC If the local reference/instance is of the derived type, cast is unnecessary? I would hate it if we have to `getRegisterInfo<MyRegisterInfo>()` in every place we need to access TRI from inside TII methods.
Or did you mean something else?

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


More information about the llvm-commits mailing list