diff options
author | Jan Hubicka <jh@suse.cz> | 2003-08-16 13:04:59 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2003-08-16 11:04:59 +0000 |
commit | e767b5be438a67c59f8f23b6214fcbb7183a8092 (patch) | |
tree | df38d256a957a8ffd8b53d92a0e7ccf9f23354bc /gcc/cgraphunit.c | |
parent | 5ab7486eee0b529d1561533e0b1216c33b652621 (diff) | |
download | gcc-e767b5be438a67c59f8f23b6214fcbb7183a8092.zip gcc-e767b5be438a67c59f8f23b6214fcbb7183a8092.tar.gz gcc-e767b5be438a67c59f8f23b6214fcbb7183a8092.tar.bz2 |
i386.c (ix86_fntype_regparm): Rename from ...
* i386.c (ix86_fntype_regparm): Rename from ...
(ix86_function_regparm): ... this one; add fastcall and local
functions.
(ix86_function_ok_for_sibcall): Update.
(ix86_return_pops_args): Likewise.
(init_cumulative_args): Likewise.
(x86_can_output_mi_thunk): Likewise.
(function_arg): Fix formating.
(x86_this_parameter): Fix fastcall.
(x86_output_mi_thunk): Likewise.
* cgraph.c (cgraph_mark_needed_node): Do not mark functions without
body as reachable; mark nested functions as needed too.
(dump_cgraph): Do not output global.calls.
* cgraph.h (cgraph_global_info): Kill.
* cgraphunit.c (cgraph_finalize_function): Enqueue needed functions.
(record_call_1): Speedup.
(cgraph_analyze_function): Break out from ...; compute inlining
parameters.
(cgraph_finalize_compilation_unit): ... here.
(cgraph_mark_inline): Kill computation of calls.
(cgraph_decide_inlining): Do not compute most of initial values.
From-SVN: r70504
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r-- | gcc/cgraphunit.c | 104 |
1 files changed, 50 insertions, 54 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index b75c717..faf6850 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -65,6 +65,10 @@ cgraph_finalize_function (tree decl, tree body ATTRIBUTE_UNUSED) node->decl = decl; node->local.finalized = true; + /* Function now has DECL_SAVED_TREE set. Enqueue it into cgraph_nodes_queue + if needed. */ + if (node->needed) + cgraph_mark_needed_node (node, 0); if (/* Externally visible functions must be output. The exception are COMDAT functions that must be output only when they are needed. Similarly are handled deferred functions and @@ -122,6 +126,10 @@ record_call_1 (tree *tp, int *walk_subtrees, void *data) *walk_subtrees = 0; } } + /* Save some cycles by not walking types and declaration as we won't find anything + usefull there anyway. */ + if (DECL_P (*tp) || TYPE_P (*tp)) + *walk_subtrees = 0; return NULL; } @@ -135,13 +143,46 @@ cgraph_create_edges (tree decl, tree body) walk_tree_without_duplicates (&body, record_call_1, decl); } +/* Analyze the function scheduled to be output. */ +static void +cgraph_analyze_function (struct cgraph_node *node) +{ + tree decl = node->decl; + + if (lang_hooks.callgraph.lower_function) + (*lang_hooks.callgraph.lower_function) (decl); + + current_function_decl = node->decl; + + /* First kill forward declaration so reverse inlining works properly. */ + cgraph_create_edges (decl, DECL_SAVED_TREE (decl)); + + node->local.inlinable = tree_inlinable_function_p (decl); + if (!DECL_ESTIMATED_INSNS (decl)) + DECL_ESTIMATED_INSNS (decl) + = (*lang_hooks.tree_inlining.estimate_num_insns) (decl); + node->local.self_insns = DECL_ESTIMATED_INSNS (decl); + if (node->local.inlinable) + node->local.disregard_inline_limits + = (*lang_hooks.tree_inlining.disregard_inline_limits) (decl); + + /* Inlining characteristics are maintained by the cgraph_mark_inline. */ + node->global.insns = node->local.self_insns; + if (!DECL_EXTERNAL (node->decl)) + { + node->global.cloned_times = 1; + node->global.will_be_output = true; + } + + node->lowered = true; +} + /* Analyze the whole compilation unit once it is parsed completely. */ void cgraph_finalize_compilation_unit (void) { struct cgraph_node *node; - struct cgraph_edge *edge; cgraph_varpool_assemble_pending_decls (); if (!quiet_flag) @@ -163,6 +204,7 @@ cgraph_finalize_compilation_unit (void) method table generation for instance). */ while (cgraph_nodes_queue) { + struct cgraph_edge *edge; tree decl = cgraph_nodes_queue->decl; node = cgraph_nodes_queue; @@ -171,38 +213,12 @@ cgraph_finalize_compilation_unit (void) if (node->lowered || !node->reachable || !DECL_SAVED_TREE (decl)) abort (); - if (lang_hooks.callgraph.lower_function) - (*lang_hooks.callgraph.lower_function) (decl); - - current_function_decl = node->decl; - - /* At the moment frontend automatically emits all nested functions. */ - if (node->nested) - { - struct cgraph_node *node2; - - for (node2 = node->nested; node2; node2 = node2->next_nested) - if (!node2->reachable) - cgraph_mark_needed_node (node2, 0); - } - - /* First kill forward declaration so reverse inlining works properly. */ - cgraph_create_edges (decl, DECL_SAVED_TREE (decl)); - - node->local.inlinable = tree_inlinable_function_p (decl); - DECL_ESTIMATED_INSNS (decl) - = (*lang_hooks.tree_inlining.estimate_num_insns) (decl); - node->local.self_insns = DECL_ESTIMATED_INSNS (decl); - if (node->local.inlinable) - node->local.disregard_inline_limits - = (*lang_hooks.tree_inlining.disregard_inline_limits) (decl); - + cgraph_analyze_function (node); for (edge = node->callees; edge; edge = edge->next_callee) - { - if (!edge->callee->reachable) - cgraph_mark_needed_node (edge->callee, 0); - } - node->lowered = true; + { + if (!edge->callee->reachable) + cgraph_mark_needed_node (edge->callee, 0); + } cgraph_varpool_assemble_pending_decls (); } /* Collect entry points to the unit. */ @@ -214,6 +230,7 @@ cgraph_finalize_compilation_unit (void) if (node->needed && DECL_SAVED_TREE (node->decl)) fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); fprintf (cgraph_dump_file, "\n"); + dump_cgraph (cgraph_dump_file); } if (cgraph_dump_file) @@ -650,7 +667,6 @@ cgraph_mark_inline (struct cgraph_node *to, struct cgraph_node *what, overall_insns += new_insns - to->global.insns; to->global.insns = new_insns; - to->global.calls += (what->global.calls - 1) *times; if (!called && !what->needed && !what->origin && !DECL_EXTERNAL (what->decl)) { @@ -662,8 +678,6 @@ cgraph_mark_inline (struct cgraph_node *to, struct cgraph_node *what, overall_insns -= what->global.insns; } what->global.cloned_times += clones; - if (to->global.calls < 0) - abort (); for (i = 0; i < ninlined; i++) { new_insns = @@ -672,10 +686,6 @@ cgraph_mark_inline (struct cgraph_node *to, struct cgraph_node *what, if (inlined[i]->global.will_be_output) overall_insns += new_insns - inlined[i]->global.insns; inlined[i]->global.insns = new_insns; - inlined[i]->global.calls += - (what->global.calls - 1) *INLINED_TIMES (inlined[i]) * times; - if (inlined[i]->global.calls < 0) - abort (); } for (i = 0; i < ninlined_callees; i++) { @@ -883,21 +893,7 @@ cgraph_decide_inlining (void) int i, y; for (node = cgraph_nodes; node; node = node->next) - { - int ncalls = 0; - struct cgraph_edge *e; - - node->global.insns = node->local.self_insns; - for (e = node->callees; e; e = e->next_callee) - ncalls++; - node->global.calls = ncalls; - if (!DECL_EXTERNAL (node->decl)) - { - node->global.cloned_times = 1; - initial_insns += node->local.self_insns; - node->global.will_be_output = true; - } - } + initial_insns += node->local.self_insns; overall_insns = initial_insns; nnodes = cgraph_postorder (order); |