mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-09 10:05:41 +00:00
0a3368cde5
Even within a multiclass, we had been generating concrete implicit anonymous defs when parsing values (generally in value lists). This behavior was incorrect, and led to errors when multiclass parameters were used in the parameter list of the implicit anonymous def. If we had some multiclass: multiclass mc<string n> { ... : SomeClass<SomeOtherClass<n> > The capture of the multiclass parameter 'n' would not work correctly, and depending on how the implicit SomeOtherClass was used, either TableGen would ignore something it shouldn't, or would crash. To fix this problem, when inside a multiclass, we generate prototype anonymous defs for implicit anonymous defs (just as we do for explicit anonymous defs). Within the multiclass, the current record prototype is populated with a node that is essentially: !cast<SomeOtherClass>(!strconcat(NAME, anon_value_name)). This is then resolved to the correct concrete anonymous def, in the usual way, when NAME is resolved during multiclass instantiation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198348 91177308-0d34-0410-b5e6-96231b3b80d8
42 lines
796 B
TableGen
42 lines
796 B
TableGen
// RUN: llvm-tblgen %s | FileCheck %s
|
|
// XFAIL: vg_leak
|
|
|
|
// CHECK: WorldHelloCC
|
|
// CHECK-NOT: WorldHelloCC
|
|
|
|
class C<string n> {
|
|
string name = n;
|
|
}
|
|
|
|
multiclass Names<string n, string m> {
|
|
def CC : C<n>;
|
|
def World#NAME#CC : C<m>;
|
|
}
|
|
|
|
defm Hello : Names<"hello", "world">;
|
|
|
|
// Ensure that the same anonymous name is used as the prefix for all defs in an
|
|
// anonymous multiclass.
|
|
|
|
class Outer<C i> {
|
|
C Inner = i;
|
|
}
|
|
|
|
multiclass MC<string name> {
|
|
def hi : C<name>;
|
|
def there : Outer<!cast<C>(!strconcat(NAME, "hi"))>;
|
|
}
|
|
|
|
defm : MC<"foo">;
|
|
|
|
multiclass MC2<string name> {
|
|
def there : Outer<C<name> >;
|
|
}
|
|
|
|
// Ensure that we've correctly captured the reference to name from the implicit
|
|
// anonymous C def in the template parameter list of Outer.
|
|
// CHECK-NOT: MC2::name
|
|
|
|
defm : MC2<"bar">;
|
|
|