proc_cloning((float) firm_opt.clone_threshold);
}
-static void do_lower_switch(ir_graph *irg)
-{
- lower_switch(irg, firm_opt.spare_size);
-}
-
static void do_lower_mux(ir_graph *irg)
{
lower_mux(irg, NULL);
}
-static void do_lower_for_target(void)
-{
- const backend_params *be_params = be_get_backend_param();
- be_params->lower_for_target();
-}
-
static void do_vrp(ir_graph *irg)
{
set_vrp_data(irg);
IRG("local", optimize_graph_df, "local graph optimizations", OPT_FLAG_HIDE_OPTIONS),
IRG("lower", do_lower_highlevel, "lowering", OPT_FLAG_HIDE_OPTIONS | OPT_FLAG_ESSENTIAL),
IRG("lower-mux", do_lower_mux, "mux lowering", OPT_FLAG_NONE),
- IRG("lower-switch", do_lower_switch, "switch lowering", OPT_FLAG_HIDE_OPTIONS | OPT_FLAG_ESSENTIAL),
- IRG("one-return", normalize_one_return, "normalisation to 1 return", OPT_FLAG_HIDE_OPTIONS | OPT_FLAG_NO_DUMP | OPT_FLAG_NO_VERIFY),
IRG("opt-load-store", optimize_load_store, "load store optimization", OPT_FLAG_NONE),
IRG("opt-tail-rec", opt_tail_rec_irg, "tail-recursion eliminiation", OPT_FLAG_NONE),
IRG("parallelize-mem", opt_parallelize_mem, "parallelize memory", OPT_FLAG_NONE),
IRG("vrp", do_vrp, "value range propagation", OPT_FLAG_NONE),
IRP("inline", do_inline, "inlining", OPT_FLAG_NONE),
IRP("lower-const", lower_const_code, "lowering of constant code", OPT_FLAG_HIDE_OPTIONS | OPT_FLAG_NO_DUMP | OPT_FLAG_NO_VERIFY | OPT_FLAG_ESSENTIAL),
- IRP("target-lowering", do_lower_for_target, "lowering necessary for target architecture", OPT_FLAG_HIDE_OPTIONS | OPT_FLAG_ESSENTIAL),
+ IRP("target-lowering", be_lower_for_target, "lowering necessary for target architecture", OPT_FLAG_HIDE_OPTIONS | OPT_FLAG_ESSENTIAL),
IRP("opt-func-call", do_optimize_funccalls, "function call optimization", OPT_FLAG_NONE),
IRP("opt-proc-clone", do_cloning, "procedure cloning", OPT_FLAG_NONE),
IRP("remove-unused", garbage_collect_entities, "removal of unused functions/variables", OPT_FLAG_NO_DUMP | OPT_FLAG_NO_VERIFY),
set_opt_enabled("remove-confirms", true);
set_opt_enabled("ivopts", true);
set_opt_enabled("dead", true);
- set_opt_enabled("lower-switch", true);
set_opt_enabled("remove-phi-cycles", true);
set_opt_enabled("frame", true);
set_opt_enabled("combo", true);
set_opt_enabled("invert-loops", true);
set_opt_enabled("target-lowering", true);
+ set_opt_enabled("rts", true);
}
/**
*/
static void do_firm_optimizations(const char *input_filename)
{
- int i;
+ size_t i;
unsigned aa_opt;
set_opt_alias_analysis(firm_opt.alias_analysis);
set_irp_memory_disambiguator_options(aa_opt);
/* parameter passing code should set them directly sometime... */
- set_opt_enabled("rts", !firm_opt.freestanding);
set_opt_enabled("gcse", firm_opt.gcse);
set_opt_enabled("place", !firm_opt.gcse);
set_opt_enabled("confirm", firm_opt.confirm);
do_irg_opt(irg, "bool");
do_irg_opt(irg, "shape-blocks");
- do_irg_opt(irg, "lower-switch");
do_irg_opt(irg, "ivopts");
do_irg_opt(irg, "local");
do_irg_opt(irg, "dead");
{
int i;
+ /* enable architecture dependent optimizations */
+ arch_dep_set_opts((arch_dep_opts_t)
+ ((firm_opt.muls ? arch_dep_mul_to_shift : arch_dep_none) |
+ (firm_opt.divs ? arch_dep_div_by_const : arch_dep_none) |
+ (firm_opt.mods ? arch_dep_mod_by_const : arch_dep_none) ));
+ for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
+ ir_graph *irg = get_irp_irg(i);
+ do_irg_opt(irg, "reassociation");
+ do_irg_opt(irg, "local");
+ }
+
do_irp_opt("target-lowering");
if (firm_dump.statistic & STAT_AFTER_LOWER)
stat_dump_snapshot(input_filename, "low");
- dump_all("low");
-
if (firm_opt.enabled) {
timer_start(t_all_opt);
- /* run reassociation first on all graphs BEFORE the architecture
- dependent optimizations are enabled */
- for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
- ir_graph *irg = get_irp_irg(i);
- do_irg_opt(irg, "reassociation");
- }
-
- /* enable architecture dependent optimizations */
- arch_dep_set_opts((arch_dep_opts_t)
- ((firm_opt.muls ? arch_dep_mul_to_shift : arch_dep_none) |
- (firm_opt.divs ? arch_dep_div_by_const : arch_dep_none) |
- (firm_opt.mods ? arch_dep_mod_by_const : arch_dep_none) ));
-
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
ir_graph *irg = get_irp_irg(i);
if (firm_opt.cc_opt)
mark_private_methods();
- /* set the phase to low */
- for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
- ir_graph *irg = get_irp_irg(i);
- set_irg_phase_state(irg, phase_low);
- }
- set_irp_phase_state(phase_low);
-
if (firm_dump.statistic & STAT_FINAL) {
stat_dump_snapshot(input_filename, "final");
}
set_opt_cse(firm_opt.cse);
set_opt_global_cse(0);
set_opt_unreachable_code(1);
- set_opt_control_flow(firm_opt.control_flow);
- set_opt_control_flow_weak_simplification(1);
- set_opt_control_flow_strong_simplification(1);
} else {
set_optimize(0);
}