diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-09 22:49:30 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-09 22:49:30 +0000 |
commit | 4ae20857c0da0cab2fbed33d10d6b4d504aa9862 (patch) | |
tree | dd0cf0d6f5ee79e534f85b6bf4b3b2f75372bd8c /gcc/cgraph.c | |
parent | 9a6f4ddd99aa5db1bed9cfb733d52515f5e131af (diff) | |
download | gcc-4ae20857c0da0cab2fbed33d10d6b4d504aa9862.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121780 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 13b7fcd2938..87114e2ff13 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -324,7 +324,7 @@ cgraph_set_call_stmt (struct cgraph_edge *e, tree new_stmt) struct cgraph_edge * cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, - tree call_stmt, gcov_type count, int nest) + tree call_stmt, gcov_type count, int freq, int nest) { struct cgraph_edge *edge = GGC_NEW (struct cgraph_edge); #ifdef ENABLE_CHECKING @@ -362,6 +362,10 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, caller->callees = edge; callee->callers = edge; edge->count = count; + gcc_assert (count >= 0); + edge->frequency = freq; + gcc_assert (freq >= 0); + gcc_assert (freq <= CGRAPH_FREQ_MAX); edge->loop_nest = nest; if (caller->call_site_hash) { @@ -713,6 +717,9 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) if (edge->count) fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ", (HOST_WIDEST_INT)edge->count); + if (edge->frequency) + fprintf (f, "(%.2f per call) ", + edge->frequency / (double)CGRAPH_FREQ_BASE); if (!edge->inline_failed) fprintf(f, "(inlined) "); } @@ -727,6 +734,9 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) if (edge->count) fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ", (HOST_WIDEST_INT)edge->count); + if (edge->frequency) + fprintf (f, "(%.2f per call) ", + edge->frequency / (double)CGRAPH_FREQ_BASE); if (edge->loop_nest) fprintf (f, "(nested in %i loops) ", edge->loop_nest); } @@ -795,13 +805,16 @@ cgraph_function_possibly_inlined_p (tree decl) /* Create clone of E in the node N represented by CALL_EXPR the callgraph. */ struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, - tree call_stmt, gcov_type count_scale, int loop_nest, - bool update_original) + tree call_stmt, gcov_type count_scale, int freq_scale, + int loop_nest, bool update_original) { struct cgraph_edge *new; + gcov_type count = e->count * count_scale / REG_BR_PROB_BASE; + gcov_type freq = e->frequency * (gcov_type) freq_scale / CGRAPH_FREQ_BASE; - new = cgraph_create_edge (n, e->callee, call_stmt, - e->count * count_scale / REG_BR_PROB_BASE, + if (freq > CGRAPH_FREQ_MAX) + freq = CGRAPH_FREQ_MAX; + new = cgraph_create_edge (n, e->callee, call_stmt, count, freq, e->loop_nest + loop_nest); new->inline_failed = e->inline_failed; @@ -821,7 +834,7 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, function's profile to reflect the fact that part of execution is handled by node. */ struct cgraph_node * -cgraph_clone_node (struct cgraph_node *n, gcov_type count, int loop_nest, +cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, int loop_nest, bool update_original) { struct cgraph_node *new = cgraph_create_node (); @@ -853,7 +866,7 @@ cgraph_clone_node (struct cgraph_node *n, gcov_type count, int loop_nest, } for (e = n->callees;e; e=e->next_callee) - cgraph_clone_edge (e, new, e->call_stmt, count_scale, loop_nest, + cgraph_clone_edge (e, new, e->call_stmt, count_scale, freq, loop_nest, update_original); new->next_clone = n->next_clone; |