[PATCH] D44109: TableGen: Add a defset statement

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 13:07:11 PST 2018


tra added inline comments.


================
Comment at: docs/TableGen/LangRef.rst:360-368
+``defset``
+----------
+.. productionlist::
+   Defset: "defset" `Type` `TokIdentifier` "=" "{" `Object`* "}"
+
+All records inside the braces are defined normally, and are additionally
+collected in a globally accessible list of the given name. The given type
----------------
Does it mean that instantiating any record that is not of type A will be an error? That sounds rather limiting.
That would prevent use of anonymous records or non-anonymous records or different types we may want to instantiate within the same multiclass hierarchy without having to duplicate all of it.

Could we change the semantics to `the list collects all instantiated records of type A` and, maybe, allow more than one pair of type:list , so we can collect multiple record types?

Another approach would be to say -- give me all records of type A, created by this defm instance. I.e. instead of `defset A foo = { records }` you do something like `defm FOO : M<...>; list<A> foo = !defset(FOO)`. 



Repository:
  rL LLVM

https://reviews.llvm.org/D44109





More information about the llvm-commits mailing list