[PATCH] D125276: [TableGen] Remove the use of global Record state

Chris Lattner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 23:32:30 PDT 2022


lattner accepted this revision.
lattner added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/include/llvm/TableGen/Record.h:328
 protected:
+  /// The record keeper that initialized this Init.
+  RecordKeeper &RK;
----------------
craig.topper wrote:
> Most Inits inherit from TypedInit which has a RecTy. Is possible for the TypedInits to use the RecordKeeper from the the Type? Then only UnsetInit needs an explicit RecordKeeper?
> 
> But I guess that means Init::getRecordKeeper would need to examine the `Opc` to determine where to find the RecordKeeper.
Agreed, it would be nice to use an approach like MLIR does with MLIRContext: since types have access to a MLIRContext, other things that are guaranteed to have types don't need to carry it around.  Is this possible in tblgen?

Ah it seems that init doesn't carry a type. :(


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125276/new/

https://reviews.llvm.org/D125276



More information about the llvm-commits mailing list