diff options
author | Jan Hubicka <jh@suse.cz> | 2010-04-21 19:44:03 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-04-21 17:44:03 +0000 |
commit | e792884f755b35f38d3868ec17473ac608f7dffd (patch) | |
tree | cfd66cda5ba04c051de517b5c83b259a5b88d52a /gcc | |
parent | ecd03d10ccfc428749fcada10f9bee48e13f22cc (diff) | |
download | gcc-e792884f755b35f38d3868ec17473ac608f7dffd.zip gcc-e792884f755b35f38d3868ec17473ac608f7dffd.tar.gz gcc-e792884f755b35f38d3868ec17473ac608f7dffd.tar.bz2 |
tree-pass.h (ipa_opt_pass_d): Rename function_read_summary...
* tree-pass.h (ipa_opt_pass_d): Rename function_read_summary;
add write_optimization_summary, read_optimization_summary.
(ipa_write_summaries_of_cgraph_node_set): Remove.
(ipa_write_optimization_summaries): Declare.
(ipa_read_optimization_summaries): Declare.
* ipa-cp.c (pass_ipa_cp): Update.
* ipa-reference.c (pass_ipa_reference): Update.
* ipa-pure-const.c (pass_ipa_pure_const): Update.
* lto-streamer-out.c (pass_ipa_lto_gimple, pass_ipa_lto_finish):
Update.
* ipa-inline.c (pass_ipa_inline): Update.
* ipa.c (pass_ipa_whole_program): Update.
* lto-wpa-fixup.c (pass_ipa_lto_wpa_fixup): Update.
* passes.c (ipa_write_summaries_1): Do not test wpa.
(ipa_write_optimization_summaries_1): New.
(ipa_write_optimization_summaries): New.
(ipa_read_summaries): Do not test ltrans.
(ipa_read_optimization_summaries_1): New.
(ipa_read_optimization_summaries): New.
* lto.c (lto_wpa_write_files): Update.
(read_cgraph_and_symbols): Be more verbose.
(materialize_cgraph): Likewise.
(do_whole_program_analysis): Likewise.
From-SVN: r158616
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 22 | ||||
-rw-r--r-- | gcc/ipa-cp.c | 3 | ||||
-rw-r--r-- | gcc/ipa-inline.c | 3 | ||||
-rw-r--r-- | gcc/ipa-pure-const.c | 3 | ||||
-rw-r--r-- | gcc/ipa-reference.c | 3 | ||||
-rw-r--r-- | gcc/ipa.c | 5 | ||||
-rw-r--r-- | gcc/lto-streamer-out.c | 6 | ||||
-rw-r--r-- | gcc/lto-wpa-fixup.c | 7 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/lto/lto.c | 39 | ||||
-rw-r--r-- | gcc/passes.c | 103 | ||||
-rw-r--r-- | gcc/tree-pass.h | 16 |
12 files changed, 191 insertions, 26 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bb8e0aa..85d4103 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,27 @@ 2010-04-21 Jan Hubicka <jh@suse.cz> + * tree-pass.h (ipa_opt_pass_d): Rename function_read_summary; + add write_optimization_summary, read_optimization_summary. + (ipa_write_summaries_of_cgraph_node_set): Remove. + (ipa_write_optimization_summaries): Declare. + (ipa_read_optimization_summaries): Declare. + * ipa-cp.c (pass_ipa_cp): Update. + * ipa-reference.c (pass_ipa_reference): Update. + * ipa-pure-const.c (pass_ipa_pure_const): Update. + * lto-streamer-out.c (pass_ipa_lto_gimple, pass_ipa_lto_finish): + Update. + * ipa-inline.c (pass_ipa_inline): Update. + * ipa.c (pass_ipa_whole_program): Update. + * lto-wpa-fixup.c (pass_ipa_lto_wpa_fixup): Update. + * passes.c (ipa_write_summaries_1): Do not test wpa. + (ipa_write_optimization_summaries_1): New. + (ipa_write_optimization_summaries): New. + (ipa_read_summaries): Do not test ltrans. + (ipa_read_optimization_summaries_1): New. + (ipa_read_optimization_summaries): New. + +2010-04-21 Jan Hubicka <jh@suse.cz> + * lto-cgraph.c (lto_output_node): Do not output comdat groups for boundary nodes. (output_cgraph): Do not arrange comdat groups for boundary nodes. diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 527c0c4..ca7c0e6 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1344,7 +1344,8 @@ struct ipa_opt_pass_d pass_ipa_cp = ipcp_generate_summary, /* generate_summary */ ipcp_write_summary, /* write_summary */ ipcp_read_summary, /* read_summary */ - NULL, /* function_read_summary */ + NULL, /* write_optimization_summary */ + NULL, /* read_optimization_summary */ lto_ipa_fixup_call_notes, /* stmt_fixup */ 0, /* TODOs */ NULL, /* function_transform */ diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 8957990..fbd695d 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -2135,7 +2135,8 @@ struct ipa_opt_pass_d pass_ipa_inline = inline_generate_summary, /* generate_summary */ inline_write_summary, /* write_summary */ inline_read_summary, /* read_summary */ - NULL, /* function_read_summary */ + NULL, /* write_optimization_summary */ + NULL, /* read_optimization_summary */ lto_ipa_fixup_call_notes, /* stmt_fixup */ 0, /* TODOs */ inline_transform, /* function_transform */ diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 166dabb..d6a0d41 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -1095,7 +1095,8 @@ struct ipa_opt_pass_d pass_ipa_pure_const = generate_summary, /* generate_summary */ pure_const_write_summary, /* write_summary */ pure_const_read_summary, /* read_summary */ - NULL, /* function_read_summary */ + NULL, /* write_optimization_summary */ + NULL, /* read_optimization_summary */ NULL, /* stmt_fixup */ 0, /* TODOs */ NULL, /* function_transform */ diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 9eac3b1..7183e65 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -1514,7 +1514,8 @@ struct ipa_opt_pass_d pass_ipa_reference = generate_summary, /* generate_summary */ ipa_reference_write_summary, /* write_summary */ ipa_reference_read_summary, /* read_summary */ - NULL, /* function_read_summary */ + NULL, /* write_optimization_summary */ + NULL, /* read_optimization_summary */ NULL, /* stmt_fixup */ 0, /* TODOs */ NULL, /* function_transform */ @@ -271,6 +271,8 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) node->analyzed = false; node->local.inlinable = false; } + else + gcc_assert (!clone->in_other_partition); cgraph_node_remove_callees (node); if (node->prev_sibling_clone) node->prev_sibling_clone->next_sibling_clone = node->next_sibling_clone; @@ -574,7 +576,8 @@ struct ipa_opt_pass_d pass_ipa_whole_program_visibility = NULL, /* generate_summary */ NULL, /* write_summary */ NULL, /* read_summary */ - NULL, /* function_read_summary */ + NULL, /* write_optimization_summary */ + NULL, /* read_optimization_summary */ NULL, /* stmt_fixup */ 0, /* TODOs */ NULL, /* function_transform */ diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index f375282..c922025 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -2147,7 +2147,8 @@ struct ipa_opt_pass_d pass_ipa_lto_gimple_out = NULL, /* generate_summary */ lto_output, /* write_summary */ NULL, /* read_summary */ - NULL, /* function_read_summary */ + lto_output, /* write_optimization_summary */ + NULL, /* read_optimization_summary */ NULL, /* stmt_fixup */ 0, /* TODOs */ NULL, /* function_transform */ @@ -2565,7 +2566,8 @@ struct ipa_opt_pass_d pass_ipa_lto_finish_out = NULL, /* generate_summary */ produce_asm_for_decls, /* write_summary */ NULL, /* read_summary */ - NULL, /* function_read_summary */ + produce_asm_for_decls, /* write_optimization_summary */ + NULL, /* read_optimization_summary */ NULL, /* stmt_fixup */ 0, /* TODOs */ NULL, /* function_transform */ diff --git a/gcc/lto-wpa-fixup.c b/gcc/lto-wpa-fixup.c index 0839aa9..46d66e5 100644 --- a/gcc/lto-wpa-fixup.c +++ b/gcc/lto-wpa-fixup.c @@ -271,9 +271,10 @@ struct ipa_opt_pass_d pass_ipa_lto_wpa_fixup = TODO_dump_func /* todo_flags_finish */ }, NULL, /* generate_summary */ - lto_output_wpa_fixup, /* write_summary */ - lto_input_wpa_fixup, /* read_summary */ - NULL, /* function_read_summary */ + NULL, /* write_summary */ + NULL, /* read_summary */ + lto_output_wpa_fixup, /* write_optimization_summary */ + lto_input_wpa_fixup, /* read_optimization_summary */ NULL, /* stmt_fixup */ 0, /* TODOs */ NULL, /* function_transform */ diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index a97314c..74e0650 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,5 +1,12 @@ 2010-04-21 Jan Hubicka <jh@suse.cz> + * lto.c (lto_wpa_write_files): Update. + (read_cgraph_and_symbols): Be more verbose. + (materialize_cgraph): Likewise. + (do_whole_program_analysis): Likewise. + +2010-04-21 Jan Hubicka <jh@suse.cz> + * lto.c (globalize_cross_file_statics): When function has address taken, it needs to be public. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index ea8f03a..12475f1 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -1046,7 +1046,7 @@ lto_wpa_write_files (void) lto_set_current_out_file (file); - ipa_write_summaries_of_cgraph_node_set (set); + ipa_write_optimization_summaries (set); lto_set_current_out_file (NULL); lto_elf_file_close (file); @@ -1822,10 +1822,18 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) gcc_assert (num_objects == nfiles); } + if (!quiet_flag) + fprintf (stderr, "Reading object files:"); + /* Read all of the object files specified on the command line. */ for (i = 0, last_file_ix = 0; i < nfiles; ++i) { struct lto_file_decl_data *file_data = NULL; + if (!quiet_flag) + { + fprintf (stderr, " %s", fnames[i]); + fflush (stderr); + } current_lto_file = lto_elf_file_open (fnames[i], false); if (!current_lto_file) @@ -1852,9 +1860,15 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) /* Each pass will set the appropriate timer. */ timevar_pop (TV_IPA_LTO_DECL_IO); + if (!quiet_flag) + fprintf (stderr, "\nReading the callgraph\n"); + /* Read the callgraph. */ input_cgraph (); + if (!quiet_flag) + fprintf (stderr, "Merging declarations\n"); + /* Merge global decls. */ lto_symtab_merge_decls (); @@ -1862,8 +1876,14 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) lto_fixup_decls (all_file_decl_data); free_gimple_type_tables (); + if (!quiet_flag) + fprintf (stderr, "Reading summaries\n"); + /* Read the IPA summary data. */ - ipa_read_summaries (); + if (flag_ltrans) + ipa_read_optimization_summaries (); + else + ipa_read_summaries (); /* Finally merge the cgraph according to the decl merging decisions. */ lto_symtab_merge_cgraph_nodes (); @@ -1909,6 +1929,11 @@ materialize_cgraph (void) unsigned i; timevar_id_t lto_timer; + if (!quiet_flag) + fprintf (stderr, + flag_wpa ? "Materializing decls:" : "Reading function bodies:"); + + /* Now that we have input the cgraph, we need to clear all of the aux nodes and read the functions if we are not running in WPA mode. */ timevar_push (TV_IPA_LTO_GIMPLE_IO); @@ -1927,6 +1952,7 @@ materialize_cgraph (void) if (node->local.lto_file_data && !DECL_IS_BUILTIN (node->decl)) { + announce_function (node->decl); lto_materialize_function (node); lto_stats.num_input_cgraph_nodes++; } @@ -1950,6 +1976,8 @@ materialize_cgraph (void) /* Fix up any calls to DECLs that have become not exception throwing. */ lto_fixup_nothrow_decls (); + if (!quiet_flag) + fprintf (stderr, "\n"); timevar_pop (lto_timer); } @@ -1987,7 +2015,14 @@ do_whole_program_analysis (void) lto_1_to_1_map (); + if (!quiet_flag) + { + fprintf (stderr, "\nStreaming out"); + fflush (stderr); + } output_files = lto_wpa_write_files (); + if (!quiet_flag) + fprintf (stderr, "\n"); /* Show the LTO report before launching LTRANS. */ if (flag_lto_report) diff --git a/gcc/passes.c b/gcc/passes.c index 6437ab7..d9bf3cc 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1674,8 +1674,8 @@ ipa_write_summaries_1 (cgraph_node_set set) struct lto_out_decl_state *state = lto_new_out_decl_state (); lto_push_out_decl_state (state); - if (!flag_wpa) - ipa_write_summaries_2 (all_regular_ipa_passes, set, state); + gcc_assert (!flag_wpa); + ipa_write_summaries_2 (all_regular_ipa_passes, set, state); ipa_write_summaries_2 (all_lto_gen_passes, set, state); gcc_assert (lto_get_out_decl_state () == state); @@ -1730,15 +1730,58 @@ ipa_write_summaries (void) ggc_free (set); } +/* Same as execute_pass_list but assume that subpasses of IPA passes + are local passes. If SET is not NULL, write out optimization summaries of + only those node in SET. */ -/* Write all the summaries for the cgraph nodes in SET. If SET is +static void +ipa_write_optimization_summaries_1 (struct opt_pass *pass, cgraph_node_set set, + struct lto_out_decl_state *state) +{ + while (pass) + { + struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *)pass; + gcc_assert (!current_function_decl); + gcc_assert (!cfun); + gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); + if (pass->type == IPA_PASS + && ipa_pass->write_optimization_summary + && (!pass->gate || pass->gate ())) + { + /* If a timevar is present, start it. */ + if (pass->tv_id) + timevar_push (pass->tv_id); + + ipa_pass->write_optimization_summary (set); + + /* If a timevar is present, start it. */ + if (pass->tv_id) + timevar_pop (pass->tv_id); + } + + if (pass->sub && pass->sub->type != GIMPLE_PASS) + ipa_write_optimization_summaries_1 (pass->sub, set, state); + + pass = pass->next; + } +} + +/* Write all the optimization summaries for the cgraph nodes in SET. If SET is NULL, write out all summaries of all nodes. */ void -ipa_write_summaries_of_cgraph_node_set (cgraph_node_set set) +ipa_write_optimization_summaries (cgraph_node_set set) { - if (flag_generate_lto && !(errorcount || sorrycount)) - ipa_write_summaries_1 (set); + struct lto_out_decl_state *state = lto_new_out_decl_state (); + lto_push_out_decl_state (state); + + gcc_assert (flag_wpa); + ipa_write_optimization_summaries_1 (all_regular_ipa_passes, set, state); + ipa_write_optimization_summaries_1 (all_lto_gen_passes, set, state); + + gcc_assert (lto_get_out_decl_state () == state); + lto_pop_out_decl_state (); + lto_delete_out_decl_state (state); } /* Same as execute_pass_list but assume that subpasses of IPA passes @@ -1783,13 +1826,57 @@ ipa_read_summaries_1 (struct opt_pass *pass) void ipa_read_summaries (void) { - if (!flag_ltrans) - ipa_read_summaries_1 (all_regular_ipa_passes); + ipa_read_summaries_1 (all_regular_ipa_passes); ipa_read_summaries_1 (all_lto_gen_passes); } /* Same as execute_pass_list but assume that subpasses of IPA passes are local passes. */ + +static void +ipa_read_optimization_summaries_1 (struct opt_pass *pass) +{ + while (pass) + { + struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass; + + gcc_assert (!current_function_decl); + gcc_assert (!cfun); + gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); + + if (pass->gate == NULL || pass->gate ()) + { + if (pass->type == IPA_PASS && ipa_pass->read_optimization_summary) + { + /* If a timevar is present, start it. */ + if (pass->tv_id) + timevar_push (pass->tv_id); + + ipa_pass->read_optimization_summary (); + + /* Stop timevar. */ + if (pass->tv_id) + timevar_pop (pass->tv_id); + } + + if (pass->sub && pass->sub->type != GIMPLE_PASS) + ipa_read_optimization_summaries_1 (pass->sub); + } + pass = pass->next; + } +} + +/* Read all the summaries for all_regular_ipa_passes and all_lto_gen_passes. */ + +void +ipa_read_optimization_summaries (void) +{ + ipa_read_optimization_summaries_1 (all_regular_ipa_passes); + ipa_read_optimization_summaries_1 (all_lto_gen_passes); +} + +/* Same as execute_pass_list but assume that subpasses of IPA passes + are local passes. */ void execute_ipa_pass_list (struct opt_pass *pass) { diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 019b933..42ef8b2 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -182,11 +182,15 @@ struct ipa_opt_pass_d /* This hook is used to serialize IPA summaries on disk. */ void (*write_summary) (struct cgraph_node_set_def *); - /* 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. */ + /* This hook is used to deserialize IPA summaries from disk. */ void (*read_summary) (void); - void (*function_read_summary) (struct cgraph_node *); + + /* This hook is used to serialize IPA optimization summaries on disk. */ + void (*write_optimization_summary) (struct cgraph_node_set_def *); + + /* This hook is used to deserialize IPA summaries from disk. */ + void (*read_optimization_summary) (void); + /* Hook to convert gimple stmt uids into true gimple statements. The second parameter is an array of statements indexed by their uid. */ void (*stmt_fixup) (struct cgraph_node *, gimple *); @@ -601,9 +605,9 @@ extern const char *get_current_pass_name (void); extern void print_current_pass (FILE *); extern void debug_pass (void); extern void ipa_write_summaries (void); -extern void ipa_write_summaries_of_cgraph_node_set ( - struct cgraph_node_set_def *); +extern void ipa_write_optimization_summaries (struct cgraph_node_set_def *); extern void ipa_read_summaries (void); +extern void ipa_read_optimization_summaries (void); extern void register_one_dump_file (struct opt_pass *); extern bool function_called_by_processed_nodes_p (void); extern void register_pass (struct register_pass_info *); |