* @file ir/opt/ifconv.c
* @brief If conversion
* @author Christoph Mallon
- * @version $Id$
*/
#include "config.h"
#include "array_t.h"
#include "irpass_t.h"
#include "be.h"
-#include "opt_manage.h"
#include "irdump.h"
#include "debug.h"
mux_true = get_Phi_pred(p, i);
mux_false = get_Phi_pred(p, j);
}
- if (!env->allow_ifconv(sel, mux_false, mux_true)) {
+ if (mux_true == mux_false)
+ continue;
+ ir_mode *mode = get_irn_mode(mux_true);
+ if (mode == mode_M
+ || !env->allow_ifconv(sel, mux_false, mux_true)) {
supported = false;
break;
}
}
}
-static ir_graph_state_t do_ifconv(ir_graph *irg)
+void opt_if_conv(ir_graph *irg)
{
walker_env env;
const backend_params *be_params = be_get_backend_param();
+ assure_irg_properties(irg,
+ IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES
+ | IR_GRAPH_PROPERTY_NO_UNREACHABLE_CODE
+ | IR_GRAPH_PROPERTY_NO_BADS
+ | IR_GRAPH_PROPERTY_ONE_RETURN);
+
/* get the parameters */
env.allow_ifconv = be_params->allow_ifconv;
env.changed = false;
free_cdep(irg);
- return IR_GRAPH_STATE_NO_CRITICAL_EDGES | IR_GRAPH_STATE_ONE_RETURN;
-}
-
-static optdesc_t opt_ifconv = {
- "if-conversion",
- IR_GRAPH_STATE_NO_CRITICAL_EDGES | IR_GRAPH_STATE_NO_UNREACHABLE_CODE | IR_GRAPH_STATE_NO_BADS | IR_GRAPH_STATE_ONE_RETURN,
- do_ifconv,
-};
-
-void opt_if_conv(ir_graph *irg)
-{
- perform_irg_optimization(irg, &opt_ifconv);
+ confirm_irg_properties(irg,
+ IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES
+ | IR_GRAPH_PROPERTY_ONE_RETURN);
}
ir_graph_pass_t *opt_if_conv_pass(const char *name)