cleanup backend: make pre_spill_prepare_constraint independent of chordal allocator...
[libfirm] / ir / be / beflags.c
index 19af144..43d7138 100644 (file)
@@ -35,9 +35,7 @@
  * spilled. So in some situations (for example 2 adc-nodes that use the flags of
  * a single add node on x86) operations have to be repeated to work correctly.
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "irgwalk.h"
 #include "irnode_t.h"
@@ -74,7 +72,7 @@ static ir_node *default_remat(ir_node *node, ir_node *after)
 }
 
 /**
- * tests wether we can legally move node node after node after
+ * tests whether we can legally move node node after node after
  * (only works for nodes in same block)
  */
 static int can_move(ir_node *node, ir_node *after)
@@ -93,15 +91,15 @@ static int can_move(ir_node *node, ir_node *after)
                        assert(get_irn_n_edges_kind(out, EDGE_KIND_DEP) == 0);
                        foreach_out_edge(out, edge2) {
                                ir_node *out2 = get_edge_src_irn(edge2);
-                               /* phi represents a usage at block end */
-                               if(is_Phi(out2))
+                               /* Phi or End represents a usage at block end. */
+                               if(is_Phi(out2) || is_End(out2))
                                        continue;
                                if(is_Sync(out2)) {
                                        const ir_edge_t *edge3;
                                        foreach_out_edge(out2, edge3) {
                                                ir_node *out3 = get_edge_src_irn(edge3);
-                                               /* phi represents a usage at block end */
-                                               if(is_Phi(out3))
+                                               /* Phi or End represents a usage at block end. */
+                                               if(is_Phi(out3) || is_End(out3))
                                                        continue;
                                                assert(!is_Sync(out3));
                                                if(sched_get_time_step(out3) <= sched_get_time_step(after)) {
@@ -148,8 +146,7 @@ static void rematerialize_or_move(ir_node *flags_needed, ir_node *node,
        if(get_irn_mode(copy) == mode_T) {
                ir_node *block = get_nodes_block(copy);
                ir_mode *mode  = flag_class->mode;
-               value = new_rd_Proj(NULL, current_ir_graph, block,
-                                                       copy, mode, pn);
+               value = new_rd_Proj(NULL, block, copy, mode, pn);
        } else {
                value = copy;
        }