1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/TableGen/Dag.td
Chris Lattner 0bc415a491 Generalize tblgen's dag parsing logic to handle arbitrary expressions
as the operator of the dag.  Specifically, this allows parsing things
like (F.x 4) in addition to just (a 4).

Unfortunately, this runs afoul of an idiom being used by llvmc.  It
is using dags like (foo [1,2,3]) to represent a list of stuff being
passed into foo.  With this change, this is parsed as a [1,2,3] 
subscript on foo instead of being the first argument to the dag.
Cope with this in the short term by requiring a "-llvmc-temp-hack"
argument to tblgen to get the old parsing behavior.

llvm-svn: 115742
2010-10-06 04:55:48 +00:00

72 lines
1.4 KiB
TableGen

// RUN: tblgen %s | FileCheck %s
// XFAIL: vg_leak
//===----------------------------------------------------------------------===//
// Substitution of an int.
def X1;
class C1<int N> {
dag d = (X1 N);
}
def VAL1 : C1<13>;
// CHECK: def VAL1 {
// CHECK-NEXT: dag d = (X1 13)
//===----------------------------------------------------------------------===//
// Substitution of a DAG.
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)
//===----------------------------------------------------------------------===//
// 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);
// 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);
// CHECK-NEXT: }