Create clean register requirements for Phis, otherwise reg_reqs_equal() and maybe...
[libfirm] / ir / opt / opt_blocks.c
index 93fee8b..ec5c499 100644 (file)
@@ -37,6 +37,7 @@
 #include "trouts.h"
 #include "irgwalk.h"
 #include "set.h"
+#include "irpass.h"
 #include "debug.h"
 
 /* define this for general block shaping: congruent blocks
@@ -826,7 +827,7 @@ static void apply(ir_graph *irg, partition_t *part) {
                if (is_op_forking(cfop)) {
                        /* a critical edge */
                        ir_node *block = new_r_Block(irg, 1, &ins[i]);
-                       ir_node *jmp   = new_r_Jmp(irg, block);
+                       ir_node *jmp   = new_r_Jmp(block);
                        ins[i] = jmp;
                }
        }
@@ -845,7 +846,7 @@ static void apply(ir_graph *irg, partition_t *part) {
        for (repr_pair = repr->input_pairs; repr_pair != NULL; repr_pair = repr_pair->next) {
                ir_node *input = get_irn_n(repr_pair->irn, repr_pair->index);
                ir_mode *mode  = get_irn_mode(input);
-               ir_node *phi   = new_r_Phi(current_ir_graph, block, n, repr_pair->ins, mode);
+               ir_node *phi   = new_r_Phi(block, n, repr_pair->ins, mode);
 
                set_irn_n(repr_pair->irn, repr_pair->index, phi);
                DEL_ARR_F(repr_pair->ins);
@@ -1088,8 +1089,8 @@ static void check_for_cf_meet(ir_node *block, void *ctx) {
  * Compare two nodes for root ordering.
  */
 static int cmp_nodes(const void *a, const void *b) {
-       ir_node *const *pa     = a;
-       ir_node *const *pb     = b;
+       const ir_node *const *pa = a;
+       const ir_node *const *pb = b;
        const ir_node  *irn_a  = *pa;
        const ir_node  *irn_b  = *pb;
        ir_opcode      code_a  = get_irn_opcode(irn_a);
@@ -1258,3 +1259,7 @@ int shape_blocks(ir_graph *irg) {
 
        return res;
 }  /* shape_blocks */
+
+ir_graph_pass_t *shape_blocks_pass(const char *name) {
+       return def_graph_pass_ret(name ? name : "shape_blocks", shape_blocks);
+}  /* shape_blocks_pass */