aboutsummaryrefslogtreecommitdiff
path: root/test/TableGen
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2018-03-06 13:49:01 +0000
committerNicolai Haehnle <nhaehnle@gmail.com>2018-03-06 13:49:01 +0000
commit1f3e2338d931065948b0895e2a12cc13b1514a20 (patch)
treebb4d1844eade08fe58428729f2c4c5d9f183d29b /test/TableGen
parentea80ae41c7cb80d54cf74f0bc17ce724a59c379c (diff)
downloadllvm-1f3e2338d931065948b0895e2a12cc13b1514a20.tar.gz
TableGen: Delay instantiating inline anonymous records
Summary: Only instantiate anonymous records once all variable references in template arguments have been resolved. This allows patterns like the new test case, which in practice can appear in expressions like: class IntrinsicTypeProfile<list<LLVMType> ty, int shift> { list<LLVMType> types = !listconcat(ty, [llvm_any_ty, LLVMMatchType<shift>]); } class FooIntrinsic<IntrinsicTypeProfile P, ...> : Intrinsic<..., P.types, ...>; Without this change, the anonymous LLVMMatchType instantiation would never get resolved. Another consequence of this change is that anonymous inline instantiations are uniqued via the folding set of the newly introduced VarDefInit. Change-Id: I7a7041a20e297cf98c9109b28d85e64e176c932a Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43756 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen')
-rw-r--r--test/TableGen/AnonDefinitionOnDemand.td26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/TableGen/AnonDefinitionOnDemand.td b/test/TableGen/AnonDefinitionOnDemand.td
index b6e0fc7df55..a02671e70eb 100644
--- a/test/TableGen/AnonDefinitionOnDemand.td
+++ b/test/TableGen/AnonDefinitionOnDemand.td
@@ -1,6 +1,24 @@
-// RUN: llvm-tblgen < %s
+// RUN: llvm-tblgen %s | FileCheck %s
// XFAIL: vg_leak
+// CHECK: --- Defs ---
+
+// CHECK: def X {
+// CHECK: foo Y = anonymous_0;
+// CHECK: }
+
+// CHECK: def ZD {
+// CHECK: foo Z = anonymous_1;
+// CHECK: }
+
+// CHECK: def anonymous_0 {
+// CHECK: int THEVAL = 1;
+// CHECK: }
+
+// CHECK: def anonymous_1 {
+// CHECK: int THEVAL = 42;
+// CHECK: }
+
class foo<int X> { int THEVAL = X; }
def foo_imp : foo<1>;
@@ -11,3 +29,9 @@ def x {
def X {
foo Y = foo<1>; // This should work too, synthesizing a new foo<1>.
}
+
+class Z<int X> {
+ foo Z = foo<X>;
+}
+
+def ZD : Z<42>;