make use of generated proj nums
[libfirm] / ir / be / belistsched.c
index bffc885..4db8f1e 100644 (file)
@@ -28,6 +28,7 @@
 #include "irprintf_t.h"
 #include "array.h"
 #include "debug.h"
+#include "irtools.h"
 
 #include "besched_t.h"
 #include "beutil.h"
@@ -37,9 +38,6 @@
 #include "bearch.h"
 #include "bestat.h"
 
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-
 /**
  * All scheduling info needed per node.
  */
@@ -656,6 +654,9 @@ static void add_tuple_projs(block_sched_env_t *env, ir_node *irn)
 
        assert(get_irn_mode(irn) == mode_T && "Mode of node must be tuple");
 
+       if(is_Bad(irn))
+               return;
+
        foreach_out_edge(irn, edge) {
                ir_node *out = edge->src;
 
@@ -698,6 +699,9 @@ static int is_root(ir_node *root, ir_node *block) {
 
                if (is_Block(succ))
                        continue;
+               /* Phi nodes are always in "another block */
+               if (is_Phi(succ))
+                       continue;
                if (get_nodes_block(succ) == block)
                        return 0;
        }