diff options
author | Trevor Saunders <tsaunders@mozilla.com> | 2014-04-17 12:37:34 +0000 |
---|---|---|
committer | Trevor Saunders <tbsaunde@gcc.gnu.org> | 2014-04-17 12:37:34 +0000 |
commit | be55bfe6cf456943b12fe128f8a445b583ace36f (patch) | |
tree | 2c7de59d1f6572c580defbe0ccac2d0b83cd1eb3 /gcc/tree-ssa-pre.c | |
parent | 1a3d085cf2a0caa5daef7c0443b1d280bcef295e (diff) | |
download | gcc-be55bfe6cf456943b12fe128f8a445b583ace36f.zip gcc-be55bfe6cf456943b12fe128f8a445b583ace36f.tar.gz gcc-be55bfe6cf456943b12fe128f8a445b583ace36f.tar.bz2 |
pass cfun to pass::execute
gcc/
* passes.c (opt_pass::execute): Adjust.
(pass_manager::execute_pass_mode_switching): Likewise.
(early_local_passes::execute): Likewise.
(execute_one_pass): Pass cfun to the pass's execute method.
* tree-pass.h (opt_pass::execute): Add function * argument.
* asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c,
cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c,
compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c,
config/epiphany/resolve-sw-modes.c, config/i386/i386.c,
config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c,
config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c,
except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c,
gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c,
graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c,
ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c,
ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c,
lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c,
postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c,
reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c,
store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c,
tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c,
tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c,
tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c,
tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c,
tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c,
tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c,
tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c:
Adjust.
From-SVN: r209482
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r-- | gcc/tree-ssa-pre.c | 129 |
1 files changed, 62 insertions, 67 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index cda315a..b5785d8 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -4690,15 +4690,44 @@ fini_pre () free_dominance_info (CDI_POST_DOMINATORS); } -/* Gate and execute functions for PRE. */ +namespace { -static unsigned int -do_pre (void) +const pass_data pass_data_pre = +{ + GIMPLE_PASS, /* type */ + "pre", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + true, /* has_execute */ + TV_TREE_PRE, /* tv_id */ + /* PROP_no_crit_edges is ensured by placing pass_split_crit_edges before + pass_pre. */ + ( PROP_no_crit_edges | PROP_cfg | PROP_ssa ), /* properties_required */ + 0, /* properties_provided */ + PROP_no_crit_edges, /* properties_destroyed */ + TODO_rebuild_alias, /* todo_flags_start */ + TODO_verify_ssa, /* todo_flags_finish */ +}; + +class pass_pre : public gimple_opt_pass +{ +public: + pass_pre (gcc::context *ctxt) + : gimple_opt_pass (pass_data_pre, ctxt) + {} + + /* opt_pass methods: */ + virtual bool gate (function *) { return flag_tree_pre != 0; } + virtual unsigned int execute (function *); + +}; // class pass_pre + +unsigned int +pass_pre::execute (function *fun) { unsigned int todo = 0; do_partial_partial = - flag_tree_partial_pre && optimize_function_for_speed_p (cfun); + flag_tree_partial_pre && optimize_function_for_speed_p (fun); /* This has to happen before SCCVN runs because loop_optimizer_init may create new phis, etc. */ @@ -4721,7 +4750,7 @@ do_pre (void) fixed, don't run it when he have an incredibly large number of bb's. If we aren't going to run insert, there is no point in computing ANTIC, either, even though it's plenty fast. */ - if (n_basic_blocks_for_fn (cfun) < 4000) + if (n_basic_blocks_for_fn (fun) < 4000) { compute_antic (); insert (); @@ -4736,10 +4765,10 @@ do_pre (void) /* Remove all the redundant expressions. */ todo |= eliminate (); - statistics_counter_event (cfun, "Insertions", pre_stats.insertions); - statistics_counter_event (cfun, "PA inserted", pre_stats.pa_insert); - statistics_counter_event (cfun, "New PHIs", pre_stats.phis); - statistics_counter_event (cfun, "Eliminated", pre_stats.eliminations); + statistics_counter_event (fun, "Insertions", pre_stats.insertions); + statistics_counter_event (fun, "PA inserted", pre_stats.pa_insert); + statistics_counter_event (fun, "New PHIs", pre_stats.phis); + statistics_counter_event (fun, "Eliminated", pre_stats.eliminations); clear_expression_ids (); remove_dead_inserted_code (); @@ -4771,37 +4800,6 @@ do_pre (void) return todo; } -namespace { - -const pass_data pass_data_pre = -{ - GIMPLE_PASS, /* type */ - "pre", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - true, /* has_execute */ - TV_TREE_PRE, /* tv_id */ - /* PROP_no_crit_edges is ensured by placing pass_split_crit_edges before - pass_pre. */ - ( PROP_no_crit_edges | PROP_cfg | PROP_ssa ), /* properties_required */ - 0, /* properties_provided */ - PROP_no_crit_edges, /* properties_destroyed */ - TODO_rebuild_alias, /* todo_flags_start */ - TODO_verify_ssa, /* todo_flags_finish */ -}; - -class pass_pre : public gimple_opt_pass -{ -public: - pass_pre (gcc::context *ctxt) - : gimple_opt_pass (pass_data_pre, ctxt) - {} - - /* opt_pass methods: */ - virtual bool gate (function *) { return flag_tree_pre != 0; } - unsigned int execute () { return do_pre (); } - -}; // class pass_pre - } // anon namespace gimple_opt_pass * @@ -4810,32 +4808,6 @@ make_pass_pre (gcc::context *ctxt) return new pass_pre (ctxt); } - -/* Gate and execute functions for FRE. */ - -static unsigned int -execute_fre (void) -{ - unsigned int todo = 0; - - if (!run_scc_vn (VN_WALKREWRITE)) - return 0; - - memset (&pre_stats, 0, sizeof (pre_stats)); - - /* Remove all the redundant expressions. */ - todo |= eliminate (); - - todo |= fini_eliminate (); - - free_scc_vn (); - - statistics_counter_event (cfun, "Insertions", pre_stats.insertions); - statistics_counter_event (cfun, "Eliminated", pre_stats.eliminations); - - return todo; -} - namespace { const pass_data pass_data_fre = @@ -4862,10 +4834,33 @@ public: /* opt_pass methods: */ opt_pass * clone () { return new pass_fre (m_ctxt); } virtual bool gate (function *) { return flag_tree_fre != 0; } - unsigned int execute () { return execute_fre (); } + virtual unsigned int execute (function *); }; // class pass_fre +unsigned int +pass_fre::execute (function *fun) +{ + unsigned int todo = 0; + + if (!run_scc_vn (VN_WALKREWRITE)) + return 0; + + memset (&pre_stats, 0, sizeof (pre_stats)); + + /* Remove all the redundant expressions. */ + todo |= eliminate (); + + todo |= fini_eliminate (); + + free_scc_vn (); + + statistics_counter_event (fun, "Insertions", pre_stats.insertions); + statistics_counter_event (fun, "Eliminated", pre_stats.eliminations); + + return todo; +} + } // anon namespace gimple_opt_pass * |