[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / test / TableGen / foreach-eval.td
blob227475f9df4ef141b46cd2d12a242b4f65617391
1 // RUN: llvm-tblgen %s | FileCheck %s
2 // XFAIL: vg_leak
4 // Tests evaluation of !foreach operator.
6 def d0;
7 def d1;
8 def d2;
9 def d3;
10 def d4;
12 class D<dag d> {
13   dag r1 = !foreach(tmp, d, !subst(d1, d0, !subst(d2, d0,
14                                            !subst(d3, d0,
15                                            !subst(d4, d0, tmp)))));
16   list<dag> dl = [d];
17   list<dag> r2 = !foreach(tmp2, dl,
18                           !foreach(tmp, tmp2, !subst(d1, d0,
19                                               !subst(d2, d0,
20                                               !subst(d3, d0,
21                                               !subst(d4, d0, tmp))))));
24 // CHECK-LABEL: def d
25 // CHECK: dag r1 = (d0 d0, d0, d0, d0);
26 // CHECK: list<dag> r2 = [(d0 d0, d0, d0, d0)];
27 def d : D <(d0 d1, d2, d3, d4)>;
29 class I<list<int> i> {
30   list<int> r1 = !foreach(tmp, i, !add(3, !add(4, tmp)));
32   list<list<int>> li = [i];
33   list<list<int>> r2 = !foreach(tmp2, li,
34                                 !foreach(tmp, tmp2, !add(3, !add(4, tmp))));
37 // CHECK-LABEL: def i
38 // CHECK: list<int> r1 = [8, 9, 10];
39 // CHECK: list<list<int>> r2 = [{{[[]}}8, 9, 10]];
40 def i : I<[1,2,3]>;
42 class J0<list<dag> pattern> {
43   list<dag> Pattern = pattern;
45 class J1<dag pattern>
46       : J0<[!foreach(tmp, pattern, !subst(d1, d0,
47                                    !subst(d2, d0,
48                                    !subst(d3, d0,
49                                    !subst(d4, d0, tmp)))))]>;
50 class J2<list<dag> patterns>
51       : J0<!foreach(t0, patterns,
52                     !foreach(t1, t0, !subst(d1, d0,
53                                      !subst(d2, d0,
54                                      !subst(d3, d0,
55                                      !subst(d4, d0, t1))))))>;
56 // CHECK-LABEL: def j1
57 // CHECK: list<dag> Pattern = [(d0 d0:$dst, (d0 d0:$src1))];
58 def j1 : J1< (d1 d2:$dst, (d3 d4:$src1))>;
59 // CHECK-LABEL: def j2
60 // CHECK: list<dag> Pattern = [(d0 d0:$dst, (d0 d0:$src1))];
61 def j2 : J2< [(d1 d2:$dst, (d3 d4:$src1))]>;