summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-09-30 20:59:52 +0000
committerDavid Greene <greened@obbligato.org>2011-09-30 20:59:52 +0000
commitdc221dd6494c865c9ce373fc43b20a02a05e6a0b (patch)
tree18e2cbbee3950e0f6926ed256709ca81fa2bbef4 /llvm
parent0c3a2b48e7a20fed005054613625403545ebf32e (diff)
downloadbcm5719-llvm-dc221dd6494c865c9ce373fc43b20a02a05e6a0b.tar.gz
bcm5719-llvm-dc221dd6494c865c9ce373fc43b20a02a05e6a0b.zip
Test More Complicated Lists
Test of indexing lists of lists of lists works. This also exercises some operators. llvm-svn: 140884
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/TableGen/LoLoL.td17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/TableGen/LoLoL.td b/llvm/test/TableGen/LoLoL.td
new file mode 100644
index 00000000000..0307b399bc5
--- /dev/null
+++ b/llvm/test/TableGen/LoLoL.td
@@ -0,0 +1,17 @@
+// RUN: tblgen %s | FileCheck %s
+
+class Base<list<int> v> {
+ list<int> values = v;
+}
+
+class Derived<list<int> v> : Base<!if(!empty(v),[0],v)>;
+
+multiclass Multi<list<list<list<int>>> v> {
+ def ONE : Derived<!if(!empty(v),[]<int>,!if(!empty(!head(v)),[]<int>,v[0][0]))>;
+ def TWO : Derived<!if(!empty(v),[]<int>,!if(!empty(!tail(v)),!if(!empty(!head(v)),[]<int>,v[0][0]),v[1][0]))>;
+}
+
+defm Def : Multi<[[[]],[[1, 2, 3]]]>;
+
+// CHECK: values = [0]
+// CHECK: values = [1, 2, 3]
OpenPOWER on IntegriCloud