diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2014-11-16 20:36:37 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-11-16 19:36:37 +0000 |
commit | 70486010428fdaeabd875022fee05122e9866424 (patch) | |
tree | 764c758c25d54ae7dff3cb061662445a47d38b28 /gcc/cgraph.c | |
parent | 9ff2f666aa330107eb6767c246b9d302247359c9 (diff) | |
download | gcc-70486010428fdaeabd875022fee05122e9866424.zip gcc-70486010428fdaeabd875022fee05122e9866424.tar.gz gcc-70486010428fdaeabd875022fee05122e9866424.tar.bz2 |
passes.c (execute_one_pass): Do not apply all transforms prior every simple IPA pass.
* passes.c (execute_one_pass): Do not apply all transforms prior
every simple IPA pass.
* cgraphunit.c: Do not include fibheap.h
(expand_thunk): Use get_untransformed_body.
(cgraph_node::expand): Likewise.
* tree-ssa-structalias.c (ipa_pta_execute): Skip inline clones.
* cgraph.c (release_function_body): Do not push cfun when CFG is not there.
(cgraph_node::get_untransformed_body): Break out from ...
(cgraph_node::get_body): ... here; add code to apply all transforms.
* cgraph.h (cgraph_node): Add get_untransformed_body.
* ipa-icf.c (sem_function::init): Use get_untransformed_body.
* cgraphclones.c (duplicate_thunk_for_node): Likewise.
* tree-inline.c (expand_call_inline): LIkewise.
* i386.c (ix86_reset_to_default_globals): Break out from ...
(ix86_set_current_function): ... here;
(ix86_reset_previous_fndecl): Use it.
(ix86_simd_clone_adjust): Use ix86_reset_previous_fndecl.
From-SVN: r217633
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 86 |
1 files changed, 64 insertions, 22 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index a66c9c0..ad181b0 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1664,29 +1664,33 @@ release_function_body (tree decl) { if (DECL_STRUCT_FUNCTION (decl)) { - push_cfun (DECL_STRUCT_FUNCTION (decl)); - if (cfun->cfg - && current_loops) - { - cfun->curr_properties &= ~PROP_loops; - loop_optimizer_finalize (); - } - if (cfun->gimple_df) + if (DECL_STRUCT_FUNCTION (decl)->cfg + || DECL_STRUCT_FUNCTION (decl)->gimple_df) { - delete_tree_ssa (); - delete_tree_cfg_annotations (); - cfun->eh = NULL; - } - if (cfun->cfg) - { - gcc_assert (!dom_info_available_p (CDI_DOMINATORS)); - gcc_assert (!dom_info_available_p (CDI_POST_DOMINATORS)); - clear_edges (); - cfun->cfg = NULL; + push_cfun (DECL_STRUCT_FUNCTION (decl)); + if (cfun->cfg + && current_loops) + { + cfun->curr_properties &= ~PROP_loops; + loop_optimizer_finalize (); + } + if (cfun->gimple_df) + { + delete_tree_ssa (); + delete_tree_cfg_annotations (); + cfun->eh = NULL; + } + if (cfun->cfg) + { + gcc_assert (!dom_info_available_p (CDI_DOMINATORS)); + gcc_assert (!dom_info_available_p (CDI_POST_DOMINATORS)); + clear_edges (); + cfun->cfg = NULL; + } + if (cfun->value_histograms) + free_histograms (); + pop_cfun (); } - if (cfun->value_histograms) - free_histograms (); - pop_cfun (); gimple_set_body (decl, NULL); /* Struct function hangs a lot of data that would leak if we didn't removed all pointers to it. */ @@ -3138,7 +3142,7 @@ cgraph_node::function_symbol (enum availability *availability) present. */ bool -cgraph_node::get_body (void) +cgraph_node::get_untransformed_body (void) { lto_file_decl_data *file_data; const char *data, *name; @@ -3178,6 +3182,44 @@ cgraph_node::get_body (void) return true; } +/* Prepare function body. When doing LTO, read cgraph_node's body from disk + if it is not already present. When some IPA transformations are scheduled, + apply them. */ + +bool +cgraph_node::get_body (void) +{ + bool updated; + + updated = get_untransformed_body (); + + /* Getting transformed body makes no sense for inline clones; + we should never use this on real clones becuase they are materialized + early. + TODO: Materializing clones here will likely lead to smaller LTRANS + footprint. */ + gcc_assert (!global.inlined_to && !clone_of); + if (ipa_transforms_to_apply.exists ()) + { + opt_pass *saved_current_pass = current_pass; + FILE *saved_dump_file = dump_file; + int saved_dump_flags = dump_flags; + + push_cfun (DECL_STRUCT_FUNCTION (decl)); + execute_all_ipa_transforms (); + cgraph_edge::rebuild_edges (); + free_dominance_info (CDI_DOMINATORS); + free_dominance_info (CDI_POST_DOMINATORS); + pop_cfun (); + updated = true; + + current_pass = saved_current_pass; + dump_file = saved_dump_file; + dump_flags = saved_dump_flags; + } + return updated; +} + /* Return the DECL_STRUCT_FUNCTION of the function. */ struct function * |