X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=driver%2Ffirm_opt.c;h=f7ef189e7cd491dc6292345af0ecad702f03467a;hb=c29f6cc2814aaa0c7a3f25ff1785baf35dbf83f3;hp=637995ca0d02bc81887382b79b6037861c1d3fea;hpb=82d978b5f7ddefeea8123bc5da97677603056ceb;p=cparser diff --git a/driver/firm_opt.c b/driver/firm_opt.c index 637995c..f7ef189 100644 --- a/driver/firm_opt.c +++ b/driver/firm_opt.c @@ -309,6 +309,7 @@ static void do_optimize_funccalls(void) static void do_gcse(ir_graph *irg) { set_opt_global_cse(1); + optimize_graph_df(irg); place_code(irg); set_opt_global_cse(0); } @@ -330,7 +331,7 @@ static void do_stred(ir_graph *irg) static void do_inline(void) { - inline_functions(500, 50); + inline_functions(firm_opt.inline_maxsize, firm_opt.inline_threshold); } static void do_cloning(void) @@ -386,6 +387,7 @@ static opt_config_t opts[] = { { OPT_TARGET_IRG, "gvnpre", (func_ptr_t) do_gvn_pre, true, true, true, -1 }, { OPT_TARGET_IRG, "ifconv", (func_ptr_t) do_if_conv, true, true, true, TV_IF_CONV }, { OPT_TARGET_IRG, "bool", (func_ptr_t) opt_bool, true, true, true, -1 }, + { OPT_TARGET_IRG, "end-melt", (func_ptr_t) melt_end_blocks, true, true, true, TV_END_MELT }, { OPT_TARGET_IRG, "stred", (func_ptr_t) do_stred, true, true, true, TV_OSR }, { OPT_TARGET_IRG, "dead", (func_ptr_t) dead_node_elimination, true, false, true, TV_DEAD_NODE }, { OPT_TARGET_IRP, "inline", (func_ptr_t) do_inline, true, true, true, -1 }, @@ -478,6 +480,7 @@ static void do_firm_optimizations(const char *input_filename) set_opt_scalar_replacement(firm_opt.scalar_replace); set_opt_auto_create_sync(firm_opt.auto_sync); set_opt_alias_analysis(firm_opt.alias_analysis); + set_opt_combo(firm_opt.combo); aa_opt = aa_opt_no_opt; if (firm_opt.strict_alias) @@ -503,6 +506,7 @@ static void do_firm_optimizations(const char *input_filename) set_opt_enabled("gvnpre", firm_opt.gvn_pre); set_opt_enabled("ifconv", firm_opt.if_conversion); set_opt_enabled("bool", firm_opt.bool_opt); + set_opt_enabled("end-melt", firm_opt.end_melt); set_opt_enabled("inline", firm_opt.do_inline); set_opt_enabled("clone", firm_opt.cloning); set_opt_enabled("combo", firm_opt.combo); @@ -572,6 +576,7 @@ static void do_firm_optimizations(const char *input_filename) } do_irg_opt(irg, "bool"); + do_irg_opt(irg, "end-melt"); do_irg_opt(irg, "stred"); do_irg_opt(irg, "local"); do_irg_opt(irg, "dead"); @@ -842,14 +847,9 @@ static void do_firm_lowering(const char *input_filename) /* run reassociation first on all graphs BEFORE the architecture dependent optimizations are enabled */ for (i = get_irp_n_irgs() - 1; i >= 0; --i) { - current_ir_graph = get_irp_irg(i); - - timer_push(TV_REASSOCIATION); - optimize_reassociation(current_ir_graph); - timer_pop(); - DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, current_ir_graph, "reassoc"); - CHECK_ONE(firm_opt.check_all, current_ir_graph); - } + ir_graph *irg = get_irp_irg(i); + do_irg_opt(irg, "reassoc"); + } /* enable architecture dependent optimizations */ arch_dep_set_opts((arch_dep_opts_t) @@ -858,63 +858,23 @@ static void do_firm_lowering(const char *input_filename) (firm_opt.mods ? arch_dep_mod_by_const : arch_dep_none) )); for (i = get_irp_n_irgs() - 1; i >= 0; --i) { - current_ir_graph = get_irp_irg(i); - - if (firm_opt.gcse) - set_opt_global_cse(1); - - timer_push(TV_LOCAL_OPT); - optimize_graph_df(current_ir_graph); - timer_pop(); - DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, current_ir_graph, "lopt"); - if (! firm_opt.gcse) - CHECK_ONE(firm_opt.check_all, current_ir_graph); - - if (firm_opt.gcse) { - timer_push(TV_CODE_PLACE); - place_code(current_ir_graph); - set_opt_global_cse(0); - timer_pop(); - DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, current_ir_graph, "place"); - CHECK_ONE(firm_opt.check_all, current_ir_graph); - } - - timer_push(TV_LOAD_STORE); - optimize_load_store(current_ir_graph); - timer_pop(); - DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, current_ir_graph, "ldst"); - CHECK_ONE(firm_opt.check_all, current_ir_graph); - + ir_graph *irg = get_irp_irg(i); - timer_push(TV_LOCAL_OPT); - optimize_graph_df(current_ir_graph); - timer_pop(); - DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, current_ir_graph, "lopt"); + current_ir_graph = irg; - timer_push(TV_CF_OPT); - optimize_cf(current_ir_graph); - timer_pop(); - DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, current_ir_graph, "cf"); - CHECK_ONE(firm_opt.check_all, current_ir_graph); + do_irg_opt(irg, "local"); + do_irg_opt(irg, "gcse"); + do_irg_opt(irg, "ldst"); + do_irg_opt(irg, "local"); + do_irg_opt(irg, "controlflow"); if (firm_opt.if_conversion) { - timer_push(TV_IF_CONV); - opt_if_conv(current_ir_graph, if_conv_info); - timer_pop(); - DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, current_ir_graph, "if"); - CHECK_ONE(firm_opt.check_all, current_ir_graph); - - timer_push(TV_LOCAL_OPT); - optimize_graph_df(current_ir_graph); - timer_pop(); - timer_push(TV_CF_OPT); - optimize_cf(current_ir_graph); - timer_pop(); - DUMP_ONE_C(firm_dump.ir_graph && firm_dump.all_phases, current_ir_graph, "after_if"); - CHECK_ONE(firm_opt.check_all, current_ir_graph); - } + do_irg_opt(irg, "ifconv"); + do_irg_opt(irg, "local"); + do_irg_opt(irg, "controlflow"); + } - do_irg_opt(current_ir_graph, "sync"); + do_irg_opt(current_ir_graph, "sync"); } timer_stop(TV_ALL_OPT);