diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-30 18:52:03 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-30 18:52:03 +0000 |
commit | 3ea50c0149c43275844458dc63d0e7ea005d0b79 (patch) | |
tree | 86d36b6befd119e3194601e30d17b0d964537ee4 /gcc/pass_manager.h | |
parent | b26b6f0d091d1b331680d590da37f07a96b46db9 (diff) | |
download | gcc-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/pass_manager.h')
-rw-r--r-- | gcc/pass_manager.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h new file mode 100644 index 00000000000..f66cd80408f --- /dev/null +++ b/gcc/pass_manager.h @@ -0,0 +1,89 @@ +/* pass_manager.h - The pipeline of optimization passes + Copyright (C) 2013 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef GCC_PASS_MANAGER_H +#define GCC_PASS_MANAGER_H + +class opt_pass; +struct register_pass_info; + +/* Define a list of pass lists so that both passes.c and plugins can easily + find all the pass lists. */ +#define GCC_PASS_LISTS \ + DEF_PASS_LIST (all_lowering_passes) \ + DEF_PASS_LIST (all_small_ipa_passes) \ + DEF_PASS_LIST (all_regular_ipa_passes) \ + DEF_PASS_LIST (all_lto_gen_passes) \ + DEF_PASS_LIST (all_passes) + +#define DEF_PASS_LIST(LIST) PASS_LIST_NO_##LIST, +enum pass_list +{ + GCC_PASS_LISTS + PASS_LIST_NUM +}; +#undef DEF_PASS_LIST + +namespace gcc { + +class context; + +class pass_manager +{ +public: + pass_manager(context *ctxt); + + void register_pass (struct register_pass_info *pass_info); + void register_one_dump_file (struct opt_pass *pass); + + opt_pass *get_pass_for_id (int id) const; + + void dump_passes () const; + + void dump_profile_report () const; + +public: + /* The root of the compilation pass tree, once constructed. */ + opt_pass *all_passes; + opt_pass *all_small_ipa_passes; + opt_pass *all_lowering_passes; + opt_pass *all_regular_ipa_passes; + opt_pass *all_lto_gen_passes; + opt_pass *all_late_ipa_passes; + + /* A map from static pass id to optimization pass. */ + opt_pass **passes_by_id; + int passes_by_id_size; + + opt_pass **pass_lists[PASS_LIST_NUM]; + +private: + void set_pass_for_id (int id, opt_pass *pass); + int register_dump_files_1 (struct opt_pass *pass, int properties); + void register_dump_files (struct opt_pass *pass, int properties); + +private: + context *ctxt_; + +}; // class pass_manager + +} // namespace gcc + +#endif /* ! GCC_PASS_MANAGER_H */ + |