diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-03 01:12:56 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-03 01:12:56 +0000 |
commit | f517b36eec084c177098f54c4755ab7222fb7e2f (patch) | |
tree | 8220e38043cf20d1777f9ce1815232f73e5df606 /gcc/tree-optimize.c | |
parent | c07348604b30e10f5570aeed66a06884a7a24dc3 (diff) | |
download | gcc-f517b36eec084c177098f54c4755ab7222fb7e2f.tar.gz |
* gcc.dg/pr16194.c: We now output error on all three functions, not just
first one.
* cgraph.c: Include tree-flow.h
(cgraph_add_new-function): Handle IPA_SSA mode; execute
early_local_passes.
* cgraph.h (enum cgraph_state): Add CGRAPH_STATE_IPA_SSA.
* tree-pass.h (pass_all_early_optimizations): Declare.
* cgraphunit.c (cgraph_process_new_functions): Add IPA_SSA; execute
early_local_passes.
(cgraph_analyze_function): Do early_local_passes.
* tree-mudflap.c (mf_decl_cache_locals, mf_build_check_statement_for):
Do not add referenced vars.
* tree-optimize.c (gate_all_optimizations): Do not execute when not in
SSA form.
(gate_all_early_local_passes): New gate.
(pass_early_local_passes): Use new gate.
(execute_early_local_optimizations): New functions.
(gate_all_early_optimizations): New gate.
(pass_all_early_optimizations): New pass.
(execute_free_datastructures): Free SSA only when initialized.
(gate_init_datastructures): Init only when optimizing.
(tree_lowering_passes): Do early local passes when called late.
* tree-profile.c (do_tree_profiling): Don't profile functions added
late.
(do_early_tree_profiling, pass_early_tree_profile): Kill.
* tree-cfg.c (update_modified_stmts): Do not update when operands are
not active.
* passes.c (init_optimizations_passes): Reorder so we go into SSA
during early_local_passes.
* Makefile.in (cgraph.o): Add dependency on tree-flow.h.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120373 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-optimize.c')
-rw-r--r-- | gcc/tree-optimize.c | 69 |
1 files changed, 63 insertions, 6 deletions
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 463349293e4..5be07cb07c5 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -57,8 +57,9 @@ static bool gate_all_optimizations (void) { return (optimize >= 1 - /* Don't bother doing anything if the program has errors. */ - && !(errorcount || sorrycount)); + /* Don't bother doing anything if the program has errors. + We have to pass down the queue if we already went into SSA */ + && (!(errorcount || sorrycount) || gimple_in_ssa_p (cfun))); } struct tree_opt_pass pass_all_optimizations = @@ -78,10 +79,19 @@ struct tree_opt_pass pass_all_optimizations = 0 /* letter */ }; +/* Gate: execute, or not, all of the non-trivial optimizations. */ + +static bool +gate_all_early_local_passes (void) +{ + /* Don't bother doing anything if the program has errors. */ + return (!errorcount && !sorrycount); +} + struct tree_opt_pass pass_early_local_passes = { - NULL, /* name */ - gate_all_optimizations, /* gate */ + "early_local_cleanups", /* name */ + gate_all_early_local_passes, /* gate */ NULL, /* execute */ NULL, /* sub */ NULL, /* next */ @@ -95,6 +105,41 @@ struct tree_opt_pass pass_early_local_passes = 0 /* letter */ }; +static unsigned int +execute_early_local_optimizations (void) +{ + if (flag_unit_at_a_time) + cgraph_state = CGRAPH_STATE_IPA_SSA; + return 0; +} + +/* Gate: execute, or not, all of the non-trivial optimizations. */ + +static bool +gate_all_early_optimizations (void) +{ + return (optimize >= 1 + /* Don't bother doing anything if the program has errors. */ + && !(errorcount || sorrycount)); +} + +struct tree_opt_pass pass_all_early_optimizations = +{ + "early_optimizations", /* name */ + gate_all_early_optimizations, /* gate */ + execute_early_local_optimizations, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + /* Pass: cleanup the CFG just before expanding trees to RTL. This is just a round of label cleanups and case node grouping because after the tree optimizers have run such cleanups may @@ -170,7 +215,8 @@ execute_free_datastructures (void) /* Remove the ssa structures. Do it here since this includes statement annotations that need to be intact during disband_implicit_edges. */ - delete_tree_ssa (); + if (cfun->gimple_df) + delete_tree_ssa (); return 0; } @@ -376,10 +422,18 @@ execute_init_datastructures (void) return 0; } +/* Gate: initialize or not the SSA datastructures. */ + +static bool +gate_init_datastructures (void) +{ + return (optimize >= 1); +} + struct tree_opt_pass pass_init_datastructures = { NULL, /* name */ - NULL, /* gate */ + gate_init_datastructures, /* gate */ execute_init_datastructures, /* execute */ NULL, /* sub */ NULL, /* next */ @@ -403,7 +457,10 @@ tree_lowering_passes (tree fn) tree_register_cfg_hooks (); bitmap_obstack_initialize (NULL); execute_pass_list (all_lowering_passes); + if (optimize && cgraph_global_info_ready) + execute_pass_list (pass_early_local_passes.sub); free_dominance_info (CDI_POST_DOMINATORS); + free_dominance_info (CDI_DOMINATORS); compact_blocks (); current_function_decl = saved_current_function_decl; bitmap_obstack_release (NULL); |