[PATCH] D43654: TableGen: Resolve all template args simultaneously in ResolveMulticlassDefARgs

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 5 07:24:05 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL326708: TableGen: Resolve all template args simultaneously in ResolveMulticlassDefARgs (authored by nha, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43654?vs=135545&id=137001#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43654

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
@@ -2576,29 +2576,30 @@
                                         ArrayRef<Init *> TArgs,
                                         ArrayRef<Init *> TemplateVals,
                                         bool DeleteArgs) {
-  // Loop over all of the template arguments, setting them to the specified
-  // value or leaving them as the default if necessary.
+  // Set all template arguments to the specified value or leave them as the
+  // default if necessary, then resolve them all simultaneously.
+  MapResolver R(CurRec);
+
   for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
     // Check if a value is specified for this temp-arg.
     if (i < TemplateVals.size()) {
-      // Set it now.
       if (SetValue(CurRec, DefmPrefixLoc, TArgs[i], None, TemplateVals[i]))
         return true;
-
-      // Resolve it next.
-      CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
-
-      if (DeleteArgs)
-        // Now remove it.
-        CurRec->removeValue(TArgs[i]);
-
     } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
       return Error(SubClassLoc, "value not specified for template argument #" +
                    Twine(i) + " (" + TArgs[i]->getAsUnquotedString() +
                    ") of multiclassclass '" + MC.Rec.getNameInitAsString() +
                    "'");
     }
+
+    R.set(TArgs[i], CurRec->getValue(TArgs[i])->getValue());
+
+    if (DeleteArgs)
+      CurRec->removeValue(TArgs[i]);
   }
+
+  CurRec->resolveReferences(R);
+
   return false;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43654.137001.patch
Type: text/x-patch
Size: 1704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180305/79fb08e8/attachment.bin>


More information about the llvm-commits mailing list