#include "irgwalk.h"
#include "irtools.h"
#include "array_t.h"
+#include "irpass_t.h"
// debug
#include "irdump.h"
f = val_i;
}
- mux = new_rd_Mux(cond_dbg, current_ir_graph, mux_block, sel, f, t, get_irn_mode(phi));
+ mux = new_rd_Mux(cond_dbg, mux_block, sel, f, t, get_irn_mode(phi));
DB((dbg, LEVEL_2, "Generating %+F for %+F\n", mux, phi));
}
#endif
return;
} else {
- rewire(block, i, j, new_r_Jmp(current_ir_graph, mux_block));
+ rewire(block, i, j, new_r_Jmp(mux_block));
goto restart;
}
}
free_cdep(irg);
}
+
+struct pass_t {
+ ir_graph_pass_t pass;
+ const ir_settings_if_conv_t *params;
+};
+
+/**
+ * Wrapper for running opt_if_conv() as an ir_graph pass.
+ */
+static int pass_wrapper(ir_graph *irg, void *context) {
+ struct pass_t *pass = context;
+ opt_if_conv(irg, pass->params);
+ return 0;
+} /* pass_wrapper */
+
+ir_graph_pass_t *opt_if_conv_pass(
+ const char *name, const ir_settings_if_conv_t *params)
+{
+ struct pass_t *pass = XMALLOCZ(struct pass_t);
+ pass->params = params;
+
+ return def_graph_pass_constructor(
+ &pass->pass, name ? name : "ifconv", pass_wrapper);
+}