[llvm] CodeGen: Keep reference to TargetRegisterInfo in TargetInstrInfo (PR #158224)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 14 20:02:48 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:
> I was trying to make it so targets would be forced to use the local reference in their own code
I read it as "targets have their own copy of the reference in derived classes".
> I would hate it if we have to `getRegisterInfo<MyRegisterInfo>()` in every place we need to access TRI from inside TII methods.
On second thought, it might not be that bad. We already have `getSubtarget<MySubtarget>()`, and those who don't like verbosity can have a typed reference in derived class members.
https://github.com/llvm/llvm-project/pull/158224
More information about the llvm-commits
mailing list