diff options
author | Richard Guenther <rguenther@suse.de> | 2012-09-19 09:29:57 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-09-19 09:29:57 +0000 |
commit | bf7a718571e1722ec2aad8e0bfc337dc597ac2d2 (patch) | |
tree | 4dffe7fee5a1a31e84a3c34642c6d71e05ef8e5c /gcc/passes.c | |
parent | f20132e7aefa8b3615154925559dd19f204c8eca (diff) | |
download | gcc-bf7a718571e1722ec2aad8e0bfc337dc597ac2d2.zip gcc-bf7a718571e1722ec2aad8e0bfc337dc597ac2d2.tar.gz gcc-bf7a718571e1722ec2aad8e0bfc337dc597ac2d2.tar.bz2 |
re PR other/53316 (Introduce -Og)
2012-09-19 Richard Guenther <rguenther@suse.de>
PR other/53316
* common.opt (optimize_debug): New variable.
(Og): New optimization level.
* doc/invoke.texi (Og): Document.
* opts.c (maybe_default_option): Add debug parameter.
(maybe_default_options): Likewise.
(default_options_optimization): Handle -Og.
(common_handle_option): Likewise.
* passes.c (gate_all_optimizations): Do not run with -Og.
(gate_all_optimizations_g): New gate, run with -Og.
(pass_all_optimizations_g): New container pass, run with -Og.
(init_optimization_passes): Schedule pass_all_optimizations_g
alongside pass_all_optimizations.
From-SVN: r191464
Diffstat (limited to 'gcc/passes.c')
-rw-r--r-- | gcc/passes.c | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/gcc/passes.c b/gcc/passes.c index a47068d..c96d533 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -337,10 +337,7 @@ static struct gimple_opt_pass pass_all_early_optimizations = static bool gate_all_optimizations (void) { - return (optimize >= 1 - /* Don't bother doing anything if the program has errors. - We have to pass down the queue if we already went into SSA */ - && (!seen_error () || gimple_in_ssa_p (cfun))); + return optimize >= 1 && !optimize_debug; } static struct gimple_opt_pass pass_all_optimizations = @@ -362,6 +359,33 @@ static struct gimple_opt_pass pass_all_optimizations = } }; +/* Gate: execute, or not, all of the non-trivial optimizations. */ + +static bool +gate_all_optimizations_g (void) +{ + return optimize >= 1 && optimize_debug; +} + +static struct gimple_opt_pass pass_all_optimizations_g = +{ + { + GIMPLE_PASS, + "*all_optimizations_g", /* name */ + gate_all_optimizations_g, /* gate */ + NULL, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_OPTIMIZE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0 /* todo_flags_finish */ + } +}; + static bool gate_rest_of_compilation (void) { @@ -1494,6 +1518,29 @@ init_optimization_passes (void) NEXT_PASS (pass_uncprop); NEXT_PASS (pass_local_pure_const); } + NEXT_PASS (pass_all_optimizations_g); + { + struct opt_pass **p = &pass_all_optimizations_g.pass.sub; + NEXT_PASS (pass_remove_cgraph_callee_edges); + NEXT_PASS (pass_strip_predict_hints); + /* Lower remaining pieces of GIMPLE. */ + NEXT_PASS (pass_lower_complex); + NEXT_PASS (pass_lower_vector_ssa); + /* Perform simple scalar cleanup which is constant/copy propagation. */ + NEXT_PASS (pass_ccp); + NEXT_PASS (pass_copy_prop); + NEXT_PASS (pass_rename_ssa_copies); + NEXT_PASS (pass_dce); + /* Fold remaining builtins. */ + NEXT_PASS (pass_object_sizes); + NEXT_PASS (pass_fold_builtins); + /* ??? We do want some kind of loop invariant motion, but we possibly + need to adjust LIM to be more friendly towards preserving accurate + debug information here. */ + NEXT_PASS (pass_late_warn_uninitialized); + NEXT_PASS (pass_uncprop); + NEXT_PASS (pass_local_pure_const); + } NEXT_PASS (pass_tm_init); { struct opt_pass **p = &pass_tm_init.pass.sub; |