Nicolai Haehnle | 18f1998 | 2018-03-19 14:14:10 +0000 | [diff] [blame^] | 1 | // RUN: llvm-tblgen %s | FileCheck %s |
| 2 | // XFAIL: vg_leak |
| 3 | |
| 4 | // CHECK: --- Defs --- |
| 5 | |
| 6 | // CHECK: def A0 { |
| 7 | // CHECK: dag a = (ops A0); |
| 8 | // CHECK: } |
| 9 | |
| 10 | // CHECK: def B0 { |
| 11 | // CHECK: dag a = (ops); |
| 12 | // CHECK: A b = B0; |
| 13 | // CHECK: } |
| 14 | |
| 15 | // CHECK: def C0 { |
| 16 | // CHECK: dag q = (ops C0); |
| 17 | // CHECK: } |
| 18 | |
| 19 | def ops; |
| 20 | |
| 21 | class A<dag d> { |
| 22 | dag a = d; |
| 23 | } |
| 24 | |
| 25 | // This type of self-reference is used in various places defining register |
| 26 | // classes. |
| 27 | def A0 : A<(ops A0)>; |
| 28 | |
| 29 | class B<string self> { |
| 30 | A b = !cast<A>(self); |
| 31 | } |
| 32 | |
| 33 | // A stronger form of this type of self-reference is used at least in the |
| 34 | // SystemZ backend to define a record which is a ComplexPattern and an Operand |
| 35 | // at the same time. |
| 36 | def B0 : A<(ops)>, B<"B0">; |
| 37 | |
| 38 | // Casting C0 to C by name here is tricky, because it happens while (or rather: |
| 39 | // before) adding C as a superclass. However, SystemZ uses this pattern. |
| 40 | class C<string self> { |
| 41 | dag q = (ops !cast<C>(self)); |
| 42 | } |
| 43 | |
| 44 | def C0 : C<"C0">; |