summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-10-06 04:55:48 +0000
committerChris Lattner <sabre@nondot.org>2010-10-06 04:55:48 +0000
commit46f55527d848bcc7cff1210137caff29bbf1b010 (patch)
treeb3fdb7408d7bf99860c1bad4889147c748b0f234 /test
parentd752593b0b407e89220209e10be715a1cf455a52 (diff)
Generalize tblgen's dag parsing logic to handle arbitrary expressions
as the operator of the dag. Specifically, this allows parsing things like (F.x 4) in addition to just (a 4). Unfortunately, this runs afoul of an idiom being used by llvmc. It is using dags like (foo [1,2,3]) to represent a list of stuff being passed into foo. With this change, this is parsed as a [1,2,3] subscript on foo instead of being the first argument to the dag. Cope with this in the short term by requiring a "-llvmc-temp-hack" argument to tblgen to get the old parsing behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115742 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/LLVMC/MultipleOutputLanguages.td2
-rw-r--r--test/LLVMC/OptionPreprocessor.td2
-rw-r--r--test/TableGen/Dag.td36
3 files changed, 38 insertions, 2 deletions
diff --git a/test/LLVMC/MultipleOutputLanguages.td b/test/LLVMC/MultipleOutputLanguages.td
index 02512c2db7c..16ce6be85c8 100644
--- a/test/LLVMC/MultipleOutputLanguages.td
+++ b/test/LLVMC/MultipleOutputLanguages.td
@@ -1,5 +1,5 @@
// Check that multiple output languages work.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
+// RUN: tblgen -I %p/../../include -llvmc-temp-hack --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx %t
// XFAIL: vg_leak
diff --git a/test/LLVMC/OptionPreprocessor.td b/test/LLVMC/OptionPreprocessor.td
index 8019c42634f..44670cee932 100644
--- a/test/LLVMC/OptionPreprocessor.td
+++ b/test/LLVMC/OptionPreprocessor.td
@@ -1,5 +1,5 @@
// Test for the OptionPreprocessor and related functionality.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
+// RUN: tblgen -I %p/../../include -llvmc-temp-hack --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx %t
// XFAIL: vg_leak
diff --git a/test/TableGen/Dag.td b/test/TableGen/Dag.td
index 8b406a59d34..d3481a550c3 100644
--- a/test/TableGen/Dag.td
+++ b/test/TableGen/Dag.td
@@ -33,3 +33,39 @@ def VAL2 : C2<Y2>;
// CHECK-NEXT: dag d = (X2 Y2)
// CHECK-NEXT: dag e = (Y2 X2)
+
+//===----------------------------------------------------------------------===//
+// Complex dag operator (F.TheOp).
+
+class operator;
+def somedef1 : operator;
+def somedef2 : operator;
+
+class foo<operator a> {
+ operator TheOp = a;
+}
+
+class bar<foo F, operator a> {
+ dag Dag1 = (somedef1 1);
+ dag Dag2 = (a 2);
+ dag Dag3 = (F.TheOp 2);
+}
+
+def foo1 : foo<somedef1>;
+def foo2 : foo<somedef2>;
+
+def VAL3 : bar<foo1, somedef1>;
+
+// CHECK: def VAL3 { // bar
+// CHECK-NEXT: dag Dag1 = (somedef1 1);
+// CHECK-NEXT: dag Dag2 = (somedef1 2);
+// CHECK-NEXT: dag Dag3 = (somedef1 2);
+// CHECK-NEXT: }
+
+
+def VAL4 : bar<foo2, somedef2>;
+// CHECK: def VAL4 {
+// CHECK-NEXT: dag Dag1 = (somedef1 1);
+// CHECK-NEXT: dag Dag2 = (somedef2 2);
+// CHECK-NEXT: dag Dag3 = (somedef2 2);
+// CHECK-NEXT: }