1// RUN: llvm-tblgen %s | FileCheck %s 2// XFAIL: vg_leak 3 4// CHECK: --- Defs --- 5 6// CHECK: def A0 { 7// CHECK: dag ret = (ops); 8// CHECK: } 9 10// CHECK: def A1 { 11// CHECK: dag ret = (ops ?:$a, 1:$b, 2); 12// CHECK: } 13 14// CHECK: def A2 { 15// CHECK: dag ret = (ops (ops ?:$name):$a, (ops 1):$b, (ops "foo"):$c); 16// CHECK: } 17 18// CHECK: def A3 { 19// CHECK: dag ret = (ops NodeA0:$a, NodeB0:$b); 20// CHECK: } 21 22// CHECK: def A4 { 23// CHECK: dag ret = (ops NodeA0, NodeB0); 24// CHECK: } 25 26// CHECK: def B0 { 27// CHECK: dag ret = (ops); 28// CHECK: } 29 30// CHECK: def B1 { 31// CHECK: dag ret = (ops 1:$a, 2:$b); 32// CHECK: } 33 34// CHECK: def C0 { 35// CHECK: dag ret1 = (ops ?:$a, ?:$b); 36// CHECK: dag ret2 = (ops 1, 2); 37// CHECK: } 38 39// CHECK: def D { 40// CHECK: dag d1 = (ops 1, ?:$name1, 2, 3); 41// CHECK: } 42 43// CHECK: def E0 { 44// CHECK: dag ret = (ops 1, 2); 45// CHECK: } 46 47class Ops; 48 49def ops : Ops; 50 51class Node<int val, string name> { 52 int Val = val; 53 string Name = name; 54} 55 56class Aint<list<int> nodes, list<string> names> { 57 dag ret = !dag(ops, nodes, names); 58} 59 60class Adag<list<dag> nodes, list<string> names> { 61 dag ret = !dag(ops, nodes, names); 62} 63 64class NodeBase; 65 66class NodeA<int val> : NodeBase { 67 int x = val; 68} 69 70class NodeB<int val> : NodeBase { 71 int y = val; 72} 73 74class Anode<list<NodeBase> nodes, list<string> names> { 75 dag ret = !dag(ops, nodes, names); 76} 77 78class B<list<Node> nodes> { 79 dag ret = !foldl((ops), nodes, lhs, rhs, !con(lhs, !dag(ops, [rhs.Val], [rhs.Name]))); 80} 81 82def A0 : Aint<[], []>; 83def A1 : Aint<[?, 1, 2], ["a", "b", ?]>; 84 85def A2 : Adag<[(ops $name), (ops 1), (ops "foo")], ["a", "b", "c"]>; 86 87def NodeA0 : NodeA<0>; 88def NodeB0 : NodeB<0>; 89 90def A3 : Anode<[NodeA0, NodeB0], ["a", "b"]>; 91 92def A4 { 93 // Like A3, but with a literal list directly in the !dag. 94 dag ret = !dag(ops, [NodeA0, NodeB0], ?); 95} 96 97def B0 : B<[]>; 98def B1 : B<[Node<1, "a">, Node<2, "b">]>; 99 100class C<list<int> nodes, list<string> names> { 101 dag ret1 = !dag(ops, ?, names); 102 dag ret2 = !dag(ops, nodes, ?); 103} 104 105def C0 : C<[1, 2], ["a", "b"]>; 106 107def D { 108 dag d1 = !con((ops 1), (ops $name1), (ops), (ops 2, 3)); 109} 110 111class E<Ops op> { 112 // Allow concatenation of DAG nodes with operators from template arguments. 113 dag ret = !con((op 1), (op 2)); 114} 115 116def E0 : E<ops>; 117