diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-14 11:00:26 +0000 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-14 11:00:26 +0000 |
commit | 6c118656380f5ee8827e73fb6e4fc5aa0950dee4 (patch) | |
tree | 0bb7e07dbc5f760d678ab5013bfe8b5bb1947554 /llvm/docs | |
parent | 3a17e75be9589517e03f59fe03fc39bebfccd0ce (diff) | |
download | bcm5719-llvm-6c118656380f5ee8827e73fb6e4fc5aa0950dee4.tar.gz bcm5719-llvm-6c118656380f5ee8827e73fb6e4fc5aa0950dee4.zip |
TableGen: Add !dag function for construction
This allows constructing DAG nodes with programmatically determined
names, and can simplify constructing DAG nodes in other cases as
well.
Also, add documentation and some very simple tests for the already
existing !con.
Change-Id: Ida61cd82e99752548d7109ce8da34d29da56a5f7
Differential revision: https://reviews.llvm.org/D44110
llvm-svn: 327492
Diffstat (limited to 'llvm/docs')
-rw-r--r-- | llvm/docs/TableGen/LangIntro.rst | 18 | ||||
-rw-r--r-- | llvm/docs/TableGen/LangRef.rst | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/llvm/docs/TableGen/LangIntro.rst b/llvm/docs/TableGen/LangIntro.rst index c4a7a34c025..a4b198b8958 100644 --- a/llvm/docs/TableGen/LangIntro.rst +++ b/llvm/docs/TableGen/LangIntro.rst @@ -165,6 +165,24 @@ supported include: remaining elements in the list may be arbitrary other values, including nested ```dag``' values. +``!con(a, b, ...)`` + Concatenate two or more DAG nodes. Their operations must equal. + + Example: !con((op a1:$name1, a2:$name2), (op b1:$name3)) results in + the DAG node (op a1:$name1, a2:$name2, b1:$name3). + +``!dag(op, children, names)`` + Generate a DAG node programmatically. 'children' and 'names' must be lists + of equal length or unset ('?'). 'names' must be a 'list<string>'. + + Due to limitations of the type system, 'children' must be a list of items + of a common type. In practice, this means that they should either have the + same type or be records with a common superclass. Mixing dag and non-dag + items is not possible. + + Example: !dag(op, [a1, a2], ["name1", "name2"]) results in + (op a1:$name1, a2:$name2). + ``!listconcat(a, b, ...)`` A list value that is the result of concatenating the 'a' and 'b' lists. The lists must have the same element type. diff --git a/llvm/docs/TableGen/LangRef.rst b/llvm/docs/TableGen/LangRef.rst index 99bcad757fc..595505001d5 100644 --- a/llvm/docs/TableGen/LangRef.rst +++ b/llvm/docs/TableGen/LangRef.rst @@ -99,7 +99,7 @@ wide variety of meanings: :!add !shl !sra !srl !and :!or !empty !subst !foreach !strconcat :!cast !listconcat !size !foldl - :!isa + :!isa !dag Syntax |