#include "irflag_t.h"
#include "firmstat.h"
+#include "irpass.h"
#include "iropt_dbg.h"
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());
/* 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) {
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;
} 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;
} 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;
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 */