aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-07-12 03:07:40 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2003-07-12 01:07:40 +0000
commitb58b11577a908528c37111404a161f744ca3a694 (patch)
treef057de333fbf0a3f853e92f6e52227b3713693c6 /gcc/cgraph.c
parent27b8e366f8683050afd41e3b23d45f77591fa6a8 (diff)
downloadgcc-b58b11577a908528c37111404a161f744ca3a694.zip
gcc-b58b11577a908528c37111404a161f744ca3a694.tar.gz
gcc-b58b11577a908528c37111404a161f744ca3a694.tar.bz2
cgraph.c (cgraph_max_uid): New global variable.
* cgraph.c (cgraph_max_uid): New global variable. (cgraph_node): Set uid field. (create_edge): Keep inline flags consistent. (dump_cgraph): Dump more info. * cgraph.h (struct cgraph_local_info): Remove inline_many and can_inline_once; add inlinable, disgread_inline_limits, and self_insn (struct cgraph_global_info): Add insns, calls, cloned_times, will_be_output. (struct cgraph_node): Add uid. (struct cgraph_edge): Add inline_call. (cgraph_max_uid, cgraph_inline_p): Declare. * cgraph.c: Include params.h and fibheap.h (cgraph_mark_functions_to_inline_once): Kill. (INSNS_PER_CALL): New constant. (ncalls_inlined, nfunctions_inlined, initial_insns, overall_insns): New static variables. (cgraph_finalize_function): Do not analyze inlining. (cgraph_finalize_compilation_unit): Set inlining attributes. (cgraph_mark_functions_to_output): More consistency checks. (cgraph_optimize_function): Set current_function_decl to NULL. (cgraph_expand_function): Use new inline flags. (cgraph_postorder): Expand from cgraph_expand_functions. (INLINED_TIMES, SET_INLINED_TIMES): New macros. (cgraph_inlined_into, cgraph_inlined_callees, cgraph_estimate_size_after_inlining, cgraph_estimate_growth, cgraph_mark_inline, cgraph_check_inline_limits, cgraph_default_inline_p, cgraph_decide_inling_of_small_functions, cgraph_decide_inlining, cgraph_inline_p): New functions. * params.def (PARAM_LARGE_FUNCTION_INSNS, PARAM_LARGE_FUNCTION_GROWTH, PARAM_INLINE_UNIT_GROWTH): New parameters. * tree-inline.c (struct inline_data): New field current_decl. (expand_call_inline): Avoid forward declarations; use inlinable_function_p. (optimize_inline_calls): Set id.current_decl. Co-Authored-By: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> From-SVN: r69262
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 7bc065b..c191381 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -48,6 +48,9 @@ struct cgraph_node *cgraph_nodes_queue;
/* Number of nodes in existence. */
int cgraph_n_nodes;
+/* Maximal uid used in cgraph nodes. */
+int cgraph_max_uid;
+
/* Set when whole unit has been analyzed so we can access global info. */
bool cgraph_global_info_ready = false;
@@ -114,6 +117,7 @@ cgraph_node (decl)
node = ggc_alloc_cleared (sizeof (*node));
node->decl = decl;
node->next = cgraph_nodes;
+ node->uid = cgraph_max_uid++;
if (cgraph_nodes)
cgraph_nodes->previous = node;
node->previous = NULL;
@@ -157,6 +161,19 @@ create_edge (caller, callee)
struct cgraph_node *caller, *callee;
{
struct cgraph_edge *edge = ggc_alloc (sizeof (struct cgraph_edge));
+ struct cgraph_edge *edge2;
+
+ edge->inline_call = false;
+ /* At the moment we don't associate calls with specific CALL_EXPRs
+ as we probably ought to, so we must preserve inline_call flags to
+ be the same in all copies of the same edge. */
+ if (cgraph_global_info_ready)
+ for (edge2 = caller->callees; edge2; edge2 = edge2->next_caller)
+ if (edge2->callee == callee)
+ {
+ edge->inline_call = edge2->inline_call;
+ break;
+ }
edge->caller = caller;
edge->callee = callee;
@@ -337,6 +354,8 @@ dump_cgraph (f)
{
struct cgraph_edge *edge;
fprintf (f, "%s", cgraph_node_name (node));
+ if (node->local.self_insns)
+ fprintf (f, " %i insns", node->local.self_insns);
if (node->origin)
fprintf (f, " nested in: %s", cgraph_node_name (node->origin));
if (node->needed)
@@ -346,13 +365,32 @@ dump_cgraph (f)
if (DECL_SAVED_TREE (node->decl))
fprintf (f, " tree");
+ if (node->local.disgread_inline_limits)
+ fprintf (f, " always_inline");
+ else if (node->local.inlinable)
+ fprintf (f, " inlinable");
+ if (node->global.insns && node->global.insns != node->local.self_insns)
+ fprintf (f, " %i insns after inlining", node->global.insns);
+ if (node->global.cloned_times > 1)
+ fprintf (f, " cloned %ix", node->global.cloned_times);
+ if (node->global.calls)
+ fprintf (f, " %i calls", node->global.calls);
+
fprintf (f, "\n called by :");
for (edge = node->callers; edge; edge = edge->next_caller)
- fprintf (f, "%s ", cgraph_node_name (edge->caller));
+ {
+ fprintf (f, "%s ", cgraph_node_name (edge->caller));
+ if (edge->inline_call)
+ fprintf(f, "(inlined) ");
+ }
fprintf (f, "\n calls: ");
for (edge = node->callees; edge; edge = edge->next_callee)
- fprintf (f, "%s ", cgraph_node_name (edge->callee));
+ {
+ fprintf (f, "%s ", cgraph_node_name (edge->callee));
+ if (edge->inline_call)
+ fprintf(f, "(inlined) ");
+ }
fprintf (f, "\n");
}
}