diff options
author | Jan Hubicka <jh@suse.cz> | 2005-05-19 12:38:42 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2005-05-19 10:38:42 +0000 |
commit | e42922b1ae4c3da94882d3a92ce978a0db123064 (patch) | |
tree | 1d011084a5002e1aadab35d8ef841e441fb68211 /gcc/cgraph.c | |
parent | eef16504e21f8d504b6a648cf73955e977d5adf6 (diff) | |
download | gcc-e42922b1ae4c3da94882d3a92ce978a0db123064.tar.gz |
basic-block.h (REG_BR_PROB_BASE): Define.
* basic-block.h (REG_BR_PROB_BASE): Define.
* cgraph.c (cgraph_create_edge): Initialize loop_nest and count.
(dump_cgraph_node): Dump count.
(cgraph_clone_edge): Rescale counts.
(cgraph_clone_node): Likewise.
* cgraph.h: Include basic-block.h
(cgraph_node): Add count.
(cgraph_edge): Add count and loop_nest.
(cgraph_node, cgraph_edge, cgraph_clone_edge, cgraph_clone_node):
Update prototypes.
* cgraphunit.c: Kill now redundant inlining comment.
(cgraph_create_edges): Make static, maintain current basic block;
fix pasto.
(record_call_1): Fill in new fields.
* ipa-inline.c (cgraph_clone_inlined_nodes): Update call of
cgraph_clone_node.
(cgraph_decide_recursive_inlining): Likewise.
* rtl.h (REG_BR_PROB_BASE): Kill.
* tree-inline.c (copy_body_r): Update call of cgraph_clone_edge.
(expand_call_inline): Update call of cgraph_create_edge.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
From-SVN: r99976
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index adef0bd09ce..c2509ffc033 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -275,7 +275,7 @@ cgraph_edge (struct cgraph_node *node, tree call_expr) struct cgraph_edge * cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, - tree call_expr) + tree call_expr, gcov_type count, int nest) { struct cgraph_edge *edge = ggc_alloc (sizeof (struct cgraph_edge)); #ifdef ENABLE_CHECKING @@ -312,6 +312,8 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, caller->callees->prev_callee = edge; caller->callees = edge; callee->callers = edge; + edge->count = count; + edge->loop_nest = nest; return edge; } @@ -559,6 +561,9 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) fprintf (f, " (inline copy in %s/%i)", cgraph_node_name (node->global.inlined_to), node->global.inlined_to->uid); + if (node->count) + fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x", + (HOST_WIDEST_INT)node->count); if (node->local.self_insns) fprintf (f, " %i insns", node->local.self_insns); if (node->global.insns && node->global.insns != node->local.self_insns) @@ -587,6 +592,9 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) { fprintf (f, "%s/%i ", cgraph_node_name (edge->caller), edge->caller->uid); + if (edge->count) + fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ", + (HOST_WIDEST_INT)edge->count); if (!edge->inline_failed) fprintf(f, "(inlined) "); } @@ -829,20 +837,28 @@ 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_expr) +cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, + tree call_expr, int count_scale, int loop_nest) { - struct cgraph_edge *new = cgraph_create_edge (n, e->callee, call_expr); + struct cgraph_edge *new; + + new = cgraph_create_edge (n, e->callee, call_expr, + e->count * count_scale / REG_BR_PROB_BASE, + e->loop_nest + loop_nest); new->inline_failed = e->inline_failed; + e->count -= new->count; return new; } -/* Create node representing clone of N. */ +/* Create node representing clone of N executed COUNT times. Decrease + the execution counts from original node too. */ struct cgraph_node * -cgraph_clone_node (struct cgraph_node *n) +cgraph_clone_node (struct cgraph_node *n, gcov_type count, int loop_nest) { struct cgraph_node *new = cgraph_create_node (); struct cgraph_edge *e; + int count_scale; new->decl = n->decl; new->origin = n->origin; @@ -855,9 +871,15 @@ cgraph_clone_node (struct cgraph_node *n) new->local = n->local; new->global = n->global; new->rtl = n->rtl; + new->count = count; + if (n->count) + count_scale = new->count * REG_BR_PROB_BASE / n->count; + else + count_scale = 0; + n->count -= count; for (e = n->callees;e; e=e->next_callee) - cgraph_clone_edge (e, new, e->call_expr); + cgraph_clone_edge (e, new, e->call_expr, count_scale, loop_nest); new->next_clone = n->next_clone; new->prev_clone = n; |