diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-05 15:21:04 +0000 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-05 15:21:04 +0000 |
commit | 8ebf7e4dfa222ae04e063f1c1e0bb5c945331ac7 (patch) | |
tree | e2e97ea9e1484e355a5569bca9534813c4dee71e /llvm/docs/TableGen | |
parent | 0b0eaf7ee2bc86108ae0628cb4fbdb5e52c25cfb (diff) | |
download | bcm5719-llvm-8ebf7e4dfa222ae04e063f1c1e0bb5c945331ac7.tar.gz bcm5719-llvm-8ebf7e4dfa222ae04e063f1c1e0bb5c945331ac7.zip |
TableGen: Reimplement !foreach using the resolving mechanism
Summary:
This changes the syntax of !foreach so that the first "parameter" is
a new syntactic variable: !foreach(x, lst, expr) will define the
variable x within the scope of expr, and evaluation of the !foreach
will substitute elements of the given list (or dag) for x in expr.
Aside from leading to a nicer syntax, this allows more complex
expressions where x is deeply nested, or even constant expressions
in which x does not occur at all.
!foreach is currently not actually used anywhere in trunk, but I
plan to use it in the AMDGPU backend. If out-of-tree targets are
using it, they can adjust to the new syntax very easily.
Change-Id: Ib966694d8ab6542279d6bc358b6f4d767945a805
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits, tpr
Differential Revision: https://reviews.llvm.org/D43651
llvm-svn: 326705
Diffstat (limited to 'llvm/docs/TableGen')
-rw-r--r-- | llvm/docs/TableGen/LangIntro.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/docs/TableGen/LangIntro.rst b/llvm/docs/TableGen/LangIntro.rst index 534597b041b..69e5c1426e4 100644 --- a/llvm/docs/TableGen/LangIntro.rst +++ b/llvm/docs/TableGen/LangIntro.rst @@ -192,9 +192,9 @@ supported include: for 'a' in 'c.' This operation is analogous to $(subst) in GNU make. ``!foreach(a, b, c)`` - For each member of dag or list 'b' apply operator 'c.' 'a' is a dummy - variable that should be declared as a member variable of an instantiated - class. This operation is analogous to $(foreach) in GNU make. + For each member of dag or list 'b' apply operator 'c'. 'a' is the name + of a variable that will be substituted by members of 'b' in 'c'. + This operation is analogous to $(foreach) in GNU make. ``!head(a)`` The first element of list 'a.' |