[llvm-commits] [dragonegg] r138800 - /dragonegg/trunk/src/Backend.cpp

Duncan Sands baldrick at free.fr
Tue Aug 30 00:31:06 PDT 2011


Author: baldrick
Date: Tue Aug 30 02:31:06 2011
New Revision: 138800

URL: http://llvm.org/viewvc/llvm-project?rev=138800&view=rev
Log:
If something goes wrong while emitting a function (eg: we come across
an unsupported feature) don't just skip output of other functions, since
otherwise GCC assertions will fire.  Instead just do the minimum to make
GCC happy, while not outputting any LLVM IR.

Modified:
    dragonegg/trunk/src/Backend.cpp

Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=138800&r1=138799&r2=138800&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Tue Aug 30 02:31:06 2011
@@ -1371,12 +1371,6 @@
 }
 
 
-/// gate_emission - Whether to turn gimple into LLVM IR.
-static bool gate_emission(void) {
-  // Don't bother doing anything if the program has errors.
-  return !errorcount && !sorrycount; // Do not process broken code.
-}
-
 /// emit_current_function - Turn the current gimple function into LLVM IR.  This
 /// is called once for each function in the compilation unit.
 static void emit_current_function() {
@@ -1558,7 +1552,7 @@
     {
       IPA_PASS,
       "emit_aliases",	/* name */
-      gate_emission,	/* gate */
+      NULL,		/* gate */
       NULL,		/* execute */
       NULL,		/* sub */
       NULL,		/* next */
@@ -1589,10 +1583,11 @@
 /// once for each function in the compilation unit if GCC optimizations are
 /// enabled.
 static unsigned int rtl_emit_function (void) {
-  InitializeBackend();
-
-  // Convert the function.
-  emit_current_function();
+  if (!errorcount && !sorrycount) {
+    InitializeBackend();
+    // Convert the function.
+    emit_current_function();
+  }
 
   // Free any data structures.
   execute_free_datastructures();
@@ -1608,7 +1603,7 @@
     {
       RTL_PASS,
       "rtl_emit_function",	/* name */
-      gate_emission,		/* gate */
+      NULL,			/* gate */
       rtl_emit_function,	/* execute */
       NULL,			/* sub */
       NULL,			/* next */





More information about the llvm-commits mailing list