llvm.org GIT mirror llvm / 2370e55
[TableGen] Use the same anonymous name as the prefix on all multiclass defs TableGen had been generating a different name for an anonymous multiclass's NAME for every def in the multiclass. This had an unfortunate side effect: it was impossible to reference one def within the multiclass from another (in the parameter list, for example). By making sure we only generate an anonymous name once per multiclass (which, as it turns out, requires only changing the name parameter to reference type), we can now concatenate NAME within the multiclass with a def name in order to generate a reference to that def. This does not matter so much, in and of itself, but is necessary for a follow-up commit that will fix variable capturing in implicit anonymous multiclass defs (and that is important). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198340 91177308-0d34-0410-b5e6-96231b3b80d8 Hal Finkel 5 years ago
3 changed file(s) with 17 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
22682268 Record *TGParser::
22692269 InstantiateMulticlassDef(MultiClass &MC,
22702270 Record *DefProto,
2271 Init *DefmPrefix,
2271 Init *&DefmPrefix,
22722272 SMRange DefmPrefixRange) {
22732273 // We need to preserve DefProto so it can be reused for later
22742274 // instantiations, so create a new Record to inherit from it.
136136 bool ParseMultiClass();
137137 Record *InstantiateMulticlassDef(MultiClass &MC,
138138 Record *DefProto,
139 Init *DefmPrefix,
139 Init *&DefmPrefix,
140140 SMRange DefmPrefixRange);
141141 bool ResolveMulticlassDefArgs(MultiClass &MC,
142142 Record *DefProto,
1313 }
1515 defm Hello : Names<"hello", "world">;
17 // Ensure that the same anonymous name is used as the prefix for all defs in an
18 // anonymous multiclass.
20 class Outer {
21 C Inner = i;
22 }
24 multiclass MC {
25 def hi : C;
26 def there : Outer(!strconcat(NAME, "hi"))>;
27 }
29 defm : MC<"foo">;