[llvm-commits] [llvm] r123934 - /llvm/trunk/utils/TableGen/CodeGenInstruction.cpp

Bob Wilson bob.wilson at apple.com
Thu Jan 20 10:38:10 PST 2011


Author: bwilson
Date: Thu Jan 20 12:38:10 2011
New Revision: 123934

URL: http://llvm.org/viewvc/llvm-project?rev=123934&view=rev
Log:
Move InstAlias check of argument types to a separate loop.

Modified:
    llvm/trunk/utils/TableGen/CodeGenInstruction.cpp

Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=123934&r1=123933&r2=123934&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Thu Jan 20 12:38:10 2011
@@ -403,6 +403,20 @@
   // NameClass - If argument names are repeated, we need to verify they have
   // the same class.
   StringMap<Record*> NameClass;
+  for (unsigned i = 0, e = Result->getNumArgs(); i != e; ++i) {
+    DefInit *ADI = dynamic_cast<DefInit*>(Result->getArg(i));
+    if (!ADI || Result->getArgName(i).empty())
+      continue;
+    // Verify we don't have something like: (someinst GR16:$foo, GR32:$foo)
+    // $foo can exist multiple times in the result list, but it must have the
+    // same type.
+    Record *&Entry = NameClass[Result->getArgName(i)];
+    if (Entry && Entry != ADI->getDef())
+      throw TGError(R->getLoc(), "result value $" + Result->getArgName(i) +
+                    " is both " + Entry->getName() + " and " +
+                    ADI->getDef()->getName() + "!");
+    Entry = ADI->getDef();
+  }
     
   // Decode and validate the arguments of the result.
   unsigned AliasOpNo = 0;
@@ -474,17 +488,6 @@
                       ", instruction operand is class " + 
                       ResultOpRec->getName());
       
-      // Verify we don't have something like: (someinst GR16:$foo, GR32:$foo)
-      // $foo can exist multiple times in the result list, but it must have the
-      // same type.
-      Record *&Entry = NameClass[Result->getArgName(AliasOpNo)];
-      if (Entry && Entry != ADI->getDef())
-        throw TGError(R->getLoc(), "result value $" +
-                      Result->getArgName(AliasOpNo) +
-                      " is both " + Entry->getName() + " and " +
-                      ADI->getDef()->getName() + "!");
-      Entry = ADI->getDef();
-      
       // Now that it is validated, add it.
       ResultOperands.push_back(ResultOperand(Result->getArgName(AliasOpNo),
                                              ADI->getDef()));





More information about the llvm-commits mailing list