summaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-30 18:52:03 +0000
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-30 18:52:03 +0000
commit3ea50c0149c43275844458dc63d0e7ea005d0b79 (patch)
tree86d36b6befd119e3194601e30d17b0d964537ee4 /gcc/cgraphunit.c
parentb26b6f0d091d1b331680d590da37f07a96b46db9 (diff)
downloadgcc-3ea50c0149c43275844458dc63d0e7ea005d0b79.tar.gz
Introduce beginnings of a pass_manager class.
This patch introduces a gcc::pass_manager class and moves various non-GTY globals relating to pass management into it. The gcc::context gains its first field: a pointer to the gcc::pass_manager instance. gcc/ * Makefile.in (PASS_MANAGER_H): New. (lto-cgraph.o): Depend on CONTEXT_H and PASS_MANAGER_H. (passes.o): Likewise. (statistics.o): Likewise. (cgraphunit.o): Likewise. (context.o): Depend on PASS_MANAGER_H. * pass_manager.h: New. * cgraphunit.c (cgraph_add_new_function): Update for moves of globals to fields of pass_manager. (analyze_function): Likewise. (expand_function): Likewise. (ipa_passes): Likewise. (compile): Likewise. * context.c (context::context): New. * context.h (context::context): New. (context::get_passes): New. (context::passes_): New. * lto-cgraph.c (input_node): Update for moves of globals to fields of pass_manager. * passes.c (all_passes): Remove, in favor of a field of the same name within the new class pass_manager. (all_small_ipa_passes): Likewise. (all_lowering_passes): Likewise. (all_regular_ipa_passes): Likewise. (all_late_ipa_passes): Likewise. (all_lto_gen_passes): Likewise. (passes_by_id): Likewise. (passes_by_id_size): Likewise. (gcc_pass_lists): Remove, in favor of "pass_lists" field within the new class pass_manager. (set_pass_for_id): Convert to... (pass_manager::set_pass_for_id): ...method. (get_pass_for_id): Convert to... (pass_manager::get_pass_for_id): ...method. (register_one_dump_file): Move body of implementation into... (pass_manager::register_one_dump_file): ...here. (register_dump_files_1): Convert to... (pass_manager::register_dump_files_1): ...method. (register_dump_files): Convert to... (pass_manager::register_dump_files): ...method. (create_pass_tab): Update for moves of globals to fields of pass_manager. (dump_passes): Move body of implementation into... (pass_manager::dump_passes): ...here. (register_pass): Move body of implementation into... (pass_manager::register_pass): ...here. (init_optimization_passes): Convert into... (pass_manager::pass_manager): ...constructor for new pass_manager class, and initialize the pass_lists array. (check_profile_consistency): Update for moves of globals to fields of pass_manager. (dump_profile_report): Move body of implementation into... (pass_manager::dump_profile_report): ...here. (ipa_write_summaries_1): Update for moves of pass lists from being globals to fields of pass_manager. (ipa_write_optimization_summaries): Likewise. (ipa_read_summaries): Likewise. (ipa_read_optimization_summaries): Likewise. (execute_all_ipa_stmt_fixups): Likewise. * statistics.c (statistics_fini): Update for moves of globals to fields of pass_manager. * toplev.c (general_init): Replace call to init_optimization_passes with construction of the pass_manager instance. * tree-pass.h (all_passes): Remove, in favor of a field of the same name within the new class pass_manager. (all_small_ipa_passes): Likewise. (all_lowering_passes): Likewise. (all_regular_ipa_passes): Likewise. (all_lto_gen_passes): Likewise. (all_late_ipa_passes): Likewise. (passes_by_id): Likewise. (passes_by_id_size): Likewise. (gcc_pass_lists): Remove, in favor of "pass_lists" field within the new class pass_manager. (get_pass_for_id): Remove. gcc/lto/ * Make-lang.in (lto/lto.o:): Depend on CONTEXT_H and PASS_MANAGER_H. * lto.c (do_whole_program_analysis): Update for move of all_regular_ipa_passes from a global to a field of class pass_manager. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201351 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index b82c2e01b57..ca36937a819 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -194,6 +194,8 @@ along with GCC; see the file COPYING3. If not see
#include "except.h"
#include "cfgloop.h"
#include "regset.h" /* FIXME: For reg_obstack. */
+#include "context.h"
+#include "pass_manager.h"
/* Queue of cgraph nodes scheduled to be added into cgraph. This is a
secondary queue used during optimization to accommodate passes that
@@ -478,6 +480,7 @@ cgraph_finalize_function (tree decl, bool nested)
void
cgraph_add_new_function (tree fndecl, bool lowered)
{
+ gcc::pass_manager *passes = g->get_passes ();
struct cgraph_node *node;
switch (cgraph_state)
{
@@ -508,7 +511,7 @@ cgraph_add_new_function (tree fndecl, bool lowered)
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL);
- execute_pass_list (all_lowering_passes);
+ execute_pass_list (passes->all_lowering_passes);
execute_pass_list (pass_early_local_passes.pass.sub);
bitmap_obstack_release (NULL);
pop_cfun ();
@@ -640,7 +643,7 @@ analyze_function (struct cgraph_node *node)
gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL);
- execute_pass_list (all_lowering_passes);
+ execute_pass_list (g->get_passes ()->all_lowering_passes);
free_dominance_info (CDI_POST_DOMINATORS);
free_dominance_info (CDI_DOMINATORS);
compact_blocks ();
@@ -1588,7 +1591,7 @@ expand_function (struct cgraph_node *node)
/* Signal the start of passes. */
invoke_plugin_callbacks (PLUGIN_ALL_PASSES_START, NULL);
- execute_pass_list (all_passes);
+ execute_pass_list (g->get_passes ()->all_passes);
/* Signal the end of passes. */
invoke_plugin_callbacks (PLUGIN_ALL_PASSES_END, NULL);
@@ -1807,6 +1810,8 @@ output_in_order (void)
static void
ipa_passes (void)
{
+ gcc::pass_manager *passes = g->get_passes ();
+
set_cfun (NULL);
current_function_decl = NULL;
gimple_register_cfg_hooks ();
@@ -1816,7 +1821,7 @@ ipa_passes (void)
if (!in_lto_p)
{
- execute_ipa_pass_list (all_small_ipa_passes);
+ execute_ipa_pass_list (passes->all_small_ipa_passes);
if (seen_error ())
return;
}
@@ -1843,14 +1848,15 @@ ipa_passes (void)
cgraph_process_new_functions ();
execute_ipa_summary_passes
- ((struct ipa_opt_pass_d *) all_regular_ipa_passes);
+ ((struct ipa_opt_pass_d *) passes->all_regular_ipa_passes);
}
/* Some targets need to handle LTO assembler output specially. */
if (flag_generate_lto)
targetm.asm_out.lto_start ();
- execute_ipa_summary_passes ((struct ipa_opt_pass_d *) all_lto_gen_passes);
+ execute_ipa_summary_passes ((struct ipa_opt_pass_d *)
+ passes->all_lto_gen_passes);
if (!in_lto_p)
ipa_write_summaries ();
@@ -1859,7 +1865,7 @@ ipa_passes (void)
targetm.asm_out.lto_end ();
if (!flag_ltrans && (in_lto_p || !flag_lto || flag_fat_lto_objects))
- execute_ipa_pass_list (all_regular_ipa_passes);
+ execute_ipa_pass_list (passes->all_regular_ipa_passes);
invoke_plugin_callbacks (PLUGIN_ALL_IPA_PASSES_END, NULL);
bitmap_obstack_release (NULL);
@@ -1985,7 +1991,7 @@ compile (void)
cgraph_materialize_all_clones ();
bitmap_obstack_initialize (NULL);
- execute_ipa_pass_list (all_late_ipa_passes);
+ execute_ipa_pass_list (g->get_passes ()->all_late_ipa_passes);
symtab_remove_unreachable_nodes (true, dump_file);
#ifdef ENABLE_CHECKING
verify_symtab ();