summaryrefslogtreecommitdiff
path: root/gcc/pass_manager.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2013-08-05 20:01:43 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2013-08-05 20:01:43 +0000
commitf7695dbf402847104b2330126a3c61fae199cc1a (patch)
treecdd5686bbad14a7a9b7c4e8de621c8b7b8826c56 /gcc/pass_manager.h
parentd0b2f8311e5e1917464aa4f65d506fbe4e580eb1 (diff)
downloadgcc-f7695dbf402847104b2330126a3c61fae199cc1a.tar.gz
Handwritten part of conversion of passes to C++ classes
gcc/ * Makefile.in (PASS_MANAGER_H): Add dep on pass-instances.def. (toplev.o): Add dep on PASS_MANAGER_H. * cgraphunit.c (cgraph_process_new_functions): Rework invocation of early local pases to reflect this moving from a global to a member of gcc::pass_manager. (cgraph_add_new_function): Likewise. * lto-cgraph.c (lto_output_node): Update for conversion of struct ipa_opt_pass_d to a C++ subclass of opt_pass. * passes.c (opt_pass::clone): New. (opt_pass::gate): New. (opt_pass::execute): New. (opt_pass::opt_pass): New. (pass_manager::execute_early_local_passes): New. (pass_manager::execute_pass_mode_switching): new. (finish_optimization_passes): Convert to... (pass_manager::finish_optimization_passes): ...this. (finish_optimization_passes): Update for conversion of passes to C++ classes. (register_dump_files_1): Use has_gate since we cannot portably check a vtable entry against NULL. (dump_one_pass): Likewise. (ipa_write_summaries_2): Likewise. (ipa_write_optimization_summaries_1): Likewise. (ipa_read_summaries_1): Likewise. (ipa_read_optimization_summaries_1): Likewise. (execute_ipa_stmt_fixups): Likewise. (pass_manager::pass_manager): Rewrite pass-creation, invoking pass-creation functions rather than wiring up globals, and storing the results in fields of pass_manager generated using pass-instances.def. (pass_manager::dump_profile_report): Update for conversion of passes to C++ classes. (pass_manager::execute_ipa_summary_passes): Likewise. (execute_one_ipa_transform_pass): Likewise. (execute_one_pass): Use has_gate and has_execute since we cannot portably check a vtable entry against NULL. * pass_manager.h (pass_manager::finish_optimization_passes): New. (pass_manager): Use pass-instances.def to add fields for the various pass instances. * toplev.c (finalize): Update for move of finish_optimization_passes to a method of gcc::pass_manager. * toplev.h (finish_optimization_passes): Move to method of class pass_manager. * tree-pass.h (struct pass_data): New. (opt_pass): Convert to C++ class, make it a subclass of pass_data. (opt_pass::gate): Convert to virtual function. (opt_pass::~opt_pass): New. (opt_pass::clone): New. (opt_pass::execute): Convert to virtual function. (opt_pass::opt_pass): New. (opt_pass::ctxt_): new. (gimple_opt_pass): Convert to subclass of opt_pass. (gimple_opt_pass::gimple_opt_pass): New. (rtl_opt_pass): Convert to subclass of opt_pass. (rtl_opt_pass::rtl_opt_pass): New. (ipa_opt_pass_d): Convert to subclass of opt_pass. (ipa_opt_pass_d::ipa_opt_pass_d): New. (simple_ipa_opt_pass): Convert to subclass of opt_pass. (simple_ipa_opt_pass::simple_ipa_opt_pass): New. * config/i386/i386.c (rest_of_handle_insert_vzeroupper): Rework invocation of pass_mode_switching to reflect this moving from a global to a member of gcc::pass_manager. (ix86_option_override): Rework how pass_insert_vzeroupper is added to the pass_manager to reflect autogenerated changes. * config/i386/t-i386 (i386.o) Add deps on CONTEXT_H and PASS_MANAGER_H. gcc/testsuite/ * g++.dg/plugin/dumb_plugin.c (plugin_init): Rework how the pass is created and added to the pass_manager to reflect autogenerated changes. * g++.dg/plugin/selfassign.c (plugin_init): Likewise. * gcc.dg/plugin/one_time_plugin.c (plugin_init): Likewise. * gcc.dg/plugin/selfassign.c (plugin_init): Likewise. From-SVN: r201505
Diffstat (limited to 'gcc/pass_manager.h')
-rw-r--r--gcc/pass_manager.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
index f66cd80408f..ea078a5eb66 100644
--- a/gcc/pass_manager.h
+++ b/gcc/pass_manager.h
@@ -58,6 +58,12 @@ public:
void dump_profile_report () const;
+ void finish_optimization_passes ();
+
+ /* Access to specific passes, so that the majority can be private. */
+ void execute_early_local_passes ();
+ unsigned int execute_pass_mode_switching ();
+
public:
/* The root of the compilation pass tree, once constructed. */
opt_pass *all_passes;
@@ -81,6 +87,37 @@ private:
private:
context *ctxt_;
+ /* References to all of the individual passes.
+ These fields are generated via macro expansion.
+
+ For example:
+ NEXT_PASS (pass_build_cfg, 1);
+ within pass-instances.def means that there is a field:
+ opt_pass *pass_build_cfg_1;
+
+ Similarly, the various:
+ NEXT_PASS (pass_copy_prop, 1);
+ ...
+ NEXT_PASS (pass_copy_prop, 8);
+ in pass-instances.def lead to fields:
+ opt_pass *pass_copy_prop_1;
+ ...
+ opt_pass *pass_copy_prop_8; */
+
+#define INSERT_PASSES_AFTER(PASS)
+#define PUSH_INSERT_PASSES_WITHIN(PASS)
+#define POP_INSERT_PASSES()
+#define NEXT_PASS(PASS, NUM) opt_pass *PASS ## _ ## NUM
+#define TERMINATE_PASS_LIST()
+
+#include "pass-instances.def"
+
+#undef INSERT_PASSES_AFTER
+#undef PUSH_INSERT_PASSES_WITHIN
+#undef POP_INSERT_PASSES
+#undef NEXT_PASS
+#undef TERMINATE_PASS_LIST
+
}; // class pass_manager
} // namespace gcc