2011-10-06 15:39:59 +02:00
|
|
|
// RUN: llvm-tblgen %s | FileCheck %s
|
2010-10-06 06:37:17 +02:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Substitution of an int.
|
2010-10-06 06:36:30 +02:00
|
|
|
def X1;
|
2006-01-31 07:01:40 +01:00
|
|
|
|
2010-10-06 06:36:30 +02:00
|
|
|
class C1<int N> {
|
|
|
|
dag d = (X1 N);
|
2006-01-31 07:01:40 +01:00
|
|
|
}
|
|
|
|
|
2010-10-06 06:36:30 +02:00
|
|
|
def VAL1 : C1<13>;
|
2006-01-31 07:01:40 +01:00
|
|
|
|
2010-10-06 06:36:30 +02:00
|
|
|
// CHECK: def VAL1 {
|
|
|
|
// CHECK-NEXT: dag d = (X1 13)
|
|
|
|
|
|
|
|
|
2010-10-06 06:37:17 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Substitution of a DAG.
|
2010-10-06 06:36:30 +02:00
|
|
|
def X2;
|
|
|
|
|
|
|
|
class yclass;
|
|
|
|
def Y2 : yclass;
|
|
|
|
|
|
|
|
class C2<yclass N> {
|
|
|
|
dag d = (X2 N);
|
|
|
|
dag e = (N X2);
|
|
|
|
}
|
|
|
|
|
|
|
|
def VAL2 : C2<Y2>;
|
|
|
|
|
|
|
|
// CHECK: def VAL2 {
|
|
|
|
// CHECK-NEXT: dag d = (X2 Y2)
|
|
|
|
// CHECK-NEXT: dag e = (Y2 X2)
|
2006-01-31 07:01:40 +01:00
|
|
|
|
2010-10-06 06:55:48 +02:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// 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);
|
2011-10-19 15:04:13 +02:00
|
|
|
// CHECK-NEXT: NAME = ?
|
2010-10-06 06:55:48 +02:00
|
|
|
// 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);
|
2011-10-19 15:04:13 +02:00
|
|
|
// CHECK-NEXT: NAME = ?
|
2010-10-06 06:55:48 +02:00
|
|
|
// CHECK-NEXT: }
|
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)>;
llvm-svn: 177843
2013-03-24 20:36:51 +01:00
|
|
|
|
|
|
|
def VAL5 : bar<foo2, somedef2> {
|
|
|
|
// 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);
|