diff options
Diffstat (limited to 'gcc/auto-inc-dec.c')
-rw-r--r-- | gcc/auto-inc-dec.c | 86 |
1 files changed, 41 insertions, 45 deletions
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c index 47f516dd33d..0314d183a83 100644 --- a/gcc/auto-inc-dec.c +++ b/gcc/auto-inc-dec.c @@ -1462,50 +1462,8 @@ merge_in_block (int max_reg, basic_block bb) #endif -static unsigned int -rest_of_handle_auto_inc_dec (void) -{ -#ifdef AUTO_INC_DEC - basic_block bb; - int max_reg = max_reg_num (); - - if (!initialized) - init_decision_table (); - - mem_tmp = gen_rtx_MEM (Pmode, NULL_RTX); - - df_note_add_problem (); - df_analyze (); - - reg_next_use = XCNEWVEC (rtx, max_reg); - reg_next_inc_use = XCNEWVEC (rtx, max_reg); - reg_next_def = XCNEWVEC (rtx, max_reg); - FOR_EACH_BB_FN (bb, cfun) - merge_in_block (max_reg, bb); - - free (reg_next_use); - free (reg_next_inc_use); - free (reg_next_def); - - mem_tmp = NULL; -#endif - return 0; -} - - /* Discover auto-inc auto-dec instructions. */ -static bool -gate_auto_inc_dec (void) -{ -#ifdef AUTO_INC_DEC - return (optimize > 0 && flag_auto_inc_dec); -#else - return false; -#endif -} - - namespace { const pass_data pass_data_inc_dec = @@ -1513,7 +1471,6 @@ const pass_data pass_data_inc_dec = RTL_PASS, /* type */ "auto_inc_dec", /* name */ OPTGROUP_NONE, /* optinfo_flags */ - true, /* has_gate */ true, /* has_execute */ TV_AUTO_INC_DEC, /* tv_id */ 0, /* properties_required */ @@ -1531,11 +1488,50 @@ public: {} /* opt_pass methods: */ - bool gate () { return gate_auto_inc_dec (); } - unsigned int execute () { return rest_of_handle_auto_inc_dec (); } + virtual bool gate (function *) + { +#ifdef AUTO_INC_DEC + return (optimize > 0 && flag_auto_inc_dec); +#else + return false; +#endif + } + + + unsigned int execute (function *); }; // class pass_inc_dec +unsigned int +pass_inc_dec::execute (function *fun ATTRIBUTE_UNUSED) +{ +#ifdef AUTO_INC_DEC + basic_block bb; + int max_reg = max_reg_num (); + + if (!initialized) + init_decision_table (); + + mem_tmp = gen_rtx_MEM (Pmode, NULL_RTX); + + df_note_add_problem (); + df_analyze (); + + reg_next_use = XCNEWVEC (rtx, max_reg); + reg_next_inc_use = XCNEWVEC (rtx, max_reg); + reg_next_def = XCNEWVEC (rtx, max_reg); + FOR_EACH_BB_FN (bb, fun) + merge_in_block (max_reg, bb); + + free (reg_next_use); + free (reg_next_inc_use); + free (reg_next_def); + + mem_tmp = NULL; +#endif + return 0; +} + } // anon namespace rtl_opt_pass * |