|
8 | 8 | // RUN: not llvm-tblgen -DERROR7 %s 2>&1 | FileCheck --check-prefix=ERROR7 %s
|
9 | 9 | // RUN: not llvm-tblgen -DERROR8 %s 2>&1 | FileCheck --check-prefix=ERROR8 %s
|
10 | 10 | // RUN: not llvm-tblgen -DERROR9 %s 2>&1 | FileCheck --check-prefix=ERROR9 %s
|
| 11 | +// RUN: not llvm-tblgen -DERROR10 %s 2>&1 | FileCheck --check-prefix=ERROR10 %s |
11 | 12 |
|
12 | 13 | // !setop and !getop are deprecated in favor of !setdagop and !getdagop.
|
13 | 14 | // Two tests retain the old names just to be sure they are still supported.
|
@@ -148,3 +149,32 @@ def test {
|
148 | 149 | dag orig_out_of_range = !setdagarg(orig, foo, (foo qux:$a));
|
149 | 150 | #endif
|
150 | 151 | }
|
| 152 | + |
| 153 | +// Copy a list (Predicates) that is a field in a dag operator |
| 154 | +// (TestInstruction), which is defined in the same multiclass |
| 155 | +// (TestInstructionAndPattern) as the destination of the copy |
| 156 | +// (TestPattern::Predicates). |
| 157 | +class TestInstruction<list<int> _Predicates> { |
| 158 | + list<int> Predicates = _Predicates; |
| 159 | +} |
| 160 | +#ifdef ERROR10 |
| 161 | +class OtherTestInstruction<list<int> _Predicates> { |
| 162 | + list<int> Predicates = _Predicates; |
| 163 | +} |
| 164 | +// ERROR10: error: Expected type 'OtherTestInstruction', got 'TestInstruction' |
| 165 | +class TestPattern<dag D> { |
| 166 | + list<int> Predicates = !getdagop<OtherTestInstruction>(D).Predicates; |
| 167 | +} |
| 168 | +#else |
| 169 | +class TestPattern<dag D> { |
| 170 | + list<int> Predicates = !getdagop<TestInstruction>(D).Predicates; |
| 171 | +} |
| 172 | +#endif |
| 173 | + |
| 174 | +multiclass TestInstructionAndPattern<list<int> Predicates> { |
| 175 | + def NAME : TestInstruction<Predicates>; |
| 176 | + def : TestPattern<(!cast<TestInstruction>(NAME) foo)>; |
| 177 | +} |
| 178 | +// CHECK: def testInst0 { // TestInstruction |
| 179 | +// CHECK-NEXT: list<int> Predicates = [7]; |
| 180 | +defm testInst0 : TestInstructionAndPattern<[7]>; |
0 commit comments