aboutsummaryrefslogtreecommitdiff
path: root/gcc/passes.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2007-02-09 23:49:30 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2007-02-09 22:49:30 +0000
commit45a80bb9e800503749c797d4c57a4b6829ca9bf7 (patch)
treedd0cf0d6f5ee79e534f85b6bf4b3b2f75372bd8c /gcc/passes.c
parentf2477b062c9c639e5354ef705022a47dcb61e213 (diff)
downloadgcc-45a80bb9e800503749c797d4c57a4b6829ca9bf7.zip
gcc-45a80bb9e800503749c797d4c57a4b6829ca9bf7.tar.gz
gcc-45a80bb9e800503749c797d4c57a4b6829ca9bf7.tar.bz2
Makefile.in (passes.o, [...]): Add dependencies.
* Makefile.in (passes.o, ipa-inline.o): Add dependencies. * cgraphbuild.c (build_cgraph_edges): Compute frequencies. (rebuild_cgraph_edges): Likewise. * cgraph.c (cgraph_set_call_stmt): Add new argument frequency. (dump_cgraph_node): Dump frequencies. (cgraph_clone_edge): Add frequency scales. (cgraph_clone_node): Add freuqnecy. * cgraph.h (cgraph_edge): Add freuqnecy argument. (CGRAPH_FREQ_BASE, CGRAPH_FREQ_MAX): New constants. (cgraph_create_edge, cgraph_clone_edge, cgraph_clone_node): Update. * tree-pass.h (TODO_rebuild_frequencies): New constant. * cgraphunit.c (verify_cgraph_node): Verify frequencies. (cgraph_copy_node_for_versioning): Update call of cgraph_clone_edge. (save_inline_function_body): Likewise. * ipa-inline.c: inluce rtl.h (cgraph_clone_inlined_nods): Update call of cgraph_clone_node. (cgraph_edge_badness): Use frequencies. (cgraph_decide_recursive_inlining): Update clonning. (cgraph_decide_inlining_of_small_function): Dump frequency. * predict.c (estimate_bb_frequencies): Export. * predict.h (estimate_bb_frequencies): Declare. * tree-inline.c (copy_bb): Watch overflows. (expand_call_inline): Update call of cgraph_create_edge. (optimize_inline_calls): Use TODO flags to update frequnecies. * passes.h: Include predict.h (init_optimization_passes): Move profile ahead. (execute_function_todo): Handle TODO_rebuild_frequencies. From-SVN: r121780
Diffstat (limited to 'gcc/passes.c')
-rw-r--r--gcc/passes.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/passes.c b/gcc/passes.c
index 44ea3f9..35e4164 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -83,6 +83,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree-flow.h"
#include "tree-pass.h"
#include "tree-dump.h"
+#include "predict.h"
#if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
#include "dwarf2out.h"
@@ -493,6 +494,7 @@ init_optimization_passes (void)
NEXT_PASS (pass_merge_phi);
NEXT_PASS (pass_dce);
NEXT_PASS (pass_tail_recursion);
+ NEXT_PASS (pass_profile);
NEXT_PASS (pass_release_ssa_names);
}
NEXT_PASS (pass_rebuild_cgraph_edges);
@@ -540,7 +542,6 @@ init_optimization_passes (void)
NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_tail_recursion);
- NEXT_PASS (pass_profile);
NEXT_PASS (pass_ch);
NEXT_PASS (pass_stdarg);
NEXT_PASS (pass_lower_complex);
@@ -886,6 +887,24 @@ execute_function_todo (void *data)
fflush (dump_file);
}
+ if (flags & TODO_rebuild_frequencies)
+ {
+ if (profile_status == PROFILE_GUESSED)
+ {
+ loop_optimizer_init (0);
+ add_noreturn_fake_exit_edges ();
+ mark_irreducible_loops ();
+ connect_infinite_loops_to_exit ();
+ estimate_bb_frequencies ();
+ remove_fake_exit_edges ();
+ loop_optimizer_finalize ();
+ }
+ else if (profile_status == PROFILE_READ)
+ counts_to_freqs ();
+ else
+ gcc_unreachable ();
+ }
+
#if defined ENABLE_CHECKING
if (flags & TODO_verify_ssa)
verify_ssa (true);