diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-06 13:49:16 +0000 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-06 13:49:16 +0000 |
commit | 8498a493c81811bf3b68657b01edd3b1703bbe9c (patch) | |
tree | 2f26ca661f827df74ae107a8d9822f5576cf59f5 /docs/TableGen | |
parent | 33774b4ded5350390ff2249b35b1119bbdcdd579 (diff) |
TableGen: Add !foldl operation
Change-Id: I63d67bf6e0b315e2d3360e47e3b62c9517f38987
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326790 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/TableGen')
-rw-r--r-- | docs/TableGen/LangIntro.rst | 9 | ||||
-rw-r--r-- | docs/TableGen/LangRef.rst | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/docs/TableGen/LangIntro.rst b/docs/TableGen/LangIntro.rst index 7437723bf3b..67000fa03c6 100644 --- a/docs/TableGen/LangIntro.rst +++ b/docs/TableGen/LangIntro.rst @@ -217,6 +217,15 @@ supported include: of a variable that will be substituted by members of 'b' in 'c'. This operation is analogous to $(foreach) in GNU make. +``!foldl(start, lst, a, b, expr)`` + Perform a left-fold over 'lst' with the given starting value. 'a' and 'b' + are variable names which will be substituted in 'expr'. If you think of + expr as a function f(a,b), the fold will compute + 'f(...f(f(start, lst[0]), lst[1]), ...), lst[n-1])' for a list of length n. + As usual, 'a' will be of the type of 'start', and 'b' will be of the type + of elements of 'lst'. These types need not be the same, but 'expr' must be + of the same type as 'start'. + ``!head(a)`` The first element of list 'a.' diff --git a/docs/TableGen/LangRef.rst b/docs/TableGen/LangRef.rst index 5f7917a5b4b..5da852879d2 100644 --- a/docs/TableGen/LangRef.rst +++ b/docs/TableGen/LangRef.rst @@ -98,7 +98,7 @@ wide variety of meanings: :!eq !if !head !tail !con :!add !shl !sra !srl !and :!or !empty !subst !foreach !strconcat - :!cast !listconcat !size + :!cast !listconcat !size !foldl Syntax |