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 | d34f6843aaffc6a8f6929cce5b589032fd55ede0 (patch) | |
tree | 4de1aaea018b4bc54a57c76241d3ac61d02e94d5 /llvm/docs/TableGen | |
parent | 616635022a7a15bf097e6c23fe2d2f5678491419 (diff) | |
download | bcm5719-llvm-d34f6843aaffc6a8f6929cce5b589032fd55ede0.tar.gz bcm5719-llvm-d34f6843aaffc6a8f6929cce5b589032fd55ede0.zip |
TableGen: Add !foldl operation
Change-Id: I63d67bf6e0b315e2d3360e47e3b62c9517f38987
llvm-svn: 326790
Diffstat (limited to 'llvm/docs/TableGen')
-rw-r--r-- | llvm/docs/TableGen/LangIntro.rst | 9 | ||||
-rw-r--r-- | llvm/docs/TableGen/LangRef.rst | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/llvm/docs/TableGen/LangIntro.rst b/llvm/docs/TableGen/LangIntro.rst index 7437723bf3b..67000fa03c6 100644 --- a/llvm/docs/TableGen/LangIntro.rst +++ b/llvm/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/llvm/docs/TableGen/LangRef.rst b/llvm/docs/TableGen/LangRef.rst index 5f7917a5b4b..5da852879d2 100644 --- a/llvm/docs/TableGen/LangRef.rst +++ b/llvm/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 |