diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-09 12:24:42 +0000 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-09 12:24:42 +0000 |
commit | fcd6525a4516f0a4d83fd8dcaee25c81ac2c14cd (patch) | |
tree | 911a9e9413187f6d3c6c62d0aeba37d78d757f9e /llvm/docs/TableGen | |
parent | 8aa9d5839dbb4d457616a935eb2167ceb0087dfa (diff) | |
download | bcm5719-llvm-fcd6525a4516f0a4d83fd8dcaee25c81ac2c14cd.tar.gz bcm5719-llvm-fcd6525a4516f0a4d83fd8dcaee25c81ac2c14cd.zip |
TableGen: Add a defset statement
Allows capturing a list of concrete instantiated defs.
This can be combined with foreach to create parallel sets of def
instantiations with less repetition in the source. This purpose is
largely also served by multiclasses, but in some cases multiclasses
can't be used.
The motivating example for this change is having a large set of
intrinsics, which are generated from the IntrinsicsBackend.td file
included by Intrinsics.td, and a corresponding set of instruction
selection patterns, which are generated via the backend's .td files.
Multiclasses cannot be used to eliminate the redundancy in this case,
because a multiclass cannot span both LLVM's common .td files and
the backend .td files at the same time.
Change-Id: I879e35042dceea542a5e6776fad23c5e0e69e76b
Differential revision: https://reviews.llvm.org/D44109
llvm-svn: 327121
Diffstat (limited to 'llvm/docs/TableGen')
-rw-r--r-- | llvm/docs/TableGen/LangRef.rst | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/docs/TableGen/LangRef.rst b/llvm/docs/TableGen/LangRef.rst index 702b40c9011..99bcad757fc 100644 --- a/llvm/docs/TableGen/LangRef.rst +++ b/llvm/docs/TableGen/LangRef.rst @@ -116,7 +116,8 @@ TableGen's top-level production consists of "objects". .. productionlist:: TableGenFile: `Object`* - Object: `Class` | `Def` | `Defm` | `Let` | `MultiClass` | `Foreach` + Object: `Class` | `Def` | `Defm` | `Defset` | `Let` | `MultiClass` | + `Foreach` ``class``\es ------------ @@ -356,6 +357,21 @@ a ``foreach``. Note that in the :token:`BaseClassList`, all of the ``multiclass``'s must precede any ``class``'s that appear. +``defset`` +---------- +.. productionlist:: + Defset: "defset" `Type` `TokIdentifier` "=" "{" `Object`* "}" + +All records defined inside the braces via ``def`` and ``defm`` are collected +in a globally accessible list of the given name (in addition to being added +to the global collection of records as usual). Anonymous records created inside +initializier expressions using the ``Class<args...>`` syntax are never collected +in a defset. + +The given type must be ``list<A>``, where ``A`` is some class. It is an error +to define a record (via ``def`` or ``defm``) inside the braces which doesn't +derive from ``A``. + ``foreach`` ----------- |