cgraph.h (compute_inline_parameters): Made public.

2008-05-15  Kenneth Zadeck <zadeck@naturalbridge.com>

	* cgraph.h (compute_inline_parameters): Made public.
	* tree-pass.h (ipa_opt_pass): Removed function_generate_summary,
	variable_generate_summary, function_write_summary,
	variable_write_summary, variable_read_summary.  Added 
	generate_summary, write_summary, read_summary.
	* cgraphunit.c (cgraph_process_new_functions): Changed call from
	pass_ipa_inline.function_generate_summary, to
	compute_inline_parameters. 
	* ipa-inline.c (compute_inline_parameters): Made public and added
	node parameter.
	(compute_inline_parameters_for_current): New function.
	(pass_inline_param): Now calls
	compute_inline_parameters_for_current.
	(inline_generate_summary): Removed parameter and made to loop over
	all cgraph nodes.
	(pass_ipa_inline): Updated for new IPA_PASS structure.
	* passes.c (execute_ipa_summary_passes): Now is called once per
	pass rather than once per node*pass.

From-SVN: r135401
This commit is contained in:
Kenneth Zadeck 2008-05-15 22:58:03 +00:00 committed by Kenneth Zadeck
parent be95b3555a
commit 1920df6c22
6 changed files with 82 additions and 33 deletions

View File

@ -1,3 +1,24 @@
2008-05-15 Kenneth Zadeck <zadeck@naturalbridge.com>
* cgraph.h (compute_inline_parameters): Made public.
* tree-pass.h (ipa_opt_pass): Removed function_generate_summary,
variable_generate_summary, function_write_summary,
variable_write_summary, variable_read_summary. Added
generate_summary, write_summary, read_summary.
* cgraphunit.c (cgraph_process_new_functions): Changed call from
pass_ipa_inline.function_generate_summary, to
compute_inline_parameters.
* ipa-inline.c (compute_inline_parameters): Made public and added
node parameter.
(compute_inline_parameters_for_current): New function.
(pass_inline_param): Now calls
compute_inline_parameters_for_current.
(inline_generate_summary): Removed parameter and made to loop over
all cgraph nodes.
(pass_ipa_inline): Updated for new IPA_PASS structure.
* passes.c (execute_ipa_summary_passes): Now is called once per
pass rather than once per node*pass.
2008-05-15 Anatoly Sokolov <aesok@post.ru>
* config/avr/avr.c (avr_base_arch_macro, avr_have_movw_lpmx_p,

View File

@ -418,6 +418,7 @@ varpool_next_static_initializer (struct varpool_node *node)
void cgraph_clone_inlined_nodes (struct cgraph_edge *, bool, bool);
void cgraph_mark_inline_edge (struct cgraph_edge *, bool);
bool cgraph_default_inline_p (struct cgraph_node *, const char **);
unsigned int compute_inline_parameters (struct cgraph_node *);
/* Create a new static variable of type TYPE. */

View File

@ -460,7 +460,7 @@ cgraph_process_new_functions (void)
cgraph_analyze_function (node);
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
current_function_decl = fndecl;
pass_ipa_inline.function_generate_summary (node);
compute_inline_parameters (node);
if ((cgraph_state == CGRAPH_STATE_IPA_SSA
&& !gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl)))
/* When not optimizing, be sure we run early local passes anyway

View File

@ -1519,11 +1519,9 @@ struct simple_ipa_opt_pass pass_ipa_early_inline =
};
/* Compute parameters of functions used by inliner. */
static unsigned int
compute_inline_parameters (void)
unsigned int
compute_inline_parameters (struct cgraph_node *node)
{
struct cgraph_node *node = cgraph_node (current_function_decl);
gcc_assert (!node->global.inlined_to);
inline_summary (node)->estimated_self_stack_size
= estimated_stack_frame_size ();
@ -1543,6 +1541,16 @@ compute_inline_parameters (void)
return 0;
}
/* Compute parameters of functions used by inliner using
current_function_decl. */
static unsigned int
compute_inline_parameters_for_current (void)
{
compute_inline_parameters (cgraph_node (current_function_decl));
return 0;
}
/* When inlining shall be performed. */
static bool
gate_inline_passes (void)
@ -1556,7 +1564,7 @@ struct gimple_opt_pass pass_inline_parameters =
GIMPLE_PASS,
NULL, /* name */
gate_inline_passes, /* gate */
compute_inline_parameters, /* execute */
compute_inline_parameters_for_current,/* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
@ -1571,9 +1579,30 @@ struct gimple_opt_pass pass_inline_parameters =
/* Note function body size. */
static void
inline_generate_summary (struct cgraph_node *node ATTRIBUTE_UNUSED)
inline_generate_summary (void)
{
compute_inline_parameters ();
struct cgraph_node **order =
XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
int nnodes = cgraph_postorder (order);
int i;
for (i = nnodes - 1; i >= 0; i--)
{
struct cgraph_node *node = order[i];
/* Allow possibly removed nodes to be garbage collected. */
order[i] = NULL;
if (node->analyzed && (node->needed || node->reachable))
{
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
current_function_decl = node->decl;
compute_inline_parameters (node);
pop_cfun ();
}
}
current_function_decl = NULL;
free (order);
return;
}
@ -1619,12 +1648,10 @@ struct ipa_opt_pass pass_ipa_inline =
TODO_dump_cgraph | TODO_dump_func
| TODO_remove_functions /* todo_flags_finish */
},
inline_generate_summary, /* function_generate_summary */
NULL, /* variable_generate_summary */
NULL, /* function_write_summary */
NULL, /* variable_write_summary */
inline_generate_summary, /* generate_summary */
NULL, /* write_summary */
NULL, /* read_summary */
NULL, /* function_read_summary */
NULL, /* variable_read_summary */
0, /* TODOs */
inline_transform, /* function_transform */
NULL, /* variable_transform */

View File

@ -1157,21 +1157,21 @@ add_ipa_transform_pass (void *data)
VEC_safe_push (ipa_opt_pass, heap, cfun->ipa_transforms_to_apply, ipa_pass);
}
/* Execute IPA pass function summary generation. DATA is pointer to
pass list to execute. */
/* Execute summary generation for all of the passes in IPA_PASS. */
static void
execute_ipa_summary_passes (void *data)
execute_ipa_summary_passes (struct ipa_opt_pass *ipa_pass)
{
struct ipa_opt_pass *ipa_pass = (struct ipa_opt_pass *)data;
struct cgraph_node *node = cgraph_node (cfun->decl);
while (ipa_pass && ipa_pass->pass.type == IPA_PASS)
while (ipa_pass)
{
struct opt_pass *pass = &ipa_pass->pass;
if (!pass->gate || pass->gate ())
/* Execute all of the IPA_PASSes in the list. */
if (ipa_pass->pass.type == IPA_PASS
&& (!pass->gate || pass->gate ()))
{
pass_init_dump_file (pass);
ipa_pass->function_generate_summary (node);
ipa_pass->generate_summary ();
pass_fini_dump_file (pass);
}
ipa_pass = (struct ipa_opt_pass *)ipa_pass->pass.next;
@ -1356,7 +1356,7 @@ execute_ipa_pass_list (struct opt_pass *pass)
{
if (!quiet_flag && !cfun)
fprintf (stderr, " <summary generate>");
do_per_function_toporder (execute_ipa_summary_passes, pass);
execute_ipa_summary_passes ((struct ipa_opt_pass *) pass);
}
summaries_generated = true;
}

View File

@ -155,24 +155,24 @@ struct ipa_opt_pass
{
struct opt_pass pass;
/* IPA passes can analyze function body and variable initializers using this
hook and produce summary. */
void (*function_generate_summary) (struct cgraph_node *);
void (*variable_generate_summary) (struct varpool_node *);
/* IPA passes can analyze function body and variable initializers
using this hook and produce summary. */
void (*generate_summary) (void);
/* These hooks will be used to serialize IPA summaries on disk. For a moment
they are just placeholders. */
void (*function_write_summary) (struct cgraph_node *);
void (*variable_write_summary) (struct varpool_node *);
/* This hook is used to serialize IPA summaries on disk. */
void (*write_summary) (void);
/* For most ipa passes, the information can only be deserialized in
one chunk. However, function bodies are read function at a time
as needed so both calls are necessary. */
void (*read_summary) (void);
void (*function_read_summary) (struct cgraph_node *);
void (*variable_read_summary) (struct varpool_node *);
/* Results of interprocedural propagation of an IPA pass is applied to
function body via this hook. */
unsigned int function_transform_todo_flags_start;
unsigned int (*function_transform) (struct cgraph_node *);
void (*variable_transform) (struct varpool_node *);
};
/* Description of simple IPA pass. Simple IPA passes have just one execute