[llvm-commits] CVS: llvm/utils/TableGen/FileParser.y

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 28 11:32:01 PST 2004


Changes in directory llvm/utils/TableGen:

FileParser.y updated: 1.27 -> 1.28

---
Log message:

Ignore X = X assignments that was causing Alkis's rewrite of X86.td to crash
tblgen.


---
Diffs of the changes:  (+9 -3)

Index: llvm/utils/TableGen/FileParser.y
diff -u llvm/utils/TableGen/FileParser.y:1.27 llvm/utils/TableGen/FileParser.y:1.28
--- llvm/utils/TableGen/FileParser.y:1.27	Fri Feb 13 10:37:43 2004
+++ llvm/utils/TableGen/FileParser.y	Sat Feb 28 11:31:28 2004
@@ -68,13 +68,20 @@
 
 static void setValue(const std::string &ValName, 
 		     std::vector<unsigned> *BitList, Init *V) {
-  if (!V) return ;
+  if (!V) return;
 
   RecordVal *RV = CurRec->getValue(ValName);
   if (RV == 0) {
     err() << "Value '" << ValName << "' unknown!\n";
     exit(1);
   }
+
+  // Do not allow assignments like 'X = X'.  This will just cause infinite loops
+  // in the resolution machinery.
+  if (!BitList)
+    if (VarInit *VI = dynamic_cast<VarInit*>(V))
+      if (VI->getName() == ValName)
+        return;
   
   // If we are assigning to a subset of the bits in the value... then we must be
   // assigning to a field of BitsRecTy, which must have a BitsInit
@@ -154,10 +161,9 @@
     }
   }
 
-
   // Since everything went well, we can now set the "superclass" list for the
   // current record.
-  const std::vector<Record*>   &SCs  = SC->getSuperClasses();
+  const std::vector<Record*> &SCs  = SC->getSuperClasses();
   for (unsigned i = 0, e = SCs.size(); i != e; ++i)
     addSuperClass(SCs[i]);
   addSuperClass(SC);





More information about the llvm-commits mailing list