aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2009-10-22 12:02:29 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2009-10-22 10:02:29 +0000
commitfb3f88cc0d34f3f03e81e2e6d0a7c2c56d87f13d (patch)
treedc0c5b1f5b9348db2afad23ab409cf18702d1173 /gcc/ipa-cp.c
parent34677bae651336700ad8a84f7218e080c435fafc (diff)
downloadgcc-fb3f88cc0d34f3f03e81e2e6d0a7c2c56d87f13d.zip
gcc-fb3f88cc0d34f3f03e81e2e6d0a7c2c56d87f13d.tar.gz
gcc-fb3f88cc0d34f3f03e81e2e6d0a7c2c56d87f13d.tar.bz2
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions. (pass_ipa_cp): Register them. (ipcp_init_stage): Analyze all functions for whopr/lto. (ipcp_propagate_stage): Skip external calls. (ipcp_iterate_stage): Call ipa_update_after_lto_read if needed. * ipa-reference.c (write_node_summary_p): Fix thinko about availability. * cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries; when in ltrans, skip executing of ipa passes since everything should've been done. * ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs. (inline_generate_summary): Likewise. (inline_read_summary): New function. (inline_write_summary): New function. (pass_ipa_inline): Register new hooks. * ipa-prop.c: Inlcude lto-streamer.h (ipa_edge_args_vector): Update declaration. (ipa_count_arguments, ipa_compute_jump_functions, ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc. (ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info, ipa_read_node_info): New static functions. (ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update. (duplicate_array): Use xmalloc. (duplicate_ggc_array): New. (ipa_edge_duplication_hook): Use it. (ipa_update_after_lto_read): New function. * ipa-prop.h (ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Declare. (ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst, jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers. (ipa_edge_args_vector): Move into GGC. (ipa_check_create_edge_args): Update. (ipa_update_after_lto_read): New. * passes.c (ipa_write_summaries_1): When in wpa, do not write summaries. (ipa_read_summaries): When in ltrans, so not read summaries. * lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions. * lto-streamer.h (LTO_section_jump_functions): New section. (produce_asm): Declare. * lto-cgraph.c (output_cgraph): Output edges in reverse order. * lto-streamer-out.c (produce_asm): Export. * lto-streamer-in.c: Include tree-pass.h (input_function): Free dominance info when done. (lto_read_body): Push ipa_inline in ltrans stage. * gengtype.c (open_base_files): Add ipa-prop.h into includes. * Makefile.in (GTFILES): Add ipa-prop.h * lto.c (lto_fixup_jump_functions): New function. (lto_fixup_decls): Use it. From-SVN: r153449
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 7e499ca..4166e78 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -614,7 +614,9 @@ ipcp_init_stage (void)
/* building jump functions */
for (cs = node->callees; cs; cs = cs->next_callee)
{
- if (!cs->callee->analyzed)
+ /* We do not need to bother analyzing calls to unknown
+ functions unless they may become known during lto/whopr. */
+ if (!cs->callee->analyzed && !flag_lto && !flag_whopr)
continue;
ipa_count_arguments (cs);
if (ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
@@ -696,7 +698,9 @@ ipcp_propagate_stage (void)
struct ipa_node_params *callee_info = IPA_NODE_REF (cs->callee);
struct ipa_edge_args *args = IPA_EDGE_REF (cs);
- if (ipa_is_called_with_var_arguments (callee_info))
+ if (ipa_is_called_with_var_arguments (callee_info)
+ || !cs->callee->analyzed
+ || ipa_is_called_with_var_arguments (callee_info))
continue;
count = ipa_get_cs_argument_count (args);
@@ -727,6 +731,10 @@ ipcp_iterate_stage (void)
if (dump_file)
fprintf (dump_file, "\nIPA iterate stage:\n\n");
+
+ if (in_lto_p)
+ ipa_update_after_lto_read ();
+
for (node = cgraph_nodes; node; node = node->next)
{
ipcp_initialize_node_lattices (node);
@@ -1276,6 +1284,20 @@ ipcp_generate_summary (void)
ipcp_init_stage ();
}
+/* Write ipcp summary for nodes in SET. */
+static void
+ipcp_write_summary (cgraph_node_set set)
+{
+ ipa_prop_write_jump_functions (set);
+}
+
+/* Read ipcp summary. */
+static void
+ipcp_read_summary (void)
+{
+ ipa_prop_read_jump_functions ();
+}
+
/* Gate for IPCP optimization. */
static bool
cgraph_gate_cp (void)
@@ -1308,8 +1330,8 @@ struct ipa_opt_pass_d pass_ipa_cp =
TODO_remove_functions /* todo_flags_finish */
},
ipcp_generate_summary, /* generate_summary */
- NULL, /* write_summary */
- NULL, /* read_summary */
+ ipcp_write_summary, /* write_summary */
+ ipcp_read_summary, /* read_summary */
NULL, /* function_read_summary */
0, /* TODOs */
NULL, /* function_transform */