diff options
author | zadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-15 22:58:03 +0000 |
---|---|---|
committer | zadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-15 22:58:03 +0000 |
commit | 9c1bff7abb9eaea655a2414de68de8f6f0d2a340 (patch) | |
tree | 2c6ab8e53e59d94a67a634900e3ca0f68350582a /gcc/ipa-inline.c | |
parent | c39f424e2d2196626259ea872694f48a40c7287d (diff) | |
download | gcc-9c1bff7abb9eaea655a2414de68de8f6f0d2a340.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135401 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r-- | gcc/ipa-inline.c | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 5361b8a1d17..c3e58f33301 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -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 */ |