[PATCH] D43653: TableGen: Resolve all template args simultaneously in AddSubMultiClass
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 5 07:23:57 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL326707: TableGen: Resolve all template args simultaneously in AddSubMultiClass (authored by nha, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D43653?vs=135544&id=137000#toc
Repository:
rL LLVM
https://reviews.llvm.org/D43653
Files:
llvm/trunk/lib/TableGen/TGParser.cpp
Index: llvm/trunk/lib/TableGen/TGParser.cpp
===================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp
+++ llvm/trunk/lib/TableGen/TGParser.cpp
@@ -252,40 +252,48 @@
// Loop over all of the template arguments, setting them to the specified
// value or leaving them as the default if necessary.
+ MapResolver CurRecResolver(CurRec);
+
for (unsigned i = 0, e = SMCTArgs.size(); i != e; ++i) {
if (i < SubMultiClass.TemplateArgs.size()) {
// If a value is specified for this template arg, set it in the
// superclass now.
if (SetValue(CurRec, SubMultiClass.RefRange.Start, SMCTArgs[i],
None, SubMultiClass.TemplateArgs[i]))
return true;
- // Resolve it next.
- CurRec->resolveReferencesTo(CurRec->getValue(SMCTArgs[i]));
-
- // Now remove it.
- CurRec->removeValue(SMCTArgs[i]);
-
// If a value is specified for this template arg, set it in the
// new defs now.
for (const auto &Def :
makeArrayRef(CurMC->DefPrototypes).slice(newDefStart)) {
if (SetValue(Def.get(), SubMultiClass.RefRange.Start, SMCTArgs[i],
None, SubMultiClass.TemplateArgs[i]))
return true;
-
- // Resolve it next.
- Def->resolveReferencesTo(Def->getValue(SMCTArgs[i]));
-
- // Now remove it
- Def->removeValue(SMCTArgs[i]);
}
} else if (!CurRec->getValue(SMCTArgs[i])->getValue()->isComplete()) {
return Error(SubMultiClass.RefRange.Start,
"Value not specified for template argument #" +
Twine(i) + " (" + SMCTArgs[i]->getAsUnquotedString() +
") of subclass '" + SMC->Rec.getNameInitAsString() + "'!");
}
+
+ CurRecResolver.set(SMCTArgs[i], CurRec->getValue(SMCTArgs[i])->getValue());
+
+ CurRec->removeValue(SMCTArgs[i]);
+ }
+
+ CurRec->resolveReferences(CurRecResolver);
+
+ for (const auto &Def :
+ makeArrayRef(CurMC->DefPrototypes).slice(newDefStart)) {
+ MapResolver R(Def.get());
+
+ for (Init *SMCTArg : SMCTArgs) {
+ R.set(SMCTArg, Def->getValue(SMCTArg)->getValue());
+ Def->removeValue(SMCTArg);
+ }
+
+ Def->resolveReferences(R);
}
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43653.137000.patch
Type: text/x-patch
Size: 2299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180305/cb8e1fd0/attachment.bin>
More information about the llvm-commits
mailing list