aboutsummaryrefslogtreecommitdiff
path: root/gcc/passes.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-04-21 19:44:03 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-04-21 17:44:03 +0000
commite792884f755b35f38d3868ec17473ac608f7dffd (patch)
treecfd66cda5ba04c051de517b5c83b259a5b88d52a /gcc/passes.c
parentecd03d10ccfc428749fcada10f9bee48e13f22cc (diff)
downloadgcc-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/passes.c')
-rw-r--r--gcc/passes.c103
1 files changed, 95 insertions, 8 deletions
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)
{