[llvm-commits] [llvm] r121166 - /llvm/trunk/utils/TableGen/FastISelEmitter.cpp

Jim Grosbach grosbach at apple.com
Tue Dec 7 11:35:36 PST 2010


Author: grosbach
Date: Tue Dec  7 13:35:36 2010
New Revision: 121166

URL: http://llvm.org/viewvc/llvm-project?rev=121166&view=rev
Log:
Change assert to diagnostic. Message still needs work, but it's better than
an assert, at least.

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

Modified: llvm/trunk/utils/TableGen/FastISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FastISelEmitter.cpp?rev=121166&r1=121165&r2=121166&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/FastISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/FastISelEmitter.cpp Tue Dec  7 13:35:36 2010
@@ -20,6 +20,7 @@
 #include "FastISelEmitter.h"
 #include "Record.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/VectorExtras.h"
 using namespace llvm;
 
@@ -380,9 +381,14 @@
       SubRegNo,
       PhysRegInputs
     };
-    assert(!SimplePatterns[Operands][OpcodeName][VT][RetVT]
-            .count(PredicateCheck) &&
-           "Duplicate pattern!");
+    // FIXME: Source location information for the diagnostic.
+    if (SimplePatterns[Operands][OpcodeName][VT][RetVT]
+            .count(PredicateCheck)) {
+      SmallString<128> PatText;
+      raw_svector_ostream OS(PatText);
+      Pattern.SrcPattern->print(OS);
+      throw "Duplicate record: " + OS.str().str();
+    }
     SimplePatterns[Operands][OpcodeName][VT][RetVT][PredicateCheck] = Memo;
   }
 }





More information about the llvm-commits mailing list