- representing the 3-state visibility (default,local,external) with 2 bits was
[libfirm] / ir / be / beflags.c
index cb1e068..0a3871a 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;
@@ -146,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;
        }
@@ -173,8 +173,10 @@ static void rematerialize_or_move(ir_node *flags_needed, ir_node *node,
                        get_nodes_block(node) != get_nodes_block(flags_needed)) {
                int i;
 
-               for (i = get_irn_arity(copy) - 1; i >= 0; --i) {
-                       be_liveness_update(lv, get_irn_n(copy, i));
+               if (lv != NULL) {
+                       for (i = get_irn_arity(copy) - 1; i >= 0; --i) {
+                               be_liveness_update(lv, get_irn_n(copy, i));
+                       }
                }
        }
 }