1 // RUN: llvm-tblgen %s | FileCheck %s
7 // CHECK: dag a = (ops A0);
11 // CHECK: dag a = (ops);
16 // CHECK: dag q = (ops C0);
28 // CHECK: Fa as_a = F0;
29 // CHECK: Fb as_b = F0;
32 // CHECK: Fc as_c = F0;
41 // This type of self-reference is used in various places defining register
45 class B<string self> {
49 // A stronger form of this type of self-reference is used at least in the
50 // SystemZ backend to define a record which is a ComplexPattern and an Operand
52 def B0 : A<(ops)>, B<"B0">;
54 // Casting C0 to C by name here is tricky, because it happens while (or rather:
55 // before) adding C as a superclass. However, SystemZ uses this pattern.
56 class C<string self> {
57 dag q = (ops !cast<C>(self));
62 // Explore some unused corner cases.
64 // A self-reference within a class may seem icky, but it unavoidably falls out
65 // orthogonally of having forward class declarations and late resolve of self
67 class D<string self> {
77 // Putting the !cast directly in the def should work as well: we shouldn't
78 // depend on implementation details of when exactly the record is looked up.
80 // Note the difference between !cast<E>("E0") and plain E0: the latter wouldn't
81 // work here because E0 does not yet have E as a superclass while the template
82 // arguments are being parsed.
83 def E0 : E<!cast<E>("E0")>;
85 // Ensure that records end up with the correct type even when direct self-
86 // references are involved.
95 def F0 : Fa, Fb<F0>, Fc<F0>;