blob: 14d616b521733c2242a315712f5be9a7f585c760 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// RUN: llvm-tblgen %s | FileCheck %s
//===----------------------------------------------------------------------===//
// 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: NAME = ?
// 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: NAME = ?
// CHECK-NEXT: }
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);
|