Start block isn't a special case anymore (and now get the old node nr).
[libfirm] / ir / be / beflags.c
index 0016f8a..a4cf30b 100644 (file)
 #include "error.h"
 
 #include "beflags.h"
-#include "bearch_t.h"
-#include "beirg_t.h"
-#include "besched_t.h"
-#include "benode_t.h"
+#include "bearch.h"
+#include "beirg.h"
+#include "besched.h"
+#include "benode.h"
+#include "belive.h"
 
 static const arch_register_class_t *flag_class = NULL;
 static const arch_register_t       *flags_reg  = NULL;
@@ -91,18 +92,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))
-                                       continue;
-                               /* ignore End keeps */
-                               if (is_End(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)) {
@@ -149,8 +147,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;
        }