From 4717fd4c0faf454ff37f133709320d0cfec0da89 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Sun, 24 Mar 2013 19:36:51 +0000 Subject: Allow TableGen DAG arguments to be just a name. DAG arguments can optionally be named: (dag node, node:$name) With this change, the node is also optional: (dag node, node:$name, $name) The missing node is treated as an UnsetInit, so the above is equivalent to: (dag node, node:$name, ?:$name) This syntax is useful in output patterns where we currently require the types of variables to be repeated: def : Pat<(subc i32:$b, i32:$c), (SUBCCrr i32:$b, i32:$c)>; This is preferable: def : Pat<(subc i32:$b, i32:$c), (SUBCCrr $b, $c)>; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177843 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/TableGen/Dag.td | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/TableGen/Dag.td') diff --git a/test/TableGen/Dag.td b/test/TableGen/Dag.td index 40399a48ee..14d616b521 100644 --- a/test/TableGen/Dag.td +++ b/test/TableGen/Dag.td @@ -70,3 +70,15 @@ def VAL4 : bar; // CHECK-NEXT: dag Dag3 = (somedef2 2); // CHECK-NEXT: NAME = ? // CHECK-NEXT: } + +def VAL5 : bar { + // Named operands. + let Dag1 = (somedef1 1:$name1); + + // Name, no node. + let Dag2 = (somedef2 $name2, $name3); +} + +// CHECK: def VAL5 { +// CHECK-NEXT: dag Dag1 = (somedef1 1:$name1); +// CHECK-NEXT: dag Dag2 = (somedef2 ?:$name2, ?:$name3); -- cgit v1.2.3-18-g5258