Commit 95622280 by Jan Hubicka Committed by Jan Hubicka

cgraph.c (dump_cgraph_node): Update.


	* cgraph.c (dump_cgraph_node): Update.
	* cgraph.h (cgraph_local_info): Break out inline summary.
	* cgraphunit.c (cgraph_process_new_functions): Use inliner analysis
	hook.
	* ipa-inline (inline_summary): New accestor function.
	(cgraph_clone_inlined_nodes, cgraph_check_inline_limits,
	cgraph_decide_inlining, compute_inline_parameters): Update.
	* ipa.c (cgraph_remove_unreachable_nodes): Remove statistics.

From-SVN: r135037
parent 96fcacb7
2008-05-07 Jan Hubicka <jh@suse.cz>
* cgraph.c (dump_cgraph_node): Update.
* cgraph.h (cgraph_local_info): Break out inline summary.
* cgraphunit.c (cgraph_process_new_functions): Use inliner analysis
hook.
* ipa-inline (inline_summary): New accestor function.
(cgraph_clone_inlined_nodes, cgraph_check_inline_limits,
cgraph_decide_inlining, compute_inline_parameters): Update.
* ipa.c (cgraph_remove_unreachable_nodes): Remove statistics.
2008-05-07 Maxim Kuvyrkov <maxim@codesourcery.com> 2008-05-07 Maxim Kuvyrkov <maxim@codesourcery.com>
Cleanup ColdFire scheduling support and add V4 pipeline model. Cleanup ColdFire scheduling support and add V4 pipeline model.
......
...@@ -723,13 +723,14 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) ...@@ -723,13 +723,14 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
if (node->count) if (node->count)
fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x", fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x",
(HOST_WIDEST_INT)node->count); (HOST_WIDEST_INT)node->count);
if (node->local.self_insns) if (node->local.inline_summary.self_insns)
fprintf (f, " %i insns", node->local.self_insns); fprintf (f, " %i insns", node->local.inline_summary.self_insns);
if (node->global.insns && node->global.insns != node->local.self_insns) if (node->global.insns && node->global.insns
!= node->local.inline_summary.self_insns)
fprintf (f, " (%i after inlining)", node->global.insns); fprintf (f, " (%i after inlining)", node->global.insns);
if (node->local.estimated_self_stack_size) if (node->local.inline_summary.estimated_self_stack_size)
fprintf (f, " %i bytes stack usage", (int)node->local.estimated_self_stack_size); fprintf (f, " %i bytes stack usage", (int)node->local.inline_summary.estimated_self_stack_size);
if (node->global.estimated_stack_size != node->local.estimated_self_stack_size) if (node->global.estimated_stack_size != node->local.inline_summary.estimated_self_stack_size)
fprintf (f, " %i bytes after inlining", (int)node->global.estimated_stack_size); fprintf (f, " %i bytes after inlining", (int)node->global.estimated_stack_size);
if (node->origin) if (node->origin)
fprintf (f, " nested in: %s", cgraph_node_name (node->origin)); fprintf (f, " nested in: %s", cgraph_node_name (node->origin));
......
...@@ -53,11 +53,13 @@ extern const char * const cgraph_availability_names[]; ...@@ -53,11 +53,13 @@ extern const char * const cgraph_availability_names[];
struct cgraph_local_info GTY(()) struct cgraph_local_info GTY(())
{ {
/* Estimated stack frame consumption by the function. */ struct inline_summary {
HOST_WIDE_INT estimated_self_stack_size; /* Estimated stack frame consumption by the function. */
HOST_WIDE_INT estimated_self_stack_size;
/* Size of the function before inlining. */ /* Size of the function before inlining. */
int self_insns; int self_insns;
} inline_summary;
/* Set when function function is visible in current compilation unit only /* Set when function function is visible in current compilation unit only
and its address is never taken. */ and its address is never taken. */
......
...@@ -460,16 +460,7 @@ cgraph_process_new_functions (void) ...@@ -460,16 +460,7 @@ cgraph_process_new_functions (void)
cgraph_analyze_function (node); cgraph_analyze_function (node);
push_cfun (DECL_STRUCT_FUNCTION (fndecl)); push_cfun (DECL_STRUCT_FUNCTION (fndecl));
current_function_decl = fndecl; current_function_decl = fndecl;
node->local.inlinable = tree_inlinable_function_p (fndecl); pass_ipa_inline.function_generate_summary (node);
node->local.self_insns = estimate_num_insns (fndecl,
&eni_inlining_weights);
node->local.disregard_inline_limits
|= DECL_DISREGARD_INLINE_LIMITS (fndecl);
/* Inlining characteristics are maintained by the
cgraph_mark_inline. */
node->global.insns = node->local.self_insns;
if (flag_really_no_inline && !node->local.disregard_inline_limits)
node->local.inlinable = 0;
if ((cgraph_state == CGRAPH_STATE_IPA_SSA if ((cgraph_state == CGRAPH_STATE_IPA_SSA
&& !gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl))) && !gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl)))
/* When not optimizing, be sure we run early local passes anyway /* When not optimizing, be sure we run early local passes anyway
......
...@@ -172,6 +172,12 @@ static int nfunctions_inlined; ...@@ -172,6 +172,12 @@ static int nfunctions_inlined;
static int overall_insns; static int overall_insns;
static gcov_type max_count; static gcov_type max_count;
static inline struct inline_summary *
inline_summary (struct cgraph_node *node)
{
return &node->local.inline_summary;
}
/* Estimate size of the function after inlining WHAT into TO. */ /* Estimate size of the function after inlining WHAT into TO. */
static int static int
...@@ -226,8 +232,10 @@ cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, bool update_o ...@@ -226,8 +232,10 @@ cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, bool update_o
else else
e->callee->global.inlined_to = e->caller; e->callee->global.inlined_to = e->caller;
e->callee->global.stack_frame_offset e->callee->global.stack_frame_offset
= e->caller->global.stack_frame_offset + e->caller->local.estimated_self_stack_size; = e->caller->global.stack_frame_offset
peak = e->callee->global.stack_frame_offset + e->callee->local.estimated_self_stack_size; + inline_summary (e->caller)->estimated_self_stack_size;
peak = e->callee->global.stack_frame_offset
+ inline_summary (e->callee)->estimated_self_stack_size;
if (e->callee->global.inlined_to->global.estimated_stack_size < peak) if (e->callee->global.inlined_to->global.estimated_stack_size < peak)
e->callee->global.inlined_to->global.estimated_stack_size = peak; e->callee->global.inlined_to->global.estimated_stack_size = peak;
...@@ -359,10 +367,10 @@ cgraph_check_inline_limits (struct cgraph_node *to, struct cgraph_node *what, ...@@ -359,10 +367,10 @@ cgraph_check_inline_limits (struct cgraph_node *to, struct cgraph_node *what,
/* When inlining large function body called once into small function, /* When inlining large function body called once into small function,
take the inlined function as base for limiting the growth. */ take the inlined function as base for limiting the growth. */
if (to->local.self_insns > what->local.self_insns) if (inline_summary (to)->self_insns > inline_summary(what)->self_insns)
limit = to->local.self_insns; limit = inline_summary (to)->self_insns;
else else
limit = what->local.self_insns; limit = inline_summary (what)->self_insns;
limit += limit * PARAM_VALUE (PARAM_LARGE_FUNCTION_GROWTH) / 100; limit += limit * PARAM_VALUE (PARAM_LARGE_FUNCTION_GROWTH) / 100;
...@@ -378,12 +386,12 @@ cgraph_check_inline_limits (struct cgraph_node *to, struct cgraph_node *what, ...@@ -378,12 +386,12 @@ cgraph_check_inline_limits (struct cgraph_node *to, struct cgraph_node *what,
return false; return false;
} }
stack_size_limit = to->local.estimated_self_stack_size; stack_size_limit = inline_summary (to)->estimated_self_stack_size;
stack_size_limit += stack_size_limit * PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) / 100; stack_size_limit += stack_size_limit * PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) / 100;
inlined_stack = (to->global.stack_frame_offset inlined_stack = (to->global.stack_frame_offset
+ to->local.estimated_self_stack_size + inline_summary (to)->estimated_self_stack_size
+ what->global.estimated_stack_size); + what->global.estimated_stack_size);
if (inlined_stack > stack_size_limit if (inlined_stack > stack_size_limit
&& inlined_stack > PARAM_VALUE (PARAM_LARGE_STACK_FRAME)) && inlined_stack > PARAM_VALUE (PARAM_LARGE_STACK_FRAME))
...@@ -1036,8 +1044,8 @@ cgraph_decide_inlining (void) ...@@ -1036,8 +1044,8 @@ cgraph_decide_inlining (void)
{ {
struct cgraph_edge *e; struct cgraph_edge *e;
initial_insns += node->local.self_insns; initial_insns += inline_summary (node)->self_insns;
gcc_assert (node->local.self_insns == node->global.insns); gcc_assert (inline_summary (node)->self_insns == node->global.insns);
for (e = node->callees; e; e = e->next_callee) for (e = node->callees; e; e = e->next_callee)
if (max_count < e->count) if (max_count < e->count)
max_count = e->count; max_count = e->count;
...@@ -1517,19 +1525,21 @@ compute_inline_parameters (void) ...@@ -1517,19 +1525,21 @@ compute_inline_parameters (void)
struct cgraph_node *node = cgraph_node (current_function_decl); struct cgraph_node *node = cgraph_node (current_function_decl);
gcc_assert (!node->global.inlined_to); gcc_assert (!node->global.inlined_to);
node->local.estimated_self_stack_size = estimated_stack_frame_size (); inline_summary (node)->estimated_self_stack_size
node->global.estimated_stack_size = node->local.estimated_self_stack_size; = estimated_stack_frame_size ();
node->global.estimated_stack_size
= inline_summary (node)->estimated_self_stack_size;
node->global.stack_frame_offset = 0; node->global.stack_frame_offset = 0;
node->local.inlinable = tree_inlinable_function_p (current_function_decl); node->local.inlinable = tree_inlinable_function_p (current_function_decl);
node->local.self_insns = estimate_num_insns (current_function_decl, inline_summary (node)->self_insns = estimate_num_insns (current_function_decl,
&eni_inlining_weights); &eni_inlining_weights);
if (node->local.inlinable && !node->local.disregard_inline_limits) if (node->local.inlinable && !node->local.disregard_inline_limits)
node->local.disregard_inline_limits node->local.disregard_inline_limits
= DECL_DISREGARD_INLINE_LIMITS (current_function_decl); = DECL_DISREGARD_INLINE_LIMITS (current_function_decl);
if (flag_really_no_inline && !node->local.disregard_inline_limits) if (flag_really_no_inline && !node->local.disregard_inline_limits)
node->local.inlinable = 0; node->local.inlinable = 0;
/* Inlining characteristics are maintained by the cgraph_mark_inline. */ /* Inlining characteristics are maintained by the cgraph_mark_inline. */
node->global.insns = node->local.self_insns; node->global.insns = inline_summary (node)->self_insns;
return 0; return 0;
} }
......
...@@ -100,7 +100,6 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) ...@@ -100,7 +100,6 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
struct cgraph_node *first = (struct cgraph_node *) (void *) 1; struct cgraph_node *first = (struct cgraph_node *) (void *) 1;
struct cgraph_node *node, *next; struct cgraph_node *node, *next;
bool changed = false; bool changed = false;
int insns = 0;
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
verify_cgraph (); verify_cgraph ();
...@@ -157,14 +156,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) ...@@ -157,14 +156,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
next = node->next; next = node->next;
if (!node->aux) if (!node->aux)
{ {
int local_insns;
tree decl = node->decl;
node->global.inlined_to = NULL; node->global.inlined_to = NULL;
if (DECL_STRUCT_FUNCTION (decl))
local_insns = node->local.self_insns;
else
local_insns = 0;
if (file) if (file)
fprintf (file, " %s", cgraph_node_name (node)); fprintf (file, " %s", cgraph_node_name (node));
if (!node->analyzed || !DECL_EXTERNAL (node->decl) if (!node->analyzed || !DECL_EXTERNAL (node->decl)
...@@ -197,15 +189,11 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) ...@@ -197,15 +189,11 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
else else
cgraph_remove_node (node); cgraph_remove_node (node);
} }
if (!DECL_SAVED_TREE (decl))
insns += local_insns;
changed = true; changed = true;
} }
} }
for (node = cgraph_nodes; node; node = node->next) for (node = cgraph_nodes; node; node = node->next)
node->aux = NULL; node->aux = NULL;
if (file)
fprintf (file, "\nReclaimed %i insns", insns);
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
verify_cgraph (); verify_cgraph ();
#endif #endif
......
...@@ -384,11 +384,11 @@ extern struct gimple_opt_pass pass_reset_cc_flags; ...@@ -384,11 +384,11 @@ extern struct gimple_opt_pass pass_reset_cc_flags;
/* IPA Passes */ /* IPA Passes */
extern struct ipa_opt_pass pass_ipa_inline; extern struct ipa_opt_pass pass_ipa_inline;
extern struct simple_ipa_opt_pass pass_ipa_reference;
extern struct simple_ipa_opt_pass pass_ipa_matrix_reorg; extern struct simple_ipa_opt_pass pass_ipa_matrix_reorg;
extern struct simple_ipa_opt_pass pass_ipa_cp; extern struct simple_ipa_opt_pass pass_ipa_cp;
extern struct simple_ipa_opt_pass pass_ipa_early_inline; extern struct simple_ipa_opt_pass pass_ipa_early_inline;
extern struct simple_ipa_opt_pass pass_ipa_reference;
extern struct simple_ipa_opt_pass pass_ipa_pure_const; extern struct simple_ipa_opt_pass pass_ipa_pure_const;
extern struct simple_ipa_opt_pass pass_ipa_type_escape; extern struct simple_ipa_opt_pass pass_ipa_type_escape;
extern struct simple_ipa_opt_pass pass_ipa_pta; extern struct simple_ipa_opt_pass pass_ipa_pta;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment