summaryrefslogtreecommitdiff
path: root/test/TableGen
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2014-05-07 10:13:19 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2014-05-07 10:13:19 +0000
commitd80222a48b11d5ec35a2e3502d014bdbd9f137c0 (patch)
treeac9c2b281c9f3e3cfc599fc0abf75c080af9293b /test/TableGen
parent0c9ea21554e976b23e494ca8bda48bd1691ac8a4 (diff)
downloadllvm-d80222a48b11d5ec35a2e3502d014bdbd9f137c0.tar.gz
llvm-d80222a48b11d5ec35a2e3502d014bdbd9f137c0.tar.bz2
llvm-d80222a48b11d5ec35a2e3502d014bdbd9f137c0.tar.xz
[tablegen] Add !listconcat operator with the similar semantics as !strconcat
Summary: It concatenates two or more lists. In addition to the !strconcat semantics the lists must have the same element type. My overall aim is to make it easy to append to Instruction.Predicates rather than override it. This can be done by concatenating lists passed as arguments, or by concatenating lists passed in additional fields. Reviewers: dsanders Reviewed By: dsanders Subscribers: hfinkel, llvm-commits Differential Revision: http://reviews.llvm.org/D3506 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen')
-rw-r--r--test/TableGen/listconcat.td18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/TableGen/listconcat.td b/test/TableGen/listconcat.td
new file mode 100644
index 0000000000..870e649d41
--- /dev/null
+++ b/test/TableGen/listconcat.td
@@ -0,0 +1,18 @@
+// RUN: llvm-tblgen %s | FileCheck %s
+
+// CHECK: class Y<list<string> Y:S = ?> {
+// CHECK: list<string> T1 = !listconcat(Y:S, ["foo"]);
+// CHECK: list<string> T2 = !listconcat(Y:S, !listconcat(["foo"], !listconcat(Y:S, ["bar", "baz"])));
+// CHECK: }
+
+// CHECK: def Z {
+// CHECK: list<string> T1 = ["fu", "foo"];
+// CHECK: list<string> T2 = ["fu", "foo", "fu", "bar", "baz"];
+// CHECK: }
+
+class Y<list<string> S> {
+ list<string> T1 = !listconcat(S, ["foo"]);
+ list<string> T2 = !listconcat(S, ["foo"], S, ["bar", "baz"]);
+}
+
+def Z : Y<["fu"]>;