[PATCH] D43554: TableGen: Generalize type deduction for !listconcat
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 07:28:41 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL325796: TableGen: Generalize type deduction for !listconcat (authored by nha, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D43554
Files:
llvm/trunk/lib/TableGen/TGParser.cpp
llvm/trunk/test/TableGen/listconcat.td
Index: llvm/trunk/lib/TableGen/TGParser.cpp
===================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp
+++ llvm/trunk/lib/TableGen/TGParser.cpp
@@ -944,9 +944,7 @@
// If we are doing !listconcat, we should know the type by now
if (OpTok == tgtok::XListConcat) {
- if (VarInit *Arg0 = dyn_cast<VarInit>(InitList[0]))
- Type = Arg0->getType();
- else if (ListInit *Arg0 = dyn_cast<ListInit>(InitList[0]))
+ if (TypedInit *Arg0 = dyn_cast<TypedInit>(InitList[0]))
Type = Arg0->getType();
else {
InitList[0]->print(errs());
Index: llvm/trunk/test/TableGen/listconcat.td
===================================================================
--- llvm/trunk/test/TableGen/listconcat.td
+++ llvm/trunk/test/TableGen/listconcat.td
@@ -1,18 +1,32 @@
// RUN: llvm-tblgen %s | FileCheck %s
+// CHECK: class X<list<int> X:a = ?, list<int> X:b = ?, list<int> X:c = ?> {
+// CHECK: list<int> x = !listconcat(!listconcat(X:a, X:b), !listconcat(X:b, X:c));
+// CHECK: }
+
// 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 DX {
+// CHECK: list<int> x = [0, 1, 1, 2]
+// CHECK: }
+
// CHECK: def Z {
// CHECK: list<string> T1 = ["fu", "foo"];
// CHECK: list<string> T2 = ["fu", "foo", "fu", "bar", "baz"];
// CHECK: }
+class X<list<int> a, list<int> b, list<int> c> {
+ list<int> x = !listconcat(!listconcat(a, b), !listconcat(b, c));
+}
+
class Y<list<string> S> {
list<string> T1 = !listconcat(S, ["foo"]);
list<string> T2 = !listconcat(S, ["foo"], S, ["bar", "baz"]);
}
+def DX : X<[0], [1], [2]>;
+
def Z : Y<["fu"]>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43554.135419.patch
Type: text/x-patch
Size: 1827 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180222/f01622ff/attachment.bin>
More information about the llvm-commits
mailing list