X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fcfopt.c;h=76160e58da0a081a3a2ae6965695759fc59ff7b5;hb=1852308bd33b77378f0fca9e5347d4f9082464c4;hp=aaa043e00e2562ef76dbb3898acb9107f0f9bfb3;hpb=80d22a2b8ed15af53c7134a3025da89ccb1923ca;p=libfirm diff --git a/ir/opt/cfopt.c b/ir/opt/cfopt.c index aaa043e00..76160e58d 100644 --- a/ir/opt/cfopt.c +++ b/ir/opt/cfopt.c @@ -50,6 +50,7 @@ #include "irflag_t.h" #include "firmstat.h" +#include "irpass.h" #include "iropt_dbg.h" @@ -102,7 +103,7 @@ static int remove_senseless_conds(ir_node *bl) { ir_node *cond_j = skip_Proj(pred_j); if (cond_j == cond_i) { - ir_node *jmp = new_r_Jmp(current_ir_graph, get_nodes_block(cond_i)); + ir_node *jmp = new_r_Jmp(get_nodes_block(cond_i)); set_irn_n(bl, i, jmp); set_irn_n(bl, j, new_Bad()); @@ -627,7 +628,7 @@ static int handle_switch_cond(ir_node *cond) { /* this Cond has only one Proj: must be the defProj */ assert(get_Cond_default_proj(cond) == get_Proj_proj(proj1)); /* convert it into a Jmp */ - jmp = new_r_Jmp(current_ir_graph, blk); + jmp = new_r_Jmp(blk); exchange(proj1, jmp); return 1; } else if (get_irn_link(proj2) == NULL) { @@ -643,7 +644,7 @@ static int handle_switch_cond(ir_node *cond) { if (def_num == get_Proj_proj(proj1)) { /* first one is the defProj */ if (num == get_Proj_proj(proj2)) { - jmp = new_r_Jmp(current_ir_graph, blk); + jmp = new_r_Jmp(blk); exchange(proj2, jmp); exchange(proj1, new_Bad()); return 1; @@ -651,7 +652,7 @@ static int handle_switch_cond(ir_node *cond) { } else if (def_num == get_Proj_proj(proj2)) { /* second one is the defProj */ if (num == get_Proj_proj(proj1)) { - jmp = new_r_Jmp(current_ir_graph, blk); + jmp = new_r_Jmp(blk); exchange(proj1, jmp); exchange(proj2, new_Bad()); return 1; @@ -659,12 +660,12 @@ static int handle_switch_cond(ir_node *cond) { } else { /* neither: strange, Cond was not optimized so far */ if (num == get_Proj_proj(proj1)) { - jmp = new_r_Jmp(current_ir_graph, blk); + jmp = new_r_Jmp(blk); exchange(proj1, jmp); exchange(proj2, new_Bad()); return 1; } else if (num == get_Proj_proj(proj2)) { - jmp = new_r_Jmp(current_ir_graph, blk); + jmp = new_r_Jmp(blk); exchange(proj2, jmp); exchange(proj1, new_Bad()); return 1; @@ -873,3 +874,9 @@ restart: current_ir_graph = rem; } + +/* Creates an ir_graph pass for optimize_cf. */ +ir_graph_pass_t *optimize_cf_pass(const char *name) +{ + return def_graph_pass(name ? name : "optimize_cf", optimize_cf); +} /* optimize_cf_pass */