diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-08-07 01:14:39 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-08-07 01:14:39 +0000 |
commit | a6ae2cf4cfdd79b97135c3905a5e39df2ef67cd3 (patch) | |
tree | 385c4f824e3b48ea8105418478de6436fc129a42 /gcc | |
parent | db6c4d9f8a5ea1fe0535dbbc7403f5ea887708ee (diff) | |
download | gcc-a6ae2cf4cfdd79b97135c3905a5e39df2ef67cd3.tar.gz |
2013-08-07 David Malcolm <dmalcolm@redhat.com>
* coretypes.h (rtl_opt_pass): Add.
(gcc::context): Add.
* config/epiphany/epiphany.c (pass_mode_switch_use): New.
(epiphany_init): Port to new C++ pass API.
(epiphany_optimize_mode_switching): Likewise.
* pass_manager.h (pass_manager::get_pass_split_all_insns): New.
(pass_manager::get_pass_mode_switching): New.
(pass_manager::get_pass_peephole2): New.
* mode-switching.c (pass_mode_switching): Add clone method.
* recog.c (pass_peephole2): Add clone method.
(pass_split_all_insns): Add clone method.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201549 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/config/epiphany/epiphany.c | 35 | ||||
-rw-r--r-- | gcc/coretypes.h | 6 | ||||
-rw-r--r-- | gcc/mode-switching.c | 3 | ||||
-rw-r--r-- | gcc/pass_manager.h | 9 | ||||
-rw-r--r-- | gcc/recog.c | 6 |
6 files changed, 62 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 66ce8528f6c..f89f5eba9d7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2013-08-07 David Malcolm <dmalcolm@redhat.com> + + * coretypes.h (rtl_opt_pass): Add. + (gcc::context): Add. + * config/epiphany/epiphany.c (pass_mode_switch_use): New. + (epiphany_init): Port to new C++ pass API. + (epiphany_optimize_mode_switching): Likewise. + * pass_manager.h (pass_manager::get_pass_split_all_insns): New. + (pass_manager::get_pass_mode_switching): New. + (pass_manager::get_pass_peephole2): New. + * mode-switching.c (pass_mode_switching): Add clone method. + * recog.c (pass_peephole2): Add clone method. + (pass_split_all_insns): Add clone method. + 2013-08-06 David Malcolm <dmalcolm@redhat.com> * config/mips/mips.c (insert_pass_mips_machine_reorg2): Move diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c index 1dcdc4b3808..fd4c01c49a4 100644 --- a/gcc/config/epiphany/epiphany.c +++ b/gcc/config/epiphany/epiphany.c @@ -45,6 +45,8 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "tm-constrs.h" #include "tree-pass.h" /* for current_pass */ +#include "context.h" +#include "pass_manager.h" /* Which cpu we're compiling for. */ int epiphany_cpu_type; @@ -59,6 +61,9 @@ char epiphany_punct_chars[256]; /* The rounding mode that we generally use for floating point. */ int epiphany_normal_fp_rounding; +/* The pass instance, for use in epiphany_optimize_mode_switching. */ +static opt_pass *pass_mode_switch_use; + static void epiphany_init_reg_tables (void); static int get_epiphany_condition_code (rtx); static tree epiphany_handle_interrupt_attribute (tree *, tree, tree, int, bool *); @@ -165,20 +170,26 @@ epiphany_init (void) pass because of the side offect of epiphany_mode_needed on MACHINE_FUNCTION(cfun)->unknown_mode_uses. But it must run before pass_resolve_sw_modes. */ - static struct register_pass_info insert_use_info - = { &pass_mode_switch_use.pass, "mode_sw", + pass_mode_switch_use = make_pass_mode_switch_use (g); + struct register_pass_info insert_use_info + = { pass_mode_switch_use, "mode_sw", 1, PASS_POS_INSERT_AFTER }; - static struct register_pass_info mode_sw2_info - = { &pass_mode_switching.pass, "mode_sw", + opt_pass *mode_sw2 + = g->get_passes()->get_pass_mode_switching ()->clone (); + struct register_pass_info mode_sw2_info + = { mode_sw2, "mode_sw", 1, PASS_POS_INSERT_AFTER }; - static struct register_pass_info mode_sw3_info - = { &pass_resolve_sw_modes.pass, "mode_sw", + opt_pass *mode_sw3 = make_pass_resolve_sw_modes (g); + struct register_pass_info mode_sw3_info + = { mode_sw3, "mode_sw", 1, PASS_POS_INSERT_AFTER }; - static struct register_pass_info mode_sw4_info - = { &pass_split_all_insns.pass, "mode_sw", + opt_pass *mode_sw4 + = g->get_passes()->get_pass_split_all_insns ()->clone (); + struct register_pass_info mode_sw4_info + = { mode_sw4, "mode_sw", 1, PASS_POS_INSERT_AFTER }; static const int num_modes[] = NUM_MODES_FOR_MODE_SWITCHING; @@ -205,8 +216,10 @@ epiphany_init (void) (see http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02819.html,) we need a second peephole2 pass to get reasonable code. */ { - static struct register_pass_info peep2_2_info - = { &pass_peephole2.pass, "peephole2", + opt_pass *extra_peephole2 + = g->get_passes ()->get_pass_peephole2 ()->clone (); + struct register_pass_info peep2_2_info + = { extra_peephole2, "peephole2", 1, PASS_POS_INSERT_AFTER }; @@ -2256,7 +2269,7 @@ epiphany_optimize_mode_switching (int entity) return (MACHINE_FUNCTION (cfun)->sw_entities_processed & (1 << EPIPHANY_MSW_ENTITY_ROUND_UNKNOWN)) != 0; case EPIPHANY_MSW_ENTITY_FPU_OMNIBUS: - return optimize == 0 || current_pass == &pass_mode_switch_use.pass; + return optimize == 0 || current_pass == pass_mode_switch_use; } gcc_unreachable (); } diff --git a/gcc/coretypes.h b/gcc/coretypes.h index edb9c8c8477..54bfe7f8654 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -169,6 +169,12 @@ typedef const struct basic_block_def *const_basic_block; in target.h. */ typedef int reg_class_t; +class rtl_opt_pass; + +namespace gcc { + class context; +} + #else struct _dont_use_rtx_here_; diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c index c941eb11672..56c4d0fef9a 100644 --- a/gcc/mode-switching.c +++ b/gcc/mode-switching.c @@ -809,6 +809,9 @@ public: {} /* opt_pass methods: */ + /* The epiphany backend creates a second instance of this pass, so we need + a clone method. */ + opt_pass * clone () { return new pass_mode_switching (ctxt_); } bool gate () { return gate_mode_switching (); } unsigned int execute () { return rest_of_handle_mode_switching (); } diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h index 00f0b1c50f4..41d2c7605d2 100644 --- a/gcc/pass_manager.h +++ b/gcc/pass_manager.h @@ -66,6 +66,15 @@ public: void execute_early_local_passes (); unsigned int execute_pass_mode_switching (); + /* Various passes are manually cloned by epiphany. */ + opt_pass *get_pass_split_all_insns () const { + return pass_split_all_insns_1; + } + opt_pass *get_pass_mode_switching () const { + return pass_mode_switching_1; + } + opt_pass *get_pass_peephole2 () const { return pass_peephole2_1; } + public: /* The root of the compilation pass tree, once constructed. */ opt_pass *all_passes; diff --git a/gcc/recog.c b/gcc/recog.c index 352fbac896d..2d44416892e 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -3803,6 +3803,9 @@ public: {} /* opt_pass methods: */ + /* The epiphany backend creates a second instance of this pass, so we need + a clone method. */ + opt_pass * clone () { return new pass_peephole2 (ctxt_); } bool gate () { return gate_handle_peephole2 (); } unsigned int execute () { return rest_of_handle_peephole2 (); } @@ -3848,6 +3851,9 @@ public: {} /* opt_pass methods: */ + /* The epiphany backend creates a second instance of this pass, so + we need a clone method. */ + opt_pass * clone () { return new pass_split_all_insns (ctxt_); } unsigned int execute () { return rest_of_handle_split_all_insns (); } }; // class pass_split_all_insns |