X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=driver%2Ffirm_opt.c;h=174a34a99757f3b5620252201efd3e3adec475ab;hb=2c26c7a7885635fc12bda81d06b334f9726a70df;hp=a105190cc9acb2651d56bf44097be03246a281b6;hpb=321d7bff758a89eee73d2d51f6c6c54dd9a60f96;p=cparser diff --git a/driver/firm_opt.c b/driver/firm_opt.c index a105190..174a34a 100644 --- a/driver/firm_opt.c +++ b/driver/firm_opt.c @@ -199,12 +199,6 @@ 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); @@ -273,7 +267,7 @@ static opt_config_t opts[] = { 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), @@ -401,6 +395,7 @@ static void enable_safe_defaults(void) set_opt_enabled("combo", true); set_opt_enabled("invert-loops", true); set_opt_enabled("target-lowering", true); + set_opt_enabled("rts", true); } /** @@ -410,7 +405,7 @@ static void enable_safe_defaults(void) */ 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); @@ -424,7 +419,6 @@ static void do_firm_optimizations(const char *input_filename) 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); @@ -544,29 +538,25 @@ static void do_firm_lowering(const char *input_filename) { 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); @@ -602,13 +592,6 @@ static void do_firm_lowering(const char *input_filename) 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"); } @@ -670,9 +653,6 @@ void gen_firm_init(void) 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); }