public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 3/6] remove has_gate
  2014-04-17  8:38 [PATCH 1/6] remove properties stuff from register_dump_files_1 tsaunders
@ 2014-04-17  8:38 ` tsaunders
  2014-04-17  8:56   ` Richard Biener
  2014-04-17  8:38 ` [PATCH 4/6] enable -Woverloaded-virtual when available tsaunders
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: tsaunders @ 2014-04-17  8:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tsaunders@mozilla.com>


2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>

gcc/
	* pass_manager.h (pass_manager::register_dump_files_1): Remove declaration.
	* passes.c (pass_manager::register_dump_files_1): Merge into
	(pass_manager::register_dump_files): this, and remove its handling of
	properties since the pass always has the properties anyway.
	(pass_manager::pass_manager): Adjust.

2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>
	
gcc/
	* passes.c (dump_one_pass): don't check pass->has_gate.
	(execute_ipa_summary_passes): Likewise.
	(execute_one_pass): Likewise.
	(ipa_write_summaries_2): Likewise.
	(ipa_write_optimization_summaries_1): Likewise.
	(ipa_read_optimization_summaries_1): Likewise.
	(execute_ipa_stmt_fixups): Likewise.
	* tree-pass.h (pass_data::has_gate): Remove.
	* 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/sh/sh_optimize_sett_clrt.cc, config/sh/sh_treg_combine.cc,
	config/sparc/sparc.c, cprop.c, cse.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,
	modulo-sched.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-profile.c,
	tree-sra.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.

gcc/testsuite/
	* g++.dg/plugin/dumb_plugin.c, g++.dg/plugin/selfassign.c,
	gcc/plugin/one_time_plugin.c, gcc.dg/plugin/selfassign.c: Adjust.

diff --git a/gcc/asan.c b/gcc/asan.c
index 53992a8..e26ce41 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2485,7 +2485,6 @@ const pass_data pass_data_asan =
   GIMPLE_PASS, /* type */
   "asan", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
@@ -2531,7 +2530,6 @@ const pass_data pass_data_asan_O0 =
   GIMPLE_PASS, /* type */
   "asan0", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
@@ -2614,7 +2612,6 @@ const pass_data pass_data_sanopt =
   GIMPLE_PASS, /* type */
   "sanopt", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index 47f516d..4346e85 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -1513,7 +1513,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 */
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index fa6f62f..6ac0242 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2338,7 +2338,6 @@ const pass_data pass_data_reorder_blocks =
   RTL_PASS, /* type */
   "bbro", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_REORDER_BLOCKS, /* tv_id */
   0, /* properties_required */
@@ -2511,7 +2510,6 @@ const pass_data pass_data_duplicate_computed_gotos =
   RTL_PASS, /* type */
   "compgotos", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_REORDER_BLOCKS, /* tv_id */
   0, /* properties_required */
@@ -2735,7 +2733,6 @@ const pass_data pass_data_partition_blocks =
   RTL_PASS, /* type */
   "bbpart", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_REORDER_BLOCKS, /* tv_id */
   PROP_cfglayout, /* properties_required */
diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index 4fa68f1..d44917f 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -1515,7 +1515,6 @@ const pass_data pass_data_branch_target_load_optimize1 =
   RTL_PASS, /* type */
   "btl1", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -1584,7 +1583,6 @@ const pass_data pass_data_branch_target_load_optimize2 =
   RTL_PASS, /* type */
   "btl2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 77196ee..d5d68bf 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -3096,7 +3096,6 @@ const pass_data pass_data_jump =
   RTL_PASS, /* type */
   "jump", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_JUMP, /* tv_id */
   0, /* properties_required */
@@ -3140,7 +3139,6 @@ const pass_data pass_data_jump2 =
   RTL_PASS, /* type */
   "jump2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_JUMP, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index b7f6360..c60703f 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -5923,7 +5923,6 @@ const pass_data pass_data_expand =
   RTL_PASS, /* type */
   "expand", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_EXPAND, /* tv_id */
   ( PROP_ssa | PROP_gimple_leh | PROP_cfg
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 60b0c06..0404d08 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -469,7 +469,6 @@ const pass_data pass_data_free_cfg =
   RTL_PASS, /* type */
   "*free_cfg", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -3495,7 +3494,6 @@ const pass_data pass_data_into_cfg_layout_mode =
   RTL_PASS, /* type */
   "into_cfglayout", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_CFG, /* tv_id */
   0, /* properties_required */
@@ -3532,7 +3530,6 @@ const pass_data pass_data_outof_cfg_layout_mode =
   RTL_PASS, /* type */
   "outof_cfglayout", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_CFG, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 19961e2..9c6d46d 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -388,7 +388,6 @@ const pass_data pass_data_build_cgraph_edges =
   GIMPLE_PASS, /* type */
   "*build_cgraph_edges", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
@@ -522,7 +521,6 @@ const pass_data pass_data_rebuild_cgraph_edges =
   GIMPLE_PASS, /* type */
   "*rebuild_cgraph_edges", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_CGRAPH, /* tv_id */
   PROP_cfg, /* properties_required */
@@ -570,7 +568,6 @@ const pass_data pass_data_remove_cgraph_callee_edges =
   GIMPLE_PASS, /* type */
   "*remove_cgraph_callee_edges", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index 69fd5ea..ec22ab3 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -650,7 +650,6 @@ const pass_data pass_data_stack_adjustments =
   RTL_PASS, /* type */
   "csa", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_COMBINE_STACK_ADJUST, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/combine.c b/gcc/combine.c
index f7a279e..63933c0 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -13897,7 +13897,6 @@ const pass_data pass_data_combine =
   RTL_PASS, /* type */
   "combine", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_COMBINE, /* tv_id */
   PROP_cfglayout, /* properties_required */
diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c
index 3fbe140..e66b1c6 100644
--- a/gcc/compare-elim.c
+++ b/gcc/compare-elim.c
@@ -659,7 +659,6 @@ const pass_data pass_data_compare_elim_after_reload =
   RTL_PASS, /* type */
   "cmpelim", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 604a2ec..eddc55e 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -605,7 +605,6 @@ const pass_data pass_data_arc_ifcvt =
   RTL_PASS,
   "arc_ifcvt",				/* name */
   OPTGROUP_NONE,			/* optinfo_flags */
-  false,				/* has_gate */
   true,					/* has_execute */
   TV_IFCVT2,				/* tv_id */
   0,					/* properties_required */
@@ -644,7 +643,6 @@ const pass_data pass_data_arc_predicate_delay_insns =
   RTL_PASS,
   "arc_predicate_delay_insns",		/* name */
   OPTGROUP_NONE,			/* optinfo_flags */
-  false,				/* has_gate */
   true,					/* has_execute */
   TV_IFCVT2,				/* tv_id */
   0,					/* properties_required */
diff --git a/gcc/config/epiphany/mode-switch-use.c b/gcc/config/epiphany/mode-switch-use.c
index a0aa249..d893934 100644
--- a/gcc/config/epiphany/mode-switch-use.c
+++ b/gcc/config/epiphany/mode-switch-use.c
@@ -78,7 +78,6 @@ const pass_data pass_data_mode_switch_use =
   RTL_PASS, /* type */
   "mode_switch_use", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
index 1684918..486330c 100644
--- a/gcc/config/epiphany/resolve-sw-modes.c
+++ b/gcc/config/epiphany/resolve-sw-modes.c
@@ -168,7 +168,6 @@ const pass_data pass_data_resolve_sw_modes =
   RTL_PASS, /* type */
   "resolve_sw_modes", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_MODE_SWITCH, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index f2e6957..6dd1bbe 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2525,7 +2525,6 @@ const pass_data pass_data_insert_vzeroupper =
   RTL_PASS, /* type */
   "vzeroupper", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 83fe55b..6c0b3c2 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -16533,7 +16533,6 @@ const pass_data pass_data_mips_machine_reorg2 =
   RTL_PASS, /* type */
   "mach2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_MACH_DEP, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index b5cd2ad..88b030f 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -142,7 +142,6 @@ const pass_data pass_data_rl78_devirt =
   RTL_PASS, /* type */
   "devirt", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_MACH_DEP, /* tv_id */
   0, /* properties_required */
@@ -226,7 +225,6 @@ const pass_data pass_data_rl78_move_elim =
   RTL_PASS, /* type */
   "move_elim", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_MACH_DEP, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index aac8de8..77e163f 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -8665,7 +8665,6 @@ const pass_data pass_data_s390_early_mach =
   RTL_PASS, /* type */
   "early_mach", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_MACH_DEP, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/config/sh/sh_optimize_sett_clrt.cc b/gcc/config/sh/sh_optimize_sett_clrt.cc
index 313e5b5..85cb6a1 100644
--- a/gcc/config/sh/sh_optimize_sett_clrt.cc
+++ b/gcc/config/sh/sh_optimize_sett_clrt.cc
@@ -138,7 +138,6 @@ const pass_data sh_optimize_sett_clrt::default_pass_data =
   RTL_PASS,		// type
   "",			// name (overwritten by the constructor)
   OPTGROUP_NONE,	// optinfo_flags
-  true,			// has_gate
   true,			// has_execute
   TV_OPTIMIZE,		// tv_id
   0,			// properties_required
diff --git a/gcc/config/sh/sh_treg_combine.cc b/gcc/config/sh/sh_treg_combine.cc
index e736040..1285ba2 100644
--- a/gcc/config/sh/sh_treg_combine.cc
+++ b/gcc/config/sh/sh_treg_combine.cc
@@ -593,7 +593,6 @@ const pass_data sh_treg_combine::default_pass_data =
   RTL_PASS,		// type
   "",			// name (overwritten by the constructor)
   OPTGROUP_NONE,	// optinfo_flags
-  true,			// has_gate
   true,			// has_execute
   TV_OPTIMIZE,		// tv_id
   0,			// properties_required
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index f52b976..a63e813 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1129,7 +1129,6 @@ const pass_data pass_data_work_around_errata =
   RTL_PASS, /* type */
   "errata", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_MACH_DEP, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/cprop.c b/gcc/cprop.c
index c3acb05..f22cde7 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -1925,7 +1925,6 @@ const pass_data pass_data_rtl_cprop =
   RTL_PASS, /* type */
   "cprop", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_CPROP, /* tv_id */
   PROP_cfglayout, /* properties_required */
diff --git a/gcc/cse.c b/gcc/cse.c
index b8223f7..6edea01 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7497,7 +7497,6 @@ const pass_data pass_data_cse =
   RTL_PASS, /* type */
   "cse1", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_CSE, /* tv_id */
   0, /* properties_required */
@@ -7577,7 +7576,6 @@ const pass_data pass_data_cse2 =
   RTL_PASS, /* type */
   "cse2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_CSE2, /* tv_id */
   0, /* properties_required */
@@ -7655,7 +7653,6 @@ const pass_data pass_data_cse_after_global_opts =
   RTL_PASS, /* type */
   "cse_local", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_CSE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/dce.c b/gcc/dce.c
index 07592f4..33cdefd 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -793,7 +793,6 @@ const pass_data pass_data_ud_rtl_dce =
   RTL_PASS, /* type */
   "ud_dce", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_DCE, /* tv_id */
   0, /* properties_required */
@@ -1226,7 +1225,6 @@ const pass_data pass_data_fast_rtl_dce =
   RTL_PASS, /* type */
   "rtl_dce", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_DCE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/df-core.c b/gcc/df-core.c
index edb3b25..9909ac3 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -754,7 +754,6 @@ const pass_data pass_data_df_initialize_opt =
   RTL_PASS, /* type */
   "dfinit", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_DF_SCAN, /* tv_id */
   0, /* properties_required */
@@ -800,7 +799,6 @@ const pass_data pass_data_df_initialize_no_opt =
   RTL_PASS, /* type */
   "no-opt dfinit", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_DF_SCAN, /* tv_id */
   0, /* properties_required */
@@ -866,7 +864,6 @@ const pass_data pass_data_df_finish =
   RTL_PASS, /* type */
   "dfinish", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/dse.c b/gcc/dse.c
index 09dc5df..a3a66b1 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -3733,7 +3733,6 @@ const pass_data pass_data_rtl_dse1 =
   RTL_PASS, /* type */
   "dse1", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_DSE1, /* tv_id */
   0, /* properties_required */
@@ -3771,7 +3770,6 @@ const pass_data pass_data_rtl_dse2 =
   RTL_PASS, /* type */
   "dse2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_DSE2, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index abcdeb3..d278a27 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -3399,7 +3399,6 @@ const pass_data pass_data_dwarf2_frame =
   RTL_PASS, /* type */
   "dwarf2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_FINAL, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/except.c b/gcc/except.c
index 908954c..cf3cd5f 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2008,7 +2008,6 @@ const pass_data pass_data_set_nothrow_function_flags =
   RTL_PASS, /* type */
   "nothrow", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -2639,7 +2638,6 @@ const pass_data pass_data_convert_to_eh_region_ranges =
   RTL_PASS, /* type */
   "eh_ranges", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/final.c b/gcc/final.c
index 83abee2..91b8ccc 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -852,7 +852,6 @@ const pass_data pass_data_compute_alignments =
   RTL_PASS, /* type */
   "alignments", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -4481,7 +4480,6 @@ const pass_data pass_data_final =
   RTL_PASS, /* type */
   "final", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_FINAL, /* tv_id */
   0, /* properties_required */
@@ -4527,7 +4525,6 @@ const pass_data pass_data_shorten_branches =
   RTL_PASS, /* type */
   "shorten", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_SHORTEN_BRANCH, /* tv_id */
   0, /* properties_required */
@@ -4691,7 +4688,6 @@ const pass_data pass_data_clean_state =
   RTL_PASS, /* type */
   "*clean_state", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_FINAL, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/function.c b/gcc/function.c
index a61e475..cf07255 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1950,7 +1950,6 @@ const pass_data pass_data_instantiate_virtual_regs =
   RTL_PASS, /* type */
   "vregs", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -6949,7 +6948,6 @@ const pass_data pass_data_leaf_regs =
   RTL_PASS, /* type */
   "*leaf_regs", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -7009,7 +7007,6 @@ const pass_data pass_data_thread_prologue_and_epilogue =
   RTL_PASS, /* type */
   "pro_and_epilogue", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_THREAD_PROLOGUE_AND_EPILOGUE, /* tv_id */
   0, /* properties_required */
@@ -7229,7 +7226,6 @@ const pass_data pass_data_match_asm_constraints =
   RTL_PASS, /* type */
   "asmcons", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index 4317f51..061d533 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -1490,7 +1490,6 @@ const pass_data pass_data_rtl_fwprop =
   RTL_PASS, /* type */
   "fwprop1", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_FWPROP, /* tv_id */
   0, /* properties_required */
@@ -1557,7 +1556,6 @@ const pass_data pass_data_rtl_fwprop_addr =
   RTL_PASS, /* type */
   "fwprop2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_FWPROP, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/gcse.c b/gcc/gcse.c
index b852aa1..6797b08 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4220,7 +4220,6 @@ const pass_data pass_data_rtl_pre =
   RTL_PASS, /* type */
   "rtl pre", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_PRE, /* tv_id */
   PROP_cfglayout, /* properties_required */
@@ -4259,7 +4258,6 @@ const pass_data pass_data_rtl_hoist =
   RTL_PASS, /* type */
   "hoist", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_HOIST, /* tv_id */
   PROP_cfglayout, /* properties_required */
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index da3fb9f..66ea322 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -163,7 +163,6 @@ const pass_data pass_data_lower_cf =
   GIMPLE_PASS, /* type */
   "lower", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_gimple_any, /* properties_required */
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 56fcfc8..e0ce2ec 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -429,7 +429,6 @@ const pass_data pass_data_isolate_erroneous_paths =
   GIMPLE_PASS, /* type */
   "isolate-paths", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_ISOLATE_ERRONEOUS_PATHS, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 9ad1b4f..8d19031 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -3659,7 +3659,6 @@ const pass_data pass_data_strength_reduction =
   GIMPLE_PASS, /* type */
   "slsr", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_GIMPLE_SLSR, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 311b7e3..03a7161 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -357,7 +357,6 @@ const pass_data pass_data_graphite =
   GIMPLE_PASS, /* type */
   "graphite0", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_GRAPHITE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -394,7 +393,6 @@ const pass_data pass_data_graphite_transforms =
   GIMPLE_PASS, /* type */
   "graphite", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_GRAPHITE_TRANSFORMS, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 0d1adce..5c0843d 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -4545,7 +4545,6 @@ const pass_data pass_data_rtl_ifcvt =
   RTL_PASS, /* type */
   "ce1", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IFCVT, /* tv_id */
   0, /* properties_required */
@@ -4600,7 +4599,6 @@ const pass_data pass_data_if_after_combine =
   RTL_PASS, /* type */
   "ce2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IFCVT, /* tv_id */
   0, /* properties_required */
@@ -4654,7 +4652,6 @@ const pass_data pass_data_if_after_reload =
   RTL_PASS, /* type */
   "ce3", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IFCVT2, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/init-regs.c b/gcc/init-regs.c
index fcc6e2c..265fed7 100644
--- a/gcc/init-regs.c
+++ b/gcc/init-regs.c
@@ -145,7 +145,6 @@ const pass_data pass_data_initialize_regs =
   RTL_PASS, /* type */
   "init-regs", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 689378a..1f28b69 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -3779,7 +3779,6 @@ const pass_data pass_data_ipa_cp =
   IPA_PASS, /* type */
   "cp", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_CONSTANT_PROP, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 3a5432e..19369c6 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -1928,7 +1928,6 @@ const pass_data pass_data_ipa_devirt =
   IPA_PASS, /* type */
   "devirt", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_DEVIRT, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 8e0f5dd..8783caa 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -2920,7 +2920,6 @@ const pass_data pass_data_inline_parameters =
   GIMPLE_PASS, /* type */
   "inline_param", /* name */
   OPTGROUP_INLINE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_INLINE_PARAMETERS, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 4051819..da02afc 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -2340,7 +2340,6 @@ const pass_data pass_data_early_inline =
   GIMPLE_PASS, /* type */
   "einline", /* name */
   OPTGROUP_INLINE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_EARLY_INLINING, /* tv_id */
   PROP_ssa, /* properties_required */
@@ -2377,7 +2376,6 @@ const pass_data pass_data_ipa_inline =
   IPA_PASS, /* type */
   "inline", /* name */
   OPTGROUP_INLINE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_IPA_INLINING, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
index 17de687..f2a72de 100644
--- a/gcc/ipa-profile.c
+++ b/gcc/ipa-profile.c
@@ -724,7 +724,6 @@ const pass_data pass_data_ipa_profile =
   IPA_PASS, /* type */
   "profile_estimate", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_PROFILE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 7d35880..eac3636 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1515,7 +1515,6 @@ const pass_data pass_data_ipa_pure_const =
   IPA_PASS, /* type */
   "pure-const", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_PURE_CONST, /* tv_id */
   0, /* properties_required */
@@ -1699,7 +1698,6 @@ const pass_data pass_data_local_pure_const =
   GIMPLE_PASS, /* type */
   "local-pure-const", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_PURE_CONST, /* tv_id */
   0, /* properties_required */
@@ -1755,7 +1753,6 @@ const pass_data pass_data_warn_function_noreturn =
   GIMPLE_PASS, /* type */
   "*warn_function_noreturn", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index dbe32e4..126948e 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -1163,7 +1163,6 @@ const pass_data pass_data_ipa_reference =
   IPA_PASS, /* type */
   "static-var", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_REFERENCE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 38bd883..ebb9197 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1664,7 +1664,6 @@ const pass_data pass_data_split_functions =
   GIMPLE_PASS, /* type */
   "fnsplit", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_FNSPLIT, /* tv_id */
   PROP_cfg, /* properties_required */
@@ -1724,7 +1723,6 @@ const pass_data pass_data_feedback_split_functions =
   GIMPLE_PASS, /* type */
   "feedback_fnsplit", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_FNSPLIT, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 26e9b03..5e06509 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -1195,7 +1195,6 @@ const pass_data pass_data_ipa_function_and_variable_visibility =
   SIMPLE_IPA_PASS, /* type */
   "visibility", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_CGRAPHOPT, /* tv_id */
   0, /* properties_required */
@@ -1244,7 +1243,6 @@ const pass_data pass_data_ipa_free_inline_summary =
   SIMPLE_IPA_PASS, /* type */
   "*free_inline_summary", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_IPA_FREE_INLINE_SUMMARY, /* tv_id */
   0, /* properties_required */
@@ -1300,7 +1298,6 @@ const pass_data pass_data_ipa_whole_program_visibility =
   IPA_PASS, /* type */
   "whole-program", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_CGRAPHOPT, /* tv_id */
   0, /* properties_required */
@@ -1633,7 +1630,6 @@ const pass_data pass_data_ipa_cdtor_merge =
   IPA_PASS, /* type */
   "cdtor", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_CGRAPHOPT, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/ira.c b/gcc/ira.c
index 4d91d21..da0f453 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5562,7 +5562,6 @@ const pass_data pass_data_ira =
   RTL_PASS, /* type */
   "ira", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_IRA, /* tv_id */
   0, /* properties_required */
@@ -5606,7 +5605,6 @@ const pass_data pass_data_reload =
   RTL_PASS, /* type */
   "reload", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_RELOAD, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/jump.c b/gcc/jump.c
index e6dabd0..7361101 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -146,7 +146,6 @@ const pass_data pass_data_cleanup_barriers =
   RTL_PASS, /* type */
   "barriers", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 2c2c269..d0bd4ec 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -320,7 +320,6 @@ const pass_data pass_data_loop2 =
   RTL_PASS, /* type */
   "loop2", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_LOOP, /* tv_id */
   0, /* properties_required */
@@ -374,7 +373,6 @@ const pass_data pass_data_rtl_loop_init =
   RTL_PASS, /* type */
   "loop2_init", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_LOOP, /* tv_id */
   0, /* properties_required */
@@ -432,7 +430,6 @@ const pass_data pass_data_rtl_loop_done =
   RTL_PASS, /* type */
   "loop2_done", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_LOOP, /* tv_id */
   0, /* properties_required */
@@ -485,7 +482,6 @@ const pass_data pass_data_rtl_move_loop_invariants =
   RTL_PASS, /* type */
   "loop2_invariant", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_LOOP_MOVE_INVARIANTS, /* tv_id */
   0, /* properties_required */
@@ -540,7 +536,6 @@ const pass_data pass_data_rtl_unswitch =
   RTL_PASS, /* type */
   "loop2_unswitch", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_LOOP_UNSWITCH, /* tv_id */
   0, /* properties_required */
@@ -607,7 +602,6 @@ const pass_data pass_data_rtl_unroll_and_peel_loops =
   RTL_PASS, /* type */
   "loop2_unroll", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_LOOP_UNROLL, /* tv_id */
   0, /* properties_required */
@@ -667,7 +661,6 @@ const pass_data pass_data_rtl_doloop =
   RTL_PASS, /* type */
   "loop2_doloop", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_LOOP_DOLOOP, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index a1331c0..53ef1d9 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1720,7 +1720,6 @@ const pass_data pass_data_lower_subreg =
   RTL_PASS, /* type */
   "subreg1", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_LOWER_SUBREG, /* tv_id */
   0, /* properties_required */
@@ -1758,7 +1757,6 @@ const pass_data pass_data_lower_subreg2 =
   RTL_PASS, /* type */
   "subreg2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_LOWER_SUBREG, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index 2848da3..d73135a 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -816,7 +816,6 @@ const pass_data pass_data_mode_switching =
   RTL_PASS, /* type */
   "mode_sw", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_MODE_SWITCH, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index 7ba3ddb..a097df3 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -3362,7 +3362,6 @@ const pass_data pass_data_sms =
   RTL_PASS, /* type */
   "sms", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_SMS, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index ed4e218..cadec81 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8340,7 +8340,6 @@ const pass_data pass_data_expand_omp =
   GIMPLE_PASS, /* type */
   "ompexp", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_gimple_any, /* properties_required */
@@ -10201,7 +10200,6 @@ const pass_data pass_data_lower_omp =
   GIMPLE_PASS, /* type */
   "omplower", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_gimple_any, /* properties_required */
@@ -10632,7 +10630,6 @@ const pass_data pass_data_diagnose_omp_blocks =
   GIMPLE_PASS, /* type */
   "*diagnose_omp_blocks", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_gimple_any, /* properties_required */
@@ -11797,7 +11794,6 @@ const pass_data pass_data_omp_simd_clone =
   SIMPLE_IPA_PASS,		/* type */
   "simdclone",			/* name */
   OPTGROUP_NONE,		/* optinfo_flags */
-  true,				/* has_gate */
   true,				/* has_execute */
   TV_NONE,			/* tv_id */
   ( PROP_ssa | PROP_cfg ),	/* properties_required */
diff --git a/gcc/passes.c b/gcc/passes.c
index 7508771..5d5a94c 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -353,7 +353,6 @@ const pass_data pass_data_early_local_passes =
   SIMPLE_IPA_PASS, /* type */
   "early_local_cleanups", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_EARLY_LOCAL, /* tv_id */
   0, /* properties_required */
@@ -401,7 +400,6 @@ const pass_data pass_data_all_early_optimizations =
   GIMPLE_PASS, /* type */
   "early_optimizations", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -446,7 +444,6 @@ const pass_data pass_data_all_optimizations =
   GIMPLE_PASS, /* type */
   "*all_optimizations", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_OPTIMIZE, /* tv_id */
   0, /* properties_required */
@@ -491,7 +488,6 @@ const pass_data pass_data_all_optimizations_g =
   GIMPLE_PASS, /* type */
   "*all_optimizations_g", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_OPTIMIZE, /* tv_id */
   0, /* properties_required */
@@ -536,7 +532,6 @@ const pass_data pass_data_rest_of_compilation =
   RTL_PASS, /* type */
   "*rest_of_compilation", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_REST_OF_COMPILATION, /* tv_id */
   PROP_rtl, /* properties_required */
@@ -579,7 +574,6 @@ const pass_data pass_data_postreload =
   RTL_PASS, /* type */
   "*all-postreload", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_POSTRELOAD, /* tv_id */
   PROP_rtl, /* properties_required */
@@ -829,7 +823,7 @@ dump_one_pass (opt_pass *pass, int pass_indent)
   const char *pn;
   bool is_on, is_really_on;
 
-  is_on = pass->has_gate ? pass->gate () : true;
+  is_on = pass->gate ();
   is_really_on = override_gate_status (pass, current_function_decl, is_on);
 
   if (pass->static_pass_number <= 0)
@@ -1982,7 +1976,7 @@ execute_ipa_summary_passes (ipa_opt_pass_d *ipa_pass)
 
       /* Execute all of the IPA_PASSes in the list.  */
       if (ipa_pass->type == IPA_PASS
-	  && ((!pass->has_gate) || pass->gate ())
+	  && pass->gate ()
 	  && ipa_pass->generate_summary)
 	{
 	  pass_init_dump_file (pass);
@@ -2134,7 +2128,7 @@ execute_one_pass (opt_pass *pass)
 
   /* Check whether gate check should be avoided.
      User controls the value of the gate through the parameter "gate_status". */
-  gate_status = pass->has_gate ? pass->gate () : true;
+  gate_status = pass->gate ();
   gate_status = override_gate_status (pass, current_function_decl, gate_status);
 
   /* Override gate with plugin.  */
@@ -2280,7 +2274,7 @@ ipa_write_summaries_2 (opt_pass *pass, struct lto_out_decl_state *state)
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
       if (pass->type == IPA_PASS
 	  && ipa_pass->write_summary
-	  && ((!pass->has_gate) || pass->gate ()))
+	  && pass->gate ())
 	{
 	  /* If a timevar is present, start it.  */
 	  if (pass->tv_id)
@@ -2398,7 +2392,7 @@ ipa_write_optimization_summaries_1 (opt_pass *pass,
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
       if (pass->type == IPA_PASS
 	  && ipa_pass->write_optimization_summary
-	  && ((!pass->has_gate) || pass->gate ()))
+	  && pass->gate ())
 	{
 	  /* If a timevar is present, start it.  */
 	  if (pass->tv_id)
@@ -2476,7 +2470,7 @@ ipa_read_summaries_1 (opt_pass *pass)
       gcc_assert (!cfun);
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
 
-      if ((!pass->has_gate) || pass->gate ())
+      if (pass->gate ())
 	{
 	  if (pass->type == IPA_PASS && ipa_pass->read_summary)
 	    {
@@ -2526,7 +2520,7 @@ ipa_read_optimization_summaries_1 (opt_pass *pass)
       gcc_assert (!cfun);
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
 
-      if ((!pass->has_gate) || pass->gate ())
+      if (pass->gate ())
 	{
 	  if (pass->type == IPA_PASS && ipa_pass->read_optimization_summary)
 	    {
@@ -2603,7 +2597,7 @@ execute_ipa_stmt_fixups (opt_pass *pass,
     {
       /* Execute all of the IPA_PASSes in the list.  */
       if (pass->type == IPA_PASS
-	  && ((!pass->has_gate) || pass->gate ()))
+	  && pass->gate ())
 	{
 	  ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass;
 
diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index 5555794..264bd9a 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -1331,7 +1331,6 @@ const pass_data pass_data_gcse2 =
   RTL_PASS, /* type */
   "gcse2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_GCSE_AFTER_RELOAD, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 9bfffe5..0870183 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -2346,7 +2346,6 @@ const pass_data pass_data_postreload_cse =
   RTL_PASS, /* type */
   "postreload", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_RELOAD_CSE_REGS, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/predict.c b/gcc/predict.c
index 249433f..dccde72 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3160,7 +3160,6 @@ const pass_data pass_data_profile =
   GIMPLE_PASS, /* type */
   "profile_estimate", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_BRANCH_PROB, /* tv_id */
   PROP_cfg, /* properties_required */
@@ -3198,7 +3197,6 @@ const pass_data pass_data_strip_predict_hints =
   GIMPLE_PASS, /* type */
   "*strip_predict_hints", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_BRANCH_PROB, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/recog.c b/gcc/recog.c
index f2647e3..b7113aa 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3832,7 +3832,6 @@ const pass_data pass_data_peephole2 =
   RTL_PASS, /* type */
   "peephole2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_PEEPHOLE2, /* tv_id */
   0, /* properties_required */
@@ -3880,7 +3879,6 @@ const pass_data pass_data_split_all_insns =
   RTL_PASS, /* type */
   "split1", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -3931,7 +3929,6 @@ const pass_data pass_data_split_after_reload =
   RTL_PASS, /* type */
   "split2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -3993,7 +3990,6 @@ const pass_data pass_data_split_before_regstack =
   RTL_PASS, /* type */
   "split3", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -4052,7 +4048,6 @@ const pass_data pass_data_split_before_sched2 =
   RTL_PASS, /* type */
   "split4", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
@@ -4102,7 +4097,6 @@ const pass_data pass_data_split_for_shorten_branches =
   RTL_PASS, /* type */
   "split5", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/ree.c b/gcc/ree.c
index fcde9a0..09dfa61 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -1108,7 +1108,6 @@ const pass_data pass_data_ree =
   RTL_PASS, /* type */
   "ree", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_REE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index a92830b..02e3e09 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -3302,7 +3302,6 @@ const pass_data pass_data_stack_regs =
   RTL_PASS, /* type */
   "*stack_regs", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_REG_STACK, /* tv_id */
   0, /* properties_required */
@@ -3351,7 +3350,6 @@ const pass_data pass_data_stack_regs_run =
   RTL_PASS, /* type */
   "stack", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_REG_STACK, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index 101de76..a7dbbc3 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -1261,7 +1261,6 @@ const pass_data pass_data_cprop_hardreg =
   RTL_PASS, /* type */
   "cprop_hardreg", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_CPROP_REGISTERS, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index bdb980d..82b6081 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -968,7 +968,6 @@ const pass_data pass_data_reginfo_init =
   RTL_PASS, /* type */
   "reginfo", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 6517f4e..30f7abc 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -1849,7 +1849,6 @@ const pass_data pass_data_regrename =
   RTL_PASS, /* type */
   "rnreg", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_RENAME_REGISTERS, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 054304a..fff342f 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3891,7 +3891,6 @@ const pass_data pass_data_delay_slots =
   RTL_PASS, /* type */
   "dbr", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_DBR_SCHED, /* tv_id */
   0, /* properties_required */
@@ -3944,7 +3943,6 @@ const pass_data pass_data_machine_reorg =
   RTL_PASS, /* type */
   "mach", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_MACH_DEP, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index dc6fa16..18b50a4 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -3681,7 +3681,6 @@ const pass_data pass_data_live_range_shrinkage =
   RTL_PASS, /* type */
   "lr_shrinkage", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_LIVE_RANGE_SHRINKAGE, /* tv_id */
   0, /* properties_required */
@@ -3720,7 +3719,6 @@ const pass_data pass_data_sched =
   RTL_PASS, /* type */
   "sched1", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_SCHED, /* tv_id */
   0, /* properties_required */
@@ -3759,7 +3757,6 @@ const pass_data pass_data_sched2 =
   RTL_PASS, /* type */
   "sched2", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_SCHED2, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c
index 6b78085..d1375a4 100644
--- a/gcc/stack-ptr-mod.c
+++ b/gcc/stack-ptr-mod.c
@@ -97,7 +97,6 @@ const pass_data pass_data_stack_ptr_mod =
   RTL_PASS, /* type */
   "*stack_ptr_mod", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/store-motion.c b/gcc/store-motion.c
index f383ca5..5aacaad 100644
--- a/gcc/store-motion.c
+++ b/gcc/store-motion.c
@@ -1248,7 +1248,6 @@ const pass_data pass_data_rtl_store_motion =
   RTL_PASS, /* type */
   "store_motion", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_LSM, /* tv_id */
   PROP_cfglayout, /* properties_required */
diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
index e197d66..d73bea8 100644
--- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
+++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
@@ -65,7 +65,6 @@ const pass_data pass_data_dumb_plugin_example =
   GIMPLE_PASS, /* type */
   "dumb_plugin_example", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
index 041f25d..8df8579 100644
--- a/gcc/testsuite/g++.dg/plugin/selfassign.c
+++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
@@ -285,7 +285,6 @@ const pass_data pass_data_warn_self_assign =
   GIMPLE_PASS, /* type */
   "warn_self_assign", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_ssa, /* properties_required */
diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
index f80719a..33106ad 100644
--- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
@@ -31,7 +31,6 @@ const pass_data pass_data_one_pass =
   GIMPLE_PASS, /* type */
   "cfg", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_gimple_any, /* properties_required */
diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
index 041f25d..8df8579 100644
--- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
+++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
@@ -285,7 +285,6 @@ const pass_data pass_data_warn_self_assign =
   GIMPLE_PASS, /* type */
   "warn_self_assign", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_ssa, /* properties_required */
diff --git a/gcc/tracer.c b/gcc/tracer.c
index f036c19..73e3209 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -411,7 +411,6 @@ const pass_data pass_data_tracer =
   GIMPLE_PASS, /* type */
   "tracer", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TRACER, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index fe6dc28..a259b77 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -846,7 +846,6 @@ const pass_data pass_data_diagnose_tm_blocks =
   GIMPLE_PASS, /* type */
   "*diagnose_tm_blocks", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TRANS_MEM, /* tv_id */
   PROP_gimple_any, /* properties_required */
@@ -1769,7 +1768,6 @@ const pass_data pass_data_lower_tm =
   GIMPLE_PASS, /* type */
   "tmlower", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TRANS_MEM, /* tv_id */
   PROP_gimple_lcf, /* properties_required */
@@ -2047,7 +2045,6 @@ const pass_data pass_data_tm_init =
   GIMPLE_PASS, /* type */
   "*tminit", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_TRANS_MEM, /* tv_id */
   ( PROP_ssa | PROP_cfg ), /* properties_required */
@@ -3023,7 +3020,6 @@ const pass_data pass_data_tm_mark =
   GIMPLE_PASS, /* type */
   "tmmark", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_TRANS_MEM, /* tv_id */
   ( PROP_ssa | PROP_cfg ), /* properties_required */
@@ -3206,7 +3202,6 @@ const pass_data pass_data_tm_edges =
   GIMPLE_PASS, /* type */
   "tmedge", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_TRANS_MEM, /* tv_id */
   ( PROP_ssa | PROP_cfg ), /* properties_required */
@@ -3947,7 +3942,6 @@ const pass_data pass_data_tm_memopt =
   GIMPLE_PASS, /* type */
   "tmmemopt", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TRANS_MEM, /* tv_id */
   ( PROP_ssa | PROP_cfg ), /* properties_required */
@@ -5583,7 +5577,6 @@ const pass_data pass_data_ipa_tm =
   SIMPLE_IPA_PASS, /* type */
   "tmipa", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TRANS_MEM, /* tv_id */
   ( PROP_ssa | PROP_cfg ), /* properties_required */
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 4b2ad87..3293493 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -933,7 +933,6 @@ const pass_data pass_data_call_cdce =
   GIMPLE_PASS, /* type */
   "cdce", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_CALL_CDCE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index cd35d55..739ca54 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -351,7 +351,6 @@ const pass_data pass_data_build_cfg =
   GIMPLE_PASS, /* type */
   "cfg", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_TREE_CFG, /* tv_id */
   PROP_gimple_leh, /* properties_required */
@@ -8084,7 +8083,6 @@ const pass_data pass_data_split_crit_edges =
   GIMPLE_PASS, /* type */
   "crited", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_TREE_SPLIT_EDGES, /* tv_id */
   PROP_cfg, /* properties_required */
@@ -8256,7 +8254,6 @@ const pass_data pass_data_warn_function_return =
   GIMPLE_PASS, /* type */
   "*warn_function_return", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
@@ -8371,7 +8368,6 @@ const pass_data pass_data_warn_unused_result =
   GIMPLE_PASS, /* type */
   "*warn_unused_result", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_gimple_any, /* properties_required */
@@ -8514,7 +8510,6 @@ const pass_data pass_data_fixup_cfg =
   GIMPLE_PASS, /* type */
   "*free_cfg_annotations", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index b7882cf..914523d 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -1048,7 +1048,6 @@ const pass_data pass_data_merge_phi =
   GIMPLE_PASS, /* type */
   "mergephi", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_MERGE_PHI, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -1133,7 +1132,6 @@ const pass_data pass_data_cleanup_cfg_post_optimizing =
   GIMPLE_PASS, /* type */
   "optimized", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_TREE_CLEANUP_CFG, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 4a657c0..283c827 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1662,7 +1662,6 @@ const pass_data pass_data_lower_complex =
   GIMPLE_PASS, /* type */
   "cplxlower", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_ssa, /* properties_required */
@@ -1709,7 +1708,6 @@ const pass_data pass_data_lower_complex_O0 =
   GIMPLE_PASS, /* type */
   "cplxlower0", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 14ed52a..f51f18c 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2170,7 +2170,6 @@ const pass_data pass_data_lower_eh =
   GIMPLE_PASS, /* type */
   "eh", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_TREE_EH, /* tv_id */
   PROP_gimple_lcf, /* properties_required */
@@ -3129,7 +3128,6 @@ const pass_data pass_data_refactor_eh =
   GIMPLE_PASS, /* type */
   "ehopt", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_EH, /* tv_id */
   PROP_gimple_lcf, /* properties_required */
@@ -3356,7 +3354,6 @@ const pass_data pass_data_lower_resx =
   GIMPLE_PASS, /* type */
   "resx", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_EH, /* tv_id */
   PROP_gimple_lcf, /* properties_required */
@@ -3765,7 +3762,6 @@ const pass_data pass_data_lower_eh_dispatch =
   GIMPLE_PASS, /* type */
   "ehdisp", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_EH, /* tv_id */
   PROP_gimple_lcf, /* properties_required */
@@ -4613,7 +4609,6 @@ const pass_data pass_data_cleanup_eh =
   GIMPLE_PASS, /* type */
   "ehcleanup", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_EH, /* tv_id */
   PROP_gimple_lcf, /* properties_required */
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index 3391cc3..84aa008 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -831,7 +831,6 @@ const pass_data pass_data_ipa_lower_emutls =
   SIMPLE_IPA_PASS, /* type */
   "emutls", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_OPT, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 7ff2132..b87c476 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -2031,7 +2031,6 @@ const pass_data pass_data_if_conversion =
   GIMPLE_PASS, /* type */
   "ifcvt", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 3ca2bd1..dec5a5b 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -2381,7 +2381,6 @@ const pass_data pass_data_build_ssa =
   GIMPLE_PASS, /* type */
   "ssa", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_SSA_OTHER, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 9db92db..dcc61c7 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -1804,7 +1804,6 @@ const pass_data pass_data_loop_distribution =
   GIMPLE_PASS, /* type */
   "ldist", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_LOOP_DISTRIBUTION, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index b443388..a39bc5e 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -285,7 +285,6 @@ const pass_data pass_data_nrv =
   GIMPLE_PASS, /* type */
   "nrv", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_NRV, /* tv_id */
   ( PROP_ssa | PROP_cfg ), /* properties_required */
@@ -389,7 +388,6 @@ const pass_data pass_data_return_slot =
   GIMPLE_PASS, /* type */
   "retslot", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_ssa, /* properties_required */
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 994845b..23f7250 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -1288,7 +1288,6 @@ const pass_data pass_data_object_sizes =
   GIMPLE_PASS, /* type */
   "objsz", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 47179a9..e346074 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -2277,7 +2277,6 @@ const pass_data pass_data_parallelize_loops =
   GIMPLE_PASS, /* type */
   "parloops", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_PARALLELIZE_LOOPS, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 3b86770..9bb6455 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -47,10 +47,6 @@ struct pass_data
   /* The -fopt-info optimization group flags as defined in dumpfile.h. */
   unsigned int optinfo_flags;
 
-  /* If true, this pass has its own implementation of the opt_pass::gate
-     method.  */
-  bool has_gate;
-
   /* If true, this pass has its own implementation of the opt_pass::execute
      method.  */
   bool has_execute;
@@ -90,9 +86,8 @@ public:
      The default implementation prints an error message and aborts.  */
   virtual opt_pass *clone ();
 
-  /* If has_gate is set, this pass and all sub-passes are executed only if
-     the function returns true.
-     The default implementation returns true.  */
+  /* This pass and all sub-passes are executed only if the function returns
+     true.  The default implementation returns true.  */
   virtual bool gate ();
 
   /* This is the code to run.  If has_execute is false, then there should
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 730bad4..859a112 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -2586,7 +2586,6 @@ const pass_data pass_data_predcom =
   GIMPLE_PASS, /* type */
   "pcom", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_PREDCOM, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 02e9ff2..0372c92 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -680,7 +680,6 @@ const pass_data pass_data_ipa_tree_profile =
   SIMPLE_IPA_PASS, /* type */
   "profile", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_PROFILE, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 91286b4..acca2a7 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3507,7 +3507,6 @@ const pass_data pass_data_sra_early =
   GIMPLE_PASS, /* type */
   "esra", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_SRA, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -3545,7 +3544,6 @@ const pass_data pass_data_sra =
   GIMPLE_PASS, /* type */
   "sra", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_SRA, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -5067,7 +5065,6 @@ const pass_data pass_data_early_ipa_sra =
   GIMPLE_PASS, /* type */
   "eipa_sra", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_SRA, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index eeefeaf..c7a7e89 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2301,7 +2301,6 @@ const pass_data pass_data_ccp =
   GIMPLE_PASS, /* type */
   "ccp", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_CCP, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -2719,7 +2718,6 @@ const pass_data pass_data_fold_builtins =
   GIMPLE_PASS, /* type */
   "fab", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 02f4743..fc26d03 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -657,7 +657,6 @@ const pass_data pass_data_copy_prop =
   GIMPLE_PASS, /* type */
   "copyprop", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_COPY_PROP, /* tv_id */
   ( PROP_ssa | PROP_cfg ), /* properties_required */
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index bc947b6..0da3d82 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -450,7 +450,6 @@ const pass_data pass_data_rename_ssa_copies =
   GIMPLE_PASS, /* type */
   "copyrename", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_COPY_RENAME, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 13a71ce..8db149e 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1517,7 +1517,6 @@ const pass_data pass_data_dce =
   GIMPLE_PASS, /* type */
   "dce", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_DCE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -1556,7 +1555,6 @@ const pass_data pass_data_dce_loop =
   GIMPLE_PASS, /* type */
   "dceloop", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_DCE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -1595,7 +1593,6 @@ const pass_data pass_data_cd_dce =
   GIMPLE_PASS, /* type */
   "cddce", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_CD_DCE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 91253dc..8101a54 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -965,7 +965,6 @@ const pass_data pass_data_dominator =
   GIMPLE_PASS, /* type */
   "dom", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_SSA_DOMINATOR_OPTS, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -3123,7 +3122,6 @@ const pass_data pass_data_phi_only_cprop =
   GIMPLE_PASS, /* type */
   "phicprop", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_PHI_CPROP, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 2c2f3f7..0096b4c 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -376,7 +376,6 @@ const pass_data pass_data_dse =
   GIMPLE_PASS, /* type */
   "dse", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_DSE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index b6bedfe..66ae113 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -3845,7 +3845,6 @@ const pass_data pass_data_forwprop =
   GIMPLE_PASS, /* type */
   "forwprop", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_FORWPROP, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index be28fb0..ef0c0c4 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -769,7 +769,6 @@ const pass_data pass_data_tree_ifcombine =
   GIMPLE_PASS, /* type */
   "ifcombine", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_IFCOMBINE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index 0a6b1c1..99cc39c 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -270,7 +270,6 @@ const pass_data pass_data_ch =
   GIMPLE_PASS, /* type */
   "ch", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_CH, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index c75f257..aab521e 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -2551,7 +2551,6 @@ const pass_data pass_data_lim =
   GIMPLE_PASS, /* type */
   "lim", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_LIM, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index cdf1559..177666d 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -1278,7 +1278,6 @@ const pass_data pass_data_iv_canon =
   GIMPLE_PASS, /* type */
   "ivcanon", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_LOOP_IVCANON, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -1335,7 +1334,6 @@ const pass_data pass_data_complete_unroll =
   GIMPLE_PASS, /* type */
   "cunroll", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_COMPLETE_UNROLL, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -1400,7 +1398,6 @@ const pass_data pass_data_complete_unrolli =
   GIMPLE_PASS, /* type */
   "cunrolli", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_COMPLETE_UNROLL, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index c0968c8..dd52703 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -2026,7 +2026,6 @@ const pass_data pass_data_loop_prefetch =
   GIMPLE_PASS, /* type */
   "aprefetch", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_PREFETCH, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 5031378..e755b62 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -424,7 +424,6 @@ const pass_data pass_data_tree_unswitch =
   GIMPLE_PASS, /* type */
   "unswitch", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_LOOP_UNSWITCH, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 4008b2b..84e24a1 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -57,7 +57,6 @@ const pass_data pass_data_tree_loop =
   GIMPLE_PASS, /* type */
   "loop", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_TREE_LOOP, /* tv_id */
   PROP_cfg, /* properties_required */
@@ -113,7 +112,6 @@ const pass_data pass_data_tree_loop_init =
   GIMPLE_PASS, /* type */
   "loopinit", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
@@ -167,7 +165,6 @@ const pass_data pass_data_vectorize =
   GIMPLE_PASS, /* type */
   "vect", /* name */
   OPTGROUP_LOOP | OPTGROUP_VEC, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_VECTORIZATION, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -223,7 +220,6 @@ const pass_data pass_data_check_data_deps =
   GIMPLE_PASS, /* type */
   "ckdd", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_CHECK_DATA_DEPS, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -269,7 +265,6 @@ const pass_data pass_data_scev_cprop =
   GIMPLE_PASS, /* type */
   "sccp", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_SCEV_CONST, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -321,7 +316,6 @@ const pass_data pass_data_record_bounds =
   GIMPLE_PASS, /* type */
   "*record_bounds", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_TREE_LOOP_BOUNDS, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -376,7 +370,6 @@ const pass_data pass_data_iv_optimize =
   GIMPLE_PASS, /* type */
   "ivopts", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_LOOP_IVOPTS, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -425,7 +418,6 @@ const pass_data pass_data_tree_loop_done =
   GIMPLE_PASS, /* type */
   "loopdone", /* name */
   OPTGROUP_LOOP, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 63aba8e..f63c75d 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -660,7 +660,6 @@ const pass_data pass_data_cse_reciprocals =
   GIMPLE_PASS, /* type */
   "recip", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_ssa, /* properties_required */
@@ -1578,7 +1577,6 @@ const pass_data pass_data_cse_sincos =
   GIMPLE_PASS, /* type */
   "sincos", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_ssa, /* properties_required */
@@ -2080,7 +2078,6 @@ const pass_data pass_data_optimize_bswap =
   GIMPLE_PASS, /* type */
   "bswap", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_ssa, /* properties_required */
@@ -2890,7 +2887,6 @@ const pass_data pass_data_optimize_widening_mul =
   GIMPLE_PASS, /* type */
   "widening_mul", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_ssa, /* properties_required */
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index f1aa14d..3892317 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -2215,7 +2215,6 @@ const pass_data pass_data_phiopt =
   GIMPLE_PASS, /* type */
   "phiopt", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_PHIOPT, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -2261,7 +2260,6 @@ const pass_data pass_data_cselim =
   GIMPLE_PASS, /* type */
   "cselim", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_PHIOPT, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index 4d66c12..d67f488 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -422,7 +422,6 @@ const pass_data pass_data_phiprop =
   GIMPLE_PASS, /* type */
   "phiprop", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_PHIPROP, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index df9ff23..1329fe2 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4784,7 +4784,6 @@ const pass_data pass_data_pre =
   GIMPLE_PASS, /* type */
   "pre", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_PRE, /* tv_id */
   /* PROP_no_crit_edges is ensured by placing pass_split_crit_edges before
@@ -4856,7 +4855,6 @@ const pass_data pass_data_fre =
   GIMPLE_PASS, /* type */
   "fre", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_FRE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index e9e29e5..0b37b7b 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -4678,7 +4678,6 @@ const pass_data pass_data_reassoc =
   GIMPLE_PASS, /* type */
   "reassoc", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_REASSOC, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index 6d02975..4a7410d 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -601,7 +601,6 @@ const pass_data pass_data_sink_code =
   GIMPLE_PASS, /* type */
   "sink", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_SINK, /* tv_id */
   /* PROP_no_crit_edges is ensured by running split_critical_edges in
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index f55b7ee..aa6b6b9 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -2102,7 +2102,6 @@ const pass_data pass_data_strlen =
   GIMPLE_PASS, /* type */
   "strlen", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_STRLEN, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 70133cf..9e1cdbc 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -7005,7 +7005,6 @@ const pass_data pass_data_build_alias =
   GIMPLE_PASS, /* type */
   "alias", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -7045,7 +7044,6 @@ const pass_data pass_data_build_ealias =
   GIMPLE_PASS, /* type */
   "ealias", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   false, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -7437,7 +7435,6 @@ const pass_data pass_data_ipa_pta =
   SIMPLE_IPA_PASS, /* type */
   "pta", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_PTA, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index a43dd1a..41f4bd8 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -594,7 +594,6 @@ const pass_data pass_data_uncprop =
   GIMPLE_PASS, /* type */
   "uncprop", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_SSA_UNCPROP, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index eee83f7..86d84a1 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -2365,7 +2365,6 @@ const pass_data pass_data_late_warn_uninitialized =
   GIMPLE_PASS, /* type */
   "uninit", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_ssa, /* properties_required */
@@ -2425,7 +2424,6 @@ const pass_data pass_data_early_warn_uninitialized =
   GIMPLE_PASS, /* type */
   "*early_warn_uninitialized", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_UNINIT, /* tv_id */
   PROP_ssa, /* properties_required */
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 20f061f..ecc8da3 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1155,7 +1155,6 @@ const pass_data pass_data_init_datastructures =
   GIMPLE_PASS, /* type */
   "*init_datastructures", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
@@ -1686,7 +1685,6 @@ const pass_data pass_data_update_address_taken =
   GIMPLE_PASS, /* type */
   "addressables", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   false, /* has_execute */
   TV_ADDRESS_TAKEN, /* tv_id */
   PROP_ssa, /* properties_required */
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index 2b535a1..b18b688 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -610,7 +610,6 @@ const pass_data pass_data_release_ssa_names =
   GIMPLE_PASS, /* type */
   "release_ssa", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_TREE_SSA_OTHER, /* tv_id */
   PROP_ssa, /* properties_required */
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index feb6ece..7da36c4 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -1006,7 +1006,6 @@ const pass_data pass_data_stdarg =
   GIMPLE_PASS, /* type */
   "stdarg", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 5540ed3..cf2e763 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1480,7 +1480,6 @@ const pass_data pass_data_convert_switch =
   GIMPLE_PASS, /* type */
   "switchconv", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_SWITCH_CONVERSION, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 3488c2f..b3a6256 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -1090,7 +1090,6 @@ const pass_data pass_data_tail_recursion =
   GIMPLE_PASS, /* type */
   "tailr", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
@@ -1129,7 +1128,6 @@ const pass_data pass_data_tail_calls =
   GIMPLE_PASS, /* type */
   "tailc", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index d00a4b4..035c143 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -1566,7 +1566,6 @@ const pass_data pass_data_lower_vector =
   GIMPLE_PASS, /* type */
   "veclower", /* name */
   OPTGROUP_VEC, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
@@ -1607,7 +1606,6 @@ const pass_data pass_data_lower_vector_ssa =
   GIMPLE_PASS, /* type */
   "veclower2", /* name */
   OPTGROUP_VEC, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   PROP_cfg, /* properties_required */
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 765e38f..17be3aa 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -626,7 +626,6 @@ const pass_data pass_data_slp_vectorize =
   GIMPLE_PASS, /* type */
   "slp", /* name */
   OPTGROUP_LOOP | OPTGROUP_VEC, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_SLP_VECTORIZATION, /* tv_id */
   ( PROP_ssa | PROP_cfg ), /* properties_required */
@@ -717,7 +716,6 @@ const pass_data pass_data_ipa_increase_alignment =
   SIMPLE_IPA_PASS, /* type */
   "increase_alignment", /* name */
   OPTGROUP_LOOP | OPTGROUP_VEC, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_IPA_OPT, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 14f1526..4ccb90b 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -9907,7 +9907,6 @@ const pass_data pass_data_vrp =
   GIMPLE_PASS, /* type */
   "vrp", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_VRP, /* tv_id */
   PROP_ssa, /* properties_required */
diff --git a/gcc/tree.c b/gcc/tree.c
index d829faa..b897988 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5625,7 +5625,6 @@ const pass_data pass_data_ipa_free_lang_data =
   SIMPLE_IPA_PASS, /* type */
   "*free_lang_data", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  false, /* has_gate */
   true, /* has_execute */
   TV_IPA_FREE_LANG_DATA, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/tsan.c b/gcc/tsan.c
index 2e32cd2..f30cf57 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -747,7 +747,6 @@ const pass_data pass_data_tsan =
   GIMPLE_PASS, /* type */
   "tsan", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_ssa | PROP_cfg ), /* properties_required */
@@ -792,7 +791,6 @@ const pass_data pass_data_tsan_O0 =
   GIMPLE_PASS, /* type */
   "tsan0", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_NONE, /* tv_id */
   ( PROP_ssa | PROP_cfg ), /* properties_required */
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index ac40c85..c205e6b 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -916,7 +916,6 @@ const pass_data pass_data_ubsan =
   GIMPLE_PASS, /* type */
   "ubsan", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_TREE_UBSAN, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 65d8285..e6ca3af 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -10359,7 +10359,6 @@ const pass_data pass_data_variable_tracking =
   RTL_PASS, /* type */
   "vartrack", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_VAR_TRACKING, /* tv_id */
   0, /* properties_required */
diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
index 4e4c21a..99caa88 100644
--- a/gcc/vtable-verify.c
+++ b/gcc/vtable-verify.c
@@ -757,7 +757,6 @@ const pass_data pass_data_vtable_verify =
   GIMPLE_PASS, /* type */
   "vtable-verify", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_VTABLE_VERIFICATION, /* tv_id */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
diff --git a/gcc/web.c b/gcc/web.c
index d67151c..ba4172e 100644
--- a/gcc/web.c
+++ b/gcc/web.c
@@ -456,7 +456,6 @@ const pass_data pass_data_web =
   RTL_PASS, /* type */
   "web", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_gate */
   true, /* has_execute */
   TV_WEB, /* tv_id */
   0, /* properties_required */
-- 
1.9.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 5/6] pass current function to opt_pass::gate ()
  2014-04-17  8:38 [PATCH 1/6] remove properties stuff from register_dump_files_1 tsaunders
  2014-04-17  8:38 ` [PATCH 3/6] remove has_gate tsaunders
  2014-04-17  8:38 ` [PATCH 4/6] enable -Woverloaded-virtual when available tsaunders
@ 2014-04-17  8:38 ` tsaunders
  2014-04-17  9:00   ` Richard Biener
  2014-04-17  8:38 ` [PATCH 2/6] merge register_dump_files_1 into register_dump_files tsaunders
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: tsaunders @ 2014-04-17  8:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tsaunders@mozilla.com>

Hi,

 This gets rid of usage of cfun, and a bunch of useless functions.

bootstrap + regtest passed on x86_64-unknown-linux-gnu, ok?

Trev

2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>

gcc/
	* passes.c (opt_pass::gate): Take function * argument.
	(gate_all_early_local_passes): Merge into
	(early_local_passes::gate): this.
	(gate_all_early_optimizations): Merge into
	(all_early_optimizations::gate): this.
	(gate_all_optimizations): Mege into
	(all_optimizations::gate): this.
	(gate_all_optimizations_g): Merge into
	(all_optimizations_g::gate): this.
	(gate_rest_of_compilation): Mege into
	(rest_of_compilation::gate): this.
	(gate_postreload): Merge into
	(postreload::gate): this.
	(dump_one_pass): Pass cfun to the pass's gate method.
	(execute_ipa_summary_passes): Likewise.
	(execute_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.
	* tree-pass.h (opt_pass::gate): Add function * argument.
	* asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
	combine-stack-adj.c, combine.c, compare-elim.c,
	config/epiphany/resolve-sw-modes.c, config/i386/i386.c,
	config/rl78/rl78.c, config/sh/sh_optimize_sett_clrt.cc,
	config/sh/sh_treg_combine.cc, config/sparc/sparc.c, cprop.c, cse.c,
	dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c,  fwprop.c, gcse.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-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c,
	loop-init.c, lower-subreg.c, mode-switching.c, modulo-sched.c,
	omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c,
	reg-stack.c, regcprop.c, regrename.c, reorg.c, sched-rgn.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-parloops.c, tree-predcom.c, tree-profile.c,
	tree-sra.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-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
	tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tsan.c, ubsan.c,
	var-tracking.c, vtable-verify.c, web.c: Adjust.

gcc/testsuite/
	* g++.dg/plugin/dumb_plugin.c, g++.dg/plugin/selfasign.c,
	gcc.dg/plugin/one_time_plugin.c, gcc.dg/plugin/selfasign.c: Adjust.



diff --git a/gcc/asan.c b/gcc/asan.c
index e26ce41..3fe50ef 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2504,7 +2504,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_asan (m_ctxt); }
-  bool gate () { return gate_asan (); }
+  virtual bool gate (function *) { return gate_asan (); }
   unsigned int execute () { return asan_instrument (); }
 
 }; // class pass_asan
@@ -2517,12 +2517,6 @@ make_pass_asan (gcc::context *ctxt)
   return new pass_asan (ctxt);
 }
 
-static bool
-gate_asan_O0 (void)
-{
-  return !optimize && gate_asan ();
-}
-
 namespace {
 
 const pass_data pass_data_asan_O0 =
@@ -2548,7 +2542,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_asan_O0 (); }
+  virtual bool gate (function *) { return !optimize && gate_asan (); }
   unsigned int execute () { return asan_instrument (); }
 
 }; // class pass_asan_O0
@@ -2599,12 +2593,6 @@ execute_sanopt (void)
   return 0;
 }
 
-static bool
-gate_sanopt (void)
-{
-  return flag_sanitize;
-}
-
 namespace {
 
 const pass_data pass_data_sanopt =
@@ -2630,7 +2618,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_sanopt (); }
+  virtual bool gate (function *) { return flag_sanitize; }
   unsigned int execute () { return execute_sanopt (); }
 
 }; // class pass_sanopt
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index 4346e85..e1485a3 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -1495,17 +1495,6 @@ rest_of_handle_auto_inc_dec (void)
 
 /* 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 =
@@ -1530,7 +1519,16 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_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 () { return rest_of_handle_auto_inc_dec (); }
 
 }; // class pass_inc_dec
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 6ac0242..57103bd 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2302,15 +2302,6 @@ insert_section_boundary_note (void)
     }
 }
 
-static bool
-gate_handle_reorder_blocks (void)
-{
-  if (targetm.cannot_modify_jumps_p ())
-    return false;
-  return (optimize > 0
-	  && (flag_reorder_blocks || flag_reorder_blocks_and_partition));
-}
-
 static unsigned int
 rest_of_handle_reorder_blocks (void)
 {
@@ -2355,7 +2346,14 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_reorder_blocks (); }
+  virtual bool gate (function *)
+    {
+      if (targetm.cannot_modify_jumps_p ())
+	return false;
+      return (optimize > 0
+	      && (flag_reorder_blocks || flag_reorder_blocks_and_partition));
+    }
+
   unsigned int execute () { return rest_of_handle_reorder_blocks (); }
 
 }; // class pass_reorder_blocks
@@ -2374,16 +2372,6 @@ make_pass_reorder_blocks (gcc::context *ctxt)
    which can seriously pessimize code with many computed jumps in the source
    code, such as interpreters.  See e.g. PR15242.  */
 
-static bool
-gate_duplicate_computed_gotos (void)
-{
-  if (targetm.cannot_modify_jumps_p ())
-    return false;
-  return (optimize > 0
-	  && flag_expensive_optimizations
-	  && ! optimize_function_for_size_p (cfun));
-}
-
 
 static unsigned int
 duplicate_computed_gotos (void)
@@ -2527,11 +2515,21 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_duplicate_computed_gotos (); }
+  virtual bool gate (function *);
   unsigned int execute () { return duplicate_computed_gotos (); }
 
 }; // class pass_duplicate_computed_gotos
 
+bool
+pass_duplicate_computed_gotos::gate (function *fun)
+{
+  if (targetm.cannot_modify_jumps_p ())
+    return false;
+  return (optimize > 0
+	  && flag_expensive_optimizations
+	  && ! optimize_function_for_size_p (fun));
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -2540,22 +2538,6 @@ make_pass_duplicate_computed_gotos (gcc::context *ctxt)
   return new pass_duplicate_computed_gotos (ctxt);
 }
 
-static bool
-gate_handle_partition_blocks (void)
-{
-  /* The optimization to partition hot/cold basic blocks into separate
-     sections of the .o file does not work well with linkonce or with
-     user defined section attributes.  Don't call it if either case
-     arises.  */
-  return (flag_reorder_blocks_and_partition
-          && optimize
-	  /* See gate_handle_reorder_blocks.  We should not partition if
-	     we are going to omit the reordering.  */
-	  && optimize_function_for_speed_p (cfun)
-	  && !DECL_ONE_ONLY (current_function_decl)
-	  && !user_defined_section_attribute);
-}
-
 /* This function is the main 'entrance' for the optimization that
    partitions hot and cold basic blocks into separate sections of the
    .o file (to improve performance and cache locality).  Ideally it
@@ -2750,11 +2732,27 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_partition_blocks (); }
+  virtual bool gate (function *);
   unsigned int execute () { return partition_hot_cold_basic_blocks (); }
 
 }; // class pass_partition_blocks
 
+bool
+pass_partition_blocks::gate (function *fun)
+{
+  /* The optimization to partition hot/cold basic blocks into separate
+     sections of the .o file does not work well with linkonce or with
+     user defined section attributes.  Don't call it if either case
+     arises.  */
+  return (flag_reorder_blocks_and_partition
+	  && optimize
+	  /* See gate_handle_reorder_blocks.  We should not partition if
+	     we are going to omit the reordering.  */
+	  && optimize_function_for_speed_p (fun)
+	  && !DECL_ONE_ONLY (current_function_decl)
+	  && !user_defined_section_attribute);
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index d44917f..fc2aea7 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -1494,12 +1494,6 @@ branch_target_load_optimize (bool after_prologue_epilogue_gen)
     }
 }
 \f
-static bool
-gate_handle_branch_target_load_optimize1 (void)
-{
-  return flag_branch_target_load_optimize;
-}
-
 
 static unsigned int
 rest_of_handle_branch_target_load_optimize1 (void)
@@ -1532,7 +1526,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_branch_target_load_optimize1 (); }
+  virtual bool gate (function *) { return flag_branch_target_load_optimize; }
   unsigned int execute () {
     return rest_of_handle_branch_target_load_optimize1 ();
   }
@@ -1547,12 +1541,6 @@ make_pass_branch_target_load_optimize1 (gcc::context *ctxt)
   return new pass_branch_target_load_optimize1 (ctxt);
 }
 
-static bool
-gate_handle_branch_target_load_optimize2 (void)
-{
-  return (optimize > 0 && flag_branch_target_load_optimize2);
-}
-
 
 static unsigned int
 rest_of_handle_branch_target_load_optimize2 (void)
@@ -1600,7 +1588,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_branch_target_load_optimize2 (); }
+  virtual bool gate (function *)
+    {
+      return (optimize > 0 && flag_branch_target_load_optimize2);
+    }
+
   unsigned int execute () {
     return rest_of_handle_branch_target_load_optimize2 ();
   }
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index ec22ab3..37fc7a5 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -619,21 +619,6 @@ combine_stack_adjustments_for_block (basic_block bb)
     free_csa_reflist (reflist);
 }
 \f
-
-static bool
-gate_handle_stack_adjustments (void)
-{
-  /* This is kind of a heuristic.  We need to run combine_stack_adjustments
-     even for machines with possibly nonzero TARGET_RETURN_POPS_ARGS
-     and ACCUMULATE_OUTGOING_ARGS.  We expect that only ports having
-     push instructions will have popping returns.  */
-#ifndef PUSH_ROUNDING
-  if (ACCUMULATE_OUTGOING_ARGS)
-    return false;
-#endif
-  return flag_combine_stack_adjustments;
-}
-
 static unsigned int
 rest_of_handle_stack_adjustments (void)
 {
@@ -667,11 +652,25 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_stack_adjustments (); }
+  virtual bool gate (function *);
   unsigned int execute () { return rest_of_handle_stack_adjustments (); }
 
 }; // class pass_stack_adjustments
 
+bool
+pass_stack_adjustments::gate (function *)
+{
+  /* This is kind of a heuristic.  We need to run combine_stack_adjustments
+     even for machines with possibly nonzero TARGET_RETURN_POPS_ARGS
+     and ACCUMULATE_OUTGOING_ARGS.  We expect that only ports having
+     push instructions will have popping returns.  */
+#ifndef PUSH_ROUNDING
+  if (ACCUMULATE_OUTGOING_ARGS)
+    return false;
+#endif
+  return flag_combine_stack_adjustments;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/combine.c b/gcc/combine.c
index 63933c0..1b1e33c 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -13854,12 +13854,6 @@ dump_combine_total_stats (FILE *file)
      total_attempts, total_merges, total_extras, total_successes);
 }
 \f
-static bool
-gate_handle_combine (void)
-{
-  return (optimize > 0);
-}
-
 /* Try combining insns through substitution.  */
 static unsigned int
 rest_of_handle_combine (void)
@@ -13914,7 +13908,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_combine (); }
+  virtual bool gate (function *) { return (optimize > 0); }
   unsigned int execute () { return rest_of_handle_combine (); }
 
 }; // class pass_combine
diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c
index e66b1c6..9cddb7a 100644
--- a/gcc/compare-elim.c
+++ b/gcc/compare-elim.c
@@ -643,15 +643,6 @@ execute_compare_elim_after_reload (void)
   return 0;
 }
 
-static bool
-gate_compare_elim_after_reload (void)
-{
-  /* Setting this target hook value is how a backend indicates the need.  */
-  if (targetm.flags_regnum == INVALID_REGNUM)
-    return false;
-  return flag_compare_elim_after_reload;
-}
-
 namespace {
 
 const pass_data pass_data_compare_elim_after_reload =
@@ -677,7 +668,14 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_compare_elim_after_reload (); }
+  virtual bool gate (function *)
+    {
+      /* Setting this target hook value is how a backend indicates the need.  */
+      if (targetm.flags_regnum == INVALID_REGNUM)
+	return false;
+      return flag_compare_elim_after_reload;
+    }
+
   unsigned int execute () { return execute_compare_elim_after_reload (); }
 
 }; // class pass_compare_elim_after_reload
diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
index 486330c..31928fd 100644
--- a/gcc/config/epiphany/resolve-sw-modes.c
+++ b/gcc/config/epiphany/resolve-sw-modes.c
@@ -45,12 +45,6 @@ along with GCC; see the file COPYING3.  If not see
    insert new mode setting insns on the edges where the other mode
    becomes unambigous.  */
 
-static bool
-gate_resolve_sw_modes (void)
-{
-  return optimize;
-}
-
 static unsigned
 resolve_sw_modes (void)
 {
@@ -185,7 +179,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_resolve_sw_modes (); }
+  virtual bool gate (function *) { return optimize; }
   unsigned int execute () { return resolve_sw_modes (); }
 
 }; // class pass_resolve_sw_modes
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 6dd1bbe..8cfdaf6 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2493,12 +2493,6 @@ static const struct ptt processor_target_table[PROCESSOR_max] =
   {"btver2", &btver2_cost, 16, 10, 16, 7, 11}
 };
 \f
-static bool
-gate_insert_vzeroupper (void)
-{
-  return TARGET_AVX && !TARGET_AVX512F && TARGET_VZEROUPPER;
-}
-
 static unsigned int
 rest_of_handle_insert_vzeroupper (void)
 {
@@ -2542,7 +2536,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_insert_vzeroupper (); }
+  virtual bool gate (function *)
+    {
+      return TARGET_AVX && !TARGET_AVX512F && TARGET_VZEROUPPER;
+    }
+
   unsigned int execute () { return rest_of_handle_insert_vzeroupper (); }
 
 }; // class pass_insert_vzeroupper
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index 88b030f..988e1cd 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -117,13 +117,6 @@ rl78_init_machine_status (void)
   return m;
 }
 
-/* Returns whether to run the devirtualization pass.  */
-static bool
-devirt_gate (void)
-{
-  return true;
-}
-
 /* Runs the devirtualization pass.  */
 static unsigned int
 devirt_pass (void)
@@ -160,7 +153,6 @@ public:
   }
 
   /* opt_pass methods: */
-  bool gate () { return devirt_gate (); }
   unsigned int execute () { return devirt_pass (); }
 };
 
@@ -243,7 +235,6 @@ public:
   }
 
   /* opt_pass methods: */
-  bool gate () { return devirt_gate (); }
   unsigned int execute () { return move_elim_pass (); }
 };
 
diff --git a/gcc/config/sh/sh_optimize_sett_clrt.cc b/gcc/config/sh/sh_optimize_sett_clrt.cc
index 85cb6a1..5b1afcd 100644
--- a/gcc/config/sh/sh_optimize_sett_clrt.cc
+++ b/gcc/config/sh/sh_optimize_sett_clrt.cc
@@ -79,7 +79,7 @@ class sh_optimize_sett_clrt : public rtl_opt_pass
 public:
   sh_optimize_sett_clrt (gcc::context* ctx, const char* name);
   virtual ~sh_optimize_sett_clrt (void);
-  virtual bool gate (void);
+  virtual bool gate (function *);
   virtual unsigned int execute (void);
 
 private:
@@ -161,7 +161,7 @@ sh_optimize_sett_clrt::~sh_optimize_sett_clrt (void)
 }
 
 bool
-sh_optimize_sett_clrt::gate (void)
+sh_optimize_sett_clrt::gate (function *)
 {
   return optimize > 0;
 }
diff --git a/gcc/config/sh/sh_treg_combine.cc b/gcc/config/sh/sh_treg_combine.cc
index 1285ba2..57eddd2 100644
--- a/gcc/config/sh/sh_treg_combine.cc
+++ b/gcc/config/sh/sh_treg_combine.cc
@@ -424,7 +424,7 @@ class sh_treg_combine : public rtl_opt_pass
 public:
   sh_treg_combine (gcc::context* ctx, bool split_insns, const char* name);
   virtual ~sh_treg_combine (void);
-  virtual bool gate (void);
+  virtual bool gate (function *);
   virtual unsigned int execute (void);
 
 private:
@@ -1435,7 +1435,7 @@ sh_treg_combine::try_optimize_cbranch (rtx insn)
 }
 
 bool
-sh_treg_combine::gate (void)
+sh_treg_combine::gate (function *)
 {
   return optimize > 0;
 }
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index a63e813..5578cb8 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -871,13 +871,6 @@ mem_ref (rtx x)
    pass runs as late as possible.  The pass is inserted in the pass pipeline
    at the end of sparc_option_override.  */
 
-static bool
-sparc_gate_work_around_errata (void)
-{
-  /* The only errata we handle are those of the AT697F and UT699.  */
-  return sparc_fix_at697f != 0 || sparc_fix_ut699 != 0;
-}
-
 static unsigned int
 sparc_do_work_around_errata (void)
 {
@@ -1146,7 +1139,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return sparc_gate_work_around_errata (); }
+  virtual bool gate (function *)
+    {
+      /* The only errata we handle are those of the AT697F and UT699.  */
+      return sparc_fix_at697f != 0 || sparc_fix_ut699 != 0;
+    }
+
   unsigned int execute () { return sparc_do_work_around_errata (); }
 
 }; // class pass_work_around_errata
diff --git a/gcc/cprop.c b/gcc/cprop.c
index f22cde7..9802b8a 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -1896,14 +1896,6 @@ one_cprop_pass (void)
    setjmp.
    FIXME: Should just handle setjmp via REG_SETJMP notes.  */
 
-static bool
-gate_rtl_cprop (void)
-{
-  return optimize > 0 && flag_gcse
-    && !cfun->calls_setjmp
-    && dbg_cnt (cprop);
-}
-
 static unsigned int
 execute_rtl_cprop (void)
 {
@@ -1944,7 +1936,13 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_rtl_cprop (m_ctxt); }
-  bool gate () { return gate_rtl_cprop (); }
+  virtual bool gate (function *fun)
+    {
+      return optimize > 0 && flag_gcse
+	&& !fun->calls_setjmp
+	&& dbg_cnt (cprop);
+    }
+
   unsigned int execute () { return execute_rtl_cprop (); }
 
 }; // class pass_rtl_cprop
diff --git a/gcc/cse.c b/gcc/cse.c
index 6edea01..60ec9a9 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7457,12 +7457,6 @@ cse_condition_code_reg (void)
 /* Perform common subexpression elimination.  Nonzero value from
    `cse_main' means that jumps were simplified and some code may now
    be unreachable, so do jump optimization again.  */
-static bool
-gate_handle_cse (void)
-{
-  return optimize > 0;
-}
-
 static unsigned int
 rest_of_handle_cse (void)
 {
@@ -7515,7 +7509,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_cse (); }
+  virtual bool gate (function *) { return optimize > 0; }
   unsigned int execute () { return rest_of_handle_cse (); }
 
 }; // class pass_cse
@@ -7529,12 +7523,6 @@ make_pass_cse (gcc::context *ctxt)
 }
 
 
-static bool
-gate_handle_cse2 (void)
-{
-  return optimize > 0 && flag_rerun_cse_after_loop;
-}
-
 /* Run second CSE pass after loop optimizations.  */
 static unsigned int
 rest_of_handle_cse2 (void)
@@ -7594,7 +7582,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_cse2 (); }
+  virtual bool gate (function *)
+    {
+      return optimize > 0 && flag_rerun_cse_after_loop;
+    }
+
   unsigned int execute () { return rest_of_handle_cse2 (); }
 
 }; // class pass_cse2
@@ -7607,12 +7599,6 @@ make_pass_cse2 (gcc::context *ctxt)
   return new pass_cse2 (ctxt);
 }
 
-static bool
-gate_handle_cse_after_global_opts (void)
-{
-  return optimize > 0 && flag_rerun_cse_after_global_opts;
-}
-
 /* Run second CSE pass after loop optimizations.  */
 static unsigned int
 rest_of_handle_cse_after_global_opts (void)
@@ -7671,7 +7657,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_cse_after_global_opts (); }
+  virtual bool gate (function *)
+    {
+      return optimize > 0 && flag_rerun_cse_after_global_opts;
+    }
+
   unsigned int execute () {
     return rest_of_handle_cse_after_global_opts ();
   }
diff --git a/gcc/dce.c b/gcc/dce.c
index 33cdefd..1d290e3 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -779,13 +779,6 @@ rest_of_handle_ud_dce (void)
 }
 
 
-static bool
-gate_ud_dce (void)
-{
-  return optimize > 1 && flag_dce
-    && dbg_cnt (dce_ud);
-}
-
 namespace {
 
 const pass_data pass_data_ud_rtl_dce =
@@ -810,7 +803,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_ud_dce (); }
+  virtual bool gate (function *)
+    {
+      return optimize > 1 && flag_dce && dbg_cnt (dce_ud);
+    }
+
   unsigned int execute () { return rest_of_handle_ud_dce (); }
 
 }; // class pass_ud_rtl_dce
@@ -1211,13 +1208,6 @@ run_fast_dce (void)
 }
 
 
-static bool
-gate_fast_dce (void)
-{
-  return optimize > 0 && flag_dce
-    && dbg_cnt (dce_fast);
-}
-
 namespace {
 
 const pass_data pass_data_fast_rtl_dce =
@@ -1242,7 +1232,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_fast_dce (); }
+  virtual bool gate (function *)
+    {
+      return optimize > 0 && flag_dce && dbg_cnt (dce_fast);
+    }
+
   unsigned int execute () { return rest_of_handle_fast_dce (); }
 
 }; // class pass_fast_rtl_dce
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 9909ac3..bd3cb31 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -740,13 +740,6 @@ rest_of_handle_df_initialize (void)
 }
 
 
-static bool
-gate_opt (void)
-{
-  return optimize > 0;
-}
-
-
 namespace {
 
 const pass_data pass_data_df_initialize_opt =
@@ -771,7 +764,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_opt (); }
+  virtual bool gate (function *) { return optimize > 0; }
   unsigned int execute () { return rest_of_handle_df_initialize (); }
 
 }; // class pass_df_initialize_opt
@@ -785,13 +778,6 @@ make_pass_df_initialize_opt (gcc::context *ctxt)
 }
 
 
-static bool
-gate_no_opt (void)
-{
-  return optimize == 0;
-}
-
-
 namespace {
 
 const pass_data pass_data_df_initialize_no_opt =
@@ -816,7 +802,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_no_opt (); }
+  virtual bool gate (function *) { return optimize == 0; }
   unsigned int execute () { return rest_of_handle_df_initialize (); }
 
 }; // class pass_df_initialize_no_opt
diff --git a/gcc/dse.c b/gcc/dse.c
index a3a66b1..a80c025 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -608,11 +608,6 @@ static bitmap kill_on_calls;
 
 /* The number of bits used in the global bitmaps.  */
 static unsigned int current_position;
-
-
-static bool gate_dse1 (void);
-static bool gate_dse2 (void);
-
 \f
 /*----------------------------------------------------------------------------
    Zeroth step.
@@ -3712,20 +3707,6 @@ rest_of_handle_dse (void)
   return 0;
 }
 
-static bool
-gate_dse1 (void)
-{
-  return optimize > 0 && flag_dse
-    && dbg_cnt (dse1);
-}
-
-static bool
-gate_dse2 (void)
-{
-  return optimize > 0 && flag_dse
-    && dbg_cnt (dse2);
-}
-
 namespace {
 
 const pass_data pass_data_rtl_dse1 =
@@ -3750,7 +3731,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_dse1 (); }
+  virtual bool gate (function *)
+    {
+      return optimize > 0 && flag_dse && dbg_cnt (dse1);
+    }
+
   unsigned int execute () { return rest_of_handle_dse (); }
 
 }; // class pass_rtl_dse1
@@ -3787,7 +3772,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_dse2 (); }
+  virtual bool gate (function *)
+    {
+      return optimize > 0 && flag_dse && dbg_cnt (dse2);
+    }
+
   unsigned int execute () { return rest_of_handle_dse (); }
 
 }; // class pass_rtl_dse2
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index d278a27..3749277 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -3377,21 +3377,6 @@ dwarf2out_do_cfi_asm (void)
   return true;
 }
 
-static bool
-gate_dwarf2_frame (void)
-{
-#ifndef HAVE_prologue
-  /* Targets which still implement the prologue in assembler text
-     cannot use the generic dwarf2 unwinding.  */
-  return false;
-#endif
-
-  /* ??? What to do for UI_TARGET unwinding?  They might be able to benefit
-     from the optimized shrink-wrapping annotations that we will compute.
-     For now, only produce the CFI notes for dwarf2.  */
-  return dwarf2out_do_frame ();
-}
-
 namespace {
 
 const pass_data pass_data_dwarf2_frame =
@@ -3416,11 +3401,26 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_dwarf2_frame (); }
+  virtual bool gate (function *);
   unsigned int execute () { return execute_dwarf2_frame (); }
 
 }; // class pass_dwarf2_frame
 
+bool
+pass_dwarf2_frame::gate (function *)
+{
+#ifndef HAVE_prologue
+  /* Targets which still implement the prologue in assembler text
+     cannot use the generic dwarf2 unwinding.  */
+  return false;
+#endif
+
+  /* ??? What to do for UI_TARGET unwinding?  They might be able to benefit
+     from the optimized shrink-wrapping annotations that we will compute.
+     For now, only produce the CFI notes for dwarf2.  */
+  return dwarf2out_do_frame ();
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/except.c b/gcc/except.c
index cf3cd5f..2015809 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2620,17 +2620,6 @@ convert_to_eh_region_ranges (void)
   return 0;
 }
 
-static bool
-gate_convert_to_eh_region_ranges (void)
-{
-  /* Nothing to do for SJLJ exceptions or if no regions created.  */
-  if (cfun->eh->region_tree == NULL)
-    return false;
-  if (targetm_common.except_unwind_info (&global_options) == UI_SJLJ)
-    return false;
-  return true;
-}
-
 namespace {
 
 const pass_data pass_data_convert_to_eh_region_ranges =
@@ -2655,11 +2644,22 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_convert_to_eh_region_ranges (); }
+  virtual bool gate (function *);
   unsigned int execute () { return convert_to_eh_region_ranges (); }
 
 }; // class pass_convert_to_eh_region_ranges
 
+bool
+pass_convert_to_eh_region_ranges::gate (function *)
+{
+  /* Nothing to do for SJLJ exceptions or if no regions created.  */
+  if (cfun->eh->region_tree == NULL)
+    return false;
+  if (targetm_common.except_unwind_info (&global_options) == UI_SJLJ)
+    return false;
+  return true;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index 061d533..c6fa4ee 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -1508,7 +1508,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_fwprop (); }
+  virtual bool gate (function *) { return gate_fwprop (); }
   unsigned int execute () { return fwprop (); }
 
 }; // class pass_rtl_fwprop
@@ -1573,7 +1573,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_fwprop (); }
+  virtual bool gate (function *) { return gate_fwprop (); }
   unsigned int execute () { return fwprop_addr (); }
 
 }; // class pass_rtl_fwprop_addr
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 6797b08..942ea64 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4157,24 +4157,6 @@ is_too_expensive (const char *pass)
   return false;
 }
 \f
-/* All the passes implemented in this file.  Each pass has its
-   own gate and execute function, and at the end of the file a
-   pass definition for passes.c.
-
-   We do not construct an accurate cfg in functions which call
-   setjmp, so none of these passes runs if the function calls
-   setjmp.
-   FIXME: Should just handle setjmp via REG_SETJMP notes.  */
-
-static bool
-gate_rtl_pre (void)
-{
-  return optimize > 0 && flag_gcse
-    && !cfun->calls_setjmp
-    && optimize_function_for_speed_p (cfun)
-    && dbg_cnt (pre);
-}
-
 static unsigned int
 execute_rtl_pre (void)
 {
@@ -4188,18 +4170,6 @@ execute_rtl_pre (void)
   return 0;
 }
 
-static bool
-gate_rtl_hoist (void)
-{
-  return optimize > 0 && flag_gcse
-    && !cfun->calls_setjmp
-    /* It does not make sense to run code hoisting unless we are optimizing
-       for code size -- it rarely makes programs faster, and can make then
-       bigger if we did PRE (when optimizing for space, we don't run PRE).  */
-    && optimize_function_for_size_p (cfun)
-    && dbg_cnt (hoist);
-}
-
 static unsigned int
 execute_rtl_hoist (void)
 {
@@ -4238,11 +4208,25 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_rtl_pre (); }
+  virtual bool gate (function *);
   unsigned int execute () { return execute_rtl_pre (); }
 
 }; // class pass_rtl_pre
 
+/* We do not construct an accurate cfg in functions which call
+   setjmp, so none of these passes runs if the function calls
+   setjmp.
+   FIXME: Should just handle setjmp via REG_SETJMP notes.  */
+
+bool
+pass_rtl_pre::gate (function *fun)
+{
+  return optimize > 0 && flag_gcse
+    && !fun->calls_setjmp
+    && optimize_function_for_speed_p (fun)
+    && dbg_cnt (pre);
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -4276,11 +4260,23 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_rtl_hoist (); }
+  virtual bool gate (function *);
   unsigned int execute () { return execute_rtl_hoist (); }
 
 }; // class pass_rtl_hoist
 
+bool
+pass_rtl_hoist::gate (function *)
+{
+  return optimize > 0 && flag_gcse
+    && !cfun->calls_setjmp
+    /* It does not make sense to run code hoisting unless we are optimizing
+       for code size -- it rarely makes programs faster, and can make then
+       bigger if we did PRE (when optimizing for space, we don't run PRE).  */
+    && optimize_function_for_size_p (cfun)
+    && dbg_cnt (hoist);
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index e0ce2ec..ab6185c 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -414,15 +414,6 @@ gimple_ssa_isolate_erroneous_paths (void)
   return 0;
 }
 
-static bool
-gate_isolate_erroneous_paths (void)
-{
-  /* If we do not have a suitable builtin function for the trap statement,
-     then do not perform the optimization.  */
-  return (flag_isolate_erroneous_paths_dereference != 0
-	  || flag_isolate_erroneous_paths_attribute != 0);
-}
-
 namespace {
 const pass_data pass_data_isolate_erroneous_paths =
 {
@@ -447,7 +438,14 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_isolate_erroneous_paths (m_ctxt); }
-  bool gate () { return gate_isolate_erroneous_paths (); }
+  virtual bool gate (function *)
+    {
+      /* If we do not have a suitable builtin function for the trap statement,
+	 then do not perform the optimization.  */
+      return (flag_isolate_erroneous_paths_dereference != 0
+	      || flag_isolate_erroneous_paths_attribute != 0);
+    }
+
   unsigned int execute () { return gimple_ssa_isolate_erroneous_paths (); }
 
 }; // class pass_isolate_erroneous_paths
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 8d19031..a8596e0 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -3646,12 +3646,6 @@ execute_strength_reduction (void)
   return 0;
 }
 
-static bool
-gate_strength_reduction (void)
-{
-  return flag_tree_slsr;
-}
-
 namespace {
 
 const pass_data pass_data_strength_reduction =
@@ -3676,7 +3670,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_strength_reduction (); }
+  virtual bool gate (function *) { return flag_tree_slsr; }
   unsigned int execute () { return execute_strength_reduction (); }
 
 }; // class pass_strength_reduction
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 03a7161..68c9390 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -374,7 +374,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_graphite_transforms (); }
+  virtual bool gate (function *) { return gate_graphite_transforms (); }
 
 }; // class pass_graphite
 
@@ -410,7 +410,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_graphite_transforms (); }
+  virtual bool gate (function *) { return gate_graphite_transforms (); }
   unsigned int execute () { return graphite_transforms (); }
 
 }; // class pass_graphite_transforms
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 5c0843d..657b585 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -4512,13 +4512,6 @@ if_convert (bool after_combine)
 #endif
 }
 \f
-static bool
-gate_handle_if_conversion (void)
-{
-  return (optimize > 0)
-    && dbg_cnt (if_conversion);
-}
-
 /* If-conversion and CFG cleanup.  */
 static unsigned int
 rest_of_handle_if_conversion (void)
@@ -4562,7 +4555,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_if_conversion (); }
+  virtual bool gate (function *)
+    {
+      return (optimize > 0) && dbg_cnt (if_conversion);
+    }
+
   unsigned int execute () { return rest_of_handle_if_conversion (); }
 
 }; // class pass_rtl_ifcvt
@@ -4575,13 +4572,6 @@ make_pass_rtl_ifcvt (gcc::context *ctxt)
   return new pass_rtl_ifcvt (ctxt);
 }
 
-static bool
-gate_handle_if_after_combine (void)
-{
-  return optimize > 0 && flag_if_conversion
-    && dbg_cnt (if_after_combine);
-}
-
 
 /* Rerun if-conversion, as combine may have simplified things enough
    to now meet sequence length restrictions.  */
@@ -4616,7 +4606,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_if_after_combine (); }
+  virtual bool gate (function *)
+    {
+      return optimize > 0 && flag_if_conversion
+	&& dbg_cnt (if_after_combine);
+    }
+
   unsigned int execute () { return rest_of_handle_if_after_combine (); }
 
 }; // class pass_if_after_combine
@@ -4630,13 +4625,6 @@ make_pass_if_after_combine (gcc::context *ctxt)
 }
 
 
-static bool
-gate_handle_if_after_reload (void)
-{
-  return optimize > 0 && flag_if_conversion2
-    && dbg_cnt (if_after_reload);
-}
-
 static unsigned int
 rest_of_handle_if_after_reload (void)
 {
@@ -4669,7 +4657,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_if_after_reload (); }
+  virtual bool gate (function *)
+    {
+      return optimize > 0 && flag_if_conversion2
+	&& dbg_cnt (if_after_reload);
+    }
+
   unsigned int execute () { return rest_of_handle_if_after_reload (); }
 
 }; // class pass_if_after_reload
diff --git a/gcc/init-regs.c b/gcc/init-regs.c
index 265fed7..2025b77 100644
--- a/gcc/init-regs.c
+++ b/gcc/init-regs.c
@@ -125,12 +125,6 @@ initialize_uninitialized_regs (void)
   BITMAP_FREE (already_genned);
 }
 
-static bool
-gate_initialize_regs (void)
-{
-  return optimize > 0;
-}
-
 static unsigned int
 rest_of_handle_initialize_regs (void)
 {
@@ -162,7 +156,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_initialize_regs (); }
+  virtual bool gate (function *) { return optimize > 0; }
   unsigned int execute () { return rest_of_handle_initialize_regs (); }
 
 }; // class pass_initialize_regs
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 1f28b69..ee48fc0 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -3762,16 +3762,6 @@ ipcp_read_summary (void)
   ipa_prop_read_jump_functions ();
 }
 
-/* Gate for IPCP optimization.  */
-
-static bool
-cgraph_gate_cp (void)
-{
-  /* FIXME: We should remove the optimize check after we ensure we never run
-     IPA passes when not optimizing.  */
-  return flag_ipa_cp && optimize;
-}
-
 namespace {
 
 const pass_data pass_data_ipa_cp =
@@ -3807,7 +3797,13 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return cgraph_gate_cp (); }
+  virtual bool gate (function *)
+    {
+      /* FIXME: We should remove the optimize check after we ensure we never run
+	 IPA passes when not optimizing.  */
+      return flag_ipa_cp && optimize;
+    }
+
   unsigned int execute () { return ipcp_driver (); }
 
 }; // class pass_ipa_cp
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 19369c6..3bc6815 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -1911,16 +1911,6 @@ ipa_devirt (void)
   return ndevirtualized ? TODO_remove_functions : 0;
 }
 
-/* Gate for speculative IPA devirtualization optimization.  */
-
-static bool
-gate_ipa_devirt (void)
-{
-  return (flag_devirtualize
-	  && flag_devirtualize_speculatively
-	  && optimize);
-}
-
 namespace {
 
 const pass_data pass_data_ipa_devirt =
@@ -1954,7 +1944,13 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_ipa_devirt (); }
+  virtual bool gate (function *)
+    {
+      return (flag_devirtualize
+	      && flag_devirtualize_speculatively
+	      && optimize);
+    }
+
   unsigned int execute () { return ipa_devirt (); }
 
 }; // class pass_ipa_devirt
diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
index f2a72de..7b58716 100644
--- a/gcc/ipa-profile.c
+++ b/gcc/ipa-profile.c
@@ -711,12 +711,6 @@ ipa_profile (void)
   return 0;
 }
 
-static bool
-gate_ipa_profile (void)
-{
-  return flag_ipa_profile;
-}
-
 namespace {
 
 const pass_data pass_data_ipa_profile =
@@ -750,7 +744,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_ipa_profile (); }
+  virtual bool gate (function *) { return flag_ipa_profile; }
   unsigned int execute () { return ipa_profile (); }
 
 }; // class pass_ipa_profile
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index eac3636..eab7633 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1541,7 +1541,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_pure_const (); }
+  virtual bool gate (function *) { return gate_pure_const (); }
   unsigned int execute () { return propagate (); }
 
 }; // class pass_ipa_pure_const
@@ -1716,7 +1716,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_local_pure_const (m_ctxt); }
-  bool gate () { return gate_pure_const (); }
+  virtual bool gate (function *) { return gate_pure_const (); }
   unsigned int execute () { return local_pure_const (); }
 
 }; // class pass_local_pure_const
@@ -1740,12 +1740,6 @@ execute_warn_function_noreturn (void)
   return 0;
 }
 
-static bool
-gate_warn_function_noreturn (void)
-{
-  return warn_suggest_attribute_noreturn;
-}
-
 namespace {
 
 const pass_data pass_data_warn_function_noreturn =
@@ -1770,7 +1764,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_warn_function_noreturn (); }
+  virtual bool gate (function *) { return warn_suggest_attribute_noreturn; }
   unsigned int execute () { return execute_warn_function_noreturn (); }
 
 }; // class pass_warn_function_noreturn
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 126948e..51a57ac 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -1148,14 +1148,6 @@ ipa_reference_read_optimization_summary (void)
     }
 }
 
-static bool
-gate_reference (void)
-{
-  return (flag_ipa_reference
-	  /* Don't bother doing anything if the program has errors.  */
-	  && !seen_error ());
-}
-
 namespace {
 
 const pass_data pass_data_ipa_reference =
@@ -1191,7 +1183,13 @@ public:
     {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_reference (); }
+  virtual bool gate (function *)
+    {
+      return (flag_ipa_reference
+	      /* Don't bother doing anything if the program has errors.  */
+	      && !seen_error ());
+    }
+
   unsigned int execute () { return propagate (); }
 
 }; // class pass_ipa_reference
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index ebb9197..187dc98 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1646,17 +1646,6 @@ execute_split_functions (void)
   return todo;
 }
 
-/* Gate function splitting pass.  When doing profile feedback, we want
-   to execute the pass after profiling is read.  So disable one in 
-   early optimization.  */
-
-static bool
-gate_split_functions (void)
-{
-  return (flag_partial_inlining
-	  && !profile_arc_flag && !flag_branch_probabilities);
-}
-
 namespace {
 
 const pass_data pass_data_split_functions =
@@ -1681,11 +1670,20 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_split_functions (); }
+  virtual bool gate (function *);
   unsigned int execute () { return execute_split_functions (); }
 
 }; // class pass_split_functions
 
+bool
+pass_split_functions::gate (function *)
+{
+  /* When doing profile feedback, we want to execute the pass after profiling
+     is read.  So disable one in early optimization.  */
+  return (flag_partial_inlining
+	  && !profile_arc_flag && !flag_branch_probabilities);
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -1694,17 +1692,6 @@ make_pass_split_functions (gcc::context *ctxt)
   return new pass_split_functions (ctxt);
 }
 
-/* Gate feedback driven function splitting pass.
-   We don't need to split when profiling at all, we are producing
-   lousy code anyway.  */
-
-static bool
-gate_feedback_split_functions (void)
-{
-  return (flag_partial_inlining
-	  && flag_branch_probabilities);
-}
-
 /* Execute function splitting pass.  */
 
 static unsigned int
@@ -1740,11 +1727,20 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_feedback_split_functions (); }
+  virtual bool gate (function *);
   unsigned int execute () { return execute_feedback_split_functions (); }
 
 }; // class pass_feedback_split_functions
 
+bool
+pass_feedback_split_functions::gate (function *)
+{
+  /* We don't need to split when profiling at all, we are producing
+     lousy code anyway.  */
+  return (flag_partial_inlining
+	  && flag_branch_probabilities);
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 5e06509..7af2584 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -1272,14 +1272,6 @@ make_pass_ipa_free_inline_summary (gcc::context *ctxt)
   return new pass_ipa_free_inline_summary (ctxt);
 }
 
-/* Do not re-run on ltrans stage.  */
-
-static bool
-gate_whole_program_function_and_variable_visibility (void)
-{
-  return !flag_ltrans;
-}
-
 /* Bring functionss local at LTO time with -fwhole-program.  */
 
 static unsigned int
@@ -1324,9 +1316,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () {
-    return gate_whole_program_function_and_variable_visibility ();
-  }
+
+  virtual bool gate (function *)
+    {
+      /* Do not re-run on ltrans stage.  */
+      return !flag_ltrans;
+    }
   unsigned int execute () {
     return whole_program_function_and_variable_visibility ();
   }
@@ -1613,16 +1608,6 @@ ipa_cdtor_merge (void)
   return 0;
 }
 
-/* Perform the pass when we have no ctors/dtors support
-   or at LTO time to merge multiple constructors into single
-   function.  */
-
-static bool
-gate_ipa_cdtor_merge (void)
-{
-  return !targetm.have_ctors_dtors || (optimize && in_lto_p);
-}
-
 namespace {
 
 const pass_data pass_data_ipa_cdtor_merge =
@@ -1656,11 +1641,20 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_ipa_cdtor_merge (); }
+  virtual bool gate (function *);
   unsigned int execute () { return ipa_cdtor_merge (); }
 
 }; // class pass_ipa_cdtor_merge
 
+bool
+pass_ipa_cdtor_merge::gate (function *)
+{
+  /* Perform the pass when we have no ctors/dtors support
+     or at LTO time to merge multiple constructors into single
+     function.  */
+  return !targetm.have_ctors_dtors || (optimize && in_lto_p);
+}
+
 } // anon namespace
 
 ipa_opt_pass_d *
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index d0bd4ec..6da29d3 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -287,31 +287,8 @@ fix_loop_structure (bitmap changed_bbs)
   return number_of_loops (cfun) - old_nloops;
 }
 \f
-/* Gate for the RTL loop superpass.  The actual passes are subpasses.
-   See passes.c for more on that.  */
-
-static bool
-gate_handle_loop2 (void)
-{
-  if (optimize > 0
-      && (flag_move_loop_invariants
-	  || flag_unswitch_loops
-	  || flag_peel_loops
-	  || flag_unroll_loops
-#ifdef HAVE_doloop_end
-	  || (flag_branch_on_count_reg && HAVE_doloop_end)
-#endif
-	 ))
-    return true;
-  else
-    {
-      /* No longer preserve loops, remove them now.  */
-      cfun->curr_properties &= ~PROP_loops;
-      if (current_loops)
-	loop_optimizer_finalize ();
-      return false;
-    } 
-}
+/* The RTL loop superpass.  The actual passes are subpasses.  See passes.c for
+   more on that.  */
 
 namespace {
 
@@ -337,10 +314,33 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_loop2 (); }
+  virtual bool gate (function *);
 
 }; // class pass_loop2
 
+bool
+pass_loop2::gate (function *fun)
+{
+  if (optimize > 0
+      && (flag_move_loop_invariants
+	  || flag_unswitch_loops
+	  || flag_peel_loops
+	  || flag_unroll_loops
+#ifdef HAVE_doloop_end
+	  || (flag_branch_on_count_reg && HAVE_doloop_end)
+#endif
+      ))
+    return true;
+  else
+    {
+      /* No longer preserve loops, remove them now.  */
+      fun->curr_properties &= ~PROP_loops;
+      if (current_loops)
+	loop_optimizer_finalize ();
+      return false;
+    } 
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -461,12 +461,6 @@ make_pass_rtl_loop_done (gcc::context *ctxt)
 
 \f
 /* Loop invariant code motion.  */
-static bool
-gate_rtl_move_loop_invariants (void)
-{
-  return flag_move_loop_invariants;
-}
-
 static unsigned int
 rtl_move_loop_invariants (void)
 {
@@ -500,7 +494,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_rtl_move_loop_invariants (); }
+  virtual bool gate (function *) { return flag_move_loop_invariants; }
   unsigned int execute () { return rtl_move_loop_invariants (); }
 
 }; // class pass_rtl_move_loop_invariants
@@ -514,13 +508,6 @@ make_pass_rtl_move_loop_invariants (gcc::context *ctxt)
 }
 
 \f
-/* Loop unswitching for RTL.  */
-static bool
-gate_rtl_unswitch (void)
-{
-  return flag_unswitch_loops;
-}
-
 static unsigned int
 rtl_unswitch (void)
 {
@@ -553,7 +540,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_rtl_unswitch (); }
+  virtual bool gate (function *) { return flag_unswitch_loops; }
   unsigned int execute () { return rtl_unswitch (); }
 
 }; // class pass_rtl_unswitch
@@ -567,13 +554,6 @@ make_pass_rtl_unswitch (gcc::context *ctxt)
 }
 
 \f
-/* Loop unswitching for RTL.  */
-static bool
-gate_rtl_unroll_and_peel_loops (void)
-{
-  return (flag_peel_loops || flag_unroll_loops || flag_unroll_all_loops);
-}
-
 static unsigned int
 rtl_unroll_and_peel_loops (void)
 {
@@ -619,7 +599,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_rtl_unroll_and_peel_loops (); }
+  virtual bool gate (function *)
+    {
+      return (flag_peel_loops || flag_unroll_loops || flag_unroll_all_loops);
+    }
+
   unsigned int execute () { return rtl_unroll_and_peel_loops (); }
 
 }; // class pass_rtl_unroll_and_peel_loops
@@ -633,17 +617,6 @@ make_pass_rtl_unroll_and_peel_loops (gcc::context *ctxt)
 }
 
 \f
-/* The doloop optimization.  */
-static bool
-gate_rtl_doloop (void)
-{
-#ifdef HAVE_doloop_end
-  return (flag_branch_on_count_reg && HAVE_doloop_end);
-#else
-  return 0;
-#endif
-}
-
 static unsigned int
 rtl_doloop (void)
 {
@@ -678,11 +651,21 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_rtl_doloop (); }
+  virtual bool gate (function *);
   unsigned int execute () { return rtl_doloop (); }
 
 }; // class pass_rtl_doloop
 
+bool
+pass_rtl_doloop::gate (function *)
+{
+#ifdef HAVE_doloop_end
+  return (flag_branch_on_count_reg && HAVE_doloop_end);
+#else
+  return false;
+#endif
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 53ef1d9..89d9763 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1687,14 +1687,6 @@ decompose_multiword_subregs (bool decompose_copies)
   BITMAP_FREE (subreg_context);
 }
 \f
-/* Gate function for lower subreg pass.  */
-
-static bool
-gate_handle_lower_subreg (void)
-{
-  return flag_split_wide_types != 0;
-}
-
 /* Implement first lower subreg pass.  */
 
 static unsigned int
@@ -1737,7 +1729,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_lower_subreg (); }
+  virtual bool gate (function *) { return flag_split_wide_types != 0; }
   unsigned int execute () { return rest_of_handle_lower_subreg (); }
 
 }; // class pass_lower_subreg
@@ -1775,7 +1767,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_lower_subreg (); }
+  virtual bool gate (function *) { return flag_split_wide_types != 0; }
   unsigned int execute () { return rest_of_handle_lower_subreg2 (); }
 
 }; // class pass_lower_subreg2
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index d73135a..e73d6ee 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -789,16 +789,6 @@ optimize_mode_switching (void)
 
 #endif /* OPTIMIZE_MODE_SWITCHING */
 \f
-static bool
-gate_mode_switching (void)
-{
-#ifdef OPTIMIZE_MODE_SWITCHING
-  return true;
-#else
-  return false;
-#endif
-}
-
 static unsigned int
 rest_of_handle_mode_switching (void)
 {
@@ -836,7 +826,15 @@ public:
   /* The epiphany backend creates a second instance of this pass, so we need
      a clone method.  */
   opt_pass * clone () { return new pass_mode_switching (m_ctxt); }
-  bool gate () { return gate_mode_switching (); }
+  virtual bool gate (function *)
+    {
+#ifdef OPTIMIZE_MODE_SWITCHING
+      return true;
+#else
+      return false;
+#endif
+    }
+
   unsigned int execute () { return rest_of_handle_mode_switching (); }
 
 }; // class pass_mode_switching
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index a097df3..20e2e62 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -3323,13 +3323,6 @@ rotate_partial_schedule (partial_schedule_ptr ps, int start_cycle)
 
 #endif /* INSN_SCHEDULING */
 \f
-static bool
-gate_handle_sms (void)
-{
-  return (optimize > 0 && flag_modulo_sched);
-}
-
-
 /* Run instruction scheduler.  */
 /* Perform SMS module scheduling.  */
 static unsigned int
@@ -3380,7 +3373,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_sms (); }
+  virtual bool gate (function *)
+{
+  return (optimize > 0 && flag_modulo_sched);
+}
+
   unsigned int execute () { return rest_of_handle_sms (); }
 
 }; // class pass_sms
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index cadec81..0e96b88 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8326,13 +8326,6 @@ execute_expand_omp (void)
 
 /* OMP expansion -- the default pass, run before creation of SSA form.  */
 
-static bool
-gate_expand_omp (void)
-{
-  return ((flag_openmp != 0 || flag_openmp_simd != 0
-	   || flag_cilkplus != 0) && !seen_error ());
-}
-
 namespace {
 
 const pass_data pass_data_expand_omp =
@@ -8357,7 +8350,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_expand_omp (); }
+  virtual bool gate (function *)
+    {
+      return ((flag_openmp != 0 || flag_openmp_simd != 0
+	       || flag_cilkplus != 0) && !seen_error ());
+    }
+
   unsigned int execute () { return execute_expand_omp (); }
 
 }; // class pass_expand_omp
@@ -10617,12 +10615,6 @@ diagnose_omp_structured_block_errors (void)
   return 0;
 }
 
-static bool
-gate_diagnose_omp_blocks (void)
-{
-  return flag_openmp || flag_cilkplus;
-}
-
 namespace {
 
 const pass_data pass_data_diagnose_omp_blocks =
@@ -10647,7 +10639,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_diagnose_omp_blocks (); }
+  virtual bool gate (function *) { return flag_openmp || flag_cilkplus; }
   unsigned int execute () {
     return diagnose_omp_structured_block_errors ();
   }
@@ -11811,13 +11803,19 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return ((flag_openmp || flag_openmp_simd
-			  || flag_cilkplus || (in_lto_p && !flag_wpa))
-			 && (targetm.simd_clone.compute_vecsize_and_simdlen
-			     != NULL)); }
+  virtual bool gate (function *);
   unsigned int execute () { return ipa_omp_simd_clone (); }
 };
 
+bool
+pass_omp_simd_clone::gate (function *)
+{
+  return ((flag_openmp || flag_openmp_simd
+	   || flag_cilkplus
+	   || (in_lto_p && !flag_wpa))
+	  && (targetm.simd_clone.compute_vecsize_and_simdlen != NULL));
+}
+
 } // anon namespace
 
 simple_ipa_opt_pass *
diff --git a/gcc/passes.c b/gcc/passes.c
index 5d5a94c..b71c11e 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -108,7 +108,7 @@ opt_pass::clone ()
 }
 
 bool
-opt_pass::gate ()
+opt_pass::gate (function *)
 {
   return true;
 }
@@ -337,15 +337,6 @@ execute_all_early_local_passes (void)
   return 0;
 }
 
-/* Gate: execute, or not, all of the non-trivial optimizations.  */
-
-static bool
-gate_all_early_local_passes (void)
-{
-	  /* Don't bother doing anything if the program has errors.  */
-  return (!seen_error () && !in_lto_p);
-}
-
 namespace {
 
 const pass_data pass_data_early_local_passes =
@@ -370,7 +361,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_all_early_local_passes (); }
+  virtual bool gate (function *)
+    {
+      /* Don't bother doing anything if the program has errors.  */
+      return (!seen_error () && !in_lto_p);
+    }
+
   unsigned int execute () { return execute_all_early_local_passes (); }
 
 }; // class pass_early_local_passes
@@ -383,16 +379,6 @@ make_pass_early_local_passes (gcc::context *ctxt)
   return new pass_early_local_passes (ctxt);
 }
 
-/* Gate: execute, or not, all of the non-trivial optimizations.  */
-
-static bool
-gate_all_early_optimizations (void)
-{
-  return (optimize >= 1
-	  /* Don't bother doing anything if the program has errors.  */
-	  && !seen_error ());
-}
-
 namespace {
 
 const pass_data pass_data_all_early_optimizations =
@@ -417,7 +403,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_all_early_optimizations (); }
+  virtual bool gate (function *)
+    {
+      return (optimize >= 1
+	      /* Don't bother doing anything if the program has errors.  */
+	      && !seen_error ());
+    }
 
 }; // class pass_all_early_optimizations
 
@@ -429,14 +420,6 @@ make_pass_all_early_optimizations (gcc::context *ctxt)
   return new pass_all_early_optimizations (ctxt);
 }
 
-/* Gate: execute, or not, all of the non-trivial optimizations.  */
-
-static bool
-gate_all_optimizations (void)
-{
-  return optimize >= 1 && !optimize_debug;
-}
-
 namespace {
 
 const pass_data pass_data_all_optimizations =
@@ -461,7 +444,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_all_optimizations (); }
+  virtual bool gate (function *) { return optimize >= 1 && !optimize_debug; }
 
 }; // class pass_all_optimizations
 
@@ -473,14 +456,6 @@ make_pass_all_optimizations (gcc::context *ctxt)
   return new pass_all_optimizations (ctxt);
 }
 
-/* Gate: execute, or not, all of the non-trivial optimizations.  */
-
-static bool
-gate_all_optimizations_g (void)
-{
-  return optimize >= 1 && optimize_debug;
-}
-
 namespace {
 
 const pass_data pass_data_all_optimizations_g =
@@ -505,7 +480,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_all_optimizations_g (); }
+  virtual bool gate (function *) { return optimize >= 1 && optimize_debug; }
 
 }; // class pass_all_optimizations_g
 
@@ -517,14 +492,6 @@ make_pass_all_optimizations_g (gcc::context *ctxt)
   return new pass_all_optimizations_g (ctxt);
 }
 
-static bool
-gate_rest_of_compilation (void)
-{
-  /* Early return if there were errors.  We can run afoul of our
-     consistency checks, and there's not really much point in fixing them.  */
-  return !(rtl_dump_and_exit || flag_syntax_only || seen_error ());
-}
-
 namespace {
 
 const pass_data pass_data_rest_of_compilation =
@@ -549,7 +516,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_rest_of_compilation (); }
+  virtual bool gate (function *)
+    {
+      /* Early return if there were errors.  We can run afoul of our
+	 consistency checks, and there's not really much point in fixing them.  */
+      return !(rtl_dump_and_exit || flag_syntax_only || seen_error ());
+    }
 
 }; // class pass_rest_of_compilation
 
@@ -561,12 +533,6 @@ make_pass_rest_of_compilation (gcc::context *ctxt)
   return new pass_rest_of_compilation (ctxt);
 }
 
-static bool
-gate_postreload (void)
-{
-  return reload_completed;
-}
-
 namespace {
 
 const pass_data pass_data_postreload =
@@ -591,7 +557,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_postreload (); }
+  virtual bool gate (function *) { return reload_completed; }
 
 }; // class pass_postreload
 
@@ -823,7 +789,7 @@ dump_one_pass (opt_pass *pass, int pass_indent)
   const char *pn;
   bool is_on, is_really_on;
 
-  is_on = pass->gate ();
+  is_on = pass->gate (cfun);
   is_really_on = override_gate_status (pass, current_function_decl, is_on);
 
   if (pass->static_pass_number <= 0)
@@ -1976,7 +1942,7 @@ execute_ipa_summary_passes (ipa_opt_pass_d *ipa_pass)
 
       /* Execute all of the IPA_PASSes in the list.  */
       if (ipa_pass->type == IPA_PASS
-	  && pass->gate ()
+	  && pass->gate (cfun)
 	  && ipa_pass->generate_summary)
 	{
 	  pass_init_dump_file (pass);
@@ -2128,7 +2094,7 @@ execute_one_pass (opt_pass *pass)
 
   /* Check whether gate check should be avoided.
      User controls the value of the gate through the parameter "gate_status". */
-  gate_status = pass->gate ();
+  gate_status = pass->gate (cfun);
   gate_status = override_gate_status (pass, current_function_decl, gate_status);
 
   /* Override gate with plugin.  */
@@ -2274,7 +2240,7 @@ ipa_write_summaries_2 (opt_pass *pass, struct lto_out_decl_state *state)
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
       if (pass->type == IPA_PASS
 	  && ipa_pass->write_summary
-	  && pass->gate ())
+	  && pass->gate (cfun))
 	{
 	  /* If a timevar is present, start it.  */
 	  if (pass->tv_id)
@@ -2392,7 +2358,7 @@ ipa_write_optimization_summaries_1 (opt_pass *pass,
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
       if (pass->type == IPA_PASS
 	  && ipa_pass->write_optimization_summary
-	  && pass->gate ())
+	  && pass->gate (cfun))
 	{
 	  /* If a timevar is present, start it.  */
 	  if (pass->tv_id)
@@ -2470,7 +2436,7 @@ ipa_read_summaries_1 (opt_pass *pass)
       gcc_assert (!cfun);
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
 
-      if (pass->gate ())
+      if (pass->gate (cfun))
 	{
 	  if (pass->type == IPA_PASS && ipa_pass->read_summary)
 	    {
@@ -2520,7 +2486,7 @@ ipa_read_optimization_summaries_1 (opt_pass *pass)
       gcc_assert (!cfun);
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
 
-      if (pass->gate ())
+      if (pass->gate (cfun))
 	{
 	  if (pass->type == IPA_PASS && ipa_pass->read_optimization_summary)
 	    {
@@ -2597,7 +2563,7 @@ execute_ipa_stmt_fixups (opt_pass *pass,
     {
       /* Execute all of the IPA_PASSes in the list.  */
       if (pass->type == IPA_PASS
-	  && pass->gate ())
+	  && pass->gate (cfun))
 	{
 	  ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass;
 
diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index 264bd9a..8a804fb 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -1308,13 +1308,6 @@ gcse_after_reload_main (rtx f ATTRIBUTE_UNUSED)
 }
 
 \f
-static bool
-gate_handle_gcse2 (void)
-{
-  return (optimize > 0 && flag_gcse_after_reload
-	  && optimize_function_for_speed_p (cfun));
-}
-
 
 static unsigned int
 rest_of_handle_gcse2 (void)
@@ -1348,7 +1341,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_gcse2 (); }
+  virtual bool gate (function *fun)
+    {
+      return (optimize > 0 && flag_gcse_after_reload
+	      && optimize_function_for_speed_p (fun));
+    }
+
   unsigned int execute () { return rest_of_handle_gcse2 (); }
 
 }; // class pass_gcse2
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 0870183..0568c53 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -2315,13 +2315,6 @@ move2add_note_store (rtx dst, const_rtx set, void *data)
     }
 }
 \f
-static bool
-gate_handle_postreload (void)
-{
-  return (optimize > 0 && reload_completed);
-}
-
-
 static unsigned int
 rest_of_handle_postreload (void)
 {
@@ -2363,7 +2356,8 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_postreload (); }
+  virtual bool gate (function *) { return (optimize > 0 && reload_completed); }
+
   unsigned int execute () { return rest_of_handle_postreload (); }
 
 }; // class pass_postreload_cse
diff --git a/gcc/predict.c b/gcc/predict.c
index dccde72..068c187 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3131,12 +3131,6 @@ compute_function_frequency (void)
     }
 }
 
-static bool
-gate_estimate_probability (void)
-{
-  return flag_guess_branch_prob;
-}
-
 /* Build PREDICT_EXPR.  */
 tree
 build_predict_expr (enum br_predictor predictor, enum prediction taken)
@@ -3177,7 +3171,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_estimate_probability (); }
+  virtual bool gate (function *) { return flag_guess_branch_prob; }
   unsigned int execute () { return tree_estimate_probability_driver (); }
 
 }; // class pass_profile
diff --git a/gcc/recog.c b/gcc/recog.c
index b7113aa..8afea7e 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3810,12 +3810,6 @@ if_test_bypass_p (rtx out_insn, rtx in_insn)
   return true;
 }
 \f
-static bool
-gate_handle_peephole2 (void)
-{
-  return (optimize > 0 && flag_peephole2);
-}
-
 static unsigned int
 rest_of_handle_peephole2 (void)
 {
@@ -3852,7 +3846,7 @@ public:
   /* The epiphany backend creates a second instance of this pass, so we need
      a clone method.  */
   opt_pass * clone () { return new pass_peephole2 (m_ctxt); }
-  bool gate () { return gate_handle_peephole2 (); }
+  virtual bool gate (function *) { return (optimize > 0 && flag_peephole2); }
   unsigned int execute () { return rest_of_handle_peephole2 (); }
 
 }; // class pass_peephole2
@@ -3958,24 +3952,6 @@ make_pass_split_after_reload (gcc::context *ctxt)
   return new pass_split_after_reload (ctxt);
 }
 
-static bool
-gate_handle_split_before_regstack (void)
-{
-#if HAVE_ATTR_length && defined (STACK_REGS)
-  /* If flow2 creates new instructions which need splitting
-     and scheduling after reload is not done, they might not be
-     split until final which doesn't allow splitting
-     if HAVE_ATTR_length.  */
-# ifdef INSN_SCHEDULING
-  return (optimize && !flag_schedule_insns_after_reload);
-# else
-  return (optimize);
-# endif
-#else
-  return 0;
-#endif
-}
-
 static unsigned int
 rest_of_handle_split_before_regstack (void)
 {
@@ -4007,13 +3983,31 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_split_before_regstack (); }
+  virtual bool gate (function *);
   unsigned int execute () {
     return rest_of_handle_split_before_regstack ();
   }
 
 }; // class pass_split_before_regstack
 
+bool
+pass_split_before_regstack::gate (function *)
+{
+#if HAVE_ATTR_length && defined (STACK_REGS)
+  /* If flow2 creates new instructions which need splitting
+     and scheduling after reload is not done, they might not be
+     split until final which doesn't allow splitting
+     if HAVE_ATTR_length.  */
+# ifdef INSN_SCHEDULING
+  return (optimize && !flag_schedule_insns_after_reload);
+# else
+  return (optimize);
+# endif
+#else
+  return 0;
+#endif
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -4022,16 +4016,6 @@ make_pass_split_before_regstack (gcc::context *ctxt)
   return new pass_split_before_regstack (ctxt);
 }
 
-static bool
-gate_handle_split_before_sched2 (void)
-{
-#ifdef INSN_SCHEDULING
-  return optimize > 0 && flag_schedule_insns_after_reload;
-#else
-  return 0;
-#endif
-}
-
 static unsigned int
 rest_of_handle_split_before_sched2 (void)
 {
@@ -4065,7 +4049,15 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_split_before_sched2 (); }
+  virtual bool gate (function *)
+    {
+#ifdef INSN_SCHEDULING
+      return optimize > 0 && flag_schedule_insns_after_reload;
+#else
+      return false;
+#endif
+    }
+
   unsigned int execute () { return rest_of_handle_split_before_sched2 (); }
 
 }; // class pass_split_before_sched2
@@ -4078,18 +4070,6 @@ make_pass_split_before_sched2 (gcc::context *ctxt)
   return new pass_split_before_sched2 (ctxt);
 }
 
-/* The placement of the splitting that we do for shorten_branches
-   depends on whether regstack is used by the target or not.  */
-static bool
-gate_do_final_split (void)
-{
-#if HAVE_ATTR_length && !defined (STACK_REGS)
-  return 1;
-#else
-  return 0;
-#endif
-}
-
 namespace {
 
 const pass_data pass_data_split_for_shorten_branches =
@@ -4114,7 +4094,17 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_do_final_split (); }
+  virtual bool gate (function *)
+    {
+      /* The placement of the splitting that we do for shorten_branches
+	 depends on whether regstack is used by the target or not.  */
+#if HAVE_ATTR_length && !defined (STACK_REGS)
+      return true;
+#else
+      return false;
+#endif
+    }
+
   unsigned int execute () { return split_all_insns_noflow (); }
 
 }; // class pass_split_for_shorten_branches
diff --git a/gcc/ree.c b/gcc/ree.c
index 09dfa61..435bb88 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -1093,14 +1093,6 @@ rest_of_handle_ree (void)
   return 0;
 }
 
-/* Run REE pass when flag_ree is set at optimization level > 0.  */
-
-static bool
-gate_handle_ree (void)
-{
-  return (optimize > 0 && flag_ree);
-}
-
 namespace {
 
 const pass_data pass_data_ree =
@@ -1125,7 +1117,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_ree (); }
+  virtual bool gate (function *) { return (optimize > 0 && flag_ree); }
   unsigned int execute () { return rest_of_handle_ree (); }
 
 }; // class pass_ree
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 02e3e09..f8f8658 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -3285,16 +3285,6 @@ reg_to_stack (void)
 }
 #endif /* STACK_REGS */
 \f
-static bool
-gate_handle_stack_regs (void)
-{
-#ifdef STACK_REGS
-  return 1;
-#else
-  return 0;
-#endif
-}
-
 namespace {
 
 const pass_data pass_data_stack_regs =
@@ -3319,7 +3309,14 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_stack_regs (); }
+  virtual bool gate (function *)
+    {
+#ifdef STACK_REGS
+      return true;
+#else
+      return false;
+#endif
+    }
 
 }; // class pass_stack_regs
 
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index a7dbbc3..24992e4 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -1247,13 +1247,6 @@ validate_value_data (struct value_data *vd)
 }
 #endif
 \f
-static bool
-gate_handle_cprop (void)
-{
-  return (optimize > 0 && (flag_cprop_registers));
-}
-
-
 namespace {
 
 const pass_data pass_data_cprop_hardreg =
@@ -1278,7 +1271,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_cprop (); }
+  virtual bool gate (function *)
+    {
+      return (optimize > 0 && (flag_cprop_registers));
+    }
+
   unsigned int execute () { return copyprop_hardreg_forward (); }
 
 }; // class pass_cprop_hardreg
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 30f7abc..321d5bf 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -1836,12 +1836,6 @@ regrename_optimize (void)
   return 0;
 }
 \f
-static bool
-gate_handle_regrename (void)
-{
-  return (optimize > 0 && (flag_rename_registers));
-}
-
 namespace {
 
 const pass_data pass_data_regrename =
@@ -1866,7 +1860,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_regrename (); }
+  virtual bool gate (function *)
+    {
+      return (optimize > 0 && (flag_rename_registers));
+    }
+
   unsigned int execute () { return regrename_optimize (); }
 
 }; // class pass_regrename
diff --git a/gcc/reorg.c b/gcc/reorg.c
index fff342f..22f0b5a 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3863,17 +3863,6 @@ dbr_schedule (rtx first)
 }
 #endif /* DELAY_SLOTS */
 \f
-static bool
-gate_handle_delay_slots (void)
-{
-#ifdef DELAY_SLOTS
-  /* At -O0 dataflow info isn't updated after RA.  */
-  return optimize > 0 && flag_delayed_branch && !crtl->dbr_scheduled_p;
-#else
-  return 0;
-#endif
-}
-
 /* Run delay slot optimization.  */
 static unsigned int
 rest_of_handle_delay_slots (void)
@@ -3908,11 +3897,22 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_delay_slots (); }
+  virtual bool gate (function *);
   unsigned int execute () { return rest_of_handle_delay_slots (); }
 
 }; // class pass_delay_slots
 
+bool
+pass_delay_slots::gate (function *)
+{
+#ifdef DELAY_SLOTS
+  /* At -O0 dataflow info isn't updated after RA.  */
+  return optimize > 0 && flag_delayed_branch && !crtl->dbr_scheduled_p;
+#else
+  return 0;
+#endif
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -3922,12 +3922,6 @@ make_pass_delay_slots (gcc::context *ctxt)
 }
 
 /* Machine dependent reorg pass.  */
-static bool
-gate_handle_machine_reorg (void)
-{
-  return targetm.machine_dependent_reorg != 0;
-}
-
 
 static unsigned int
 rest_of_handle_machine_reorg (void)
@@ -3960,7 +3954,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_machine_reorg (); }
+  virtual bool gate (function *)
+    {
+      return targetm.machine_dependent_reorg != 0;
+    }
+
   unsigned int execute () { return rest_of_handle_machine_reorg (); }
 
 }; // class pass_machine_reorg
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 18b50a4..e0a80c2 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -3591,16 +3591,6 @@ advance_target_bb (basic_block bb, rtx insn)
 
 #endif
 \f
-static bool
-gate_handle_live_range_shrinkage (void)
-{
-#ifdef INSN_SCHEDULING
-  return flag_live_range_shrinkage;
-#else
-  return 0;
-#endif
-}
-
 /* Run instruction scheduler.  */
 static unsigned int
 rest_of_handle_live_range_shrinkage (void)
@@ -3618,16 +3608,6 @@ rest_of_handle_live_range_shrinkage (void)
   return 0;
 }
 
-static bool
-gate_handle_sched (void)
-{
-#ifdef INSN_SCHEDULING
-  return optimize > 0 && flag_schedule_insns && dbg_cnt (sched_func);
-#else
-  return 0;
-#endif
-}
-
 /* Run instruction scheduler.  */
 static unsigned int
 rest_of_handle_sched (void)
@@ -3642,17 +3622,6 @@ rest_of_handle_sched (void)
   return 0;
 }
 
-static bool
-gate_handle_sched2 (void)
-{
-#ifdef INSN_SCHEDULING
-  return optimize > 0 && flag_schedule_insns_after_reload
-    && !targetm.delay_sched2 && dbg_cnt (sched2_func);
-#else
-  return 0;
-#endif
-}
-
 /* Run second scheduling pass after reload.  */
 static unsigned int
 rest_of_handle_sched2 (void)
@@ -3699,7 +3668,15 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_live_range_shrinkage (); }
+  virtual bool gate (function *)
+    {
+#ifdef INSN_SCHEDULING
+      return flag_live_range_shrinkage;
+#else
+      return 0;
+#endif
+    }
+
   unsigned int execute () { return rest_of_handle_live_range_shrinkage (); }
 
 }; // class pass_live_range_shrinkage
@@ -3737,11 +3714,21 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_sched (); }
+  virtual bool gate (function *);
   unsigned int execute () { return rest_of_handle_sched (); }
 
 }; // class pass_sched
 
+bool
+pass_sched::gate (function *)
+{
+#ifdef INSN_SCHEDULING
+  return optimize > 0 && flag_schedule_insns && dbg_cnt (sched_func);
+#else
+  return 0;
+#endif
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -3775,11 +3762,22 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_sched2 (); }
+  virtual bool gate (function *);
   unsigned int execute () { return rest_of_handle_sched2 (); }
 
 }; // class pass_sched2
 
+bool
+pass_sched2::gate (function *)
+{
+#ifdef INSN_SCHEDULING
+  return optimize > 0 && flag_schedule_insns_after_reload
+    && !targetm.delay_sched2 && dbg_cnt (sched2_func);
+#else
+  return 0;
+#endif
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/store-motion.c b/gcc/store-motion.c
index 5aacaad..7c57754 100644
--- a/gcc/store-motion.c
+++ b/gcc/store-motion.c
@@ -1223,15 +1223,6 @@ one_store_motion_pass (void)
 }
 
 \f
-static bool
-gate_rtl_store_motion (void)
-{
-  return optimize > 0 && flag_gcse_sm
-    && !cfun->calls_setjmp
-    && optimize_function_for_speed_p (cfun)
-    && dbg_cnt (store_motion);
-}
-
 static unsigned int
 execute_rtl_store_motion (void)
 {
@@ -1266,11 +1257,20 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_rtl_store_motion (); }
+  virtual bool gate (function *);
   unsigned int execute () { return execute_rtl_store_motion (); }
 
 }; // class pass_rtl_store_motion
 
+bool
+pass_rtl_store_motion::gate (function *fun)
+{
+  return optimize > 0 && flag_gcse_sm
+    && !fun->calls_setjmp
+    && optimize_function_for_speed_p (fun)
+    && dbg_cnt (store_motion);
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
index d73bea8..a3b04a2 100644
--- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
+++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
@@ -52,12 +52,6 @@ execute_dumb_plugin_example (void)
   return 0;
 }
 
-static bool
-gate_dumb_plugin_example (void)
-{
-  return true;
-}
-
 namespace {
 
 const pass_data pass_data_dumb_plugin_example =
@@ -82,7 +76,6 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_dumb_plugin_example (); }
   unsigned int execute () { return execute_dumb_plugin_example (); }
 
 }; // class pass_dumb_plugin_example
diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
index 8df8579..033047b 100644
--- a/gcc/testsuite/g++.dg/plugin/selfassign.c
+++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
@@ -270,14 +270,6 @@ execute_warn_self_assign (void)
   return 0;
 }
 
-/* Pass gate function. Currently always returns true.  */
-
-static bool
-gate_warn_self_assign (void)
-{
-  return true;
-}
-
 namespace {
 
 const pass_data pass_data_warn_self_assign =
@@ -302,7 +294,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_warn_self_assign (); }
+  bool gate (function *) { return true; }
   unsigned int execute () { return execute_warn_self_assign (); }
 
 }; // class pass_warn_self_assign
diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
index 33106ad..18e8b07 100644
--- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
@@ -49,7 +49,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate ();
+  virtual bool gate (function *);
   unsigned int execute ();
 
 private:
@@ -58,7 +58,7 @@ private:
 
 } // anon namespace
 
-bool one_pass::gate (void)
+bool one_pass::gate (function *)
 {
   return true;
 }
diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
index 8df8579..098df06 100644
--- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
+++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
@@ -270,14 +270,6 @@ execute_warn_self_assign (void)
   return 0;
 }
 
-/* Pass gate function. Currently always returns true.  */
-
-static bool
-gate_warn_self_assign (void)
-{
-  return true;
-}
-
 namespace {
 
 const pass_data pass_data_warn_self_assign =
@@ -302,7 +294,6 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_warn_self_assign (); }
   unsigned int execute () { return execute_warn_self_assign (); }
 
 }; // class pass_warn_self_assign
diff --git a/gcc/tracer.c b/gcc/tracer.c
index 73e3209..794d385 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -398,12 +398,6 @@ tracer (void)
   return changed ? TODO_cleanup_cfg : 0;
 }
 \f
-static bool
-gate_tracer (void)
-{
-  return (optimize > 0 && flag_tracer && flag_reorder_blocks);
-}
-
 namespace {
 
 const pass_data pass_data_tracer =
@@ -428,7 +422,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tracer (); }
+  virtual bool gate (function *)
+    {
+      return (optimize > 0 && flag_tracer && flag_reorder_blocks);
+    }
+
   unsigned int execute () { return tracer (); }
 
 }; // class pass_tracer
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index a259b77..be876f5 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -456,14 +456,6 @@ build_tm_abort_call (location_t loc, bool is_outer)
 					     AR_USERABORT
 					     | (is_outer ? AR_OUTERABORT : 0)));
 }
-
-/* Common gateing function for several of the TM passes.  */
-
-static bool
-gate_tm (void)
-{
-  return flag_tm;
-}
 \f
 /* Map for aribtrary function replacement under TM, as created
    by the tm_wrap attribute.  */
@@ -863,7 +855,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tm (); }
+  virtual bool gate (function *) { return flag_tm; }
   unsigned int execute () { return diagnose_tm_blocks (); }
 
 }; // class pass_diagnose_tm_blocks
@@ -1785,7 +1777,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tm (); }
+  virtual bool gate (function *) { return flag_tm; }
   unsigned int execute () { return execute_lower_tm (); }
 
 }; // class pass_lower_tm
@@ -2062,7 +2054,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tm_init (); }
+  virtual bool gate (function *) { return gate_tm_init (); }
 
 }; // class pass_tm_init
 
@@ -3929,12 +3921,6 @@ execute_tm_memopt (void)
   return 0;
 }
 
-static bool
-gate_tm_memopt (void)
-{
-  return flag_tm && optimize > 0;
-}
-
 namespace {
 
 const pass_data pass_data_tm_memopt =
@@ -3959,7 +3945,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tm_memopt (); }
+  virtual bool gate (function *) { return flag_tm && optimize > 0; }
   unsigned int execute () { return execute_tm_memopt (); }
 
 }; // class pass_tm_memopt
@@ -5594,7 +5580,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tm (); }
+  virtual bool gate (function *) { return flag_tm; }
   unsigned int execute () { return ipa_tm_execute (); }
 
 }; // class pass_ipa_tm
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 3293493..c271493 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -917,15 +917,6 @@ tree_call_cdce (void)
   return 0;
 }
 
-static bool
-gate_call_cdce (void)
-{
-  /* The limit constants used in the implementation
-     assume IEEE floating point format.  Other formats
-     can be supported in the future if needed.  */
-  return flag_tree_builtin_call_dce != 0 && optimize_function_for_speed_p (cfun);
-}
-
 namespace {
 
 const pass_data pass_data_call_cdce =
@@ -950,7 +941,15 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_call_cdce (); }
+  virtual bool gate (function *fun)
+    {
+      /* The limit constants used in the implementation
+	 assume IEEE floating point format.  Other formats
+	 can be supported in the future if needed.  */
+      return flag_tree_builtin_call_dce != 0
+       	&& optimize_function_for_speed_p (fun);
+    }
+
   unsigned int execute () { return tree_call_cdce (); }
 
 }; // class pass_call_cdce
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 739ca54..08e0280 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -8355,12 +8355,6 @@ run_warn_unused_result (void)
   return 0;
 }
 
-static bool
-gate_warn_unused_result (void)
-{
-  return flag_warn_unused_result;
-}
-
 namespace {
 
 const pass_data pass_data_warn_unused_result =
@@ -8385,7 +8379,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_warn_unused_result (); }
+  virtual bool gate (function *) { return flag_warn_unused_result; }
   unsigned int execute () { return run_warn_unused_result (); }
 
 }; // class pass_warn_unused_result
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 914523d..19433f9 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -1035,12 +1035,6 @@ merge_phi_nodes (void)
   return 0;
 }
 
-static bool
-gate_merge_phi (void)
-{
-  return 1;
-}
-
 namespace {
 
 const pass_data pass_data_merge_phi =
@@ -1066,7 +1060,6 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_merge_phi (m_ctxt); }
-  bool gate () { return gate_merge_phi (); }
   unsigned int execute () { return merge_phi_nodes (); }
 
 }; // class pass_merge_phi
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 283c827..9ec83d9 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1693,14 +1693,6 @@ make_pass_lower_complex (gcc::context *ctxt)
 }
 
 \f
-static bool
-gate_no_optimization (void)
-{
-  /* With errors, normal optimization passes are not run.  If we don't
-     lower complex operations at all, rtl expansion will abort.  */
-  return !(cfun->curr_properties & PROP_gimple_lcx);
-}
-
 namespace {
 
 const pass_data pass_data_lower_complex_O0 =
@@ -1725,7 +1717,13 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_no_optimization (); }
+  virtual bool gate (function *fun)
+    {
+      /* With errors, normal optimization passes are not run.  If we don't
+	 lower complex operations at all, rtl expansion will abort.  */
+      return !(fun->curr_properties & PROP_gimple_lcx);
+    }
+
   unsigned int execute () { return tree_lower_complex (); }
 
 }; // class pass_lower_complex_O0
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index f51f18c..41f96c4 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -3115,12 +3115,6 @@ refactor_eh (void)
   return 0;
 }
 
-static bool
-gate_refactor_eh (void)
-{
-  return flag_exceptions != 0;
-}
-
 namespace {
 
 const pass_data pass_data_refactor_eh =
@@ -3145,7 +3139,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_refactor_eh (); }
+  virtual bool gate (function *) { return flag_exceptions != 0; }
   unsigned int execute () { return refactor_eh (); }
 
 }; // class pass_refactor_eh
@@ -3341,12 +3335,6 @@ execute_lower_resx (void)
   return any_rewritten ? TODO_update_ssa_only_virtuals : 0;
 }
 
-static bool
-gate_lower_resx (void)
-{
-  return flag_exceptions != 0;
-}
-
 namespace {
 
 const pass_data pass_data_lower_resx =
@@ -3371,7 +3359,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_lower_resx (); }
+  virtual bool gate (function *) { return flag_exceptions != 0; }
   unsigned int execute () { return execute_lower_resx (); }
 
 }; // class pass_lower_resx
@@ -3749,12 +3737,6 @@ execute_lower_eh_dispatch (void)
   return flags;
 }
 
-static bool
-gate_lower_eh_dispatch (void)
-{
-  return cfun->eh->region_tree != NULL;
-}
-
 namespace {
 
 const pass_data pass_data_lower_eh_dispatch =
@@ -3779,7 +3761,8 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_lower_eh_dispatch (); }
+  virtual bool gate (function *fun) { return fun->eh->region_tree != NULL; }
+
   unsigned int execute () { return execute_lower_eh_dispatch (); }
 
 }; // class pass_lower_eh_dispatch
@@ -4596,12 +4579,6 @@ execute_cleanup_eh (void)
   return ret;
 }
 
-static bool
-gate_cleanup_eh (void)
-{
-  return cfun->eh != NULL && cfun->eh->region_tree != NULL;
-}
-
 namespace {
 
 const pass_data pass_data_cleanup_eh =
@@ -4627,7 +4604,11 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_cleanup_eh (m_ctxt); }
-  bool gate () { return gate_cleanup_eh (); }
+  virtual bool gate (function *fun)
+    {
+      return fun->eh != NULL && fun->eh->region_tree != NULL;
+    }
+
   unsigned int execute () { return execute_cleanup_eh (); }
 
 }; // class pass_cleanup_eh
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index 84aa008..280a606 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -816,14 +816,6 @@ ipa_lower_emutls (void)
   return TODO_verify_all;
 }
 
-/* If the target supports TLS natively, we need do nothing here.  */
-
-static bool
-gate_emutls (void)
-{
-  return !targetm.have_tls;
-}
-
 namespace {
 
 const pass_data pass_data_ipa_lower_emutls =
@@ -848,7 +840,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_emutls (); }
+  virtual bool gate (function *)
+    {
+      /* If the target supports TLS natively, we need do nothing here.  */
+      return !targetm.have_tls;
+    }
+
   unsigned int execute () { return ipa_lower_emutls (); }
 
 }; // class pass_ipa_lower_emutls
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index b87c476..90b62a8 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -2013,17 +2013,6 @@ main_tree_if_conversion (void)
   return todo;
 }
 
-/* Returns true when the if-conversion pass is enabled.  */
-
-static bool
-gate_tree_if_conversion (void)
-{
-  return (((flag_tree_loop_vectorize || cfun->has_force_vectorize_loops)
-	   && flag_tree_loop_if_convert != 0)
-	  || flag_tree_loop_if_convert == 1
-	  || flag_tree_loop_if_convert_stores == 1);
-}
-
 namespace {
 
 const pass_data pass_data_if_conversion =
@@ -2049,11 +2038,20 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_if_conversion (); }
+  virtual bool gate (function *);
   unsigned int execute () { return main_tree_if_conversion (); }
 
 }; // class pass_if_conversion
 
+bool
+pass_if_conversion::gate (function *fun)
+{
+  return (((flag_tree_loop_vectorize || fun->has_force_vectorize_loops)
+	   && flag_tree_loop_if_convert != 0)
+	  || flag_tree_loop_if_convert == 1
+	  || flag_tree_loop_if_convert_stores == 1);
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index dec5a5b..332901d 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -2365,15 +2365,6 @@ rewrite_into_ssa (void)
   return 0;
 }
 
-/* Gate for IPCP optimization.  */
-
-static bool
-gate_into_ssa (void)
-{
-  /* Do nothing for funcions that was produced already in SSA form.  */
-  return !(cfun->curr_properties & PROP_ssa);
-}
-
 namespace {
 
 const pass_data pass_data_build_ssa =
@@ -2398,7 +2389,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_into_ssa (); }
+  virtual bool gate (function *fun)
+    {
+      /* Do nothing for funcions that was produced already in SSA form.  */
+      return !(fun->curr_properties & PROP_ssa);
+    }
+
   unsigned int execute () { return rewrite_into_ssa (); }
 
 }; // class pass_build_ssa
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index dcc61c7..0a15412 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -1790,13 +1790,6 @@ out:
   return 0;
 }
 
-static bool
-gate_tree_loop_distribution (void)
-{
-  return flag_tree_loop_distribution
-    || flag_tree_loop_distribute_patterns;
-}
-
 namespace {
 
 const pass_data pass_data_loop_distribution =
@@ -1821,7 +1814,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_loop_distribution (); }
+  virtual bool gate (function *)
+    {
+      return flag_tree_loop_distribution
+	|| flag_tree_loop_distribute_patterns;
+    }
+
   unsigned int execute () { return tree_loop_distribution (); }
 
 }; // class pass_loop_distribution
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index a39bc5e..71f8d68 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -272,12 +272,6 @@ tree_nrv (void)
   return 0;
 }
 
-static bool
-gate_pass_return_slot (void)
-{
-  return optimize > 0;
-}
-
 namespace {
 
 const pass_data pass_data_nrv =
@@ -302,7 +296,8 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_pass_return_slot (); }
+  virtual bool gate (function *) { return optimize > 0; }
+
   unsigned int execute () { return tree_nrv (); }
 
 }; // class pass_nrv
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index e346074..a46fa51 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -2253,12 +2253,6 @@ parallelize_loops (void)
 
 /* Parallelization.  */
 
-static bool
-gate_tree_parallelize_loops (void)
-{
-  return flag_tree_parallelize_loops > 1;
-}
-
 static unsigned
 tree_parallelize_loops (void)
 {
@@ -2294,7 +2288,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_parallelize_loops (); }
+  virtual bool gate (function *) { return flag_tree_parallelize_loops > 1; }
   unsigned int execute () { return tree_parallelize_loops (); }
 
 }; // class pass_parallelize_loops
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 9bb6455..9de2822 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -25,6 +25,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "timevar.h"
 #include "dumpfile.h"
 
+struct function;
+
 /* Optimization pass type.  */
 enum opt_pass_type
 {
@@ -88,7 +90,7 @@ public:
 
   /* This pass and all sub-passes are executed only if the function returns
      true.  The default implementation returns true.  */
-  virtual bool gate ();
+  virtual bool gate (function *fun);
 
   /* This is the code to run.  If has_execute is false, then there should
      be sub-passes otherwise this pass does nothing.
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 859a112..7dd86e1 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -2573,12 +2573,6 @@ run_tree_predictive_commoning (void)
   return tree_predictive_commoning ();
 }
 
-static bool
-gate_tree_predictive_commoning (void)
-{
-  return flag_predictive_commoning != 0;
-}
-
 namespace {
 
 const pass_data pass_data_predcom =
@@ -2603,7 +2597,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_predictive_commoning (); }
+  virtual bool gate (function *) { return flag_predictive_commoning != 0; }
   unsigned int execute () { return run_tree_predictive_commoning (); }
 
 }; // class pass_predcom
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 0372c92..b7d0466 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -663,16 +663,6 @@ tree_profiling (void)
   return 0;
 }
 
-/* When profile instrumentation, use or test coverage shall be performed.  */
-
-static bool
-gate_tree_profile_ipa (void)
-{
-  return (!in_lto_p
-	  && (flag_branch_probabilities || flag_test_coverage
-	      || profile_arc_flag));
-}
-
 namespace {
 
 const pass_data pass_data_ipa_tree_profile =
@@ -697,11 +687,20 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_profile_ipa (); }
+  virtual bool gate (function *);
   unsigned int execute () { return tree_profiling (); }
 
 }; // class pass_ipa_tree_profile
 
+bool
+pass_ipa_tree_profile::gate (function *)
+{
+  /* When profile instrumentation, use or test coverage shall be performed.  */
+  return (!in_lto_p
+	  && (flag_branch_probabilities || flag_test_coverage
+	      || profile_arc_flag));
+}
+
 } // anon namespace
 
 simple_ipa_opt_pass *
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index acca2a7..27f71a3 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3524,7 +3524,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_intra_sra (); }
+  virtual bool gate (function *) { return gate_intra_sra (); }
   unsigned int execute () { return early_intra_sra (); }
 
 }; // class pass_sra_early
@@ -3561,7 +3561,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_intra_sra (); }
+  virtual bool gate (function *) { return gate_intra_sra (); }
   unsigned int execute () { return late_intra_sra (); }
 
 }; // class pass_sra
@@ -5051,13 +5051,6 @@ ipa_early_sra (void)
   return ret;
 }
 
-/* Return if early ipa sra shall be performed.  */
-static bool
-ipa_early_sra_gate (void)
-{
-  return flag_ipa_sra && dbg_cnt (eipa_sra);
-}
-
 namespace {
 
 const pass_data pass_data_early_ipa_sra =
@@ -5082,7 +5075,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return ipa_early_sra_gate (); }
+  virtual bool gate (function *) { return flag_ipa_sra && dbg_cnt (eipa_sra); }
   unsigned int execute () { return ipa_early_sra (); }
 
 }; // class pass_early_ipa_sra
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index c7a7e89..c4a5c71 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2287,13 +2287,6 @@ do_ssa_ccp (void)
 }
 
 
-static bool
-gate_ccp (void)
-{
-  return flag_tree_ccp != 0;
-}
-
-
 namespace {
 
 const pass_data pass_data_ccp =
@@ -2320,7 +2313,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_ccp (m_ctxt); }
-  bool gate () { return gate_ccp (); }
+  virtual bool gate (function *) { return flag_tree_ccp != 0; }
   unsigned int execute () { return do_ssa_ccp (); }
 
 }; // class pass_ccp
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index fc26d03..bd6ac04 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -644,12 +644,6 @@ execute_copy_prop (void)
   return 0;
 }
 
-static bool
-gate_copy_prop (void)
-{
-  return flag_tree_copy_prop != 0;
-}
-
 namespace {
 
 const pass_data pass_data_copy_prop =
@@ -676,7 +670,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_copy_prop (m_ctxt); }
-  bool gate () { return gate_copy_prop (); }
+  virtual bool gate (function *) { return flag_tree_copy_prop != 0; }
   unsigned int execute () { return execute_copy_prop (); }
 
 }; // class pass_copy_prop
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index 0da3d82..65d8044 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -435,14 +435,6 @@ rename_ssa_copies (void)
   return 0;
 }
 
-/* Return true if copy rename is to be performed.  */
-
-static bool
-gate_copyrename (void)
-{
-  return flag_tree_copyrename != 0;
-}
-
 namespace {
 
 const pass_data pass_data_rename_ssa_copies =
@@ -468,7 +460,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_rename_ssa_copies (m_ctxt); }
-  bool gate () { return gate_copyrename (); }
+  virtual bool gate (function *) { return flag_tree_copyrename != 0; }
   unsigned int execute () { return rename_ssa_copies (); }
 
 }; // class pass_rename_ssa_copies
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 8db149e..e5799b9 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1504,12 +1504,6 @@ tree_ssa_cd_dce (void)
   return perform_tree_ssa_dce (/*aggressive=*/optimize >= 2);
 }
 
-static bool
-gate_dce (void)
-{
-  return flag_tree_dce != 0;
-}
-
 namespace {
 
 const pass_data pass_data_dce =
@@ -1535,7 +1529,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_dce (m_ctxt); }
-  bool gate () { return gate_dce (); }
+  virtual bool gate (function *) { return flag_tree_dce != 0; }
   unsigned int execute () { return tree_ssa_dce (); }
 
 }; // class pass_dce
@@ -1573,7 +1567,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_dce_loop (m_ctxt); }
-  bool gate () { return gate_dce (); }
+  virtual bool gate (function *) { return flag_tree_dce != 0; }
   unsigned int execute () { return tree_ssa_dce_loop (); }
 
 }; // class pass_dce_loop
@@ -1611,7 +1605,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_cd_dce (m_ctxt); }
-  bool gate () { return gate_dce (); }
+  virtual bool gate (function *) { return flag_tree_dce != 0; }
   unsigned int execute () { return tree_ssa_cd_dce (); }
 
 }; // class pass_cd_dce
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 8101a54..b9cc5cc 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -952,12 +952,6 @@ tree_ssa_dominator_optimize (void)
   return 0;
 }
 
-static bool
-gate_dominator (void)
-{
-  return flag_tree_dom != 0;
-}
-
 namespace {
 
 const pass_data pass_data_dominator =
@@ -985,7 +979,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_dominator (m_ctxt); }
-  bool gate () { return gate_dominator (); }
+  virtual bool gate (function *) { return flag_tree_dom != 0; }
   unsigned int execute () { return tree_ssa_dominator_optimize (); }
 
 }; // class pass_dominator
@@ -3142,7 +3136,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_phi_only_cprop (m_ctxt); }
-  bool gate () { return gate_dominator (); }
+  virtual bool gate (function *) { return flag_tree_dom != 0; }
   unsigned int execute () { return eliminate_degenerate_phis (); }
 
 }; // class pass_phi_only_cprop
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 0096b4c..b6fbdaf 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -80,7 +80,6 @@ along with GCC; see the file COPYING3.  If not see
    remove their dead edges eventually.  */
 static bitmap need_eh_cleanup;
 
-static bool gate_dse (void);
 static unsigned int tree_ssa_dse (void);
 
 
@@ -363,12 +362,6 @@ tree_ssa_dse (void)
   return 0;
 }
 
-static bool
-gate_dse (void)
-{
-  return flag_tree_dse != 0;
-}
-
 namespace {
 
 const pass_data pass_data_dse =
@@ -394,7 +387,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_dse (m_ctxt); }
-  bool gate () { return gate_dse (); }
+  virtual bool gate (function *) { return flag_tree_dse != 0; }
   unsigned int execute () { return tree_ssa_dse (); }
 
 }; // class pass_dse
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 66ae113..8d5ca5f 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -3831,13 +3831,6 @@ ssa_forward_propagate_and_combine (void)
   return todoflags;
 }
 
-
-static bool
-gate_forwprop (void)
-{
-  return flag_tree_forwprop;
-}
-
 namespace {
 
 const pass_data pass_data_forwprop =
@@ -3863,7 +3856,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_forwprop (m_ctxt); }
-  bool gate () { return gate_forwprop (); }
+  virtual bool gate (function *) { return flag_tree_forwprop; }
   unsigned int execute () { return ssa_forward_propagate_and_combine (); }
 
 }; // class pass_forwprop
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index ef0c0c4..b901f37 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -756,12 +756,6 @@ tree_ssa_ifcombine (void)
   return cfg_changed ? TODO_cleanup_cfg : 0;
 }
 
-static bool
-gate_ifcombine (void)
-{
-  return 1;
-}
-
 namespace {
 
 const pass_data pass_data_tree_ifcombine =
@@ -786,7 +780,6 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_ifcombine (); }
   unsigned int execute () { return tree_ssa_ifcombine (); }
 
 }; // class pass_tree_ifcombine
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index 99cc39c..34d1f70 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -257,12 +257,6 @@ copy_loop_headers (void)
   return 0;
 }
 
-static bool
-gate_ch (void)
-{
-  return flag_tree_ch != 0;
-}
-
 namespace {
 
 const pass_data pass_data_ch =
@@ -288,7 +282,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_ch (); }
+  virtual bool gate (function *) { return flag_tree_ch != 0; }
   unsigned int execute () { return copy_loop_headers (); }
 
 }; // class pass_ch
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index aab521e..f38ee95 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -2538,12 +2538,6 @@ tree_ssa_loop_im (void)
   return tree_ssa_lim ();
 }
 
-static bool
-gate_tree_ssa_loop_im (void)
-{
-  return flag_tree_loop_im != 0;
-}
-
 namespace {
 
 const pass_data pass_data_lim =
@@ -2569,7 +2563,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_lim (m_ctxt); }
-  bool gate () { return gate_tree_ssa_loop_im (); }
+  virtual bool gate (function *) { return flag_tree_loop_im != 0; }
   unsigned int execute () { return tree_ssa_loop_im (); }
 
 }; // class pass_lim
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 177666d..df82816 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -1265,12 +1265,6 @@ tree_ssa_loop_ivcanon (void)
   return canonicalize_induction_variables ();
 }
 
-static bool
-gate_tree_ssa_loop_ivcanon (void)
-{
-  return flag_tree_loop_ivcanon != 0;
-}
-
 namespace {
 
 const pass_data pass_data_iv_canon =
@@ -1295,7 +1289,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_ssa_loop_ivcanon (); }
+  virtual bool gate (function *) { return flag_tree_loop_ivcanon != 0; }
   unsigned int execute () { return tree_ssa_loop_ivcanon (); }
 
 }; // class pass_iv_canon
@@ -1321,12 +1315,6 @@ tree_complete_unroll (void)
 				       || optimize >= 3, true);
 }
 
-static bool
-gate_tree_complete_unroll (void)
-{
-  return true;
-}
-
 namespace {
 
 const pass_data pass_data_complete_unroll =
@@ -1351,7 +1339,6 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_complete_unroll (); }
   unsigned int execute () { return tree_complete_unroll (); }
 
 }; // class pass_complete_unroll
@@ -1385,12 +1372,6 @@ tree_complete_unroll_inner (void)
   return ret;
 }
 
-static bool
-gate_tree_complete_unroll_inner (void)
-{
-  return optimize >= 2;
-}
-
 namespace {
 
 const pass_data pass_data_complete_unrolli =
@@ -1415,7 +1396,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_complete_unroll_inner (); }
+  virtual bool gate (function *) { return optimize >= 2; }
   unsigned int execute () { return tree_complete_unroll_inner (); }
 
 }; // class pass_complete_unrolli
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index dd52703..17b13d1 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -2013,12 +2013,6 @@ tree_ssa_loop_prefetch (void)
   return tree_ssa_prefetch_arrays ();
 }
 
-static bool
-gate_tree_ssa_loop_prefetch (void)
-{
-  return flag_prefetch_loop_arrays > 0;
-}
-
 namespace {
 
 const pass_data pass_data_loop_prefetch =
@@ -2043,7 +2037,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_ssa_loop_prefetch (); }
+  virtual bool gate (function *) { return flag_prefetch_loop_arrays > 0; }
   unsigned int execute () { return tree_ssa_loop_prefetch (); }
 
 }; // class pass_loop_prefetch
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index e755b62..90bb205 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -411,12 +411,6 @@ tree_ssa_loop_unswitch (void)
   return tree_ssa_unswitch_loops ();
 }
 
-static bool
-gate_tree_ssa_loop_unswitch (void)
-{
-  return flag_unswitch_loops != 0;
-}
-
 namespace {
 
 const pass_data pass_data_tree_unswitch =
@@ -441,7 +435,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_ssa_loop_unswitch (); }
+  virtual bool gate (function *) { return flag_unswitch_loops != 0; }
   unsigned int execute () { return tree_ssa_loop_unswitch (); }
 
 }; // class pass_tree_unswitch
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 84e24a1..38e7b13 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -44,12 +44,6 @@ along with GCC; see the file COPYING3.  If not see
 
 /* The loop superpass.  */
 
-static bool
-gate_tree_loop (void)
-{
-  return flag_tree_loop_optimize != 0;
-}
-
 namespace {
 
 const pass_data pass_data_tree_loop =
@@ -74,7 +68,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_loop (); }
+  virtual bool gate (function *) { return flag_tree_loop_optimize != 0; }
 
 }; // class pass_tree_loop
 
@@ -152,12 +146,6 @@ tree_loop_vectorize (void)
   return vectorize_loops ();
 }
 
-static bool
-gate_tree_loop_vectorize (void)
-{
-  return flag_tree_loop_vectorize || cfun->has_force_vectorize_loops;
-}
-
 namespace {
 
 const pass_data pass_data_vectorize =
@@ -182,7 +170,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_loop_vectorize (); }
+  virtual bool gate (function *fun)
+    {
+      return flag_tree_loop_vectorize || fun->has_force_vectorize_loops;
+    }
+
   unsigned int execute () { return tree_loop_vectorize (); }
 
 }; // class pass_vectorize
@@ -207,12 +199,6 @@ check_data_deps (void)
   return 0;
 }
 
-static bool
-gate_check_data_deps (void)
-{
-  return flag_check_data_deps != 0;
-}
-
 namespace {
 
 const pass_data pass_data_check_data_deps =
@@ -237,7 +223,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_check_data_deps (); }
+  virtual bool gate (function *) { return flag_check_data_deps != 0; }
   unsigned int execute () { return check_data_deps (); }
 
 }; // class pass_check_data_deps
@@ -252,12 +238,6 @@ make_pass_check_data_deps (gcc::context *ctxt)
 
 /* Propagation of constants using scev.  */
 
-static bool
-gate_scev_const_prop (void)
-{
-  return flag_tree_scev_cprop;
-}
-
 namespace {
 
 const pass_data pass_data_scev_cprop =
@@ -283,7 +263,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_scev_const_prop (); }
+  virtual bool gate (function *) { return flag_tree_scev_cprop; }
   unsigned int execute () { return scev_const_prop (); }
 
 }; // class pass_scev_cprop
@@ -357,12 +337,6 @@ tree_ssa_loop_ivopts (void)
   return 0;
 }
 
-static bool
-gate_tree_ssa_loop_ivopts (void)
-{
-  return flag_ivopts != 0;
-}
-
 namespace {
 
 const pass_data pass_data_iv_optimize =
@@ -387,7 +361,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_ssa_loop_ivopts (); }
+  virtual bool gate (function *) { return flag_ivopts != 0; }
   unsigned int execute () { return tree_ssa_loop_ivopts (); }
 
 }; // class pass_iv_optimize
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index f63c75d..fef1b1e 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -504,12 +504,6 @@ execute_cse_reciprocals_1 (gimple_stmt_iterator *def_gsi, tree def)
   occ_head = NULL;
 }
 
-static bool
-gate_cse_reciprocals (void)
-{
-  return optimize && flag_reciprocal_math;
-}
-
 /* Go through all the floating-point SSA_NAMEs, and call
    execute_cse_reciprocals_1 on each of them.  */
 static unsigned int
@@ -678,7 +672,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_cse_reciprocals (); }
+  virtual bool gate (function *) { return optimize && flag_reciprocal_math; }
   unsigned int execute () { return execute_cse_reciprocals (); }
 
 }; // class pass_cse_reciprocals
@@ -1562,14 +1556,6 @@ execute_cse_sincos (void)
   return cfg_changed ? TODO_cleanup_cfg : 0;
 }
 
-static bool
-gate_cse_sincos (void)
-{
-  /* We no longer require either sincos or cexp, since powi expansion
-     piggybacks on this pass.  */
-  return optimize;
-}
-
 namespace {
 
 const pass_data pass_data_cse_sincos =
@@ -1595,7 +1581,13 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_cse_sincos (); }
+  virtual bool gate (function *)
+    {
+      /* We no longer require either sincos or cexp, since powi expansion
+	 piggybacks on this pass.  */
+      return optimize;
+    }
+
   unsigned int execute () { return execute_cse_sincos (); }
 
 }; // class pass_cse_sincos
@@ -2065,12 +2057,6 @@ execute_optimize_bswap (void)
 	  | TODO_verify_stmts : 0);
 }
 
-static bool
-gate_optimize_bswap (void)
-{
-  return flag_expensive_optimizations && optimize;
-}
-
 namespace {
 
 const pass_data pass_data_optimize_bswap =
@@ -2095,7 +2081,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_optimize_bswap (); }
+  virtual bool gate (function *)
+    {
+      return flag_expensive_optimizations && optimize;
+    }
+
   unsigned int execute () { return execute_optimize_bswap (); }
 
 }; // class pass_optimize_bswap
@@ -2874,12 +2864,6 @@ execute_optimize_widening_mul (void)
   return cfg_changed ? TODO_cleanup_cfg : 0;
 }
 
-static bool
-gate_optimize_widening_mul (void)
-{
-  return flag_expensive_optimizations && optimize;
-}
-
 namespace {
 
 const pass_data pass_data_optimize_widening_mul =
@@ -2905,7 +2889,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_optimize_widening_mul (); }
+  virtual bool gate (function *)
+    {
+      return flag_expensive_optimizations && optimize;
+    }
+
   unsigned int execute () { return execute_optimize_widening_mul (); }
 
 }; // class pass_optimize_widening_mul
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 3892317..1ee39a5 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -2202,11 +2202,6 @@ gate_hoist_loads (void)
 
 /* Always do these optimizations if we have SSA
    trees to work on.  */
-static bool
-gate_phiopt (void)
-{
-  return 1;
-}
 
 namespace {
 
@@ -2234,7 +2229,6 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_phiopt (m_ctxt); }
-  bool gate () { return gate_phiopt (); }
   unsigned int execute () { return tree_ssa_phiopt (); }
 
 }; // class pass_phiopt
@@ -2247,12 +2241,6 @@ make_pass_phiopt (gcc::context *ctxt)
   return new pass_phiopt (ctxt);
 }
 
-static bool
-gate_cselim (void)
-{
-  return flag_tree_cselim;
-}
-
 namespace {
 
 const pass_data pass_data_cselim =
@@ -2278,7 +2266,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_cselim (); }
+  virtual bool gate (function *) { return flag_tree_cselim; }
   unsigned int execute () { return tree_ssa_cs_elim (); }
 
 }; // class pass_cselim
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index d67f488..cbdbc6e 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -409,12 +409,6 @@ tree_ssa_phiprop (void)
   return 0;
 }
 
-static bool
-gate_phiprop (void)
-{
-  return flag_tree_phiprop;
-}
-
 namespace {
 
 const pass_data pass_data_phiprop =
@@ -439,7 +433,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_phiprop (); }
+  virtual bool gate (function *) { return flag_tree_phiprop; }
   unsigned int execute () { return tree_ssa_phiprop (); }
 
 }; // class pass_phiprop
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 1329fe2..cda315a 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4771,12 +4771,6 @@ do_pre (void)
   return todo;
 }
 
-static bool
-gate_pre (void)
-{
-  return flag_tree_pre != 0;
-}
-
 namespace {
 
 const pass_data pass_data_pre =
@@ -4803,7 +4797,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_pre (); }
+  virtual bool gate (function *) { return flag_tree_pre != 0; }
   unsigned int execute () { return do_pre (); }
 
 }; // class pass_pre
@@ -4842,12 +4836,6 @@ execute_fre (void)
   return todo;
 }
 
-static bool
-gate_fre (void)
-{
-  return flag_tree_fre != 0;
-}
-
 namespace {
 
 const pass_data pass_data_fre =
@@ -4873,7 +4861,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_fre (m_ctxt); }
-  bool gate () { return gate_fre (); }
+  virtual bool gate (function *) { return flag_tree_fre != 0; }
   unsigned int execute () { return execute_fre (); }
 
 }; // class pass_fre
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 0b37b7b..92a215a 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -4665,12 +4665,6 @@ execute_reassoc (void)
   return 0;
 }
 
-static bool
-gate_tree_ssa_reassoc (void)
-{
-  return flag_tree_reassoc != 0;
-}
-
 namespace {
 
 const pass_data pass_data_reassoc =
@@ -4698,7 +4692,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_reassoc (m_ctxt); }
-  bool gate () { return gate_tree_ssa_reassoc (); }
+  virtual bool gate (function *) { return flag_tree_reassoc != 0; }
   unsigned int execute () { return execute_reassoc (); }
 
 }; // class pass_reassoc
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index 4a7410d..6803160 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -588,12 +588,6 @@ do_sink (void)
   return 0;
 }
 
-static bool
-gate_sink (void)
-{
-  return flag_tree_sink != 0;
-}
-
 namespace {
 
 const pass_data pass_data_sink_code =
@@ -621,7 +615,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_sink (); }
+  virtual bool gate (function *) { return flag_tree_sink != 0; }
   unsigned int execute () { return do_sink (); }
 
 }; // class pass_sink_code
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index aa6b6b9..fb83093 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -2089,12 +2089,6 @@ tree_ssa_strlen (void)
   return 0;
 }
 
-static bool
-gate_strlen (void)
-{
-  return flag_optimize_strlen != 0;
-}
-
 namespace {
 
 const pass_data pass_data_strlen =
@@ -2119,7 +2113,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_strlen (); }
+  virtual bool gate (function *) { return flag_optimize_strlen != 0; }
   unsigned int execute () { return tree_ssa_strlen (); }
 
 }; // class pass_strlen
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 9e1cdbc..3548ac5 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -6989,12 +6989,6 @@ compute_may_aliases (void)
   return 0;
 }
 
-static bool
-gate_tree_pta (void)
-{
-  return flag_tree_pta;
-}
-
 /* A dummy pass to cause points-to information to be computed via
    TODO_rebuild_alias.  */
 
@@ -7022,7 +7016,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_pta (); }
+  virtual bool gate (function *) { return flag_tree_pta; }
 
 }; // class pass_build_alias
 
@@ -7061,7 +7055,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_pta (); }
+  virtual bool gate (function *) { return flag_tree_pta; }
 
 }; // class pass_build_ealias
 
@@ -7074,16 +7068,6 @@ make_pass_build_ealias (gcc::context *ctxt)
 }
 
 
-/* Return true if we should execute IPA PTA.  */
-static bool
-gate_ipa_pta (void)
-{
-  return (optimize
-	  && flag_ipa_pta
-	  /* Don't bother doing anything if the program has errors.  */
-	  && !seen_error ());
-}
-
 /* IPA PTA solutions for ESCAPED.  */
 struct pt_solution ipa_escaped_pt
   = { true, false, false, false, false, false, false, false, NULL };
@@ -7452,7 +7436,14 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_ipa_pta (); }
+  virtual bool gate (function *)
+    {
+      return (optimize
+	      && flag_ipa_pta
+	      /* Don't bother doing anything if the program has errors.  */
+	      && !seen_error ());
+    }
+
   unsigned int execute () { return ipa_pta_execute (); }
 
 }; // class pass_ipa_pta
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index 41f4bd8..e39ce88 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -581,12 +581,6 @@ uncprop_dom_walker::before_dom_children (basic_block bb)
   uncprop_into_successor_phis (bb);
 }
 
-static bool
-gate_uncprop (void)
-{
-  return flag_tree_dom != 0;
-}
-
 namespace {
 
 const pass_data pass_data_uncprop =
@@ -612,7 +606,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_uncprop (m_ctxt); }
-  bool gate () { return gate_uncprop (); }
+  virtual bool gate (function *) { return flag_tree_dom != 0; }
   unsigned int execute () { return tree_ssa_uncprop (); }
 
 }; // class pass_uncprop
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 86d84a1..03ff3b8 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -2383,7 +2383,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
-  bool gate () { return gate_warn_uninitialized (); }
+  virtual bool gate (function *) { return gate_warn_uninitialized (); }
   unsigned int execute () { return execute_late_warn_uninitialized (); }
 
 }; // class pass_late_warn_uninitialized
@@ -2441,7 +2441,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_warn_uninitialized (); }
+  virtual bool gate (function *) { return gate_warn_uninitialized (); }
   unsigned int execute () { return execute_early_warn_uninitialized (); }
 
 }; // class pass_early_warn_uninitialized
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index ecc8da3..52126ca 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1139,15 +1139,6 @@ execute_init_datastructures (void)
   return 0;
 }
 
-/* Gate for IPCP optimization.  */
-
-static bool
-gate_init_datastructures (void)
-{
-  /* Do nothing for funcions that was produced already in SSA form.  */
-  return !(cfun->curr_properties & PROP_ssa);
-}
-
 namespace {
 
 const pass_data pass_data_init_datastructures =
@@ -1172,7 +1163,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_init_datastructures (); }
+  virtual bool gate (function *fun)
+    {
+      /* Do nothing for funcions that was produced already in SSA form.  */
+      return !(fun->curr_properties & PROP_ssa);
+    }
+
   unsigned int execute () { return execute_init_datastructures (); }
 
 }; // class pass_init_datastructures
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 7da36c4..710711b 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -663,18 +663,6 @@ check_all_va_list_escapes (struct stdarg_info *si)
   return false;
 }
 
-
-/* Return true if this optimization pass should be done.
-   It makes only sense for stdarg functions.  */
-
-static bool
-gate_optimize_stdarg (void)
-{
-  /* This optimization is only for stdarg functions.  */
-  return cfun->stdarg != 0;
-}
-
-
 /* Entry point to the stdarg optimization pass.  */
 
 static unsigned int
@@ -1023,7 +1011,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_optimize_stdarg (); }
+  virtual bool gate (function *fun)
+    {
+      /* This optimization is only for stdarg functions.  */
+      return fun->stdarg != 0;
+    }
+
   unsigned int execute () { return execute_optimize_stdarg (); }
 
 }; // class pass_stdarg
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index cf2e763..a0f9d19 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1465,14 +1465,6 @@ do_switchconv (void)
   return 0;
 }
 
-/* The pass gate. */
-
-static bool
-switchconv_gate (void)
-{
-  return flag_tree_switch_conversion != 0;
-}
-
 namespace {
 
 const pass_data pass_data_convert_switch =
@@ -1499,7 +1491,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return switchconv_gate (); }
+  virtual bool gate (function *) { return flag_tree_switch_conversion != 0; }
   unsigned int execute () { return do_switchconv (); }
 
 }; // class pass_convert_switch
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index b3a6256..84cdbde 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -1108,7 +1108,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_tail_recursion (m_ctxt); }
-  bool gate () { return gate_tail_calls (); }
+  virtual bool gate (function *) { return gate_tail_calls (); }
   unsigned int execute () { return execute_tail_recursion (); }
 
 }; // class pass_tail_recursion
@@ -1145,7 +1145,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tail_calls (); }
+  virtual bool gate (function *) { return gate_tail_calls (); }
   unsigned int execute () { return execute_tail_calls (); }
 
 }; // class pass_tail_calls
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index 035c143..4274417 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -1528,12 +1528,6 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
 /* Use this to lower vector operations introduced by the vectorizer,
    if it may need the bit-twiddling tricks implemented in this file.  */
 
-static bool
-gate_expand_vector_operations_ssa (void)
-{
-  return !(cfun->curr_properties & PROP_gimple_lvec);
-}
-
 static unsigned int
 expand_vector_operations (void)
 {
@@ -1586,7 +1580,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_expand_vector_operations_ssa (); }
+  virtual bool gate (function *fun)
+    {
+      return !(fun->curr_properties & PROP_gimple_lvec);
+    }
+
   unsigned int execute () { return expand_vector_operations (); }
 
 }; // class pass_lower_vector
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 17be3aa..7b5691a 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -613,12 +613,6 @@ execute_vect_slp (void)
   return 0;
 }
 
-static bool
-gate_vect_slp (void)
-{
-  return flag_tree_slp_vectorize != 0;
-}
-
 namespace {
 
 const pass_data pass_data_slp_vectorize =
@@ -644,7 +638,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_vect_slp (); }
+  virtual bool gate (function *) { return flag_tree_slp_vectorize != 0; }
   unsigned int execute () { return execute_vect_slp (); }
 
 }; // class pass_slp_vectorize
@@ -702,13 +696,6 @@ increase_alignment (void)
 }
 
 
-static bool
-gate_increase_alignment (void)
-{
-  return flag_section_anchors && flag_tree_loop_vectorize;
-}
-
-
 namespace {
 
 const pass_data pass_data_ipa_increase_alignment =
@@ -733,7 +720,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_increase_alignment (); }
+  virtual bool gate (function *)
+    {
+      return flag_section_anchors && flag_tree_loop_vectorize;
+    }
+
   unsigned int execute () { return increase_alignment (); }
 
 }; // class pass_ipa_increase_alignment
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 4ccb90b..80f3888 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -9894,12 +9894,6 @@ execute_vrp (void)
   return 0;
 }
 
-static bool
-gate_vrp (void)
-{
-  return flag_tree_vrp != 0;
-}
-
 namespace {
 
 const pass_data pass_data_vrp =
@@ -9927,7 +9921,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_vrp (m_ctxt); }
-  bool gate () { return gate_vrp (); }
+  virtual bool gate (function *) { return flag_tree_vrp != 0; }
   unsigned int execute () { return execute_vrp (); }
 
 }; // class pass_vrp
diff --git a/gcc/tsan.c b/gcc/tsan.c
index f30cf57..b413bb5 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -715,14 +715,6 @@ tsan_pass (void)
   return 0;
 }
 
-/* The pass's gate.  */
-
-static bool
-tsan_gate (void)
-{
-  return (flag_sanitize & SANITIZE_THREAD) != 0;
-}
-
 /* Inserts __tsan_init () into the list of CTORs.  */
 
 void
@@ -765,7 +757,11 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_tsan (m_ctxt); }
-  bool gate () { return tsan_gate (); }
+  virtual bool gate (function *)
+{
+  return (flag_sanitize & SANITIZE_THREAD) != 0;
+}
+
   unsigned int execute () { return tsan_pass (); }
 
 }; // class pass_tsan
@@ -778,12 +774,6 @@ make_pass_tsan (gcc::context *ctxt)
   return new pass_tsan (ctxt);
 }
 
-static bool
-tsan_gate_O0 (void)
-{
-  return (flag_sanitize & SANITIZE_THREAD) != 0 && !optimize;
-}
-
 namespace {
 
 const pass_data pass_data_tsan_O0 =
@@ -808,7 +798,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return tsan_gate_O0 (); }
+  virtual bool gate (function *)
+    {
+      return (flag_sanitize & SANITIZE_THREAD) != 0 && !optimize;
+    }
+
   unsigned int execute () { return tsan_pass (); }
 
 }; // class pass_tsan_O0
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index c205e6b..8e7dda5 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -902,13 +902,6 @@ ubsan_pass (void)
   return 0;
 }
 
-static bool
-gate_ubsan (void)
-{
-  return flag_sanitize & (SANITIZE_NULL | SANITIZE_SI_OVERFLOW
-			  | SANITIZE_BOOL | SANITIZE_ENUM);
-}
-
 namespace {
 
 const pass_data pass_data_ubsan =
@@ -933,7 +926,12 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_ubsan (); }
+  virtual bool gate (function *)
+    {
+      return flag_sanitize & (SANITIZE_NULL | SANITIZE_SI_OVERFLOW
+			      | SANITIZE_BOOL | SANITIZE_ENUM);
+    }
+
   unsigned int execute () { return ubsan_pass (); }
 
 }; // class pass_ubsan
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index e6ca3af..4586afc 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -10344,14 +10344,6 @@ variable_tracking_main (void)
   return ret;
 }
 \f
-static bool
-gate_handle_var_tracking (void)
-{
-  return (flag_var_tracking && !targetm.delay_vartrack);
-}
-
-
-
 namespace {
 
 const pass_data pass_data_variable_tracking =
@@ -10376,7 +10368,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_var_tracking (); }
+  virtual bool gate (function *)
+    {
+      return (flag_var_tracking && !targetm.delay_vartrack);
+    }
+
   unsigned int execute () { return variable_tracking_main (); }
 
 }; // class pass_variable_tracking
diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
index 99caa88..601b2ce 100644
--- a/gcc/vtable-verify.c
+++ b/gcc/vtable-verify.c
@@ -740,14 +740,6 @@ vtable_verify_main (void)
   return ret;
 }
 
-/* Gate function for the pass.  */
-
-static bool
-gate_tree_vtable_verify (void)
-{
-  return (flag_vtable_verify);
-}
-
 /* Definition of this optimization pass.  */
 
 namespace {
@@ -774,7 +766,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_tree_vtable_verify (); }
+  virtual bool gate (function *) { return (flag_vtable_verify); }
   unsigned int execute () { return vtable_verify_main (); }
 
 }; // class pass_vtable_verify
diff --git a/gcc/web.c b/gcc/web.c
index ba4172e..50fc9e6 100644
--- a/gcc/web.c
+++ b/gcc/web.c
@@ -325,12 +325,6 @@ replace_ref (df_ref ref, rtx reg)
 }
 
 \f
-static bool
-gate_handle_web (void)
-{
-  return (optimize > 0 && flag_web);
-}
-
 /* Main entry point.  */
 
 static unsigned int
@@ -473,7 +467,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  bool gate () { return gate_handle_web (); }
+  virtual bool gate (function *) { return (optimize > 0 && flag_web); }
   unsigned int execute () { return web_main (); }
 
 }; // class pass_web
-- 
1.9.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/6] remove properties stuff from register_dump_files_1
@ 2014-04-17  8:38 tsaunders
  2014-04-17  8:38 ` [PATCH 3/6] remove has_gate tsaunders
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: tsaunders @ 2014-04-17  8:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tsaunders@mozilla.com>

Hi,

just removing some dead code.

bootstrapped + regtested against r209414 on x86_64-unknown-linux-gnu, ok?

Trev

2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>

	* pass_manager.h (pass_manager::register_dump_files_1): Adjust.
	* passes.c (pass_manager::register_dump_files_1): Remove dead code
	dealing with properties.
	(pass_manager::register_dump_files): Adjust.

diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
index e1d8143..8309567 100644
--- a/gcc/pass_manager.h
+++ b/gcc/pass_manager.h
@@ -91,7 +91,7 @@ public:
 
 private:
   void set_pass_for_id (int id, opt_pass *pass);
-  int register_dump_files_1 (opt_pass *pass, int properties);
+  void register_dump_files_1 (opt_pass *pass);
   void register_dump_files (opt_pass *pass, int properties);
 
 private:
diff --git a/gcc/passes.c b/gcc/passes.c
index 60fb135..3f9590a 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -708,33 +708,21 @@ pass_manager::register_one_dump_file (opt_pass *pass)
 
 /* Recursive worker function for register_dump_files.  */
 
-int
+void
 pass_manager::
-register_dump_files_1 (opt_pass *pass, int properties)
+register_dump_files_1 (opt_pass *pass)
 {
   do
     {
-      int new_properties = (properties | pass->properties_provided)
-			   & ~pass->properties_destroyed;
-
       if (pass->name && pass->name[0] != '*')
         register_one_dump_file (pass);
 
       if (pass->sub)
-        new_properties = register_dump_files_1 (pass->sub, new_properties);
-
-      /* If we have a gate, combine the properties that we could have with
-         and without the pass being examined.  */
-      if (pass->has_gate)
-        properties &= new_properties;
-      else
-        properties = new_properties;
+        register_dump_files_1 (pass->sub);
 
       pass = pass->next;
     }
   while (pass);
-
-  return properties;
 }
 
 /* Register the dump files for the pass_manager starting at PASS.
@@ -746,7 +734,7 @@ pass_manager::
 register_dump_files (opt_pass *pass,int properties)
 {
   pass->properties_required |= properties;
-  register_dump_files_1 (pass, properties);
+  register_dump_files_1 (pass);
 }
 
 struct pass_registry
-- 
1.9.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 2/6] merge register_dump_files_1 into register_dump_files
  2014-04-17  8:38 [PATCH 1/6] remove properties stuff from register_dump_files_1 tsaunders
                   ` (2 preceding siblings ...)
  2014-04-17  8:38 ` [PATCH 5/6] pass current function to opt_pass::gate () tsaunders
@ 2014-04-17  8:38 ` tsaunders
  2014-04-17  8:54   ` Richard Biener
  2014-04-17  8:53 ` [PATCH 1/6] remove properties stuff from register_dump_files_1 Richard Biener
  2014-04-17  8:53 ` [PATCH 6/6] pass cfun to pass::execute tsaunders
  5 siblings, 1 reply; 13+ messages in thread
From: tsaunders @ 2014-04-17  8:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tsaunders@mozilla.com>

Hi,

simplification allowed by previous patch.

bootstrap + regtest passed on x86_64-unknown-linux-gnu, ok?

Trev

2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>

	* pass_manager.h (pass_manager::register_dump_files_1): Remove declaration.
	* passes.c (pass_manager::register_dump_files_1): Merge into
	(pass_manager::register_dump_files): this, and remove its handling of
	properties since the pass always has the properties anyway.
	(pass_manager::pass_manager): Adjust.


diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
index 8309567..9f4d67b 100644
--- a/gcc/pass_manager.h
+++ b/gcc/pass_manager.h
@@ -91,8 +91,7 @@ public:
 
 private:
   void set_pass_for_id (int id, opt_pass *pass);
-  void register_dump_files_1 (opt_pass *pass);
-  void register_dump_files (opt_pass *pass, int properties);
+  void register_dump_files (opt_pass *pass);
 
 private:
   context *m_ctxt;
diff --git a/gcc/passes.c b/gcc/passes.c
index 3f9590a..7508771 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -706,11 +706,10 @@ pass_manager::register_one_dump_file (opt_pass *pass)
   free (CONST_CAST (char *, full_name));
 }
 
-/* Recursive worker function for register_dump_files.  */
+/* Register the dump files for the pass_manager starting at PASS. */
 
 void
-pass_manager::
-register_dump_files_1 (opt_pass *pass)
+pass_manager::register_dump_files (opt_pass *pass)
 {
   do
     {
@@ -718,25 +717,13 @@ register_dump_files_1 (opt_pass *pass)
         register_one_dump_file (pass);
 
       if (pass->sub)
-        register_dump_files_1 (pass->sub);
+        register_dump_files (pass->sub);
 
       pass = pass->next;
     }
   while (pass);
 }
 
-/* Register the dump files for the pass_manager starting at PASS.
-   PROPERTIES reflects the properties that are guaranteed to be available at
-   the beginning of the pipeline.  */
-
-void
-pass_manager::
-register_dump_files (opt_pass *pass,int properties)
-{
-  pass->properties_required |= properties;
-  register_dump_files_1 (pass);
-}
-
 struct pass_registry
 {
   const char* unique_name;
@@ -1536,19 +1523,11 @@ pass_manager::pass_manager (context *ctxt)
 #undef TERMINATE_PASS_LIST
 
   /* Register the passes with the tree dump code.  */
-  register_dump_files (all_lowering_passes, PROP_gimple_any);
-  register_dump_files (all_small_ipa_passes,
-		       PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
-		       | PROP_cfg);
-  register_dump_files (all_regular_ipa_passes,
-		       PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
-		       | PROP_cfg);
-  register_dump_files (all_late_ipa_passes,
-		       PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
-		       | PROP_cfg);
-  register_dump_files (all_passes,
-		       PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
-		       | PROP_cfg);
+  register_dump_files (all_lowering_passes);
+  register_dump_files (all_small_ipa_passes);
+  register_dump_files (all_regular_ipa_passes);
+  register_dump_files (all_late_ipa_passes);
+  register_dump_files (all_passes);
 }
 
 /* If we are in IPA mode (i.e., current_function_decl is NULL), call
-- 
1.9.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 4/6] enable -Woverloaded-virtual when available
  2014-04-17  8:38 [PATCH 1/6] remove properties stuff from register_dump_files_1 tsaunders
  2014-04-17  8:38 ` [PATCH 3/6] remove has_gate tsaunders
@ 2014-04-17  8:38 ` tsaunders
  2014-04-17  9:00   ` Richard Biener
  2014-04-17  8:38 ` [PATCH 5/6] pass current function to opt_pass::gate () tsaunders
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: tsaunders @ 2014-04-17  8:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde@mozilla.com>

hi,

its a useful warning, and helps catch bugs in the next two patches.

bootstrap + regtest passed on x86_64-unknown-linux-gnu, ok?

Trev

2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>

	* configure.ac: Check for -Woverloaded-virtual and enable it if found.
	* configure: Regenerate.


diff --git a/gcc/configure b/gcc/configure
index 415377a..1a48ca3 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -6427,6 +6427,50 @@ fi
   done
 CFLAGS="$save_CFLAGS"
 
+save_CFLAGS="$CFLAGS"
+for real_option in -Woverloaded-virtual; do
+  # Do the check with the no- prefix removed since gcc silently
+  # accepts any -Wno-* option on purpose
+  case $real_option in
+    -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
+    *) option=$real_option ;;
+  esac
+  as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5
+$as_echo_n "checking whether $CC supports $option... " >&6; }
+if { as_var=$as_acx_Woption; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  CFLAGS="$option"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_acx_Woption=yes"
+else
+  eval "$as_acx_Woption=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+eval ac_res=\$$as_acx_Woption
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then :
+  strict_warn="$strict_warn${strict_warn:+ }$real_option"
+fi
+  done
+CFLAGS="$save_CFLAGS"
+
 c_strict_warn=
 save_CFLAGS="$CFLAGS"
 for real_option in -Wold-style-definition -Wc++-compat; do
@@ -17927,7 +17971,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17930 "configure"
+#line 17974 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18033,7 +18077,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18036 "configure"
+#line 18080 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 0336066..b2726e5 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -340,6 +340,8 @@ ACX_PROG_CC_WARNING_OPTS(
 ACX_PROG_CC_WARNING_OPTS(
 	m4_quote(m4_do([-Wmissing-format-attribute])), [strict_warn])
 ACX_PROG_CC_WARNING_OPTS(
+	m4_quote(m4_do([-Woverloaded-virtual])), [strict_warn])
+ACX_PROG_CC_WARNING_OPTS(
 	m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])
 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(
 	m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ], 
-- 
1.9.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 6/6] pass cfun to pass::execute
  2014-04-17  8:38 [PATCH 1/6] remove properties stuff from register_dump_files_1 tsaunders
                   ` (4 preceding siblings ...)
  2014-04-17  8:53 ` [PATCH 1/6] remove properties stuff from register_dump_files_1 Richard Biener
@ 2014-04-17  8:53 ` tsaunders
  2014-04-17  9:01   ` Richard Biener
  5 siblings, 1 reply; 13+ messages in thread
From: tsaunders @ 2014-04-17  8:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tsaunders@mozilla.com>

Hi,

same as the previous patch.

bootstrap + regtest passed on x86_64-unknown-linux-gnu, ok?

Trev

2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>

	* 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.

diff --git a/gcc/asan.c b/gcc/asan.c
index 3fe50ef..9f29807 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2505,7 +2505,7 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_asan (m_ctxt); }
   virtual bool gate (function *) { return gate_asan (); }
-  unsigned int execute () { return asan_instrument (); }
+  virtual unsigned int execute (function *) { return asan_instrument (); }
 
 }; // class pass_asan
 
@@ -2543,7 +2543,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return !optimize && gate_asan (); }
-  unsigned int execute () { return asan_instrument (); }
+  virtual unsigned int execute (function *) { return asan_instrument (); }
 
 }; // class pass_asan_O0
 
@@ -2557,12 +2557,42 @@ make_pass_asan_O0 (gcc::context *ctxt)
 
 /* Perform optimization of sanitize functions.  */
 
-static unsigned int
-execute_sanopt (void)
+namespace {
+
+const pass_data pass_data_sanopt =
+{
+  GIMPLE_PASS, /* type */
+  "sanopt", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_verify_flow | TODO_verify_stmts
+    | TODO_update_ssa ), /* todo_flags_finish */
+};
+
+class pass_sanopt : public gimple_opt_pass
+{
+public:
+  pass_sanopt (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_sanopt, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *) { return flag_sanitize; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_sanopt
+
+unsigned int
+pass_sanopt::execute (function *fun)
 {
   basic_block bb;
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple_stmt_iterator gsi;
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -2593,36 +2623,6 @@ execute_sanopt (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_sanopt =
-{
-  GIMPLE_PASS, /* type */
-  "sanopt", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_verify_flow | TODO_verify_stmts
-    | TODO_update_ssa ), /* todo_flags_finish */
-};
-
-class pass_sanopt : public gimple_opt_pass
-{
-public:
-  pass_sanopt (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_sanopt, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *) { return flag_sanitize; }
-  unsigned int execute () { return execute_sanopt (); }
-
-}; // class pass_sanopt
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index e1485a3..0314d18 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -1462,37 +1462,6 @@ 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.  */
 
 namespace {
@@ -1529,10 +1498,40 @@ public:
     }
 
 
-  unsigned int execute () { return rest_of_handle_auto_inc_dec (); }
+  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 *
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 57103bd..db490f1 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2302,26 +2302,6 @@ insert_section_boundary_note (void)
     }
 }
 
-static unsigned int
-rest_of_handle_reorder_blocks (void)
-{
-  basic_block bb;
-
-  /* Last attempt to optimize CFG, as scheduling, peepholing and insn
-     splitting possibly introduced more crossjumping opportunities.  */
-  cfg_layout_initialize (CLEANUP_EXPENSIVE);
-
-  reorder_basic_blocks ();
-  cleanup_cfg (CLEANUP_EXPENSIVE);
-
-  FOR_EACH_BB_FN (bb, cfun)
-    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
-      bb->aux = bb->next_bb;
-  cfg_layout_finalize ();
-
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_reorder_blocks =
@@ -2354,10 +2334,30 @@ public:
 	      && (flag_reorder_blocks || flag_reorder_blocks_and_partition));
     }
 
-  unsigned int execute () { return rest_of_handle_reorder_blocks (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_reorder_blocks
 
+unsigned int
+pass_reorder_blocks::execute (function *fun)
+{
+  basic_block bb;
+
+  /* Last attempt to optimize CFG, as scheduling, peepholing and insn
+     splitting possibly introduced more crossjumping opportunities.  */
+  cfg_layout_initialize (CLEANUP_EXPENSIVE);
+
+  reorder_basic_blocks ();
+  cleanup_cfg (CLEANUP_EXPENSIVE);
+
+  FOR_EACH_BB_FN (bb, fun)
+    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (fun))
+      bb->aux = bb->next_bb;
+  cfg_layout_finalize ();
+
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -2372,16 +2372,54 @@ make_pass_reorder_blocks (gcc::context *ctxt)
    which can seriously pessimize code with many computed jumps in the source
    code, such as interpreters.  See e.g. PR15242.  */
 
+namespace {
 
-static unsigned int
-duplicate_computed_gotos (void)
+const pass_data pass_data_duplicate_computed_gotos =
+{
+  RTL_PASS, /* type */
+  "compgotos", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_REORDER_BLOCKS, /* tv_id */
+  0, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_verify_rtl_sharing, /* todo_flags_finish */
+};
+
+class pass_duplicate_computed_gotos : public rtl_opt_pass
+{
+public:
+  pass_duplicate_computed_gotos (gcc::context *ctxt)
+    : rtl_opt_pass (pass_data_duplicate_computed_gotos, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *);
+  virtual unsigned int execute (function *);
+
+}; // class pass_duplicate_computed_gotos
+
+bool
+pass_duplicate_computed_gotos::gate (function *fun)
+{
+  if (targetm.cannot_modify_jumps_p ())
+    return false;
+  return (optimize > 0
+	  && flag_expensive_optimizations
+	  && ! optimize_function_for_size_p (fun));
+}
+
+unsigned int
+pass_duplicate_computed_gotos::execute (function *fun)
 {
   basic_block bb, new_bb;
   bitmap candidates;
   int max_size;
   bool changed = false;
 
-  if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1)
+  if (n_basic_blocks_for_fn (fun) <= NUM_FIXED_BLOCKS + 1)
     return 0;
 
   clear_bb_flags ();
@@ -2400,7 +2438,7 @@ duplicate_computed_gotos (void)
   /* Look for blocks that end in a computed jump, and see if such blocks
      are suitable for unfactoring.  If a block is a candidate for unfactoring,
      mark it in the candidates.  */
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       rtx insn;
       edge e;
@@ -2408,7 +2446,7 @@ duplicate_computed_gotos (void)
       int size, all_flags;
 
       /* Build the reorder chain for the original order of blocks.  */
-      if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
+      if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (fun))
 	bb->aux = bb->next_bb;
 
       /* Obviously the block has to end in a computed jump.  */
@@ -2447,7 +2485,7 @@ duplicate_computed_gotos (void)
     goto done;
 
   /* Duplicate computed gotos.  */
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       if (bb->flags & BB_VISITED)
 	continue;
@@ -2458,7 +2496,7 @@ duplicate_computed_gotos (void)
 	 the exit block or the next block.
 	 The destination must have more than one predecessor.  */
       if (!single_succ_p (bb)
-	  || single_succ (bb) == EXIT_BLOCK_PTR_FOR_FN (cfun)
+	  || single_succ (bb) == EXIT_BLOCK_PTR_FOR_FN (fun)
 	  || single_succ (bb) == bb->next_bb
 	  || single_pred_p (single_succ (bb)))
 	continue;
@@ -2491,45 +2529,6 @@ done:
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_duplicate_computed_gotos =
-{
-  RTL_PASS, /* type */
-  "compgotos", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_REORDER_BLOCKS, /* tv_id */
-  0, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_verify_rtl_sharing, /* todo_flags_finish */
-};
-
-class pass_duplicate_computed_gotos : public rtl_opt_pass
-{
-public:
-  pass_duplicate_computed_gotos (gcc::context *ctxt)
-    : rtl_opt_pass (pass_data_duplicate_computed_gotos, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *);
-  unsigned int execute () { return duplicate_computed_gotos (); }
-
-}; // class pass_duplicate_computed_gotos
-
-bool
-pass_duplicate_computed_gotos::gate (function *fun)
-{
-  if (targetm.cannot_modify_jumps_p ())
-    return false;
-  return (optimize > 0
-	  && flag_expensive_optimizations
-	  && ! optimize_function_for_size_p (fun));
-}
-
 } // anon namespace
 
 rtl_opt_pass *
@@ -2627,12 +2626,57 @@ make_pass_duplicate_computed_gotos (gcc::context *ctxt)
    Unconditional branches are dealt with by converting them into
    indirect jumps.  */
 
-static unsigned
-partition_hot_cold_basic_blocks (void)
+namespace {
+
+const pass_data pass_data_partition_blocks =
+{
+  RTL_PASS, /* type */
+  "bbpart", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_REORDER_BLOCKS, /* tv_id */
+  PROP_cfglayout, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_partition_blocks : public rtl_opt_pass
+{
+public:
+  pass_partition_blocks (gcc::context *ctxt)
+    : rtl_opt_pass (pass_data_partition_blocks, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *);
+  virtual unsigned int execute (function *);
+
+}; // class pass_partition_blocks
+
+bool
+pass_partition_blocks::gate (function *fun)
+{
+  /* The optimization to partition hot/cold basic blocks into separate
+     sections of the .o file does not work well with linkonce or with
+     user defined section attributes.  Don't call it if either case
+     arises.  */
+  return (flag_reorder_blocks_and_partition
+	  && optimize
+	  /* See gate_handle_reorder_blocks.  We should not partition if
+	     we are going to omit the reordering.  */
+	  && optimize_function_for_speed_p (fun)
+	  && !DECL_ONE_ONLY (current_function_decl)
+	  && !user_defined_section_attribute);
+}
+
+unsigned
+pass_partition_blocks::execute (function *fun)
 {
   vec<edge> crossing_edges;
 
-  if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1)
+  if (n_basic_blocks_for_fn (fun) <= NUM_FIXED_BLOCKS + 1)
     return 0;
 
   df_set_flags (DF_DEFER_INSN_RESCAN);
@@ -2693,7 +2737,7 @@ partition_hot_cold_basic_blocks (void)
 
      In the meantime, we have no other option but to throw away all
      of the DF data and recompute it all.  */
-  if (cfun->eh->lp_array)
+  if (fun->eh->lp_array)
     {
       df_finish_pass (true);
       df_scan_alloc (NULL);
@@ -2708,51 +2752,6 @@ partition_hot_cold_basic_blocks (void)
   return TODO_verify_flow | TODO_verify_rtl_sharing;
 }
 
-namespace {
-
-const pass_data pass_data_partition_blocks =
-{
-  RTL_PASS, /* type */
-  "bbpart", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_REORDER_BLOCKS, /* tv_id */
-  PROP_cfglayout, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_partition_blocks : public rtl_opt_pass
-{
-public:
-  pass_partition_blocks (gcc::context *ctxt)
-    : rtl_opt_pass (pass_data_partition_blocks, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *);
-  unsigned int execute () { return partition_hot_cold_basic_blocks (); }
-
-}; // class pass_partition_blocks
-
-bool
-pass_partition_blocks::gate (function *fun)
-{
-  /* The optimization to partition hot/cold basic blocks into separate
-     sections of the .o file does not work well with linkonce or with
-     user defined section attributes.  Don't call it if either case
-     arises.  */
-  return (flag_reorder_blocks_and_partition
-	  && optimize
-	  /* See gate_handle_reorder_blocks.  We should not partition if
-	     we are going to omit the reordering.  */
-	  && optimize_function_for_speed_p (fun)
-	  && !DECL_ONE_ONLY (current_function_decl)
-	  && !user_defined_section_attribute);
-}
-
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index fc2aea7..53c5f58 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -1494,14 +1494,6 @@ branch_target_load_optimize (bool after_prologue_epilogue_gen)
     }
 }
 \f
-
-static unsigned int
-rest_of_handle_branch_target_load_optimize1 (void)
-{
-  branch_target_load_optimize (epilogue_completed);
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_branch_target_load_optimize1 =
@@ -1527,9 +1519,11 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_branch_target_load_optimize; }
-  unsigned int execute () {
-    return rest_of_handle_branch_target_load_optimize1 ();
-  }
+  virtual unsigned int execute (function *)
+    {
+      branch_target_load_optimize (epilogue_completed);
+      return 0;
+    }
 
 }; // class pass_branch_target_load_optimize1
 
@@ -1542,28 +1536,6 @@ make_pass_branch_target_load_optimize1 (gcc::context *ctxt)
 }
 
 
-static unsigned int
-rest_of_handle_branch_target_load_optimize2 (void)
-{
-  static int warned = 0;
-
-  /* Leave this a warning for now so that it is possible to experiment
-     with running this pass twice.  In 3.6, we should either make this
-     an error, or use separate dump files.  */
-  if (flag_branch_target_load_optimize
-      && flag_branch_target_load_optimize2
-      && !warned)
-    {
-      warning (0, "branch target register load optimization is not intended "
-		  "to be run twice");
-
-      warned = 1;
-    }
-
-  branch_target_load_optimize (epilogue_completed);
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_branch_target_load_optimize2 =
@@ -1593,12 +1565,32 @@ public:
       return (optimize > 0 && flag_branch_target_load_optimize2);
     }
 
-  unsigned int execute () {
-    return rest_of_handle_branch_target_load_optimize2 ();
-  }
+  virtual unsigned int execute (function *);
 
 }; // class pass_branch_target_load_optimize2
 
+unsigned int
+pass_branch_target_load_optimize2::execute (function *)
+{
+  static int warned = 0;
+
+  /* Leave this a warning for now so that it is possible to experiment
+     with running this pass twice.  In 3.6, we should either make this
+     an error, or use separate dump files.  */
+  if (flag_branch_target_load_optimize
+      && flag_branch_target_load_optimize2
+      && !warned)
+    {
+      warning (0, "branch target register load optimization is not intended "
+	       "to be run twice");
+
+      warned = 1;
+    }
+
+  branch_target_load_optimize (epilogue_completed);
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index d5d68bf..d793a70 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -3078,17 +3078,6 @@ cleanup_cfg (int mode)
   return changed;
 }
 \f
-static unsigned int
-execute_jump (void)
-{
-  delete_trivially_dead_insns (get_insns (), max_reg_num ());
-  if (dump_file)
-    dump_flow_info (dump_file, dump_flags);
-  cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0)
-	       | (flag_thread_jumps ? CLEANUP_THREADING : 0));
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_jump =
@@ -3113,10 +3102,21 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return execute_jump (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_jump
 
+unsigned int
+pass_jump::execute (function *)
+{
+  delete_trivially_dead_insns (get_insns (), max_reg_num ());
+  if (dump_file)
+    dump_flow_info (dump_file, dump_flags);
+  cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0)
+	       | (flag_thread_jumps ? CLEANUP_THREADING : 0));
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -3125,13 +3125,6 @@ make_pass_jump (gcc::context *ctxt)
   return new pass_jump (ctxt);
 }
 \f
-static unsigned int
-execute_jump2 (void)
-{
-  cleanup_cfg (flag_crossjumping ? CLEANUP_CROSSJUMP : 0);
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_jump2 =
@@ -3156,7 +3149,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return execute_jump2 (); }
+  virtual unsigned int execute (function *)
+    {
+      cleanup_cfg (flag_crossjumping ? CLEANUP_CROSSJUMP : 0);
+      return 0;
+    }
 
 }; // class pass_jump2
 
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index c60703f..f2fd5fc 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -5530,8 +5530,39 @@ stack_protect_prologue (void)
    confuse the CFG hooks, so be careful to not manipulate CFG during
    the expansion.  */
 
-static unsigned int
-gimple_expand_cfg (void)
+namespace {
+
+const pass_data pass_data_expand =
+{
+  RTL_PASS, /* type */
+  "expand", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_EXPAND, /* tv_id */
+  ( PROP_ssa | PROP_gimple_leh | PROP_cfg
+    | PROP_gimple_lcx
+    | PROP_gimple_lvec ), /* properties_required */
+  PROP_rtl, /* properties_provided */
+  ( PROP_ssa | PROP_trees ), /* properties_destroyed */
+  ( TODO_verify_ssa | TODO_verify_flow
+    | TODO_verify_stmts ), /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_expand : public rtl_opt_pass
+{
+public:
+  pass_expand (gcc::context *ctxt)
+    : rtl_opt_pass (pass_data_expand, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual unsigned int execute (function *);
+
+}; // class pass_expand
+
+unsigned int
+pass_expand::execute (function *fun)
 {
   basic_block bb, init_block;
   sbitmap blocks;
@@ -5554,17 +5585,17 @@ gimple_expand_cfg (void)
   /* Dominators are not kept up-to-date as we may create new basic-blocks.  */
   free_dominance_info (CDI_DOMINATORS);
 
-  rtl_profile_for_bb (ENTRY_BLOCK_PTR_FOR_FN (cfun));
+  rtl_profile_for_bb (ENTRY_BLOCK_PTR_FOR_FN (fun));
 
   insn_locations_init ();
   if (!DECL_IS_BUILTIN (current_function_decl))
     {
       /* Eventually, all FEs should explicitly set function_start_locus.  */
-      if (LOCATION_LOCUS (cfun->function_start_locus) == UNKNOWN_LOCATION)
-       set_curr_insn_location
-         (DECL_SOURCE_LOCATION (current_function_decl));
+      if (LOCATION_LOCUS (fun->function_start_locus) == UNKNOWN_LOCATION)
+	set_curr_insn_location
+	  (DECL_SOURCE_LOCATION (current_function_decl));
       else
-       set_curr_insn_location (cfun->function_start_locus);
+	set_curr_insn_location (fun->function_start_locus);
     }
   else
     set_curr_insn_location (UNKNOWN_LOCATION);
@@ -5587,7 +5618,7 @@ gimple_expand_cfg (void)
   crtl->max_used_stack_slot_alignment = STACK_BOUNDARY;
   crtl->stack_alignment_estimated = 0;
   crtl->preferred_stack_boundary = STACK_BOUNDARY;
-  cfun->cfg->max_jumptable_ents = 0;
+  fun->cfg->max_jumptable_ents = 0;
 
   /* Resovle the function section.  Some targets, like ARM EABI rely on knowledge
      of the function section at exapnsion time to predict distance of calls.  */
@@ -5606,14 +5637,14 @@ gimple_expand_cfg (void)
   /* Honor stack protection warnings.  */
   if (warn_stack_protect)
     {
-      if (cfun->calls_alloca)
+      if (fun->calls_alloca)
 	warning (OPT_Wstack_protector,
 		 "stack protector not protecting local variables: "
-                 "variable length buffer");
+		 "variable length buffer");
       if (has_short_buffer && !crtl->stack_protect_guard)
 	warning (OPT_Wstack_protector,
 		 "stack protector not protecting function: "
-                 "all local arrays are less than %d bytes long",
+		 "all local arrays are less than %d bytes long",
 		 (int) PARAM_VALUE (PARAM_SSP_BUFFER_SIZE));
     }
 
@@ -5644,12 +5675,12 @@ gimple_expand_cfg (void)
       gcc_assert (SA.partition_to_pseudo[i]);
 
       /* If this decl was marked as living in multiple places, reset
-         this now to NULL.  */
+	 this now to NULL.  */
       if (DECL_RTL_IF_SET (var) == pc_rtx)
 	SET_DECL_RTL (var, NULL);
 
       /* Some RTL parts really want to look at DECL_RTL(x) when x
-         was a decl marked in REG_ATTR or MEM_ATTR.  We could use
+	 was a decl marked in REG_ATTR or MEM_ATTR.  We could use
 	 SET_DECL_RTL here making this available, but that would mean
 	 to select one of the potentially many RTLs for one DECL.  Instead
 	 of doing that we simply reset the MEM_EXPR of the RTL in question,
@@ -5718,11 +5749,11 @@ gimple_expand_cfg (void)
 
   /* Clear EDGE_EXECUTABLE on the entry edge(s).  It is cleaned from the
      remaining edges later.  */
-  FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs)
+  FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (fun)->succs)
     e->flags &= ~EDGE_EXECUTABLE;
 
   lab_rtx_for_bb = pointer_map_create ();
-  FOR_BB_BETWEEN (bb, init_block->next_bb, EXIT_BLOCK_PTR_FOR_FN (cfun),
+  FOR_BB_BETWEEN (bb, init_block->next_bb, EXIT_BLOCK_PTR_FOR_FN (fun),
 		  next_bb)
     bb = expand_gimple_basic_block (bb, var_ret_seq != NULL_RTX);
 
@@ -5740,7 +5771,7 @@ gimple_expand_cfg (void)
 
   timevar_push (TV_POST_EXPAND);
   /* We are no longer in SSA form.  */
-  cfun->gimple_df->in_ssa_p = false;
+  fun->gimple_df->in_ssa_p = false;
   if (current_loops)
     loops_state_clear (LOOP_CLOSED_SSA);
 
@@ -5762,14 +5793,14 @@ gimple_expand_cfg (void)
     }
 
   /* Zap the tree EH table.  */
-  set_eh_throw_stmt_table (cfun, NULL);
+  set_eh_throw_stmt_table (fun, NULL);
 
   /* We need JUMP_LABEL be set in order to redirect jumps, and hence
      split edges which edge insertions might do.  */
   rebuild_jump_labels (get_insns ());
 
-  FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun),
-		  EXIT_BLOCK_PTR_FOR_FN (cfun), next_bb)
+  FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (fun),
+		  EXIT_BLOCK_PTR_FOR_FN (fun), next_bb)
     {
       edge e;
       edge_iterator ei;
@@ -5780,8 +5811,8 @@ gimple_expand_cfg (void)
 	      rebuild_jump_labels_chain (e->insns.r);
 	      /* Put insns after parm birth, but before
 		 NOTE_INSNS_FUNCTION_BEG.  */
-	      if (e->src == ENTRY_BLOCK_PTR_FOR_FN (cfun)
-		  && single_succ_p (ENTRY_BLOCK_PTR_FOR_FN (cfun)))
+	      if (e->src == ENTRY_BLOCK_PTR_FOR_FN (fun)
+		  && single_succ_p (ENTRY_BLOCK_PTR_FOR_FN (fun)))
 		{
 		  rtx insns = e->insns.r;
 		  e->insns.r = NULL_RTX;
@@ -5802,8 +5833,8 @@ gimple_expand_cfg (void)
   /* We're done expanding trees to RTL.  */
   currently_expanding_to_rtl = 0;
 
-  FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb,
-		  EXIT_BLOCK_PTR_FOR_FN (cfun), next_bb)
+  FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (fun)->next_bb,
+		  EXIT_BLOCK_PTR_FOR_FN (fun), next_bb)
     {
       edge e;
       edge_iterator ei;
@@ -5824,7 +5855,7 @@ gimple_expand_cfg (void)
 	}
     }
 
-  blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
+  blocks = sbitmap_alloc (last_basic_block_for_fn (fun));
   bitmap_ones (blocks);
   find_many_sub_basic_blocks (blocks);
   sbitmap_free (blocks);
@@ -5840,7 +5871,7 @@ gimple_expand_cfg (void)
   /* After initial rtl generation, call back to finish generating
      exception support code.  We need to do this before cleaning up
      the CFG as the code does not expect dead landing pads.  */
-  if (cfun->eh->region_tree != NULL)
+  if (fun->eh->region_tree != NULL)
     finish_eh_generation ();
 
   /* Remove unreachable blocks, otherwise we cannot compute dominators
@@ -5878,14 +5909,14 @@ gimple_expand_cfg (void)
 
   /* If we're emitting a nested function, make sure its parent gets
      emitted as well.  Doing otherwise confuses debug info.  */
-  {
-    tree parent;
-    for (parent = DECL_CONTEXT (current_function_decl);
-	 parent != NULL_TREE;
-	 parent = get_containing_scope (parent))
-      if (TREE_CODE (parent) == FUNCTION_DECL)
-	TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
-  }
+    {
+      tree parent;
+      for (parent = DECL_CONTEXT (current_function_decl);
+	   parent != NULL_TREE;
+	   parent = get_containing_scope (parent))
+	if (TREE_CODE (parent) == FUNCTION_DECL)
+	  TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
+    }
 
   /* We are now committed to emitting code for this function.  Do any
      preparation, such as emitting abstract debug info for the inline
@@ -5900,15 +5931,15 @@ gimple_expand_cfg (void)
   naked_return_label = NULL;
 
   /* After expanding, the tm_restart map is no longer needed.  */
-  if (cfun->gimple_df->tm_restart)
+  if (fun->gimple_df->tm_restart)
     {
-      htab_delete (cfun->gimple_df->tm_restart);
-      cfun->gimple_df->tm_restart = NULL;
+      htab_delete (fun->gimple_df->tm_restart);
+      fun->gimple_df->tm_restart = NULL;
     }
 
   /* Tag the blocks with a depth number so that change_scope can find
      the common parent easily.  */
-  set_block_levels (DECL_INITIAL (cfun->decl), 0);
+  set_block_levels (DECL_INITIAL (fun->decl), 0);
   default_rtl_profile ();
 
   timevar_pop (TV_POST_EXPAND);
@@ -5916,37 +5947,6 @@ gimple_expand_cfg (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_expand =
-{
-  RTL_PASS, /* type */
-  "expand", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_EXPAND, /* tv_id */
-  ( PROP_ssa | PROP_gimple_leh | PROP_cfg
-    | PROP_gimple_lcx
-    | PROP_gimple_lvec ), /* properties_required */
-  PROP_rtl, /* properties_provided */
-  ( PROP_ssa | PROP_trees ), /* properties_destroyed */
-  ( TODO_verify_ssa | TODO_verify_flow
-    | TODO_verify_stmts ), /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_expand : public rtl_opt_pass
-{
-public:
-  pass_expand (gcc::context *ctxt)
-    : rtl_opt_pass (pass_data_expand, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  unsigned int execute () { return gimple_expand_cfg (); }
-
-}; // class pass_expand
-
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 0404d08..5dd27d2 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -442,26 +442,6 @@ free_bb_for_insn (void)
   return 0;
 }
 
-static unsigned int
-rest_of_pass_free_cfg (void)
-{
-#ifdef DELAY_SLOTS
-  /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
-     valid at that point so it would be too late to call df_analyze.  */
-  if (optimize > 0 && flag_delayed_branch)
-    {
-      df_note_add_problem ();
-      df_analyze ();
-    }
-#endif
-
-  if (crtl->has_bb_partition)
-    insert_section_boundary_note ();
-
-  free_bb_for_insn ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_free_cfg =
@@ -486,10 +466,30 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_pass_free_cfg (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_free_cfg
 
+unsigned int
+pass_free_cfg::execute (function *)
+{
+#ifdef DELAY_SLOTS
+  /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
+     valid at that point so it would be too late to call df_analyze.  */
+  if (optimize > 0 && flag_delayed_branch)
+    {
+      df_note_add_problem ();
+      df_analyze ();
+    }
+#endif
+
+  if (crtl->has_bb_partition)
+    insert_section_boundary_note ();
+
+  free_bb_for_insn ();
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -3466,27 +3466,6 @@ record_effective_endpoints (void)
     cfg_layout_function_footer = unlink_insn_chain (cfg_layout_function_footer, get_last_insn ());
 }
 \f
-static unsigned int
-into_cfg_layout_mode (void)
-{
-  cfg_layout_initialize (0);
-  return 0;
-}
-
-static unsigned int
-outof_cfg_layout_mode (void)
-{
-  basic_block bb;
-
-  FOR_EACH_BB_FN (bb, cfun)
-    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
-      bb->aux = bb->next_bb;
-
-  cfg_layout_finalize ();
-
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_into_cfg_layout_mode =
@@ -3511,7 +3490,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return into_cfg_layout_mode (); }
+  virtual unsigned int execute (function *)
+    {
+      cfg_layout_initialize (0);
+      return 0;
+    }
 
 }; // class pass_into_cfg_layout_mode
 
@@ -3547,10 +3530,24 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return outof_cfg_layout_mode (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_outof_cfg_layout_mode
 
+unsigned int
+pass_outof_cfg_layout_mode::execute (function *fun)
+{
+  basic_block bb;
+
+  FOR_EACH_BB_FN (bb, fun)
+    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (fun))
+      bb->aux = bb->next_bb;
+
+  cfg_layout_finalize ();
+
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 9c6d46d..6bdc8ca 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -305,8 +305,36 @@ ipa_record_stmt_references (struct cgraph_node *node, gimple stmt)
 /* Create cgraph edges for function calls.
    Also look for functions and variables having addresses taken.  */
 
-static unsigned int
-build_cgraph_edges (void)
+namespace {
+
+const pass_data pass_data_build_cgraph_edges =
+{
+  GIMPLE_PASS, /* type */
+  "*build_cgraph_edges", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  PROP_cfg, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_build_cgraph_edges : public gimple_opt_pass
+{
+public:
+  pass_build_cgraph_edges (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_build_cgraph_edges, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual unsigned int execute (function *);
+
+}; // class pass_build_cgraph_edges
+
+unsigned int
+pass_build_cgraph_edges::execute (function *fun)
 {
   basic_block bb;
   struct cgraph_node *node = cgraph_get_node (current_function_decl);
@@ -317,7 +345,7 @@ build_cgraph_edges (void)
 
   /* Create the callgraph edges and record the nodes referenced by the function.
      body.  */
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 	{
@@ -370,45 +398,17 @@ build_cgraph_edges (void)
    }
 
   /* Look for initializers of constant variables and private statics.  */
-  FOR_EACH_LOCAL_DECL (cfun, ix, decl)
+  FOR_EACH_LOCAL_DECL (fun, ix, decl)
     if (TREE_CODE (decl) == VAR_DECL
 	&& (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
 	&& !DECL_HAS_VALUE_EXPR_P (decl))
       varpool_finalize_decl (decl);
-  record_eh_tables (node, cfun);
+  record_eh_tables (node, fun);
 
   pointer_set_destroy (visited_nodes);
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_build_cgraph_edges =
-{
-  GIMPLE_PASS, /* type */
-  "*build_cgraph_edges", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  PROP_cfg, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_build_cgraph_edges : public gimple_opt_pass
-{
-public:
-  pass_build_cgraph_edges (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_build_cgraph_edges, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  unsigned int execute () { return build_cgraph_edges (); }
-
-}; // class pass_build_cgraph_edges
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -539,7 +539,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_rebuild_cgraph_edges (m_ctxt); }
-  unsigned int execute () { return rebuild_cgraph_edges (); }
+  virtual unsigned int execute (function *) { return rebuild_cgraph_edges (); }
 
 }; // class pass_rebuild_cgraph_edges
 
@@ -552,15 +552,6 @@ make_pass_rebuild_cgraph_edges (gcc::context *ctxt)
 }
 
 
-static unsigned int
-remove_cgraph_callee_edges (void)
-{
-  struct cgraph_node *node = cgraph_get_node (current_function_decl);
-  cgraph_node_remove_callees (node);
-  ipa_remove_all_references (&node->ref_list);
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_remove_cgraph_callee_edges =
@@ -588,10 +579,19 @@ public:
   opt_pass * clone () {
     return new pass_remove_cgraph_callee_edges (m_ctxt);
   }
-  unsigned int execute () { return remove_cgraph_callee_edges (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_remove_cgraph_callee_edges
 
+unsigned int
+pass_remove_cgraph_callee_edges::execute (function *)
+{
+  struct cgraph_node *node = cgraph_get_node (current_function_decl);
+  cgraph_node_remove_callees (node);
+  ipa_remove_all_references (&node->ref_list);
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index 37fc7a5..399beb4 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -653,7 +653,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return rest_of_handle_stack_adjustments (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_stack_adjustments ();
+    }
 
 }; // class pass_stack_adjustments
 
diff --git a/gcc/combine.c b/gcc/combine.c
index 1b1e33c..9a78c06 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -13909,7 +13909,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return (optimize > 0); }
-  unsigned int execute () { return rest_of_handle_combine (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_combine ();
+    }
 
 }; // class pass_combine
 
diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c
index 9cddb7a..7555d48 100644
--- a/gcc/compare-elim.c
+++ b/gcc/compare-elim.c
@@ -676,7 +676,10 @@ public:
       return flag_compare_elim_after_reload;
     }
 
-  unsigned int execute () { return execute_compare_elim_after_reload (); }
+  virtual unsigned int execute (function *)
+    {
+      return execute_compare_elim_after_reload ();
+    }
 
 }; // class pass_compare_elim_after_reload
 
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index eddc55e..64d1312 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -623,7 +623,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_arc_ifcvt (m_ctxt); }
-  unsigned int execute () { return arc_ifcvt (); }
+  virtual unsigned int execute (function *) { return arc_ifcvt (); }
 };
 
 } // anon namespace
@@ -660,7 +660,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return arc_predicate_delay_insns (); }
+  virtual unsigned int execute (function *)
+    {
+      return arc_predicate_delay_insns ();
+    }
 };
 
 } // anon namespace
diff --git a/gcc/config/epiphany/mode-switch-use.c b/gcc/config/epiphany/mode-switch-use.c
index d893934..9617041 100644
--- a/gcc/config/epiphany/mode-switch-use.c
+++ b/gcc/config/epiphany/mode-switch-use.c
@@ -95,7 +95,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return insert_uses (); }
+  virtual unsigned int execute (function *) { return insert_uses (); }
 
 }; // class pass_mode_switch_use
 
diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
index 31928fd..fa8fea5 100644
--- a/gcc/config/epiphany/resolve-sw-modes.c
+++ b/gcc/config/epiphany/resolve-sw-modes.c
@@ -38,6 +38,35 @@ along with GCC; see the file COPYING3.  If not see
 #include "insn-attr-common.h"
 #include "tree-pass.h"
 
+namespace {
+
+const pass_data pass_data_resolve_sw_modes =
+{
+  RTL_PASS, /* type */
+  "resolve_sw_modes", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_MODE_SWITCH, /* tv_id */
+  0, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_df_finish | TODO_verify_rtl_sharing | 0 ), /* todo_flags_finish */
+};
+
+class pass_resolve_sw_modes : public rtl_opt_pass
+{
+public:
+  pass_resolve_sw_modes(gcc::context *ctxt)
+    : rtl_opt_pass(pass_data_resolve_sw_modes, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *) { return optimize; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_resolve_sw_modes
+
 /* Clean-up after mode switching:
    Check for mode setting insns that have FP_MODE_ROUND_UNKNOWN.
    If only one rounding mode is required, select that one.
@@ -45,8 +74,8 @@ along with GCC; see the file COPYING3.  If not see
    insert new mode setting insns on the edges where the other mode
    becomes unambigous.  */
 
-static unsigned
-resolve_sw_modes (void)
+unsigned
+pass_resolve_sw_modes::execute (function *fun)
 {
   basic_block bb;
   rtx insn, src;
@@ -55,15 +84,15 @@ resolve_sw_modes (void)
   bool need_commit = false;
   bool finalize_fp_sets = (MACHINE_FUNCTION (cfun)->unknown_mode_sets == 0);
 
-  todo.create (last_basic_block_for_fn (cfun));
-  pushed = sbitmap_alloc (last_basic_block_for_fn (cfun));
+  todo.create (last_basic_block_for_fn (fun));
+  pushed = sbitmap_alloc (last_basic_block_for_fn (fun));
   bitmap_clear (pushed);
   if (!finalize_fp_sets)
     {
       df_note_add_problem ();
       df_analyze ();
     }
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     FOR_BB_INSNS (bb, insn)
       {
 	enum attr_fp_mode selected_mode;
@@ -155,35 +184,6 @@ resolve_sw_modes (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_resolve_sw_modes =
-{
-  RTL_PASS, /* type */
-  "resolve_sw_modes", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_MODE_SWITCH, /* tv_id */
-  0, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_df_finish | TODO_verify_rtl_sharing | 0 ), /* todo_flags_finish */
-};
-
-class pass_resolve_sw_modes : public rtl_opt_pass
-{
-public:
-  pass_resolve_sw_modes(gcc::context *ctxt)
-    : rtl_opt_pass(pass_data_resolve_sw_modes, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *) { return optimize; }
-  unsigned int execute () { return resolve_sw_modes (); }
-
-}; // class pass_resolve_sw_modes
-
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 8cfdaf6..9f4e04d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2541,7 +2541,10 @@ public:
       return TARGET_AVX && !TARGET_AVX512F && TARGET_VZEROUPPER;
     }
 
-  unsigned int execute () { return rest_of_handle_insert_vzeroupper (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_insert_vzeroupper ();
+    }
 
 }; // class pass_insert_vzeroupper
 
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 6c0b3c2..45256e9 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -16550,7 +16550,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return mips_machine_reorg2 (); }
+  virtual unsigned int execute (function *) { return mips_machine_reorg2 (); }
 
 }; // class pass_mips_machine_reorg2
 
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index 988e1cd..0731491 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -117,14 +117,6 @@ rl78_init_machine_status (void)
   return m;
 }
 
-/* Runs the devirtualization pass.  */
-static unsigned int
-devirt_pass (void)
-{
-  rl78_reorg ();
-  return 0;
-}
-
 /* This pass converts virtual instructions using virtual registers, to
    real instructions using real registers.  Rather than run it as
    reorg, we reschedule it before vartrack to help with debugging.  */
@@ -153,7 +145,12 @@ public:
   }
 
   /* opt_pass methods: */
-  unsigned int execute () { return devirt_pass (); }
+  virtual unsigned int execute (function *)
+    {
+      rl78_reorg ();
+      return 0;
+    }
+
 };
 
 } // anon namespace
@@ -235,7 +232,7 @@ public:
   }
 
   /* opt_pass methods: */
-  unsigned int execute () { return move_elim_pass (); }
+  virtual unsigned int execute (function *) { return move_elim_pass (); }
 };
 
 } // anon namespace
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 77e163f..cc8f32e 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -8631,33 +8631,6 @@ s390_restore_gprs_from_fprs (void)
 /* A pass run immediately before shrink-wrapping and prologue and epilogue
    generation.  */
 
-static unsigned int
-s390_early_mach (void)
-{
-  rtx insn;
-
-  /* Try to get rid of the FPR clobbers.  */
-  s390_optimize_nonescaping_tx ();
-
-  /* Re-compute register info.  */
-  s390_register_info ();
-
-  /* If we're using a base register, ensure that it is always valid for
-     the first non-prologue instruction.  */
-  if (cfun->machine->base_reg)
-    emit_insn_at_entry (gen_main_pool (cfun->machine->base_reg));
-
-  /* Annotate all constant pool references to let the scheduler know
-     they implicitly use the base register.  */
-  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
-    if (INSN_P (insn))
-      {
-	annotate_constant_pool_refs (&PATTERN (insn));
-	df_insn_rescan (insn);
-      }
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_s390_early_mach =
@@ -8683,10 +8656,37 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return s390_early_mach (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_s390_early_mach
 
+unsigned int
+pass_s390_early_mach::execute (function *fun)
+{
+  rtx insn;
+
+  /* Try to get rid of the FPR clobbers.  */
+  s390_optimize_nonescaping_tx ();
+
+  /* Re-compute register info.  */
+  s390_register_info ();
+
+  /* If we're using a base register, ensure that it is always valid for
+     the first non-prologue instruction.  */
+  if (fun->machine->base_reg)
+    emit_insn_at_entry (gen_main_pool (fun->machine->base_reg));
+
+  /* Annotate all constant pool references to let the scheduler know
+     they implicitly use the base register.  */
+  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+    if (INSN_P (insn))
+      {
+	annotate_constant_pool_refs (&PATTERN (insn));
+	df_insn_rescan (insn);
+      }
+  return 0;
+}
+
 } // anon namespace
 
 /* Expand the prologue into a bunch of separate insns.  */
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 5578cb8..62354ee 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1145,7 +1145,10 @@ public:
       return sparc_fix_at697f != 0 || sparc_fix_ut699 != 0;
     }
 
-  unsigned int execute () { return sparc_do_work_around_errata (); }
+  virtual unsigned int execute (function *)
+    {
+      return sparc_do_work_around_errata ();
+    }
 
 }; // class pass_work_around_errata
 
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 9802b8a..d29b6f6 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -1943,7 +1943,7 @@ public:
 	&& dbg_cnt (cprop);
     }
 
-  unsigned int execute () { return execute_rtl_cprop (); }
+  virtual unsigned int execute (function *) { return execute_rtl_cprop (); }
 
 }; // class pass_rtl_cprop
 
diff --git a/gcc/cse.c b/gcc/cse.c
index 60ec9a9..40bc2be 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7510,7 +7510,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return optimize > 0; }
-  unsigned int execute () { return rest_of_handle_cse (); }
+  virtual unsigned int execute (function *) { return rest_of_handle_cse (); }
 
 }; // class pass_cse
 
@@ -7587,7 +7587,7 @@ public:
       return optimize > 0 && flag_rerun_cse_after_loop;
     }
 
-  unsigned int execute () { return rest_of_handle_cse2 (); }
+  virtual unsigned int execute (function *) { return rest_of_handle_cse2 (); }
 
 }; // class pass_cse2
 
@@ -7662,9 +7662,10 @@ public:
       return optimize > 0 && flag_rerun_cse_after_global_opts;
     }
 
-  unsigned int execute () {
-    return rest_of_handle_cse_after_global_opts ();
-  }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_cse_after_global_opts ();
+    }
 
 }; // class pass_cse_after_global_opts
 
diff --git a/gcc/dce.c b/gcc/dce.c
index 1d290e3..344e31a 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -808,7 +808,10 @@ public:
       return optimize > 1 && flag_dce && dbg_cnt (dce_ud);
     }
 
-  unsigned int execute () { return rest_of_handle_ud_dce (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_ud_dce ();
+    }
 
 }; // class pass_ud_rtl_dce
 
@@ -1237,7 +1240,10 @@ public:
       return optimize > 0 && flag_dce && dbg_cnt (dce_fast);
     }
 
-  unsigned int execute () { return rest_of_handle_fast_dce (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_fast_dce ();
+    }
 
 }; // class pass_fast_rtl_dce
 
diff --git a/gcc/df-core.c b/gcc/df-core.c
index bd3cb31..9fdf6010 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -765,7 +765,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return optimize > 0; }
-  unsigned int execute () { return rest_of_handle_df_initialize (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_df_initialize ();
+    }
 
 }; // class pass_df_initialize_opt
 
@@ -803,7 +806,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return optimize == 0; }
-  unsigned int execute () { return rest_of_handle_df_initialize (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_df_initialize ();
+    }
 
 }; // class pass_df_initialize_no_opt
 
@@ -867,7 +873,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_handle_df_finish (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_df_finish ();
+    }
 
 }; // class pass_df_finish
 
diff --git a/gcc/dse.c b/gcc/dse.c
index a80c025..88b8c37 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -3736,7 +3736,7 @@ public:
       return optimize > 0 && flag_dse && dbg_cnt (dse1);
     }
 
-  unsigned int execute () { return rest_of_handle_dse (); }
+  virtual unsigned int execute (function *) { return rest_of_handle_dse (); }
 
 }; // class pass_rtl_dse1
 
@@ -3777,7 +3777,7 @@ public:
       return optimize > 0 && flag_dse && dbg_cnt (dse2);
     }
 
-  unsigned int execute () { return rest_of_handle_dse (); }
+  virtual unsigned int execute (function *) { return rest_of_handle_dse (); }
 
 }; // class pass_rtl_dse2
 
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 3749277..4180890 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -3402,7 +3402,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return execute_dwarf2_frame (); }
+  virtual unsigned int execute (function *) { return execute_dwarf2_frame (); }
 
 }; // class pass_dwarf2_frame
 
diff --git a/gcc/except.c b/gcc/except.c
index 2015809..5b33c9c 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2025,7 +2025,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return set_nothrow_function_flags (); }
+  virtual unsigned int execute (function *)
+    {
+      return set_nothrow_function_flags ();
+    }
 
 }; // class pass_set_nothrow_function_flags
 
@@ -2645,7 +2648,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return convert_to_eh_region_ranges (); }
+  virtual unsigned int execute (function *)
+    {
+      return convert_to_eh_region_ranges ();
+    }
 
 }; // class pass_convert_to_eh_region_ranges
 
diff --git a/gcc/final.c b/gcc/final.c
index 91b8ccc..542886f 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -869,7 +869,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return compute_alignments (); }
+  virtual unsigned int execute (function *) { return compute_alignments (); }
 
 }; // class pass_compute_alignments
 
@@ -4497,7 +4497,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_handle_final (); }
+  virtual unsigned int execute (function *) { return rest_of_handle_final (); }
 
 }; // class pass_final
 
@@ -4542,7 +4542,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_handle_shorten_branches (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_shorten_branches ();
+    }
 
 }; // class pass_shorten_branches
 
@@ -4705,7 +4708,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_clean_state (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_clean_state ();
+    }
 
 }; // class pass_clean_state
 
diff --git a/gcc/function.c b/gcc/function.c
index cf07255..383a52a 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1967,7 +1967,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return instantiate_virtual_regs (); }
+  virtual unsigned int execute (function *)
+    {
+      return instantiate_virtual_regs ();
+    }
 
 }; // class pass_instantiate_virtual_regs
 
@@ -6965,7 +6968,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_handle_check_leaf_regs (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_check_leaf_regs ();
+    }
 
 }; // class pass_leaf_regs
 
@@ -7025,9 +7031,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () {
-    return rest_of_handle_thread_prologue_and_epilogue ();
-  }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_thread_prologue_and_epilogue ();
+    }
 
 }; // class pass_thread_prologue_and_epilogue
 
@@ -7184,8 +7191,36 @@ match_asm_constraints_1 (rtx insn, rtx *p_sets, int noutputs)
     df_insn_rescan (insn);
 }
 
-static unsigned
-rest_of_match_asm_constraints (void)
+namespace {
+
+const pass_data pass_data_match_asm_constraints =
+{
+  RTL_PASS, /* type */
+  "asmcons", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  0, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_match_asm_constraints : public rtl_opt_pass
+{
+public:
+  pass_match_asm_constraints (gcc::context *ctxt)
+    : rtl_opt_pass (pass_data_match_asm_constraints, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual unsigned int execute (function *);
+
+}; // class pass_match_asm_constraints
+
+unsigned
+pass_match_asm_constraints::execute (function *fun)
 {
   basic_block bb;
   rtx insn, pat, *p_sets;
@@ -7195,7 +7230,7 @@ rest_of_match_asm_constraints (void)
     return 0;
 
   df_set_flags (DF_DEFER_INSN_RESCAN);
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       FOR_BB_INSNS (bb, insn)
 	{
@@ -7219,34 +7254,6 @@ rest_of_match_asm_constraints (void)
   return TODO_df_finish;
 }
 
-namespace {
-
-const pass_data pass_data_match_asm_constraints =
-{
-  RTL_PASS, /* type */
-  "asmcons", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  0, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_match_asm_constraints : public rtl_opt_pass
-{
-public:
-  pass_match_asm_constraints (gcc::context *ctxt)
-    : rtl_opt_pass (pass_data_match_asm_constraints, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  unsigned int execute () { return rest_of_match_asm_constraints (); }
-
-}; // class pass_match_asm_constraints
-
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index c6fa4ee..6960d62 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -1509,7 +1509,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return gate_fwprop (); }
-  unsigned int execute () { return fwprop (); }
+  virtual unsigned int execute (function *) { return fwprop (); }
 
 }; // class pass_rtl_fwprop
 
@@ -1574,7 +1574,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return gate_fwprop (); }
-  unsigned int execute () { return fwprop_addr (); }
+  virtual unsigned int execute (function *) { return fwprop_addr (); }
 
 }; // class pass_rtl_fwprop_addr
 
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 942ea64..d88b275 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4209,7 +4209,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return execute_rtl_pre (); }
+  virtual unsigned int execute (function *) { return execute_rtl_pre (); }
 
 }; // class pass_rtl_pre
 
@@ -4261,7 +4261,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return execute_rtl_hoist (); }
+  virtual unsigned int execute (function *) { return execute_rtl_hoist (); }
 
 }; // class pass_rtl_hoist
 
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 66ea322..eff4b4f 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -180,7 +180,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return lower_function_body (); }
+  virtual unsigned int execute (function *) { return lower_function_body (); }
 
 }; // class pass_lower_cf
 
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index ab6185c..b01417d 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -446,7 +446,10 @@ public:
 	      || flag_isolate_erroneous_paths_attribute != 0);
     }
 
-  unsigned int execute () { return gimple_ssa_isolate_erroneous_paths (); }
+  virtual unsigned int execute (function *)
+    {
+      return gimple_ssa_isolate_erroneous_paths ();
+    }
 
 }; // class pass_isolate_erroneous_paths
 }
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index a8596e0..ff55d0e 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -3594,8 +3594,37 @@ analyze_candidates_and_replace (void)
     }
 }
 
-static unsigned
-execute_strength_reduction (void)
+namespace {
+
+const pass_data pass_data_strength_reduction =
+{
+  GIMPLE_PASS, /* type */
+  "slsr", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_GIMPLE_SLSR, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_verify_ssa, /* todo_flags_finish */
+};
+
+class pass_strength_reduction : public gimple_opt_pass
+{
+public:
+  pass_strength_reduction (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_strength_reduction, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *) { return flag_tree_slsr; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_strength_reduction
+
+unsigned
+pass_strength_reduction::execute (function *fun)
 {
   /* Create the obstack where candidates will reside.  */
   gcc_obstack_init (&cand_obstack);
@@ -3622,7 +3651,7 @@ execute_strength_reduction (void)
   /* Walk the CFG in predominator order looking for strength reduction
      candidates.  */
   find_candidates_dom_walker (CDI_DOMINATORS)
-    .walk (cfun->cfg->x_entry_block_ptr);
+    .walk (fun->cfg->x_entry_block_ptr);
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
@@ -3646,35 +3675,6 @@ execute_strength_reduction (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_strength_reduction =
-{
-  GIMPLE_PASS, /* type */
-  "slsr", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_GIMPLE_SLSR, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_verify_ssa, /* todo_flags_finish */
-};
-
-class pass_strength_reduction : public gimple_opt_pass
-{
-public:
-  pass_strength_reduction (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_strength_reduction, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *) { return flag_tree_slsr; }
-  unsigned int execute () { return execute_strength_reduction (); }
-
-}; // class pass_strength_reduction
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 68c9390..2e1f439 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -411,7 +411,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return gate_graphite_transforms (); }
-  unsigned int execute () { return graphite_transforms (); }
+  virtual unsigned int execute (function *) { return graphite_transforms (); }
 
 }; // class pass_graphite_transforms
 
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 657b585..e8a9fec 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -4560,7 +4560,10 @@ public:
       return (optimize > 0) && dbg_cnt (if_conversion);
     }
 
-  unsigned int execute () { return rest_of_handle_if_conversion (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_if_conversion ();
+    }
 
 }; // class pass_rtl_ifcvt
 
@@ -4575,12 +4578,6 @@ make_pass_rtl_ifcvt (gcc::context *ctxt)
 
 /* Rerun if-conversion, as combine may have simplified things enough
    to now meet sequence length restrictions.  */
-static unsigned int
-rest_of_handle_if_after_combine (void)
-{
-  if_convert (true);
-  return 0;
-}
 
 namespace {
 
@@ -4612,7 +4609,11 @@ public:
 	&& dbg_cnt (if_after_combine);
     }
 
-  unsigned int execute () { return rest_of_handle_if_after_combine (); }
+  virtual unsigned int execute (function *)
+    {
+      if_convert (true);
+      return 0;
+    }
 
 }; // class pass_if_after_combine
 
@@ -4625,14 +4626,6 @@ make_pass_if_after_combine (gcc::context *ctxt)
 }
 
 
-static unsigned int
-rest_of_handle_if_after_reload (void)
-{
-  if_convert (true);
-  return 0;
-}
-
-
 namespace {
 
 const pass_data pass_data_if_after_reload =
@@ -4663,7 +4656,11 @@ public:
 	&& dbg_cnt (if_after_reload);
     }
 
-  unsigned int execute () { return rest_of_handle_if_after_reload (); }
+  virtual unsigned int execute (function *)
+    {
+      if_convert (true);
+      return 0;
+    }
 
 }; // class pass_if_after_reload
 
diff --git a/gcc/init-regs.c b/gcc/init-regs.c
index 2025b77..59c5bc9 100644
--- a/gcc/init-regs.c
+++ b/gcc/init-regs.c
@@ -125,13 +125,6 @@ initialize_uninitialized_regs (void)
   BITMAP_FREE (already_genned);
 }
 
-static unsigned int
-rest_of_handle_initialize_regs (void)
-{
-  initialize_uninitialized_regs ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_initialize_regs =
@@ -157,7 +150,11 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return optimize > 0; }
-  unsigned int execute () { return rest_of_handle_initialize_regs (); }
+  virtual unsigned int execute (function *)
+    {
+      initialize_uninitialized_regs ();
+      return 0;
+    }
 
 }; // class pass_initialize_regs
 
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index ee48fc0..479963c 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -3804,7 +3804,7 @@ public:
       return flag_ipa_cp && optimize;
     }
 
-  unsigned int execute () { return ipcp_driver (); }
+  virtual unsigned int execute (function *) { return ipcp_driver (); }
 
 }; // class pass_ipa_cp
 
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 3bc6815..6c5e566 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -1951,7 +1951,7 @@ public:
 	      && optimize);
     }
 
-  unsigned int execute () { return ipa_devirt (); }
+  virtual unsigned int execute (function *) { return ipa_devirt (); }
 
 }; // class pass_ipa_devirt
 
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 8783caa..c471e0c 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -2938,9 +2938,10 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_inline_parameters (m_ctxt); }
-  unsigned int execute () {
-    return compute_inline_parameters_for_current ();
-  }
+  virtual unsigned int execute (function *)
+    {
+      return compute_inline_parameters_for_current ();
+    }
 
 }; // class pass_inline_parameters
 
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index da02afc..83a836a 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -2231,8 +2231,37 @@ early_inline_small_functions (struct cgraph_node *node)
 /* Do inlining of small functions.  Doing so early helps profiling and other
    passes to be somewhat more effective and avoids some code duplication in
    later real inlining pass for testcases with very many function calls.  */
-static unsigned int
-early_inliner (void)
+
+namespace {
+
+const pass_data pass_data_early_inline =
+{
+  GIMPLE_PASS, /* type */
+  "einline", /* name */
+  OPTGROUP_INLINE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_EARLY_INLINING, /* tv_id */
+  PROP_ssa, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_early_inline : public gimple_opt_pass
+{
+public:
+  pass_early_inline (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_early_inline, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual unsigned int execute (function *);
+
+}; // class pass_early_inline
+
+unsigned int
+pass_early_inline::execute (function *fun)
 {
   struct cgraph_node *node = cgraph_get_node (current_function_decl);
   struct cgraph_edge *edge;
@@ -2328,39 +2357,11 @@ early_inliner (void)
       timevar_pop (TV_INTEGRATION);
     }
 
-  cfun->always_inline_functions_inlined = true;
+  fun->always_inline_functions_inlined = true;
 
   return todo;
 }
 
-namespace {
-
-const pass_data pass_data_early_inline =
-{
-  GIMPLE_PASS, /* type */
-  "einline", /* name */
-  OPTGROUP_INLINE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_EARLY_INLINING, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_early_inline : public gimple_opt_pass
-{
-public:
-  pass_early_inline (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_early_inline, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  unsigned int execute () { return early_inliner (); }
-
-}; // class pass_early_inline
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -2402,7 +2403,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return ipa_inline (); }
+  virtual unsigned int execute (function *) { return ipa_inline (); }
 
 }; // class pass_ipa_inline
 
diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
index 7b58716..71bd61b 100644
--- a/gcc/ipa-profile.c
+++ b/gcc/ipa-profile.c
@@ -745,7 +745,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_ipa_profile; }
-  unsigned int execute () { return ipa_profile (); }
+  virtual unsigned int execute (function *) { return ipa_profile (); }
 
 }; // class pass_ipa_profile
 
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index eab7633..0ebfe5d 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1542,7 +1542,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return gate_pure_const (); }
-  unsigned int execute () { return propagate (); }
+  virtual unsigned int execute (function *) { return propagate (); }
 
 }; // class pass_ipa_pure_const
 
@@ -1581,8 +1581,38 @@ skip_function_for_local_pure_const (struct cgraph_node *node)
    ipa_pure_const.   This pass is effective when executed together with
    other optimization passes in early optimization pass queue.  */
 
-static unsigned int
-local_pure_const (void)
+namespace {
+
+const pass_data pass_data_local_pure_const =
+{
+  GIMPLE_PASS, /* type */
+  "local-pure-const", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_IPA_PURE_CONST, /* tv_id */
+  0, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_local_pure_const : public gimple_opt_pass
+{
+public:
+  pass_local_pure_const (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_local_pure_const, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_local_pure_const (m_ctxt); }
+  virtual bool gate (function *) { return gate_pure_const (); }
+  virtual unsigned int execute (function *);
+
+}; // class pass_local_pure_const
+
+unsigned int
+pass_local_pure_const::execute (function *fun)
 {
   bool changed = false;
   funct_state l;
@@ -1600,17 +1630,17 @@ local_pure_const (void)
 
   /* Do NORETURN discovery.  */
   if (!skip && !TREE_THIS_VOLATILE (current_function_decl)
-      && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) == 0)
+      && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) == 0)
     {
-      warn_function_noreturn (cfun->decl);
+      warn_function_noreturn (fun->decl);
       if (dump_file)
-        fprintf (dump_file, "Function found to be noreturn: %s\n",
-	         current_function_name ());
+	fprintf (dump_file, "Function found to be noreturn: %s\n",
+		 current_function_name ());
 
       /* Update declaration and reduce profile to executed once.  */
       TREE_THIS_VOLATILE (current_function_decl) = 1;
       if (node->frequency > NODE_FREQUENCY_EXECUTED_ONCE)
-        node->frequency = NODE_FREQUENCY_EXECUTED_ONCE;
+	node->frequency = NODE_FREQUENCY_EXECUTED_ONCE;
 
       changed = true;
     }
@@ -1691,36 +1721,6 @@ local_pure_const (void)
     return 0;
 }
 
-namespace {
-
-const pass_data pass_data_local_pure_const =
-{
-  GIMPLE_PASS, /* type */
-  "local-pure-const", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_IPA_PURE_CONST, /* tv_id */
-  0, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_local_pure_const : public gimple_opt_pass
-{
-public:
-  pass_local_pure_const (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_local_pure_const, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_local_pure_const (m_ctxt); }
-  virtual bool gate (function *) { return gate_pure_const (); }
-  unsigned int execute () { return local_pure_const (); }
-
-}; // class pass_local_pure_const
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -1731,15 +1731,6 @@ make_pass_local_pure_const (gcc::context *ctxt)
 
 /* Emit noreturn warnings.  */
 
-static unsigned int
-execute_warn_function_noreturn (void)
-{
-  if (!TREE_THIS_VOLATILE (current_function_decl)
-      && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) == 0)
-    warn_function_noreturn (current_function_decl);
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_warn_function_noreturn =
@@ -1765,7 +1756,13 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return warn_suggest_attribute_noreturn; }
-  unsigned int execute () { return execute_warn_function_noreturn (); }
+  virtual unsigned int execute (function *fun)
+    {
+      if (!TREE_THIS_VOLATILE (current_function_decl)
+	  && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) == 0)
+	warn_function_noreturn (current_function_decl);
+      return 0;
+    }
 
 }; // class pass_warn_function_noreturn
 
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 51a57ac..dc1169d 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -1190,7 +1190,7 @@ public:
 	      && !seen_error ());
     }
 
-  unsigned int execute () { return propagate (); }
+  virtual unsigned int execute (function *) { return propagate (); }
 
 }; // class pass_ipa_reference
 
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 187dc98..eefa195 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1671,7 +1671,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return execute_split_functions (); }
+  virtual unsigned int execute (function *)
+    {
+      return execute_split_functions ();
+    }
 
 }; // class pass_split_functions
 
@@ -1728,7 +1731,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return execute_feedback_split_functions (); }
+  virtual unsigned int execute (function *)
+    {
+      return execute_feedback_split_functions ();
+    }
 
 }; // class pass_feedback_split_functions
 
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 7af2584..e6e59fd 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -1182,12 +1182,6 @@ function_and_variable_visibility (bool whole_program)
 /* Local function pass handling visibilities.  This happens before LTO streaming
    so in particular -fwhole-program should be ignored at this level.  */
 
-static unsigned int
-local_function_and_variable_visibility (void)
-{
-  return function_and_variable_visibility (flag_whole_program && !flag_lto);
-}
-
 namespace {
 
 const pass_data pass_data_ipa_function_and_variable_visibility =
@@ -1213,9 +1207,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () {
-    return local_function_and_variable_visibility ();
-  }
+  virtual unsigned int execute (function *)
+    {
+      return function_and_variable_visibility (flag_whole_program && !flag_lto);
+    }
 
 }; // class pass_ipa_function_and_variable_visibility
 
@@ -1229,13 +1224,6 @@ make_pass_ipa_function_and_variable_visibility (gcc::context *ctxt)
 
 /* Free inline summary.  */
 
-static unsigned
-free_inline_summary (void)
-{
-  inline_free_summary ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_ipa_free_inline_summary =
@@ -1260,7 +1248,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return free_inline_summary (); }
+  virtual unsigned int execute (function *)
+    {
+      inline_free_summary ();
+      return 0;
+    }
 
 }; // class pass_ipa_free_inline_summary
 
@@ -1322,9 +1314,10 @@ public:
       /* Do not re-run on ltrans stage.  */
       return !flag_ltrans;
     }
-  unsigned int execute () {
-    return whole_program_function_and_variable_visibility ();
-  }
+  virtual unsigned int execute (function *)
+    {
+      return whole_program_function_and_variable_visibility ();
+    }
 
 }; // class pass_ipa_whole_program_visibility
 
@@ -1642,7 +1635,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return ipa_cdtor_merge (); }
+  virtual unsigned int execute (function *) { return ipa_cdtor_merge (); }
 
 }; // class pass_ipa_cdtor_merge
 
diff --git a/gcc/ira.c b/gcc/ira.c
index da0f453..d973001 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5548,12 +5548,6 @@ do_reload (void)
 }
 \f
 /* Run the integrated register allocator.  */
-static unsigned int
-rest_of_handle_ira (void)
-{
-  ira (dump_file);
-  return 0;
-}
 
 namespace {
 
@@ -5579,7 +5573,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_handle_ira (); }
+  virtual unsigned int execute (function *)
+    {
+      ira (dump_file);
+      return 0;
+    }
 
 }; // class pass_ira
 
@@ -5591,13 +5589,6 @@ make_pass_ira (gcc::context *ctxt)
   return new pass_ira (ctxt);
 }
 
-static unsigned int
-rest_of_handle_reload (void)
-{
-  do_reload ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_reload =
@@ -5622,7 +5613,11 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_handle_reload (); }
+  virtual unsigned int execute (function *)
+    {
+      do_reload ();
+      return 0;
+    }
 
 }; // class pass_reload
 
diff --git a/gcc/jump.c b/gcc/jump.c
index 7361101..cdea8d5 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -163,7 +163,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return cleanup_barriers (); }
+  virtual unsigned int execute (function *) { return cleanup_barriers (); }
 
 }; // class pass_cleanup_barriers
 
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 6da29d3..90453f6 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -390,7 +390,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rtl_loop_init (); }
+  virtual unsigned int execute (function *) { return rtl_loop_init (); }
 
 }; // class pass_rtl_loop_init
 
@@ -405,24 +405,6 @@ make_pass_rtl_loop_init (gcc::context *ctxt)
 \f
 /* Finalization of the RTL loop passes.  */
 
-static unsigned int
-rtl_loop_done (void)
-{
-  /* No longer preserve loops, remove them now.  */
-  cfun->curr_properties &= ~PROP_loops;
-  loop_optimizer_finalize ();
-  free_dominance_info (CDI_DOMINATORS);
-
-  cleanup_cfg (0);
-  if (dump_file)
-    {
-      dump_reg_info (dump_file);
-      dump_flow_info (dump_file, dump_flags);
-    }
-
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_rtl_loop_done =
@@ -447,10 +429,28 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rtl_loop_done (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_rtl_loop_done
 
+unsigned int
+pass_rtl_loop_done::execute (function *fun)
+{
+  /* No longer preserve loops, remove them now.  */
+  fun->curr_properties &= ~PROP_loops;
+  loop_optimizer_finalize ();
+  free_dominance_info (CDI_DOMINATORS);
+
+  cleanup_cfg (0);
+  if (dump_file)
+    {
+      dump_reg_info (dump_file);
+      dump_flow_info (dump_file, dump_flags);
+    }
+
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -461,13 +461,6 @@ make_pass_rtl_loop_done (gcc::context *ctxt)
 
 \f
 /* Loop invariant code motion.  */
-static unsigned int
-rtl_move_loop_invariants (void)
-{
-  if (number_of_loops (cfun) > 1)
-    move_loop_invariants ();
-  return 0;
-}
 
 namespace {
 
@@ -495,7 +488,12 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_move_loop_invariants; }
-  unsigned int execute () { return rtl_move_loop_invariants (); }
+  virtual unsigned int execute (function *fun)
+    {
+      if (number_of_loops (fun) > 1)
+	move_loop_invariants ();
+      return 0;
+    }
 
 }; // class pass_rtl_move_loop_invariants
 
@@ -508,14 +506,6 @@ make_pass_rtl_move_loop_invariants (gcc::context *ctxt)
 }
 
 \f
-static unsigned int
-rtl_unswitch (void)
-{
-  if (number_of_loops (cfun) > 1)
-    unswitch_loops ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_rtl_unswitch =
@@ -541,7 +531,12 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_unswitch_loops; }
-  unsigned int execute () { return rtl_unswitch (); }
+  virtual unsigned int execute (function *fun)
+    {
+      if (number_of_loops (fun) > 1)
+	unswitch_loops ();
+      return 0;
+    }
 
 }; // class pass_rtl_unswitch
 
@@ -554,27 +549,6 @@ make_pass_rtl_unswitch (gcc::context *ctxt)
 }
 
 \f
-static unsigned int
-rtl_unroll_and_peel_loops (void)
-{
-  if (number_of_loops (cfun) > 1)
-    {
-      int flags = 0;
-      if (dump_file)
-	df_dump (dump_file);
-
-      if (flag_peel_loops)
-	flags |= UAP_PEEL;
-      if (flag_unroll_loops)
-	flags |= UAP_UNROLL;
-      if (flag_unroll_all_loops)
-	flags |= UAP_UNROLL_ALL;
-
-      unroll_and_peel_loops (flags);
-    }
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_rtl_unroll_and_peel_loops =
@@ -604,10 +578,31 @@ public:
       return (flag_peel_loops || flag_unroll_loops || flag_unroll_all_loops);
     }
 
-  unsigned int execute () { return rtl_unroll_and_peel_loops (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_rtl_unroll_and_peel_loops
 
+unsigned int
+pass_rtl_unroll_and_peel_loops::execute (function *fun)
+{
+  if (number_of_loops (fun) > 1)
+    {
+      int flags = 0;
+      if (dump_file)
+	df_dump (dump_file);
+
+      if (flag_peel_loops)
+	flags |= UAP_PEEL;
+      if (flag_unroll_loops)
+	flags |= UAP_UNROLL;
+      if (flag_unroll_all_loops)
+	flags |= UAP_UNROLL_ALL;
+
+      unroll_and_peel_loops (flags);
+    }
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
@@ -617,16 +612,6 @@ make_pass_rtl_unroll_and_peel_loops (gcc::context *ctxt)
 }
 
 \f
-static unsigned int
-rtl_doloop (void)
-{
-#ifdef HAVE_doloop_end
-  if (number_of_loops (cfun) > 1)
-    doloop_optimize_loops ();
-#endif
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_rtl_doloop =
@@ -652,7 +637,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return rtl_doloop (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_rtl_doloop
 
@@ -666,6 +651,16 @@ pass_rtl_doloop::gate (function *)
 #endif
 }
 
+unsigned int
+pass_rtl_doloop::execute (function *fun ATTRIBUTE_UNUSED)
+{
+#ifdef HAVE_doloop_end
+  if (number_of_loops (fun) > 1)
+    doloop_optimize_loops ();
+#endif
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 89d9763..bdad2a6 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1689,22 +1689,6 @@ decompose_multiword_subregs (bool decompose_copies)
 \f
 /* Implement first lower subreg pass.  */
 
-static unsigned int
-rest_of_handle_lower_subreg (void)
-{
-  decompose_multiword_subregs (false);
-  return 0;
-}
-
-/* Implement second lower subreg pass.  */
-
-static unsigned int
-rest_of_handle_lower_subreg2 (void)
-{
-  decompose_multiword_subregs (true);
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_lower_subreg =
@@ -1730,7 +1714,11 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_split_wide_types != 0; }
-  unsigned int execute () { return rest_of_handle_lower_subreg (); }
+  virtual unsigned int execute (function *)
+    {
+      decompose_multiword_subregs (false);
+      return 0;
+    }
 
 }; // class pass_lower_subreg
 
@@ -1742,6 +1730,8 @@ make_pass_lower_subreg (gcc::context *ctxt)
   return new pass_lower_subreg (ctxt);
 }
 
+/* Implement second lower subreg pass.  */
+
 namespace {
 
 const pass_data pass_data_lower_subreg2 =
@@ -1768,7 +1758,11 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_split_wide_types != 0; }
-  unsigned int execute () { return rest_of_handle_lower_subreg2 (); }
+  virtual unsigned int execute (function *)
+    {
+      decompose_multiword_subregs (true);
+      return 0;
+    }
 
 }; // class pass_lower_subreg2
 
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index e73d6ee..b132cba 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -789,16 +789,6 @@ optimize_mode_switching (void)
 
 #endif /* OPTIMIZE_MODE_SWITCHING */
 \f
-static unsigned int
-rest_of_handle_mode_switching (void)
-{
-#ifdef OPTIMIZE_MODE_SWITCHING
-  optimize_mode_switching ();
-#endif /* OPTIMIZE_MODE_SWITCHING */
-  return 0;
-}
-
-
 namespace {
 
 const pass_data pass_data_mode_switching =
@@ -835,7 +825,13 @@ public:
 #endif
     }
 
-  unsigned int execute () { return rest_of_handle_mode_switching (); }
+  virtual unsigned int execute (function *)
+    {
+#ifdef OPTIMIZE_MODE_SWITCHING
+      optimize_mode_switching ();
+#endif /* OPTIMIZE_MODE_SWITCHING */
+      return 0;
+    }
 
 }; // class pass_mode_switching
 
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index 20e2e62..2e454f5 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -3325,28 +3325,6 @@ rotate_partial_schedule (partial_schedule_ptr ps, int start_cycle)
 \f
 /* Run instruction scheduler.  */
 /* Perform SMS module scheduling.  */
-static unsigned int
-rest_of_handle_sms (void)
-{
-#ifdef INSN_SCHEDULING
-  basic_block bb;
-
-  /* Collect loop information to be used in SMS.  */
-  cfg_layout_initialize (0);
-  sms_schedule ();
-
-  /* Update the life information, because we add pseudos.  */
-  max_regno = max_reg_num ();
-
-  /* Finalize layout changes.  */
-  FOR_EACH_BB_FN (bb, cfun)
-    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
-      bb->aux = bb->next_bb;
-  free_dominance_info (CDI_DOMINATORS);
-  cfg_layout_finalize ();
-#endif /* INSN_SCHEDULING */
-  return 0;
-}
 
 namespace {
 
@@ -3378,10 +3356,33 @@ public:
   return (optimize > 0 && flag_modulo_sched);
 }
 
-  unsigned int execute () { return rest_of_handle_sms (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_sms
 
+unsigned int
+pass_sms::execute (function *fun ATTRIBUTE_UNUSED)
+{
+#ifdef INSN_SCHEDULING
+  basic_block bb;
+
+  /* Collect loop information to be used in SMS.  */
+  cfg_layout_initialize (0);
+  sms_schedule ();
+
+  /* Update the life information, because we add pseudos.  */
+  max_regno = max_reg_num ();
+
+  /* Finalize layout changes.  */
+  FOR_EACH_BB_FN (bb, fun)
+    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (fun))
+      bb->aux = bb->next_bb;
+  free_dominance_info (CDI_DOMINATORS);
+  cfg_layout_finalize ();
+#endif /* INSN_SCHEDULING */
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 0e96b88..0a46fb7 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8356,7 +8356,7 @@ public:
 	       || flag_cilkplus != 0) && !seen_error ());
     }
 
-  unsigned int execute () { return execute_expand_omp (); }
+  virtual unsigned int execute (function *) { return execute_expand_omp (); }
 
 }; // class pass_expand_omp
 
@@ -10215,7 +10215,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return execute_lower_omp (); }
+  virtual unsigned int execute (function *) { return execute_lower_omp (); }
 
 }; // class pass_lower_omp
 
@@ -10640,9 +10640,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_openmp || flag_cilkplus; }
-  unsigned int execute () {
-    return diagnose_omp_structured_block_errors ();
-  }
+  virtual unsigned int execute (function *)
+    {
+      return diagnose_omp_structured_block_errors ();
+    }
 
 }; // class pass_diagnose_omp_blocks
 
@@ -11804,7 +11805,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return ipa_omp_simd_clone (); }
+  virtual unsigned int execute (function *) { return ipa_omp_simd_clone (); }
 };
 
 bool
diff --git a/gcc/passes.c b/gcc/passes.c
index b71c11e..2be7856 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -114,7 +114,7 @@ opt_pass::gate (function *)
 }
 
 unsigned int
-opt_pass::execute ()
+opt_pass::execute (function *)
 {
   return 0;
 }
@@ -138,7 +138,7 @@ pass_manager::execute_early_local_passes ()
 unsigned int
 pass_manager::execute_pass_mode_switching ()
 {
-  return pass_mode_switching_1->execute ();
+  return pass_mode_switching_1->execute (cfun);
 }
 
 
@@ -367,7 +367,10 @@ public:
       return (!seen_error () && !in_lto_p);
     }
 
-  unsigned int execute () { return execute_all_early_local_passes (); }
+  virtual unsigned int execute (function *)
+    {
+      return execute_all_early_local_passes ();
+    }
 
 }; // class pass_early_local_passes
 
@@ -2153,7 +2156,7 @@ execute_one_pass (opt_pass *pass)
   /* Do it!  */
   if (pass->has_execute)
     {
-      todo_after = pass->execute ();
+      todo_after = pass->execute (cfun);
       do_per_function (clear_last_verified, NULL);
     }
 
diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index 8a804fb..f5d5363 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -1347,7 +1347,7 @@ public:
 	      && optimize_function_for_speed_p (fun));
     }
 
-  unsigned int execute () { return rest_of_handle_gcse2 (); }
+  virtual unsigned int execute (function *) { return rest_of_handle_gcse2 (); }
 
 }; // class pass_gcse2
 
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 0568c53..b093287 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -2315,23 +2315,6 @@ move2add_note_store (rtx dst, const_rtx set, void *data)
     }
 }
 \f
-static unsigned int
-rest_of_handle_postreload (void)
-{
-  if (!dbg_cnt (postreload_cse))
-    return 0;
-
-  /* Do a very simple CSE pass over just the hard registers.  */
-  reload_cse_regs (get_insns ());
-  /* Reload_cse_regs can eliminate potentially-trapping MEMs.
-     Remove any EH edges associated with them.  */
-  if (cfun->can_throw_non_call_exceptions
-      && purge_all_dead_edges ())
-    cleanup_cfg (0);
-
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_postreload_cse =
@@ -2358,10 +2341,27 @@ public:
   /* opt_pass methods: */
   virtual bool gate (function *) { return (optimize > 0 && reload_completed); }
 
-  unsigned int execute () { return rest_of_handle_postreload (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_postreload_cse
 
+unsigned int
+pass_postreload_cse::execute (function *fun)
+{
+  if (!dbg_cnt (postreload_cse))
+    return 0;
+
+  /* Do a very simple CSE pass over just the hard registers.  */
+  reload_cse_regs (get_insns ());
+  /* Reload_cse_regs can eliminate potentially-trapping MEMs.
+     Remove any EH edges associated with them.  */
+  if (fun->can_throw_non_call_exceptions
+      && purge_all_dead_edges ())
+    cleanup_cfg (0);
+
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/predict.c b/gcc/predict.c
index 068c187..a847ec6 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1986,59 +1986,6 @@ expr_expected_value (tree expr, bitmap visited,
   return expr_expected_value_1 (TREE_TYPE (expr),
 				op0, code, op1, visited, predictor);
 }
-
-\f
-/* Get rid of all builtin_expect calls and GIMPLE_PREDICT statements
-   we no longer need.  */
-static unsigned int
-strip_predict_hints (void)
-{
-  basic_block bb;
-  gimple ass_stmt;
-  tree var;
-
-  FOR_EACH_BB_FN (bb, cfun)
-    {
-      gimple_stmt_iterator bi;
-      for (bi = gsi_start_bb (bb); !gsi_end_p (bi);)
-	{
-	  gimple stmt = gsi_stmt (bi);
-
-	  if (gimple_code (stmt) == GIMPLE_PREDICT)
-	    {
-	      gsi_remove (&bi, true);
-	      continue;
-	    }
-	  else if (is_gimple_call (stmt))
-	    {
-	      tree fndecl = gimple_call_fndecl (stmt);
-
-	      if ((fndecl
-		   && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
-		   && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
-		   && gimple_call_num_args (stmt) == 2)
-		  || (gimple_call_internal_p (stmt)
-		      && gimple_call_internal_fn (stmt) == IFN_BUILTIN_EXPECT))
-		{
-		  var = gimple_call_lhs (stmt);
-		  if (var)
-		    {
-		      ass_stmt
-			= gimple_build_assign (var, gimple_call_arg (stmt, 0));
-		      gsi_replace (&bi, ass_stmt, true);
-		    }
-		  else
-		    {
-		      gsi_remove (&bi, true);
-		      continue;
-		    }
-		}
-	    }
-	  gsi_next (&bi);
-	}
-    }
-  return 0;
-}
 \f
 /* Predict using opcode of the last statement in basic block.  */
 static void
@@ -2468,37 +2415,6 @@ tree_estimate_probability (void)
   free_dominance_info (CDI_POST_DOMINATORS);
   remove_fake_exit_edges ();
 }
-
-/* Predict branch probabilities and estimate profile of the tree CFG.
-   This is the driver function for PASS_PROFILE.  */
-
-static unsigned int
-tree_estimate_probability_driver (void)
-{
-  unsigned nb_loops;
-
-  loop_optimizer_init (LOOPS_NORMAL);
-  if (dump_file && (dump_flags & TDF_DETAILS))
-    flow_loops_dump (dump_file, NULL, 0);
-
-  mark_irreducible_loops ();
-
-  nb_loops = number_of_loops (cfun);
-  if (nb_loops > 1)
-    scev_initialize ();
-
-  tree_estimate_probability ();
-
-  if (nb_loops > 1)
-    scev_finalize ();
-
-  loop_optimizer_finalize ();
-  if (dump_file && (dump_flags & TDF_DETAILS))
-    gimple_dump_cfg (dump_file, dump_flags);
-  if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
-    profile_status_for_fn (cfun) = PROFILE_GUESSED;
-  return 0;
-}
 \f
 /* Predict edges to successors of CUR whose sources are not postdominated by
    BB by PRED and recurse to all postdominators.  */
@@ -3147,6 +3063,8 @@ predictor_name (enum br_predictor predictor)
   return predictor_info[predictor].name;
 }
 
+/* Predict branch probabilities and estimate profile of the tree CFG. */
+
 namespace {
 
 const pass_data pass_data_profile =
@@ -3172,10 +3090,38 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_guess_branch_prob; }
-  unsigned int execute () { return tree_estimate_probability_driver (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_profile
 
+unsigned int
+pass_profile::execute (function *fun)
+{
+  unsigned nb_loops;
+
+  loop_optimizer_init (LOOPS_NORMAL);
+  if (dump_file && (dump_flags & TDF_DETAILS))
+    flow_loops_dump (dump_file, NULL, 0);
+
+  mark_irreducible_loops ();
+
+  nb_loops = number_of_loops (fun);
+  if (nb_loops > 1)
+    scev_initialize ();
+
+  tree_estimate_probability ();
+
+  if (nb_loops > 1)
+    scev_finalize ();
+
+  loop_optimizer_finalize ();
+  if (dump_file && (dump_flags & TDF_DETAILS))
+    gimple_dump_cfg (dump_file, dump_flags);
+ if (profile_status_for_fn (fun) == PROFILE_ABSENT)
+    profile_status_for_fn (fun) = PROFILE_GUESSED;
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -3209,10 +3155,62 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_strip_predict_hints (m_ctxt); }
-  unsigned int execute () { return strip_predict_hints (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_strip_predict_hints
 
+/* Get rid of all builtin_expect calls and GIMPLE_PREDICT statements
+   we no longer need.  */
+unsigned int
+pass_strip_predict_hints::execute (function *fun)
+{
+  basic_block bb;
+  gimple ass_stmt;
+  tree var;
+
+  FOR_EACH_BB_FN (bb, fun)
+    {
+      gimple_stmt_iterator bi;
+      for (bi = gsi_start_bb (bb); !gsi_end_p (bi);)
+	{
+	  gimple stmt = gsi_stmt (bi);
+
+	  if (gimple_code (stmt) == GIMPLE_PREDICT)
+	    {
+	      gsi_remove (&bi, true);
+	      continue;
+	    }
+	  else if (is_gimple_call (stmt))
+	    {
+	      tree fndecl = gimple_call_fndecl (stmt);
+
+	      if ((fndecl
+		   && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
+		   && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
+		   && gimple_call_num_args (stmt) == 2)
+		  || (gimple_call_internal_p (stmt)
+		      && gimple_call_internal_fn (stmt) == IFN_BUILTIN_EXPECT))
+		{
+		  var = gimple_call_lhs (stmt);
+		  if (var)
+		    {
+		      ass_stmt
+			= gimple_build_assign (var, gimple_call_arg (stmt, 0));
+		      gsi_replace (&bi, ass_stmt, true);
+		    }
+		  else
+		    {
+		      gsi_remove (&bi, true);
+		      continue;
+		    }
+		}
+	    }
+	  gsi_next (&bi);
+	}
+    }
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/recog.c b/gcc/recog.c
index 8afea7e..057f411 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3847,7 +3847,10 @@ public:
      a clone method.  */
   opt_pass * clone () { return new pass_peephole2 (m_ctxt); }
   virtual bool gate (function *) { return (optimize > 0 && flag_peephole2); }
-  unsigned int execute () { return rest_of_handle_peephole2 (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_peephole2 ();
+    }
 
 }; // class pass_peephole2
 
@@ -3859,13 +3862,6 @@ make_pass_peephole2 (gcc::context *ctxt)
   return new pass_peephole2 (ctxt);
 }
 
-static unsigned int
-rest_of_handle_split_all_insns (void)
-{
-  split_all_insns ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_split_all_insns =
@@ -3893,7 +3889,11 @@ public:
   /* 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 (m_ctxt); }
-  unsigned int execute () { return rest_of_handle_split_all_insns (); }
+  virtual unsigned int execute (function *)
+    {
+      split_all_insns ();
+      return 0;
+    }
 
 }; // class pass_split_all_insns
 
@@ -3940,7 +3940,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_handle_split_after_reload (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_split_after_reload ();
+    }
 
 }; // class pass_split_after_reload
 
@@ -3952,13 +3955,6 @@ make_pass_split_after_reload (gcc::context *ctxt)
   return new pass_split_after_reload (ctxt);
 }
 
-static unsigned int
-rest_of_handle_split_before_regstack (void)
-{
-  split_all_insns ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_split_before_regstack =
@@ -3984,9 +3980,11 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () {
-    return rest_of_handle_split_before_regstack ();
-  }
+  virtual unsigned int execute (function *)
+    {
+      split_all_insns ();
+      return 0;
+    }
 
 }; // class pass_split_before_regstack
 
@@ -4058,7 +4056,10 @@ public:
 #endif
     }
 
-  unsigned int execute () { return rest_of_handle_split_before_sched2 (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_split_before_sched2 ();
+    }
 
 }; // class pass_split_before_sched2
 
@@ -4105,7 +4106,10 @@ public:
 #endif
     }
 
-  unsigned int execute () { return split_all_insns_noflow (); }
+  virtual unsigned int execute (function *)
+    {
+      return split_all_insns_noflow ();
+    }
 
 }; // class pass_split_for_shorten_branches
 
diff --git a/gcc/ree.c b/gcc/ree.c
index 435bb88..b471033 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -1118,7 +1118,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return (optimize > 0 && flag_ree); }
-  unsigned int execute () { return rest_of_handle_ree (); }
+  virtual unsigned int execute (function *) { return rest_of_handle_ree (); }
 
 }; // class pass_ree
 
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index f8f8658..7aa8a6b 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -3364,7 +3364,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_handle_stack_regs (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_stack_regs ();
+    }
 
 }; // class pass_stack_regs_run
 
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index 24992e4..c1fbb65 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -1056,93 +1056,6 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
   return anything_changed;
 }
 
-/* Main entry point for the forward copy propagation optimization.  */
-
-static unsigned int
-copyprop_hardreg_forward (void)
-{
-  struct value_data *all_vd;
-  basic_block bb;
-  sbitmap visited;
-  bool analyze_called = false;
-
-  all_vd = XNEWVEC (struct value_data, last_basic_block_for_fn (cfun));
-
-  visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
-  bitmap_clear (visited);
-
-  if (MAY_HAVE_DEBUG_INSNS)
-    debug_insn_changes_pool
-      = create_alloc_pool ("debug insn changes pool",
-			   sizeof (struct queued_debug_insn_change), 256);
-
-  FOR_EACH_BB_FN (bb, cfun)
-    {
-      bitmap_set_bit (visited, bb->index);
-
-      /* If a block has a single predecessor, that we've already
-	 processed, begin with the value data that was live at
-	 the end of the predecessor block.  */
-      /* ??? Ought to use more intelligent queuing of blocks.  */
-      if (single_pred_p (bb)
-	  && bitmap_bit_p (visited, single_pred (bb)->index)
-	  && ! (single_pred_edge (bb)->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)))
-	{
-	  all_vd[bb->index] = all_vd[single_pred (bb)->index];
-	  if (all_vd[bb->index].n_debug_insn_changes)
-	    {
-	      unsigned int regno;
-
-	      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
-		{
-		  if (all_vd[bb->index].e[regno].debug_insn_changes)
-		    {
-		      all_vd[bb->index].e[regno].debug_insn_changes = NULL;
-		      if (--all_vd[bb->index].n_debug_insn_changes == 0)
-			break;
-		    }
-		}
-	    }
-	}
-      else
-	init_value_data (all_vd + bb->index);
-
-      copyprop_hardreg_forward_1 (bb, all_vd + bb->index);
-    }
-
-  if (MAY_HAVE_DEBUG_INSNS)
-    {
-      FOR_EACH_BB_FN (bb, cfun)
-	if (bitmap_bit_p (visited, bb->index)
-	    && all_vd[bb->index].n_debug_insn_changes)
-	  {
-	    unsigned int regno;
-	    bitmap live;
-
-	    if (!analyze_called)
-	      {
-		df_analyze ();
-		analyze_called = true;
-	      }
-	    live = df_get_live_out (bb);
-	    for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
-	      if (all_vd[bb->index].e[regno].debug_insn_changes)
-		{
-		  if (REGNO_REG_SET_P (live, regno))
-		    apply_debug_insn_changes (all_vd + bb->index, regno);
-		  if (all_vd[bb->index].n_debug_insn_changes == 0)
-		    break;
-		}
-	  }
-
-      free_alloc_pool (debug_insn_changes_pool);
-    }
-
-  sbitmap_free (visited);
-  free (all_vd);
-  return 0;
-}
-
 /* Dump the value chain data to stderr.  */
 
 DEBUG_FUNCTION void
@@ -1276,10 +1189,95 @@ public:
       return (optimize > 0 && (flag_cprop_registers));
     }
 
-  unsigned int execute () { return copyprop_hardreg_forward (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_cprop_hardreg
 
+unsigned int
+pass_cprop_hardreg::execute (function *fun)
+{
+  struct value_data *all_vd;
+  basic_block bb;
+  sbitmap visited;
+  bool analyze_called = false;
+
+  all_vd = XNEWVEC (struct value_data, last_basic_block_for_fn (fun));
+
+  visited = sbitmap_alloc (last_basic_block_for_fn (fun));
+  bitmap_clear (visited);
+
+  if (MAY_HAVE_DEBUG_INSNS)
+    debug_insn_changes_pool
+      = create_alloc_pool ("debug insn changes pool",
+			   sizeof (struct queued_debug_insn_change), 256);
+
+  FOR_EACH_BB_FN (bb, fun)
+    {
+      bitmap_set_bit (visited, bb->index);
+
+      /* If a block has a single predecessor, that we've already
+	 processed, begin with the value data that was live at
+	 the end of the predecessor block.  */
+      /* ??? Ought to use more intelligent queuing of blocks.  */
+      if (single_pred_p (bb)
+	  && bitmap_bit_p (visited, single_pred (bb)->index)
+	  && ! (single_pred_edge (bb)->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)))
+	{
+	  all_vd[bb->index] = all_vd[single_pred (bb)->index];
+	  if (all_vd[bb->index].n_debug_insn_changes)
+	    {
+	      unsigned int regno;
+
+	      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+		{
+		  if (all_vd[bb->index].e[regno].debug_insn_changes)
+		    {
+		      all_vd[bb->index].e[regno].debug_insn_changes = NULL;
+		      if (--all_vd[bb->index].n_debug_insn_changes == 0)
+			break;
+		    }
+		}
+	    }
+	}
+      else
+	init_value_data (all_vd + bb->index);
+
+      copyprop_hardreg_forward_1 (bb, all_vd + bb->index);
+    }
+
+  if (MAY_HAVE_DEBUG_INSNS)
+    {
+      FOR_EACH_BB_FN (bb, fun)
+	if (bitmap_bit_p (visited, bb->index)
+	    && all_vd[bb->index].n_debug_insn_changes)
+	  {
+	    unsigned int regno;
+	    bitmap live;
+
+	    if (!analyze_called)
+	      {
+		df_analyze ();
+		analyze_called = true;
+	      }
+	    live = df_get_live_out (bb);
+	    for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+	      if (all_vd[bb->index].e[regno].debug_insn_changes)
+		{
+		  if (REGNO_REG_SET_P (live, regno))
+		    apply_debug_insn_changes (all_vd + bb->index, regno);
+		  if (all_vd[bb->index].n_debug_insn_changes == 0)
+		    break;
+		}
+	  }
+
+      free_alloc_pool (debug_insn_changes_pool);
+    }
+
+  sbitmap_free (visited);
+  free (all_vd);
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 82b6081..42668a1 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -985,7 +985,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return reginfo_init (); }
+  virtual unsigned int execute (function *) { return reginfo_init (); }
 
 }; // class pass_reginfo_init
 
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 321d5bf..68e8ad7 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -1865,7 +1865,7 @@ public:
       return (optimize > 0 && (flag_rename_registers));
     }
 
-  unsigned int execute () { return regrename_optimize (); }
+  virtual unsigned int execute (function *) { return regrename_optimize (); }
 
 }; // class pass_regrename
 
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 22f0b5a..95e942f 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3898,7 +3898,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return rest_of_handle_delay_slots (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_delay_slots ();
+    }
 
 }; // class pass_delay_slots
 
@@ -3923,13 +3926,6 @@ make_pass_delay_slots (gcc::context *ctxt)
 
 /* Machine dependent reorg pass.  */
 
-static unsigned int
-rest_of_handle_machine_reorg (void)
-{
-  targetm.machine_dependent_reorg ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_machine_reorg =
@@ -3959,7 +3955,11 @@ public:
       return targetm.machine_dependent_reorg != 0;
     }
 
-  unsigned int execute () { return rest_of_handle_machine_reorg (); }
+  virtual unsigned int execute (function *)
+    {
+      targetm.machine_dependent_reorg ();
+      return 0;
+    }
 
 }; // class pass_machine_reorg
 
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index e0a80c2..ce3fe5d 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -3677,7 +3677,10 @@ public:
 #endif
     }
 
-  unsigned int execute () { return rest_of_handle_live_range_shrinkage (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_live_range_shrinkage ();
+    }
 
 }; // class pass_live_range_shrinkage
 
@@ -3715,7 +3718,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return rest_of_handle_sched (); }
+  virtual unsigned int execute (function *) { return rest_of_handle_sched (); }
 
 }; // class pass_sched
 
@@ -3763,7 +3766,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return rest_of_handle_sched2 (); }
+  virtual unsigned int execute (function *)
+    {
+      return rest_of_handle_sched2 ();
+    }
 
 }; // class pass_sched2
 
diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c
index d1375a4..75bec2f 100644
--- a/gcc/stack-ptr-mod.c
+++ b/gcc/stack-ptr-mod.c
@@ -48,48 +48,10 @@ notice_stack_pointer_modification_1 (rtx x, const_rtx pat ATTRIBUTE_UNUSED,
     crtl->sp_is_unchanging = 0;
 }
 
-static void
-notice_stack_pointer_modification (void)
-{
-  basic_block bb;
-  rtx insn;
-
-  /* Assume that the stack pointer is unchanging if alloca hasn't
-     been used.  */
-  crtl->sp_is_unchanging = !cfun->calls_alloca;
-  if (crtl->sp_is_unchanging)
-    FOR_EACH_BB_FN (bb, cfun)
-      FOR_BB_INSNS (bb, insn)
-        {
-	  if (INSN_P (insn))
-	    {
-	      /* Check if insn modifies the stack pointer.  */
-	      note_stores (PATTERN (insn),
-			   notice_stack_pointer_modification_1,
-			   NULL);
-	      if (! crtl->sp_is_unchanging)
-		return;
-	    }
-	}
-
-  /* The value coming into this pass was 0, and the exit block uses
-     are based on this.  If the value is now 1, we need to redo the
-     exit block uses.  */
-  if (df && crtl->sp_is_unchanging)
-    df_update_exit_block_uses ();
-}
-
   /* Some targets can emit simpler epilogues if they know that sp was
      not ever modified during the function.  After reload, of course,
      we've already emitted the epilogue so there's no sense searching.  */
 
-static unsigned int
-rest_of_handle_stack_ptr_mod (void)
-{
-  notice_stack_pointer_modification ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_stack_ptr_mod =
@@ -114,10 +76,43 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return rest_of_handle_stack_ptr_mod (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_stack_ptr_mod
 
+unsigned int
+pass_stack_ptr_mod::execute (function *fun)
+{
+  basic_block bb;
+  rtx insn;
+
+  /* Assume that the stack pointer is unchanging if alloca hasn't
+     been used.  */
+  crtl->sp_is_unchanging = !fun->calls_alloca;
+  if (crtl->sp_is_unchanging)
+    FOR_EACH_BB_FN (bb, fun)
+      FOR_BB_INSNS (bb, insn)
+        {
+	  if (INSN_P (insn))
+	    {
+	      /* Check if insn modifies the stack pointer.  */
+	      note_stores (PATTERN (insn),
+			   notice_stack_pointer_modification_1,
+			   NULL);
+	      if (! crtl->sp_is_unchanging)
+		return 0;
+	    }
+	}
+
+  /* The value coming into this pass was 0, and the exit block uses
+     are based on this.  If the value is now 1, we need to redo the
+     exit block uses.  */
+  if (df && crtl->sp_is_unchanging)
+    df_update_exit_block_uses ();
+
+  return 0;
+}
+
 } // anon namespace
 
 rtl_opt_pass *
diff --git a/gcc/store-motion.c b/gcc/store-motion.c
index 7c57754..920da53 100644
--- a/gcc/store-motion.c
+++ b/gcc/store-motion.c
@@ -1258,7 +1258,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return execute_rtl_store_motion (); }
+  virtual unsigned int execute (function *)
+    {
+      return execute_rtl_store_motion ();
+    }
 
 }; // class pass_rtl_store_motion
 
diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
index a3b04a2..35eae15 100644
--- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
+++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
@@ -44,14 +44,6 @@ handle_end_of_compilation_unit (void *event_data, void *data)
 }
 
 
-static unsigned int
-execute_dumb_plugin_example (void)
-{
-  warning (0, G_("Analyze function %s"),
-           IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_dumb_plugin_example =
@@ -76,10 +68,18 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return execute_dumb_plugin_example (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_dumb_plugin_example
 
+unsigned int
+pass_dumb_plugin_example::execute (function *)
+{
+  warning (0, G_("Analyze function %s"),
+           IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
+  return 0;
+}
+
 } // anon namespace
 
 static gimple_opt_pass *
diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
index 033047b..59bb03a 100644
--- a/gcc/testsuite/g++.dg/plugin/selfassign.c
+++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
@@ -253,23 +253,6 @@ warn_self_assign (gimple stmt)
     }
 }
 
-/* Entry point for the self-assignment detection pass.  */
-
-static unsigned int
-execute_warn_self_assign (void)
-{
-  gimple_stmt_iterator gsi;
-  basic_block bb;
-
-  FOR_EACH_BB_FN (bb, cfun)
-    {
-      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
-        warn_self_assign (gsi_stmt (gsi));
-    }
-
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_warn_self_assign =
@@ -295,10 +278,25 @@ public:
 
   /* opt_pass methods: */
   bool gate (function *) { return true; }
-  unsigned int execute () { return execute_warn_self_assign (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_warn_self_assign
 
+unsigned int
+pass_warn_self_assign::execute (function *fun)
+{
+  gimple_stmt_iterator gsi;
+  basic_block bb;
+
+  FOR_EACH_BB_FN (bb, fun)
+    {
+      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+        warn_self_assign (gsi_stmt (gsi));
+    }
+
+  return 0;
+}
+
 } // anon namespace
 
 static gimple_opt_pass *
diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
index 18e8b07..d70f558 100644
--- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
@@ -50,7 +50,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute ();
+  virtual unsigned int execute (function *);
 
 private:
   int counter;
@@ -63,7 +63,8 @@ bool one_pass::gate (function *)
   return true;
 }
 
-unsigned int one_pass::execute ()
+unsigned int
+one_pass::execute (function *)
 {
   if (counter > 0) {
     printf ("Executed more than once \n");
diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
index 098df06..4dad0c2 100644
--- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
+++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
@@ -253,23 +253,6 @@ warn_self_assign (gimple stmt)
     }
 }
 
-/* Entry point for the self-assignment detection pass.  */
-
-static unsigned int
-execute_warn_self_assign (void)
-{
-  gimple_stmt_iterator gsi;
-  basic_block bb;
-
-  FOR_EACH_BB_FN (bb, cfun)
-    {
-      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
-        warn_self_assign (gsi_stmt (gsi));
-    }
-
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_warn_self_assign =
@@ -294,10 +277,25 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return execute_warn_self_assign (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_warn_self_assign
 
+unsigned int
+pass_warn_self_assign::execute (function *fun)
+{
+  gimple_stmt_iterator gsi;
+  basic_block bb;
+
+  FOR_EACH_BB_FN (bb, fun)
+    {
+      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+        warn_self_assign (gsi_stmt (gsi));
+    }
+
+  return 0;
+}
+
 } // anon namespace
 
 static gimple_opt_pass *
diff --git a/gcc/tracer.c b/gcc/tracer.c
index 794d385..09a8f40 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -367,36 +367,6 @@ tail_duplicate (void)
 
   return changed;
 }
-
-/* Main entry point to this file.  */
-
-static unsigned int
-tracer (void)
-{
-  bool changed;
-
-  if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1)
-    return 0;
-
-  mark_dfs_back_edges ();
-  if (dump_file)
-    brief_dump_cfg (dump_file, dump_flags);
-
-  /* Trace formation is done on the fly inside tail_duplicate */
-  changed = tail_duplicate ();
-  if (changed)
-    {
-      free_dominance_info (CDI_DOMINATORS);
-      /* If we changed the CFG schedule loops for fixup by cleanup_cfg.  */
-      if (current_loops)
-	loops_state_set (LOOPS_NEED_FIXUP);
-    }
-
-  if (dump_file)
-    brief_dump_cfg (dump_file, dump_flags);
-
-  return changed ? TODO_cleanup_cfg : 0;
-}
 \f
 namespace {
 
@@ -427,10 +397,37 @@ public:
       return (optimize > 0 && flag_tracer && flag_reorder_blocks);
     }
 
-  unsigned int execute () { return tracer (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_tracer
 
+unsigned int
+pass_tracer::execute (function *fun)
+{
+  bool changed;
+
+  if (n_basic_blocks_for_fn (fun) <= NUM_FIXED_BLOCKS + 1)
+    return 0;
+
+  mark_dfs_back_edges ();
+  if (dump_file)
+    brief_dump_cfg (dump_file, dump_flags);
+
+  /* Trace formation is done on the fly inside tail_duplicate */
+  changed = tail_duplicate ();
+  if (changed)
+    {
+      free_dominance_info (CDI_DOMINATORS);
+      /* If we changed the CFG schedule loops for fixup by cleanup_cfg.  */
+      if (current_loops)
+	loops_state_set (LOOPS_NEED_FIXUP);
+    }
+
+  if (dump_file)
+    brief_dump_cfg (dump_file, dump_flags);
+
+  return changed ? TODO_cleanup_cfg : 0;
+}
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index be876f5..2aa8bab 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -856,7 +856,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tm; }
-  unsigned int execute () { return diagnose_tm_blocks (); }
+  virtual unsigned int execute (function *) { return diagnose_tm_blocks (); }
 
 }; // class pass_diagnose_tm_blocks
 
@@ -1778,7 +1778,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tm; }
-  unsigned int execute () { return execute_lower_tm (); }
+  virtual unsigned int execute (function *) { return execute_lower_tm (); }
 
 }; // class pass_lower_tm
 
@@ -3029,7 +3029,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return execute_tm_mark (); }
+  virtual unsigned int execute (function *) { return execute_tm_mark (); }
 
 }; // class pass_tm_mark
 
@@ -3162,31 +3162,6 @@ expand_block_edges (struct tm_region *const region, basic_block bb)
 
 /* Entry point to the final expansion of transactional nodes. */
 
-static unsigned int
-execute_tm_edges (void)
-{
-  vec<tm_region_p> bb_regions
-    = get_bb_regions_instrumented (/*traverse_clones=*/false,
-				   /*include_uninstrumented_p=*/true);
-  struct tm_region *r;
-  unsigned i;
-
-  FOR_EACH_VEC_ELT (bb_regions, i, r)
-    if (r != NULL)
-      expand_block_edges (r, BASIC_BLOCK_FOR_FN (cfun, i));
-
-  bb_regions.release ();
-
-  /* We've got to release the dominance info now, to indicate that it
-     must be rebuilt completely.  Otherwise we'll crash trying to update
-     the SSA web in the TODO section following this pass.  */
-  free_dominance_info (CDI_DOMINATORS);
-  bitmap_obstack_release (&tm_obstack);
-  all_tm_regions = NULL;
-
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_tm_edges =
@@ -3211,10 +3186,35 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return execute_tm_edges (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_tm_edges
 
+unsigned int
+pass_tm_edges::execute (function *fun)
+{
+  vec<tm_region_p> bb_regions
+    = get_bb_regions_instrumented (/*traverse_clones=*/false,
+				   /*include_uninstrumented_p=*/true);
+  struct tm_region *r;
+  unsigned i;
+
+  FOR_EACH_VEC_ELT (bb_regions, i, r)
+    if (r != NULL)
+      expand_block_edges (r, BASIC_BLOCK_FOR_FN (fun, i));
+
+  bb_regions.release ();
+
+  /* We've got to release the dominance info now, to indicate that it
+     must be rebuilt completely.  Otherwise we'll crash trying to update
+     the SSA web in the TODO section following this pass.  */
+  free_dominance_info (CDI_DOMINATORS);
+  bitmap_obstack_release (&tm_obstack);
+  all_tm_regions = NULL;
+
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -3946,7 +3946,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tm && optimize > 0; }
-  unsigned int execute () { return execute_tm_memopt (); }
+  virtual unsigned int execute (function *) { return execute_tm_memopt (); }
 
 }; // class pass_tm_memopt
 
@@ -5581,7 +5581,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tm; }
-  unsigned int execute () { return ipa_tm_execute (); }
+  virtual unsigned int execute (function *) { return ipa_tm_execute (); }
 
 }; // class pass_ipa_tm
 
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index c271493..ea1df8b 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -867,16 +867,51 @@ shrink_wrap_conditional_dead_built_in_calls (vec<gimple> calls)
   return changed;
 }
 
-/* Pass entry points.  */
+namespace {
+
+const pass_data pass_data_call_cdce =
+{
+  GIMPLE_PASS, /* type */
+  "cdce", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_CALL_CDCE, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_verify_ssa, /* todo_flags_finish */
+};
+
+class pass_call_cdce : public gimple_opt_pass
+{
+public:
+  pass_call_cdce (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_call_cdce, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *fun)
+    {
+      /* The limit constants used in the implementation
+	 assume IEEE floating point format.  Other formats
+	 can be supported in the future if needed.  */
+      return flag_tree_builtin_call_dce != 0
+       	&& optimize_function_for_speed_p (fun);
+    }
 
-static unsigned int
-tree_call_cdce (void)
+  virtual unsigned int execute (function *);
+
+}; // class pass_call_cdce
+
+unsigned int
+pass_call_cdce::execute (function *fun)
 {
   basic_block bb;
   gimple_stmt_iterator i;
   bool something_changed = false;
   auto_vec<gimple> cond_dead_built_in_calls;
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       /* Collect dead call candidates.  */
       for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
@@ -910,50 +945,13 @@ tree_call_cdce (void)
       free_dominance_info (CDI_POST_DOMINATORS);
       /* As we introduced new control-flow we need to insert PHI-nodes
          for the call-clobbers of the remaining call.  */
-      mark_virtual_operands_for_renaming (cfun);
+      mark_virtual_operands_for_renaming (fun);
       return TODO_update_ssa;
     }
 
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_call_cdce =
-{
-  GIMPLE_PASS, /* type */
-  "cdce", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_CALL_CDCE, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_verify_ssa, /* todo_flags_finish */
-};
-
-class pass_call_cdce : public gimple_opt_pass
-{
-public:
-  pass_call_cdce (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_call_cdce, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *fun)
-    {
-      /* The limit constants used in the implementation
-	 assume IEEE floating point format.  Other formats
-	 can be supported in the future if needed.  */
-      return flag_tree_builtin_call_dce != 0
-       	&& optimize_function_for_speed_p (fun);
-    }
-
-  unsigned int execute () { return tree_call_cdce (); }
-
-}; // class pass_call_cdce
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 08e0280..03f8748 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -368,7 +368,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return execute_build_cfg (); }
+  virtual unsigned int execute (function *) { return execute_build_cfg (); }
 
 }; // class pass_build_cfg
 
@@ -8100,7 +8100,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return split_critical_edges (); }
+  virtual unsigned int execute (function *) { return split_critical_edges (); }
 
   opt_pass * clone () { return new pass_split_crit_edges (m_ctxt); }
 }; // class pass_split_crit_edges
@@ -8165,64 +8165,6 @@ gimplify_build1 (gimple_stmt_iterator *gsi, enum tree_code code, tree type,
 
 
 \f
-/* Emit return warnings.  */
-
-static unsigned int
-execute_warn_function_return (void)
-{
-  source_location location;
-  gimple last;
-  edge e;
-  edge_iterator ei;
-
-  if (!targetm.warn_func_return (cfun->decl))
-    return 0;
-
-  /* If we have a path to EXIT, then we do return.  */
-  if (TREE_THIS_VOLATILE (cfun->decl)
-      && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) > 0)
-    {
-      location = UNKNOWN_LOCATION;
-      FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
-	{
-	  last = last_stmt (e->src);
-	  if ((gimple_code (last) == GIMPLE_RETURN
-	       || gimple_call_builtin_p (last, BUILT_IN_RETURN))
-	      && (location = gimple_location (last)) != UNKNOWN_LOCATION)
-	    break;
-	}
-      if (location == UNKNOWN_LOCATION)
-	location = cfun->function_end_locus;
-      warning_at (location, 0, "%<noreturn%> function does return");
-    }
-
-  /* If we see "return;" in some basic block, then we do reach the end
-     without returning a value.  */
-  else if (warn_return_type
-	   && !TREE_NO_WARNING (cfun->decl)
-	   && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) > 0
-	   && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (cfun->decl))))
-    {
-      FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
-	{
-	  gimple last = last_stmt (e->src);
-	  if (gimple_code (last) == GIMPLE_RETURN
-	      && gimple_return_retval (last) == NULL
-	      && !gimple_no_warning_p (last))
-	    {
-	      location = gimple_location (last);
-	      if (location == UNKNOWN_LOCATION)
-		  location = cfun->function_end_locus;
-	      warning_at (location, OPT_Wreturn_type, "control reaches end of non-void function");
-	      TREE_NO_WARNING (cfun->decl) = 1;
-	      break;
-	    }
-	}
-    }
-  return 0;
-}
-
-
 /* Given a basic block B which ends with a conditional and has
    precisely two successors, determine which of the edges is taken if
    the conditional is true and which is taken if the conditional is
@@ -8247,6 +8189,8 @@ extract_true_false_edges_from_block (basic_block b,
     }
 }
 
+/* Emit return warnings.  */
+
 namespace {
 
 const pass_data pass_data_warn_function_return =
@@ -8271,10 +8215,65 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return execute_warn_function_return (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_warn_function_return
 
+unsigned int
+pass_warn_function_return::execute (function *fun)
+{
+  source_location location;
+  gimple last;
+  edge e;
+  edge_iterator ei;
+
+  if (!targetm.warn_func_return (fun->decl))
+    return 0;
+
+  /* If we have a path to EXIT, then we do return.  */
+  if (TREE_THIS_VOLATILE (fun->decl)
+      && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0)
+    {
+      location = UNKNOWN_LOCATION;
+      FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (fun)->preds)
+	{
+	  last = last_stmt (e->src);
+	  if ((gimple_code (last) == GIMPLE_RETURN
+	       || gimple_call_builtin_p (last, BUILT_IN_RETURN))
+	      && (location = gimple_location (last)) != UNKNOWN_LOCATION)
+	    break;
+	}
+      if (location == UNKNOWN_LOCATION)
+	location = cfun->function_end_locus;
+      warning_at (location, 0, "%<noreturn%> function does return");
+    }
+
+  /* If we see "return;" in some basic block, then we do reach the end
+     without returning a value.  */
+  else if (warn_return_type
+	   && !TREE_NO_WARNING (fun->decl)
+	   && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0
+	   && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl))))
+    {
+      FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (fun)->preds)
+	{
+	  gimple last = last_stmt (e->src);
+	  if (gimple_code (last) == GIMPLE_RETURN
+	      && gimple_return_retval (last) == NULL
+	      && !gimple_no_warning_p (last))
+	    {
+	      location = gimple_location (last);
+	      if (location == UNKNOWN_LOCATION)
+		location = fun->function_end_locus;
+	      warning_at (location, OPT_Wreturn_type, "control reaches end of non-void function");
+	      TREE_NO_WARNING (fun->decl) = 1;
+	      break;
+	    }
+	}
+    }
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -8348,13 +8347,6 @@ do_warn_unused_result (gimple_seq seq)
     }
 }
 
-static unsigned int
-run_warn_unused_result (void)
-{
-  do_warn_unused_result (gimple_body (current_function_decl));
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_warn_unused_result =
@@ -8380,7 +8372,11 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_warn_unused_result; }
-  unsigned int execute () { return run_warn_unused_result (); }
+  virtual unsigned int execute (function *)
+    {
+      do_warn_unused_result (gimple_body (current_function_decl));
+      return 0;
+    }
 
 }; // class pass_warn_unused_result
 
@@ -8522,7 +8518,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_fixup_cfg (m_ctxt); }
-  unsigned int execute () { return execute_fixup_cfg (); }
+  virtual unsigned int execute (function *) { return execute_fixup_cfg (); }
 
 }; // class pass_fixup_cfg
 
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 19433f9..1046207 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -944,17 +944,46 @@ remove_forwarder_block_with_phi (basic_block bb)
 <L10>:;
 */
 
-static unsigned int
-merge_phi_nodes (void)
+namespace {
+
+const pass_data pass_data_merge_phi =
+{
+  GIMPLE_PASS, /* type */
+  "mergephi", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_MERGE_PHI, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_verify_ssa, /* todo_flags_finish */
+};
+
+class pass_merge_phi : public gimple_opt_pass
 {
-  basic_block *worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
+public:
+  pass_merge_phi (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_merge_phi, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_merge_phi (m_ctxt); }
+  virtual unsigned int execute (function *);
+
+}; // class pass_merge_phi
+
+unsigned int
+pass_merge_phi::execute (function *fun)
+{
+  basic_block *worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (fun));
   basic_block *current = worklist;
   basic_block bb;
 
   calculate_dominance_info (CDI_DOMINATORS);
 
   /* Find all PHI nodes that we may be able to merge.  */
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       basic_block dest;
 
@@ -1035,35 +1064,6 @@ merge_phi_nodes (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_merge_phi =
-{
-  GIMPLE_PASS, /* type */
-  "mergephi", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_MERGE_PHI, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_verify_ssa, /* todo_flags_finish */
-};
-
-class pass_merge_phi : public gimple_opt_pass
-{
-public:
-  pass_merge_phi (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_merge_phi, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_merge_phi (m_ctxt); }
-  unsigned int execute () { return merge_phi_nodes (); }
-
-}; // class pass_merge_phi
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -1142,9 +1142,10 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () {
-    return execute_cleanup_cfg_post_optimizing ();
-  }
+  virtual unsigned int execute (function *)
+    {
+      return execute_cleanup_cfg_post_optimizing ();
+    }
 
 }; // class pass_cleanup_cfg_post_optimizing
 
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 9ec83d9..a97aaf9 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1680,7 +1680,7 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_lower_complex (m_ctxt); }
-  unsigned int execute () { return tree_lower_complex (); }
+  virtual unsigned int execute (function *) { return tree_lower_complex (); }
 
 }; // class pass_lower_complex
 
@@ -1724,7 +1724,7 @@ public:
       return !(fun->curr_properties & PROP_gimple_lcx);
     }
 
-  unsigned int execute () { return tree_lower_complex (); }
+  virtual unsigned int execute (function *) { return tree_lower_complex (); }
 
 }; // class pass_lower_complex_O0
 
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 41f96c4..960c04a 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2121,8 +2121,36 @@ lower_eh_constructs_1 (struct leh_state *state, gimple_seq *pseq)
     lower_eh_constructs_2 (state, &gsi);
 }
 
-static unsigned int
-lower_eh_constructs (void)
+namespace {
+
+const pass_data pass_data_lower_eh =
+{
+  GIMPLE_PASS, /* type */
+  "eh", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_EH, /* tv_id */
+  PROP_gimple_lcf, /* properties_required */
+  PROP_gimple_leh, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_lower_eh : public gimple_opt_pass
+{
+public:
+  pass_lower_eh (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_lower_eh, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual unsigned int execute (function *);
+
+}; // class pass_lower_eh
+
+unsigned int
+pass_lower_eh::execute (function *fun)
 {
   struct leh_state null_state;
   gimple_seq bodyp;
@@ -2155,7 +2183,7 @@ lower_eh_constructs (void)
 
   /* If this function needs a language specific EH personality routine
      and the frontend didn't already set one do so now.  */
-  if (function_needs_eh_personality (cfun) == eh_personality_lang
+  if (function_needs_eh_personality (fun) == eh_personality_lang
       && !DECL_FUNCTION_PERSONALITY (current_function_decl))
     DECL_FUNCTION_PERSONALITY (current_function_decl)
       = lang_hooks.eh_personality ();
@@ -2163,34 +2191,6 @@ lower_eh_constructs (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_lower_eh =
-{
-  GIMPLE_PASS, /* type */
-  "eh", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_EH, /* tv_id */
-  PROP_gimple_lcf, /* properties_required */
-  PROP_gimple_leh, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_lower_eh : public gimple_opt_pass
-{
-public:
-  pass_lower_eh (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_lower_eh, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  unsigned int execute () { return lower_eh_constructs (); }
-
-}; // class pass_lower_eh
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -3108,13 +3108,6 @@ refactor_eh_r (gimple_seq seq)
     }
 }
 
-static unsigned
-refactor_eh (void)
-{
-  refactor_eh_r (gimple_body (current_function_decl));
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_refactor_eh =
@@ -3140,7 +3133,11 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_exceptions != 0; }
-  unsigned int execute () { return refactor_eh (); }
+  virtual unsigned int execute (function *)
+    {
+      refactor_eh_r (gimple_body (current_function_decl));
+      return 0;
+    }
 
 }; // class pass_refactor_eh
 
@@ -3304,37 +3301,6 @@ lower_resx (basic_block bb, gimple stmt, struct pointer_map_t *mnt_map)
   return ret;
 }
 
-static unsigned
-execute_lower_resx (void)
-{
-  basic_block bb;
-  struct pointer_map_t *mnt_map;
-  bool dominance_invalidated = false;
-  bool any_rewritten = false;
-
-  mnt_map = pointer_map_create ();
-
-  FOR_EACH_BB_FN (bb, cfun)
-    {
-      gimple last = last_stmt (bb);
-      if (last && is_gimple_resx (last))
-	{
-	  dominance_invalidated |= lower_resx (bb, last, mnt_map);
-	  any_rewritten = true;
-	}
-    }
-
-  pointer_map_destroy (mnt_map);
-
-  if (dominance_invalidated)
-    {
-      free_dominance_info (CDI_DOMINATORS);
-      free_dominance_info (CDI_POST_DOMINATORS);
-    }
-
-  return any_rewritten ? TODO_update_ssa_only_virtuals : 0;
-}
-
 namespace {
 
 const pass_data pass_data_lower_resx =
@@ -3360,10 +3326,41 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_exceptions != 0; }
-  unsigned int execute () { return execute_lower_resx (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_lower_resx
 
+unsigned
+pass_lower_resx::execute (function *fun)
+{
+  basic_block bb;
+  struct pointer_map_t *mnt_map;
+  bool dominance_invalidated = false;
+  bool any_rewritten = false;
+
+  mnt_map = pointer_map_create ();
+
+  FOR_EACH_BB_FN (bb, fun)
+    {
+      gimple last = last_stmt (bb);
+      if (last && is_gimple_resx (last))
+	{
+	  dominance_invalidated |= lower_resx (bb, last, mnt_map);
+	  any_rewritten = true;
+	}
+    }
+
+  pointer_map_destroy (mnt_map);
+
+  if (dominance_invalidated)
+    {
+      free_dominance_info (CDI_DOMINATORS);
+      free_dominance_info (CDI_POST_DOMINATORS);
+    }
+
+  return any_rewritten ? TODO_update_ssa_only_virtuals : 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -3704,8 +3701,37 @@ lower_eh_dispatch (basic_block src, gimple stmt)
   return redirected;
 }
 
-static unsigned
-execute_lower_eh_dispatch (void)
+namespace {
+
+const pass_data pass_data_lower_eh_dispatch =
+{
+  GIMPLE_PASS, /* type */
+  "ehdisp", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_EH, /* tv_id */
+  PROP_gimple_lcf, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_verify_flow, /* todo_flags_finish */
+};
+
+class pass_lower_eh_dispatch : public gimple_opt_pass
+{
+public:
+  pass_lower_eh_dispatch (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_lower_eh_dispatch, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *fun) { return fun->eh->region_tree != NULL; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_lower_eh_dispatch
+
+unsigned
+pass_lower_eh_dispatch::execute (function *fun)
 {
   basic_block bb;
   int flags = 0;
@@ -3713,7 +3739,7 @@ execute_lower_eh_dispatch (void)
 
   assign_filter_values ();
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple last = last_stmt (bb);
       if (last == NULL)
@@ -3737,36 +3763,6 @@ execute_lower_eh_dispatch (void)
   return flags;
 }
 
-namespace {
-
-const pass_data pass_data_lower_eh_dispatch =
-{
-  GIMPLE_PASS, /* type */
-  "ehdisp", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_EH, /* tv_id */
-  PROP_gimple_lcf, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_verify_flow, /* todo_flags_finish */
-};
-
-class pass_lower_eh_dispatch : public gimple_opt_pass
-{
-public:
-  pass_lower_eh_dispatch (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_lower_eh_dispatch, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *fun) { return fun->eh->region_tree != NULL; }
-
-  unsigned int execute () { return execute_lower_eh_dispatch (); }
-
-}; // class pass_lower_eh_dispatch
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -4564,21 +4560,6 @@ execute_cleanup_eh_1 (void)
   return 0;
 }
 
-static unsigned int
-execute_cleanup_eh (void)
-{
-  int ret = execute_cleanup_eh_1 ();
-
-  /* If the function no longer needs an EH personality routine
-     clear it.  This exposes cross-language inlining opportunities
-     and avoids references to a never defined personality routine.  */
-  if (DECL_FUNCTION_PERSONALITY (current_function_decl)
-      && function_needs_eh_personality (cfun) != eh_personality_lang)
-    DECL_FUNCTION_PERSONALITY (current_function_decl) = NULL_TREE;
-
-  return ret;
-}
-
 namespace {
 
 const pass_data pass_data_cleanup_eh =
@@ -4609,10 +4590,25 @@ public:
       return fun->eh != NULL && fun->eh->region_tree != NULL;
     }
 
-  unsigned int execute () { return execute_cleanup_eh (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_cleanup_eh
 
+unsigned int
+pass_cleanup_eh::execute (function *fun)
+{
+  int ret = execute_cleanup_eh_1 ();
+
+  /* If the function no longer needs an EH personality routine
+     clear it.  This exposes cross-language inlining opportunities
+     and avoids references to a never defined personality routine.  */
+  if (DECL_FUNCTION_PERSONALITY (current_function_decl)
+      && function_needs_eh_personality (fun) != eh_personality_lang)
+    DECL_FUNCTION_PERSONALITY (current_function_decl) = NULL_TREE;
+
+  return ret;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index 280a606..0ed503a 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -846,7 +846,7 @@ public:
       return !targetm.have_tls;
     }
 
-  unsigned int execute () { return ipa_lower_emutls (); }
+  virtual unsigned int execute (function *) { return ipa_lower_emutls (); }
 
 }; // class pass_ipa_lower_emutls
 
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 90b62a8..21a9f05 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1986,33 +1986,6 @@ tree_if_conversion (struct loop *loop)
 
 /* Tree if-conversion pass management.  */
 
-static unsigned int
-main_tree_if_conversion (void)
-{
-  struct loop *loop;
-  unsigned todo = 0;
-
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  FOR_EACH_LOOP (loop, 0)
-    if (flag_tree_loop_if_convert == 1
-	|| flag_tree_loop_if_convert_stores == 1
-	|| ((flag_tree_loop_vectorize || loop->force_vectorize)
-	    && !loop->dont_vectorize))
-      todo |= tree_if_conversion (loop);
-
-#ifdef ENABLE_CHECKING
-  {
-    basic_block bb;
-    FOR_EACH_BB_FN (bb, cfun)
-      gcc_assert (!bb->aux);
-  }
-#endif
-
-  return todo;
-}
-
 namespace {
 
 const pass_data pass_data_if_conversion =
@@ -2039,7 +2012,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return main_tree_if_conversion (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_if_conversion
 
@@ -2052,6 +2025,33 @@ pass_if_conversion::gate (function *fun)
 	  || flag_tree_loop_if_convert_stores == 1);
 }
 
+unsigned int
+pass_if_conversion::execute (function *fun)
+{
+  struct loop *loop;
+  unsigned todo = 0;
+
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  FOR_EACH_LOOP (loop, 0)
+    if (flag_tree_loop_if_convert == 1
+	|| flag_tree_loop_if_convert_stores == 1
+	|| ((flag_tree_loop_vectorize || loop->force_vectorize)
+	    && !loop->dont_vectorize))
+      todo |= tree_if_conversion (loop);
+
+#ifdef ENABLE_CHECKING
+  {
+    basic_block bb;
+    FOR_EACH_BB_FN (bb, fun)
+      gcc_assert (!bb->aux);
+  }
+#endif
+
+  return todo;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 332901d..8fc4193 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -2299,15 +2299,49 @@ fini_ssa_renamer (void)
    Steps 3 and 4 are done using the dominator tree walker
    (walk_dominator_tree).  */
 
-static unsigned int
-rewrite_into_ssa (void)
+namespace {
+
+const pass_data pass_data_build_ssa =
+{
+  GIMPLE_PASS, /* type */
+  "ssa", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_SSA_OTHER, /* tv_id */
+  PROP_cfg, /* properties_required */
+  PROP_ssa, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_verify_ssa | TODO_remove_unused_locals ), /* todo_flags_finish */
+};
+
+class pass_build_ssa : public gimple_opt_pass
+{
+public:
+  pass_build_ssa (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_build_ssa, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *fun)
+    {
+      /* Do nothing for funcions that was produced already in SSA form.  */
+      return !(fun->curr_properties & PROP_ssa);
+    }
+
+  virtual unsigned int execute (function *);
+
+}; // class pass_build_ssa
+
+unsigned int
+pass_build_ssa::execute (function *fun)
 {
   bitmap_head *dfs;
   basic_block bb;
   unsigned i;
 
   /* Initialize operand data structures.  */
-  init_ssa_operands (cfun);
+  init_ssa_operands (fun);
 
   /* Initialize internal data needed by the renamer.  */
   init_ssa_renamer ();
@@ -2315,12 +2349,12 @@ rewrite_into_ssa (void)
   /* Initialize the set of interesting blocks.  The callback
      mark_def_sites will add to this set those blocks that the renamer
      should process.  */
-  interesting_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
+  interesting_blocks = sbitmap_alloc (last_basic_block_for_fn (fun));
   bitmap_clear (interesting_blocks);
 
   /* Initialize dominance frontier.  */
-  dfs = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
-  FOR_EACH_BB_FN (bb, cfun)
+  dfs = XNEWVEC (bitmap_head, last_basic_block_for_fn (fun));
+  FOR_EACH_BB_FN (bb, fun)
     bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);
 
   /* 1- Compute dominance frontiers.  */
@@ -2328,16 +2362,16 @@ rewrite_into_ssa (void)
   compute_dominance_frontiers (dfs);
 
   /* 2- Find and mark definition sites.  */
-  mark_def_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
+  mark_def_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr);
 
   /* 3- Insert PHI nodes at dominance frontiers of definition blocks.  */
   insert_phi_nodes (dfs);
 
   /* 4- Rename all the blocks.  */
-  rewrite_blocks (ENTRY_BLOCK_PTR_FOR_FN (cfun), REWRITE_ALL);
+  rewrite_blocks (ENTRY_BLOCK_PTR_FOR_FN (fun), REWRITE_ALL);
 
   /* Free allocated memory.  */
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     bitmap_clear (&dfs[bb->index]);
   free (dfs);
 
@@ -2365,40 +2399,6 @@ rewrite_into_ssa (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_build_ssa =
-{
-  GIMPLE_PASS, /* type */
-  "ssa", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_SSA_OTHER, /* tv_id */
-  PROP_cfg, /* properties_required */
-  PROP_ssa, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_verify_ssa | TODO_remove_unused_locals ), /* todo_flags_finish */
-};
-
-class pass_build_ssa : public gimple_opt_pass
-{
-public:
-  pass_build_ssa (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_build_ssa, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *fun)
-    {
-      /* Do nothing for funcions that was produced already in SSA form.  */
-      return !(fun->curr_properties & PROP_ssa);
-    }
-
-  unsigned int execute () { return rewrite_into_ssa (); }
-
-}; // class pass_build_ssa
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 0a15412..5fff7be 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -1669,15 +1669,49 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
 
 /* Distribute all loops in the current function.  */
 
-static unsigned int
-tree_loop_distribution (void)
+namespace {
+
+const pass_data pass_data_loop_distribution =
+{
+  GIMPLE_PASS, /* type */
+  "ldist", /* name */
+  OPTGROUP_LOOP, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_LOOP_DISTRIBUTION, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_verify_ssa, /* todo_flags_finish */
+};
+
+class pass_loop_distribution : public gimple_opt_pass
+{
+public:
+  pass_loop_distribution (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_loop_distribution, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *)
+    {
+      return flag_tree_loop_distribution
+	|| flag_tree_loop_distribute_patterns;
+    }
+
+  virtual unsigned int execute (function *);
+
+}; // class pass_loop_distribution
+
+unsigned int
+pass_loop_distribution::execute (function *fun)
 {
   struct loop *loop;
   bool changed = false;
   basic_block bb;
   control_dependences *cd = NULL;
 
-  FOR_ALL_BB_FN (bb, cfun)
+  FOR_ALL_BB_FN (bb, fun)
     {
       gimple_stmt_iterator gsi;
       for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -1715,7 +1749,7 @@ tree_loop_distribution (void)
 	      if (virtual_operand_p (gimple_phi_result (phi)))
 		continue;
 	      /* Distribute stmts which have defs that are used outside of
-	         the loop.  */
+		 the loop.  */
 	      if (!stmt_has_scalar_dependences_outside_loop (loop, phi))
 		continue;
 	      work_list.safe_push (phi);
@@ -1725,7 +1759,7 @@ tree_loop_distribution (void)
 	      gimple stmt = gsi_stmt (gsi);
 
 	      /* If there is a stmt with side-effects bail out - we
-	         cannot and should not distribute this loop.  */
+		 cannot and should not distribute this loop.  */
 	      if (gimple_has_side_effects (stmt))
 		{
 		  work_list.truncate (0);
@@ -1733,7 +1767,7 @@ tree_loop_distribution (void)
 		}
 
 	      /* Distribute stmts which have defs that are used outside of
-	         the loop.  */
+		 the loop.  */
 	      if (stmt_has_scalar_dependences_outside_loop (loop, stmt))
 		;
 	      /* Otherwise only distribute stores for now.  */
@@ -1779,7 +1813,7 @@ out:
 
   if (changed)
     {
-      mark_virtual_operands_for_renaming (cfun);
+      mark_virtual_operands_for_renaming (fun);
       rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
     }
 
@@ -1790,40 +1824,6 @@ out:
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_loop_distribution =
-{
-  GIMPLE_PASS, /* type */
-  "ldist", /* name */
-  OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_LOOP_DISTRIBUTION, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_verify_ssa, /* todo_flags_finish */
-};
-
-class pass_loop_distribution : public gimple_opt_pass
-{
-public:
-  pass_loop_distribution (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_loop_distribution, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *)
-    {
-      return flag_tree_loop_distribution
-	|| flag_tree_loop_distribute_patterns;
-    }
-
-  unsigned int execute () { return tree_loop_distribution (); }
-
-}; // class pass_loop_distribution
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index 71f8d68..45b16f4 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -113,8 +113,38 @@ finalize_nrv_r (tree *tp, int *walk_subtrees, void *data)
    then we could either have the languages register the optimization or
    we could change the gating function to check the current language.  */
 
-static unsigned int
-tree_nrv (void)
+namespace {
+
+const pass_data pass_data_nrv =
+{
+  GIMPLE_PASS, /* type */
+  "nrv", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_NRV, /* tv_id */
+  ( PROP_ssa | PROP_cfg ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_nrv : public gimple_opt_pass
+{
+public:
+  pass_nrv (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_nrv, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *) { return optimize > 0; }
+
+  virtual unsigned int execute (function *);
+
+}; // class pass_nrv
+
+unsigned int
+pass_nrv::execute (function *fun)
 {
   tree result = DECL_RESULT (current_function_decl);
   tree result_type = TREE_TYPE (result);
@@ -144,7 +174,7 @@ tree_nrv (void)
     return 0;
 
   /* Look through each block for assignments to the RESULT_DECL.  */
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 	{
@@ -238,7 +268,7 @@ tree_nrv (void)
      RESULT.  */
   data.var = found;
   data.result = result;
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
 	{
@@ -272,36 +302,6 @@ tree_nrv (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_nrv =
-{
-  GIMPLE_PASS, /* type */
-  "nrv", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_NRV, /* tv_id */
-  ( PROP_ssa | PROP_cfg ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_nrv : public gimple_opt_pass
-{
-public:
-  pass_nrv (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_nrv, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *) { return optimize > 0; }
-
-  unsigned int execute () { return tree_nrv (); }
-
-}; // class pass_nrv
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -347,35 +347,6 @@ dest_safe_for_nrv_p (gimple call)
    escaped prior to the call.  If it has, modifications to the local
    variable will produce visible changes elsewhere, as in PR c++/19317.  */
 
-static unsigned int
-execute_return_slot_opt (void)
-{
-  basic_block bb;
-
-  FOR_EACH_BB_FN (bb, cfun)
-    {
-      gimple_stmt_iterator gsi;
-      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
-	{
-	  gimple stmt = gsi_stmt (gsi);
-	  bool slot_opt_p;
-
-	  if (is_gimple_call (stmt)
-	      && gimple_call_lhs (stmt)
-	      && !gimple_call_return_slot_opt_p (stmt)
-	      && aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)),
-				    gimple_call_fndecl (stmt)))
-	    {
-	      /* Check if the location being assigned to is
-	         clobbered by the call.  */
-	      slot_opt_p = dest_safe_for_nrv_p (stmt);
-	      gimple_call_set_return_slot_opt (stmt, slot_opt_p);
-	    }
-	}
-    }
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_return_slot =
@@ -400,10 +371,39 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return execute_return_slot_opt (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_return_slot
 
+unsigned int
+pass_return_slot::execute (function *fun)
+{
+  basic_block bb;
+
+  FOR_EACH_BB_FN (bb, fun)
+    {
+      gimple_stmt_iterator gsi;
+      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+	{
+	  gimple stmt = gsi_stmt (gsi);
+	  bool slot_opt_p;
+
+	  if (is_gimple_call (stmt)
+	      && gimple_call_lhs (stmt)
+	      && !gimple_call_return_slot_opt_p (stmt)
+	      && aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)),
+				    gimple_call_fndecl (stmt)))
+	    {
+	      /* Check if the location being assigned to is
+		 clobbered by the call.  */
+	      slot_opt_p = dest_safe_for_nrv_p (stmt);
+	      gimple_call_set_return_slot_opt (stmt, slot_opt_p);
+	    }
+	}
+    }
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 23f7250..ec50709 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -66,7 +66,6 @@ static bool merge_object_sizes (struct object_size_info *, tree, tree,
 				unsigned HOST_WIDE_INT);
 static bool plus_stmt_object_size (struct object_size_info *, tree, gimple);
 static bool cond_expr_object_size (struct object_size_info *, tree, gimple);
-static unsigned int compute_object_sizes (void);
 static void init_offset_limit (void);
 static void check_for_plus_in_loops (struct object_size_info *, tree);
 static void check_for_plus_in_loops_1 (struct object_size_info *, tree,
@@ -1207,11 +1206,40 @@ fini_object_sizes (void)
 
 /* Simple pass to optimize all __builtin_object_size () builtins.  */
 
-static unsigned int
-compute_object_sizes (void)
+namespace {
+
+const pass_data pass_data_object_sizes =
+{
+  GIMPLE_PASS, /* type */
+  "objsz", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_verify_ssa, /* todo_flags_finish */
+};
+
+class pass_object_sizes : public gimple_opt_pass
+{
+public:
+  pass_object_sizes (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_object_sizes, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_object_sizes (m_ctxt); }
+  virtual unsigned int execute (function *);
+
+}; // class pass_object_sizes
+
+unsigned int
+pass_object_sizes::execute (function *fun)
 {
   basic_block bb;
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple_stmt_iterator i;
       for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
@@ -1281,35 +1309,6 @@ compute_object_sizes (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_object_sizes =
-{
-  GIMPLE_PASS, /* type */
-  "objsz", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_verify_ssa, /* todo_flags_finish */
-};
-
-class pass_object_sizes : public gimple_opt_pass
-{
-public:
-  pass_object_sizes (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_object_sizes, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_object_sizes (m_ctxt); }
-  unsigned int execute () { return compute_object_sizes (); }
-
-}; // class pass_object_sizes
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index a46fa51..79b327b 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -2253,17 +2253,6 @@ parallelize_loops (void)
 
 /* Parallelization.  */
 
-static unsigned
-tree_parallelize_loops (void)
-{
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  if (parallelize_loops ())
-    return TODO_cleanup_cfg | TODO_rebuild_alias;
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_parallelize_loops =
@@ -2289,10 +2278,21 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tree_parallelize_loops > 1; }
-  unsigned int execute () { return tree_parallelize_loops (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_parallelize_loops
 
+unsigned
+pass_parallelize_loops::execute (function *fun)
+{
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  if (parallelize_loops ())
+    return TODO_cleanup_cfg | TODO_rebuild_alias;
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 9de2822..e63f306 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -96,7 +96,7 @@ public:
      be sub-passes otherwise this pass does nothing.
      The return value contains TODOs to execute in addition to those in
      TODO_flags_finish.   */
-  virtual unsigned int execute ();
+  virtual unsigned int execute (function *fun);
 
 protected:
   opt_pass (const pass_data&, gcc::context *);
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 7dd86e1..4d77401 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -2598,7 +2598,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_predictive_commoning != 0; }
-  unsigned int execute () { return run_tree_predictive_commoning (); }
+  virtual unsigned int execute (function *)
+    {
+      return run_tree_predictive_commoning ();
+    }
 
 }; // class pass_predcom
 
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index b7d0466..deefa8b 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -688,7 +688,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *);
-  unsigned int execute () { return tree_profiling (); }
+  virtual unsigned int execute (function *) { return tree_profiling (); }
 
 }; // class pass_ipa_tree_profile
 
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 27f71a3..890234f 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3525,7 +3525,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return gate_intra_sra (); }
-  unsigned int execute () { return early_intra_sra (); }
+  virtual unsigned int execute (function *) { return early_intra_sra (); }
 
 }; // class pass_sra_early
 
@@ -3562,7 +3562,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return gate_intra_sra (); }
-  unsigned int execute () { return late_intra_sra (); }
+  virtual unsigned int execute (function *) { return late_intra_sra (); }
 
 }; // class pass_sra
 
@@ -5076,7 +5076,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_ipa_sra && dbg_cnt (eipa_sra); }
-  unsigned int execute () { return ipa_early_sra (); }
+  virtual unsigned int execute (function *) { return ipa_early_sra (); }
 
 }; // class pass_early_ipa_sra
 
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index c4a5c71..257d108 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2314,7 +2314,7 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_ccp (m_ctxt); }
   virtual bool gate (function *) { return flag_tree_ccp != 0; }
-  unsigned int execute () { return do_ssa_ccp (); }
+  virtual unsigned int execute (function *) { return do_ssa_ccp (); }
 
 }; // class pass_ccp
 
@@ -2559,14 +2559,43 @@ optimize_unreachable (gimple_stmt_iterator i)
 /* A simple pass that attempts to fold all builtin functions.  This pass
    is run after we've propagated as many constants as we can.  */
 
-static unsigned int
-execute_fold_all_builtins (void)
+namespace {
+
+const pass_data pass_data_fold_builtins =
+{
+  GIMPLE_PASS, /* type */
+  "fab", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_verify_ssa | TODO_update_ssa ), /* todo_flags_finish */
+};
+
+class pass_fold_builtins : public gimple_opt_pass
+{
+public:
+  pass_fold_builtins (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_fold_builtins, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_fold_builtins (m_ctxt); }
+  virtual unsigned int execute (function *);
+
+}; // class pass_fold_builtins
+
+unsigned int
+pass_fold_builtins::execute (function *fun)
 {
   bool cfg_changed = false;
   basic_block bb;
   unsigned int todoflags = 0;
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple_stmt_iterator i;
       for (i = gsi_start_bb (bb); !gsi_end_p (i); )
@@ -2608,7 +2637,7 @@ execute_fold_all_builtins (void)
 	  result = gimple_fold_builtin (stmt);
 
 	  if (result)
-	    gimple_remove_stmt_histograms (cfun, stmt);
+	    gimple_remove_stmt_histograms (fun, stmt);
 
 	  if (!result)
 	    switch (DECL_FUNCTION_CODE (callee))
@@ -2703,36 +2732,6 @@ execute_fold_all_builtins (void)
   return todoflags;
 }
 
-
-namespace {
-
-const pass_data pass_data_fold_builtins =
-{
-  GIMPLE_PASS, /* type */
-  "fab", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_verify_ssa | TODO_update_ssa ), /* todo_flags_finish */
-};
-
-class pass_fold_builtins : public gimple_opt_pass
-{
-public:
-  pass_fold_builtins (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_fold_builtins, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_fold_builtins (m_ctxt); }
-  unsigned int execute () { return execute_fold_all_builtins (); }
-
-}; // class pass_fold_builtins
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index bd6ac04..6e3a569 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -671,7 +671,7 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_copy_prop (m_ctxt); }
   virtual bool gate (function *) { return flag_tree_copy_prop != 0; }
-  unsigned int execute () { return execute_copy_prop (); }
+  virtual unsigned int execute (function *) { return execute_copy_prop (); }
 
 }; // class pass_copy_prop
 
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index 65d8044..b9c9ba3 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -299,14 +299,44 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
 }
 
 
+namespace {
+
+const pass_data pass_data_rename_ssa_copies =
+{
+  GIMPLE_PASS, /* type */
+  "copyrename", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_COPY_RENAME, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_verify_ssa, /* todo_flags_finish */
+};
+
+class pass_rename_ssa_copies : public gimple_opt_pass
+{
+public:
+  pass_rename_ssa_copies (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_rename_ssa_copies, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_rename_ssa_copies (m_ctxt); }
+  virtual bool gate (function *) { return flag_tree_copyrename != 0; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_rename_ssa_copies
+
 /* This function will make a pass through the IL, and attempt to coalesce any
    SSA versions which occur in PHI's or copies.  Coalescing is accomplished by
    changing the underlying root variable of all coalesced version.  This will
    then cause the SSA->normal pass to attempt to coalesce them all to the same
    variable.  */
 
-static unsigned int
-rename_ssa_copies (void)
+unsigned int
+pass_rename_ssa_copies::execute (function *fun)
 {
   var_map map;
   basic_block bb;
@@ -325,7 +355,7 @@ rename_ssa_copies (void)
 
   map = init_var_map (num_ssa_names);
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       /* Scan for real copies.  */
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -341,7 +371,7 @@ rename_ssa_copies (void)
 	}
     }
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       /* Treat PHI nodes as copies between the result and each argument.  */
       for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -429,42 +459,12 @@ rename_ssa_copies (void)
       replace_ssa_name_symbol (var, SSA_NAME_VAR (part_var));
     }
 
-  statistics_counter_event (cfun, "copies coalesced",
+  statistics_counter_event (fun, "copies coalesced",
 			    stats.coalesced);
   delete_var_map (map);
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_rename_ssa_copies =
-{
-  GIMPLE_PASS, /* type */
-  "copyrename", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_COPY_RENAME, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_verify_ssa, /* todo_flags_finish */
-};
-
-class pass_rename_ssa_copies : public gimple_opt_pass
-{
-public:
-  pass_rename_ssa_copies (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_rename_ssa_copies, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_rename_ssa_copies (m_ctxt); }
-  virtual bool gate (function *) { return flag_tree_copyrename != 0; }
-  unsigned int execute () { return rename_ssa_copies (); }
-
-}; // class pass_rename_ssa_copies
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index e5799b9..6389f23 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1530,7 +1530,7 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_dce (m_ctxt); }
   virtual bool gate (function *) { return flag_tree_dce != 0; }
-  unsigned int execute () { return tree_ssa_dce (); }
+  virtual unsigned int execute (function *) { return tree_ssa_dce (); }
 
 }; // class pass_dce
 
@@ -1568,7 +1568,7 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_dce_loop (m_ctxt); }
   virtual bool gate (function *) { return flag_tree_dce != 0; }
-  unsigned int execute () { return tree_ssa_dce_loop (); }
+  virtual unsigned int execute (function *) { return tree_ssa_dce_loop (); }
 
 }; // class pass_dce_loop
 
@@ -1606,7 +1606,7 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_cd_dce (m_ctxt); }
   virtual bool gate (function *) { return flag_tree_dce != 0; }
-  unsigned int execute () { return tree_ssa_cd_dce (); }
+  virtual unsigned int execute (function *) { return tree_ssa_cd_dce (); }
 
 }; // class pass_cd_dce
 
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index b9cc5cc..15c4fb0 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -832,8 +832,40 @@ private:
    every new symbol exposed, its corresponding bit will be set in
    VARS_TO_RENAME.  */
 
-static unsigned int
-tree_ssa_dominator_optimize (void)
+namespace {
+
+const pass_data pass_data_dominator =
+{
+  GIMPLE_PASS, /* type */
+  "dom", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_SSA_DOMINATOR_OPTS, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_cleanup_cfg | TODO_update_ssa
+    | TODO_verify_ssa
+    | TODO_verify_flow ), /* todo_flags_finish */
+};
+
+class pass_dominator : public gimple_opt_pass
+{
+public:
+  pass_dominator (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_dominator, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_dominator (m_ctxt); }
+  virtual bool gate (function *) { return flag_tree_dom != 0; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_dominator
+
+unsigned int
+pass_dominator::execute (function *fun)
 {
   memset (&opt_stats, 0, sizeof (opt_stats));
 
@@ -867,12 +899,12 @@ tree_ssa_dominator_optimize (void)
   mark_dfs_back_edges ();
 
   /* Recursively walk the dominator tree optimizing statements.  */
-  dom_opt_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
+  dom_opt_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr);
 
   {
     gimple_stmt_iterator gsi;
     basic_block bb;
-    FOR_EACH_BB_FN (bb, cfun)
+    FOR_EACH_BB_FN (bb, fun)
       {
 	for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 	  update_stmt_if_modified (gsi_stmt (gsi));
@@ -908,13 +940,13 @@ tree_ssa_dominator_optimize (void)
 	 iterator.  */
       EXECUTE_IF_SET_IN_BITMAP (need_eh_cleanup, 0, i, bi)
 	{
-	  basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
+	  basic_block bb = BASIC_BLOCK_FOR_FN (fun, i);
 	  if (bb == NULL)
 	    continue;
 	  while (single_succ_p (bb)
 		 && (single_succ_edge (bb)->flags & EDGE_EH) == 0)
 	    bb = single_succ (bb);
-	  if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun))
+	  if (bb == EXIT_BLOCK_PTR_FOR_FN (fun))
 	    continue;
 	  if ((unsigned) bb->index != i)
 	    bitmap_set_bit (need_eh_cleanup, bb->index);
@@ -924,11 +956,11 @@ tree_ssa_dominator_optimize (void)
       bitmap_clear (need_eh_cleanup);
     }
 
-  statistics_counter_event (cfun, "Redundant expressions eliminated",
+  statistics_counter_event (fun, "Redundant expressions eliminated",
 			    opt_stats.num_re);
-  statistics_counter_event (cfun, "Constants propagated",
+  statistics_counter_event (fun, "Constants propagated",
 			    opt_stats.num_const_prop);
-  statistics_counter_event (cfun, "Copies propagated",
+  statistics_counter_event (fun, "Copies propagated",
 			    opt_stats.num_copy_prop);
 
   /* Debugging dumps.  */
@@ -952,38 +984,6 @@ tree_ssa_dominator_optimize (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_dominator =
-{
-  GIMPLE_PASS, /* type */
-  "dom", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_SSA_DOMINATOR_OPTS, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_cleanup_cfg | TODO_update_ssa
-    | TODO_verify_ssa
-    | TODO_verify_flow ), /* todo_flags_finish */
-};
-
-class pass_dominator : public gimple_opt_pass
-{
-public:
-  pass_dominator (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_dominator, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_dominator (m_ctxt); }
-  virtual bool gate (function *) { return flag_tree_dom != 0; }
-  unsigned int execute () { return tree_ssa_dominator_optimize (); }
-
-}; // class pass_dominator
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -3025,8 +3025,40 @@ eliminate_degenerate_phis_1 (basic_block bb, bitmap interesting_names)
    pick up the secondary optimization opportunities with minimal
    cost.  */
 
-static unsigned int
-eliminate_degenerate_phis (void)
+namespace {
+
+const pass_data pass_data_phi_only_cprop =
+{
+  GIMPLE_PASS, /* type */
+  "phicprop", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_PHI_CPROP, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_cleanup_cfg | TODO_verify_ssa
+    | TODO_verify_stmts
+    | TODO_update_ssa ), /* todo_flags_finish */
+};
+
+class pass_phi_only_cprop : public gimple_opt_pass
+{
+public:
+  pass_phi_only_cprop (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_phi_only_cprop, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_phi_only_cprop (m_ctxt); }
+  virtual bool gate (function *) { return flag_tree_dom != 0; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_phi_only_cprop
+
+unsigned int
+pass_phi_only_cprop::execute (function *fun)
 {
   bitmap interesting_names;
   bitmap interesting_names1;
@@ -3059,7 +3091,7 @@ eliminate_degenerate_phis (void)
      phase in dominator order.  Presumably this is because walking
      in dominator order leaves fewer PHIs for later examination
      by the worklist phase.  */
-  eliminate_degenerate_phis_1 (ENTRY_BLOCK_PTR_FOR_FN (cfun),
+  eliminate_degenerate_phis_1 (ENTRY_BLOCK_PTR_FOR_FN (fun),
 			       interesting_names);
 
   /* Second phase.  Eliminate second order degenerate PHIs as well
@@ -3109,38 +3141,6 @@ eliminate_degenerate_phis (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_phi_only_cprop =
-{
-  GIMPLE_PASS, /* type */
-  "phicprop", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_PHI_CPROP, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_cleanup_cfg | TODO_verify_ssa
-    | TODO_verify_stmts
-    | TODO_update_ssa ), /* todo_flags_finish */
-};
-
-class pass_phi_only_cprop : public gimple_opt_pass
-{
-public:
-  pass_phi_only_cprop (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_phi_only_cprop, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_phi_only_cprop (m_ctxt); }
-  virtual bool gate (function *) { return flag_tree_dom != 0; }
-  unsigned int execute () { return eliminate_degenerate_phis (); }
-
-}; // class pass_phi_only_cprop
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index b6fbdaf..af69063 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -80,8 +80,6 @@ along with GCC; see the file COPYING3.  If not see
    remove their dead edges eventually.  */
 static bitmap need_eh_cleanup;
 
-static unsigned int tree_ssa_dse (void);
-
 
 /* A helper of dse_optimize_stmt.
    Given a GIMPLE_ASSIGN in STMT, find a candidate statement *USE_STMT that
@@ -327,10 +325,38 @@ dse_dom_walker::before_dom_children (basic_block bb)
     }
 }
 
-/* Main entry point.  */
+namespace {
+
+const pass_data pass_data_dse =
+{
+  GIMPLE_PASS, /* type */
+  "dse", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_DSE, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_verify_ssa, /* todo_flags_finish */
+};
+
+class pass_dse : public gimple_opt_pass
+{
+public:
+  pass_dse (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_dse, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_dse (m_ctxt); }
+  virtual bool gate (function *) { return flag_tree_dse != 0; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_dse
 
-static unsigned int
-tree_ssa_dse (void)
+unsigned int
+pass_dse::execute (function *fun)
 {
   need_eh_cleanup = BITMAP_ALLOC (NULL);
 
@@ -345,7 +371,7 @@ tree_ssa_dse (void)
 
   /* Dead store elimination is fundamentally a walk of the post-dominator
      tree and a backwards walk of statements within each block.  */
-  dse_dom_walker (CDI_POST_DOMINATORS).walk (cfun->cfg->x_exit_block_ptr);
+  dse_dom_walker (CDI_POST_DOMINATORS).walk (fun->cfg->x_exit_block_ptr);
 
   /* Removal of stores may make some EH edges dead.  Purge such edges from
      the CFG as needed.  */
@@ -362,36 +388,6 @@ tree_ssa_dse (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_dse =
-{
-  GIMPLE_PASS, /* type */
-  "dse", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_DSE, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_verify_ssa, /* todo_flags_finish */
-};
-
-class pass_dse : public gimple_opt_pass
-{
-public:
-  pass_dse (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_dse, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_dse (m_ctxt); }
-  virtual bool gate (function *) { return flag_tree_dse != 0; }
-  unsigned int execute () { return tree_ssa_dse (); }
-
-}; // class pass_dse
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 8d5ca5f..a623005 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -3567,15 +3567,45 @@ simplify_mult (gimple_stmt_iterator *gsi)
 /* Main entry point for the forward propagation and statement combine
    optimizer.  */
 
-static unsigned int
-ssa_forward_propagate_and_combine (void)
+namespace {
+
+const pass_data pass_data_forwprop =
+{
+  GIMPLE_PASS, /* type */
+  "forwprop", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_FORWPROP, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
+};
+
+class pass_forwprop : public gimple_opt_pass
+{
+public:
+  pass_forwprop (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_forwprop, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_forwprop (m_ctxt); }
+  virtual bool gate (function *) { return flag_tree_forwprop; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_forwprop
+
+unsigned int
+pass_forwprop::execute (function *fun)
 {
   basic_block bb;
   unsigned int todoflags = 0;
 
   cfg_changed = false;
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple_stmt_iterator gsi;
 
@@ -3660,7 +3690,7 @@ ssa_forward_propagate_and_combine (void)
 	  else if (TREE_CODE_CLASS (code) == tcc_comparison)
 	    {
 	      if (forward_propagate_comparison (&gsi))
-	        cfg_changed = true;
+		cfg_changed = true;
 	    }
 	  else
 	    gsi_next (&gsi);
@@ -3831,36 +3861,6 @@ ssa_forward_propagate_and_combine (void)
   return todoflags;
 }
 
-namespace {
-
-const pass_data pass_data_forwprop =
-{
-  GIMPLE_PASS, /* type */
-  "forwprop", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_FORWPROP, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
-};
-
-class pass_forwprop : public gimple_opt_pass
-{
-public:
-  pass_forwprop (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_forwprop, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_forwprop (m_ctxt); }
-  virtual bool gate (function *) { return flag_tree_forwprop; }
-  unsigned int execute () { return ssa_forward_propagate_and_combine (); }
-
-}; // class pass_forwprop
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index b901f37..0ce02a0 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -723,8 +723,36 @@ tree_ssa_ifcombine_bb (basic_block inner_cond_bb)
 
 /* Main entry for the tree if-conversion pass.  */
 
-static unsigned int
-tree_ssa_ifcombine (void)
+namespace {
+
+const pass_data pass_data_tree_ifcombine =
+{
+  GIMPLE_PASS, /* type */
+  "ifcombine", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_IFCOMBINE, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
+};
+
+class pass_tree_ifcombine : public gimple_opt_pass
+{
+public:
+  pass_tree_ifcombine (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_tree_ifcombine, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual unsigned int execute (function *);
+
+}; // class pass_tree_ifcombine
+
+unsigned int
+pass_tree_ifcombine::execute (function *fun)
 {
   basic_block *bbs;
   bool cfg_changed = false;
@@ -741,7 +769,7 @@ tree_ssa_ifcombine (void)
      inner ones, and also that we do not try to visit a removed
      block.  This is opposite of PHI-OPT, because we cascade the
      combining rather than cascading PHIs. */
-  for (i = n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS - 1; i >= 0; i--)
+  for (i = n_basic_blocks_for_fn (fun) - NUM_FIXED_BLOCKS - 1; i >= 0; i--)
     {
       basic_block bb = bbs[i];
       gimple stmt = last_stmt (bb);
@@ -756,34 +784,6 @@ tree_ssa_ifcombine (void)
   return cfg_changed ? TODO_cleanup_cfg : 0;
 }
 
-namespace {
-
-const pass_data pass_data_tree_ifcombine =
-{
-  GIMPLE_PASS, /* type */
-  "ifcombine", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_IFCOMBINE, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
-};
-
-class pass_tree_ifcombine : public gimple_opt_pass
-{
-public:
-  pass_tree_ifcombine (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_tree_ifcombine, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  unsigned int execute () { return tree_ssa_ifcombine (); }
-
-}; // class pass_tree_ifcombine
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index 34d1f70..fb86de4 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -131,8 +131,38 @@ do_while_loop_p (struct loop *loop)
    of the loop.  This is beneficial since it increases efficiency of
    code motion optimizations.  It also saves one jump on entry to the loop.  */
 
-static unsigned int
-copy_loop_headers (void)
+namespace {
+
+const pass_data pass_data_ch =
+{
+  GIMPLE_PASS, /* type */
+  "ch", /* name */
+  OPTGROUP_LOOP, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_CH, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_cleanup_cfg | TODO_verify_ssa
+    | TODO_verify_flow ), /* todo_flags_finish */
+};
+
+class pass_ch : public gimple_opt_pass
+{
+public:
+  pass_ch (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_ch, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *) { return flag_tree_ch != 0; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_ch
+
+unsigned int
+pass_ch::execute (function *fun)
 {
   struct loop *loop;
   basic_block header;
@@ -143,15 +173,15 @@ copy_loop_headers (void)
 
   loop_optimizer_init (LOOPS_HAVE_PREHEADERS
 		       | LOOPS_HAVE_SIMPLE_LATCHES);
-  if (number_of_loops (cfun) <= 1)
+  if (number_of_loops (fun) <= 1)
     {
       loop_optimizer_finalize ();
       return 0;
     }
 
-  bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
-  copied_bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
-  bbs_size = n_basic_blocks_for_fn (cfun);
+  bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (fun));
+  copied_bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (fun));
+  bbs_size = n_basic_blocks_for_fn (fun);
 
   FOR_EACH_LOOP (loop, 0)
     {
@@ -257,36 +287,6 @@ copy_loop_headers (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_ch =
-{
-  GIMPLE_PASS, /* type */
-  "ch", /* name */
-  OPTGROUP_LOOP, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_CH, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_cleanup_cfg | TODO_verify_ssa
-    | TODO_verify_flow ), /* todo_flags_finish */
-};
-
-class pass_ch : public gimple_opt_pass
-{
-public:
-  pass_ch (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_ch, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *) { return flag_tree_ch != 0; }
-  unsigned int execute () { return copy_loop_headers (); }
-
-}; // class pass_ch
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index f38ee95..0b44c97 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -2529,15 +2529,6 @@ tree_ssa_lim (void)
 
 /* Loop invariant motion pass.  */
 
-static unsigned int
-tree_ssa_loop_im (void)
-{
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  return tree_ssa_lim ();
-}
-
 namespace {
 
 const pass_data pass_data_lim =
@@ -2564,10 +2555,19 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_lim (m_ctxt); }
   virtual bool gate (function *) { return flag_tree_loop_im != 0; }
-  unsigned int execute () { return tree_ssa_loop_im (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_lim
 
+unsigned int
+pass_lim::execute (function *fun)
+{
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  return tree_ssa_lim ();
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index df82816..54ebe25 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -1256,15 +1256,6 @@ tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer)
 
 /* Canonical induction variable creation pass.  */
 
-static unsigned int
-tree_ssa_loop_ivcanon (void)
-{
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  return canonicalize_induction_variables ();
-}
-
 namespace {
 
 const pass_data pass_data_iv_canon =
@@ -1290,10 +1281,19 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tree_loop_ivcanon != 0; }
-  unsigned int execute () { return tree_ssa_loop_ivcanon (); }
+  virtual unsigned int execute (function *fun);
 
 }; // class pass_iv_canon
 
+unsigned int
+pass_iv_canon::execute (function *fun)
+{
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  return canonicalize_induction_variables ();
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -1304,17 +1304,6 @@ make_pass_iv_canon (gcc::context *ctxt)
 
 /* Complete unrolling of loops.  */
 
-static unsigned int
-tree_complete_unroll (void)
-{
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  return tree_unroll_loops_completely (flag_unroll_loops
-				       || flag_peel_loops
-				       || optimize >= 3, true);
-}
-
 namespace {
 
 const pass_data pass_data_complete_unroll =
@@ -1339,10 +1328,21 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return tree_complete_unroll (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_complete_unroll
 
+unsigned int
+pass_complete_unroll::execute (function *fun)
+{
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  return tree_unroll_loops_completely (flag_unroll_loops
+				       || flag_peel_loops
+				       || optimize >= 3, true);
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -1353,25 +1353,6 @@ make_pass_complete_unroll (gcc::context *ctxt)
 
 /* Complete unrolling of inner loops.  */
 
-static unsigned int
-tree_complete_unroll_inner (void)
-{
-  unsigned ret = 0;
-
-  loop_optimizer_init (LOOPS_NORMAL
-		       | LOOPS_HAVE_RECORDED_EXITS);
-  if (number_of_loops (cfun) > 1)
-    {
-      scev_initialize ();
-      ret = tree_unroll_loops_completely (optimize >= 3, false);
-      free_numbers_of_iterations_estimates ();
-      scev_finalize ();
-    }
-  loop_optimizer_finalize ();
-
-  return ret;
-}
-
 namespace {
 
 const pass_data pass_data_complete_unrolli =
@@ -1397,10 +1378,29 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return optimize >= 2; }
-  unsigned int execute () { return tree_complete_unroll_inner (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_complete_unrolli
 
+unsigned int
+pass_complete_unrolli::execute (function *fun)
+{
+  unsigned ret = 0;
+
+  loop_optimizer_init (LOOPS_NORMAL
+		       | LOOPS_HAVE_RECORDED_EXITS);
+  if (number_of_loops (fun) > 1)
+    {
+      scev_initialize ();
+      ret = tree_unroll_loops_completely (optimize >= 3, false);
+      free_numbers_of_iterations_estimates ();
+      scev_finalize ();
+    }
+  loop_optimizer_finalize ();
+
+  return ret;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 17b13d1..1cf650a 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -2004,15 +2004,6 @@ tree_ssa_prefetch_arrays (void)
 
 /* Prefetching.  */
 
-static unsigned int
-tree_ssa_loop_prefetch (void)
-{
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  return tree_ssa_prefetch_arrays ();
-}
-
 namespace {
 
 const pass_data pass_data_loop_prefetch =
@@ -2038,10 +2029,19 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_prefetch_loop_arrays > 0; }
-  unsigned int execute () { return tree_ssa_loop_prefetch (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_loop_prefetch
 
+unsigned int
+pass_loop_prefetch::execute (function *fun)
+{
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  return tree_ssa_prefetch_arrays ();
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 90bb205..a9a27d7 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -402,15 +402,6 @@ tree_unswitch_loop (struct loop *loop,
 
 /* Loop unswitching pass.  */
 
-static unsigned int
-tree_ssa_loop_unswitch (void)
-{
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  return tree_ssa_unswitch_loops ();
-}
-
 namespace {
 
 const pass_data pass_data_tree_unswitch =
@@ -436,10 +427,19 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_unswitch_loops != 0; }
-  unsigned int execute () { return tree_ssa_loop_unswitch (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_tree_unswitch
 
+unsigned int
+pass_tree_unswitch::execute (function *fun)
+{
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  return tree_ssa_unswitch_loops ();
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 38e7b13..ccc8121 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -82,23 +82,6 @@ make_pass_tree_loop (gcc::context *ctxt)
 
 /* Loop optimizer initialization.  */
 
-static unsigned int
-tree_ssa_loop_init (void)
-{
-  loop_optimizer_init (LOOPS_NORMAL
-		       | LOOPS_HAVE_RECORDED_EXITS);
-  rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
-
-  /* We might discover new loops, e.g. when turning irreducible
-     regions into reducible.  */
-  scev_initialize ();
-
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_tree_loop_init =
@@ -123,10 +106,27 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return tree_ssa_loop_init (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_tree_loop_init
 
+unsigned int
+pass_tree_loop_init::execute (function *fun)
+{
+  loop_optimizer_init (LOOPS_NORMAL
+		       | LOOPS_HAVE_RECORDED_EXITS);
+  rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
+
+  /* We might discover new loops, e.g. when turning irreducible
+     regions into reducible.  */
+  scev_initialize ();
+
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -137,15 +137,6 @@ make_pass_tree_loop_init (gcc::context *ctxt)
 
 /* Loop autovectorization.  */
 
-static unsigned int
-tree_loop_vectorize (void)
-{
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  return vectorize_loops ();
-}
-
 namespace {
 
 const pass_data pass_data_vectorize =
@@ -175,10 +166,19 @@ public:
       return flag_tree_loop_vectorize || fun->has_force_vectorize_loops;
     }
 
-  unsigned int execute () { return tree_loop_vectorize (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_vectorize
 
+unsigned int
+pass_vectorize::execute (function *fun)
+{
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  return vectorize_loops ();
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -189,16 +189,6 @@ make_pass_vectorize (gcc::context *ctxt)
 
 /* Check the correctness of the data dependence analyzers.  */
 
-static unsigned int
-check_data_deps (void)
-{
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  tree_check_data_deps ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_check_data_deps =
@@ -224,10 +214,20 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_check_data_deps != 0; }
-  unsigned int execute () { return check_data_deps (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_check_data_deps
 
+unsigned int
+pass_check_data_deps::execute (function *fun)
+{
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  tree_check_data_deps ();
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -264,7 +264,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tree_scev_cprop; }
-  unsigned int execute () { return scev_const_prop (); }
+  virtual unsigned int execute (function *) { return scev_const_prop (); }
 
 }; // class pass_scev_cprop
 
@@ -278,17 +278,6 @@ make_pass_scev_cprop (gcc::context *ctxt)
 
 /* Record bounds on numbers of iterations of loops.  */
 
-static unsigned int
-tree_ssa_loop_bounds (void)
-{
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  estimate_numbers_of_iterations ();
-  scev_reset ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_record_bounds =
@@ -313,10 +302,21 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return tree_ssa_loop_bounds (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_record_bounds
 
+unsigned int
+pass_record_bounds::execute (function *fun)
+{
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  estimate_numbers_of_iterations ();
+  scev_reset ();
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -327,16 +327,6 @@ make_pass_record_bounds (gcc::context *ctxt)
 
 /* Induction variable optimizations.  */
 
-static unsigned int
-tree_ssa_loop_ivopts (void)
-{
-  if (number_of_loops (cfun) <= 1)
-    return 0;
-
-  tree_ssa_iv_optimize ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_iv_optimize =
@@ -362,10 +352,20 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_ivopts != 0; }
-  unsigned int execute () { return tree_ssa_loop_ivopts (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_iv_optimize
 
+unsigned int
+pass_iv_optimize::execute (function *fun)
+{
+  if (number_of_loops (fun) <= 1)
+    return 0;
+
+  tree_ssa_iv_optimize ();
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -409,7 +409,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return tree_ssa_loop_done (); }
+  virtual unsigned int execute (function *) { return tree_ssa_loop_done (); }
 
 }; // class pass_tree_loop_done
 
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index fef1b1e..b965ad1 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -506,35 +506,65 @@ execute_cse_reciprocals_1 (gimple_stmt_iterator *def_gsi, tree def)
 
 /* Go through all the floating-point SSA_NAMEs, and call
    execute_cse_reciprocals_1 on each of them.  */
-static unsigned int
-execute_cse_reciprocals (void)
+namespace {
+
+const pass_data pass_data_cse_reciprocals =
+{
+  GIMPLE_PASS, /* type */
+  "recip", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  PROP_ssa, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_update_ssa | TODO_verify_ssa
+    | TODO_verify_stmts ), /* todo_flags_finish */
+};
+
+class pass_cse_reciprocals : public gimple_opt_pass
+{
+public:
+  pass_cse_reciprocals (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_cse_reciprocals, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *) { return optimize && flag_reciprocal_math; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_cse_reciprocals
+
+unsigned int
+pass_cse_reciprocals::execute (function *fun)
 {
   basic_block bb;
   tree arg;
 
   occ_pool = create_alloc_pool ("dominators for recip",
 				sizeof (struct occurrence),
-				n_basic_blocks_for_fn (cfun) / 3 + 1);
+				n_basic_blocks_for_fn (fun) / 3 + 1);
 
   memset (&reciprocal_stats, 0, sizeof (reciprocal_stats));
   calculate_dominance_info (CDI_DOMINATORS);
   calculate_dominance_info (CDI_POST_DOMINATORS);
 
 #ifdef ENABLE_CHECKING
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     gcc_assert (!bb->aux);
 #endif
 
-  for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = DECL_CHAIN (arg))
+  for (arg = DECL_ARGUMENTS (fun->decl); arg; arg = DECL_CHAIN (arg))
     if (FLOAT_TYPE_P (TREE_TYPE (arg))
 	&& is_gimple_reg (arg))
       {
-	tree name = ssa_default_def (cfun, arg);
+	tree name = ssa_default_def (fun, arg);
 	if (name)
 	  execute_cse_reciprocals_1 (NULL, name);
       }
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple_stmt_iterator gsi;
       gimple phi;
@@ -636,9 +666,9 @@ execute_cse_reciprocals (void)
 	}
     }
 
-  statistics_counter_event (cfun, "reciprocal divs inserted",
+  statistics_counter_event (fun, "reciprocal divs inserted",
 			    reciprocal_stats.rdivs_inserted);
-  statistics_counter_event (cfun, "reciprocal functions inserted",
+  statistics_counter_event (fun, "reciprocal functions inserted",
 			    reciprocal_stats.rfuncs_inserted);
 
   free_dominance_info (CDI_DOMINATORS);
@@ -647,36 +677,6 @@ execute_cse_reciprocals (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_cse_reciprocals =
-{
-  GIMPLE_PASS, /* type */
-  "recip", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_update_ssa | TODO_verify_ssa
-    | TODO_verify_stmts ), /* todo_flags_finish */
-};
-
-class pass_cse_reciprocals : public gimple_opt_pass
-{
-public:
-  pass_cse_reciprocals (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_cse_reciprocals, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *) { return optimize && flag_reciprocal_math; }
-  unsigned int execute () { return execute_cse_reciprocals (); }
-
-}; // class pass_cse_reciprocals
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -1403,8 +1403,44 @@ gimple_expand_builtin_cabs (gimple_stmt_iterator *gsi, location_t loc, tree arg)
    on the SSA_NAME argument of each of them.  Also expand powi(x,n) into
    an optimal number of multiplies, when n is a constant.  */
 
-static unsigned int
-execute_cse_sincos (void)
+namespace {
+
+const pass_data pass_data_cse_sincos =
+{
+  GIMPLE_PASS, /* type */
+  "sincos", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  PROP_ssa, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_update_ssa | TODO_verify_ssa
+    | TODO_verify_stmts ), /* todo_flags_finish */
+};
+
+class pass_cse_sincos : public gimple_opt_pass
+{
+public:
+  pass_cse_sincos (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_cse_sincos, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *)
+    {
+      /* We no longer require either sincos or cexp, since powi expansion
+	 piggybacks on this pass.  */
+      return optimize;
+    }
+
+  virtual unsigned int execute (function *);
+
+}; // class pass_cse_sincos
+
+unsigned int
+pass_cse_sincos::execute (function *fun)
 {
   basic_block bb;
   bool cfg_changed = false;
@@ -1412,7 +1448,7 @@ execute_cse_sincos (void)
   calculate_dominance_info (CDI_DOMINATORS);
   memset (&sincos_stats, 0, sizeof (sincos_stats));
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple_stmt_iterator gsi;
       bool cleanup_eh = false;
@@ -1549,49 +1585,13 @@ execute_cse_sincos (void)
 	cfg_changed |= gimple_purge_dead_eh_edges (bb);
     }
 
-  statistics_counter_event (cfun, "sincos statements inserted",
+  statistics_counter_event (fun, "sincos statements inserted",
 			    sincos_stats.inserted);
 
   free_dominance_info (CDI_DOMINATORS);
   return cfg_changed ? TODO_cleanup_cfg : 0;
 }
 
-namespace {
-
-const pass_data pass_data_cse_sincos =
-{
-  GIMPLE_PASS, /* type */
-  "sincos", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_update_ssa | TODO_verify_ssa
-    | TODO_verify_stmts ), /* todo_flags_finish */
-};
-
-class pass_cse_sincos : public gimple_opt_pass
-{
-public:
-  pass_cse_sincos (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_cse_sincos, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *)
-    {
-      /* We no longer require either sincos or cexp, since powi expansion
-	 piggybacks on this pass.  */
-      return optimize;
-    }
-
-  unsigned int execute () { return execute_cse_sincos (); }
-
-}; // class pass_cse_sincos
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -1893,8 +1893,41 @@ find_bswap (gimple stmt)
 /* Find manual byte swap implementations and turn them into a bswap
    builtin invokation.  */
 
-static unsigned int
-execute_optimize_bswap (void)
+namespace {
+
+const pass_data pass_data_optimize_bswap =
+{
+  GIMPLE_PASS, /* type */
+  "bswap", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  PROP_ssa, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_optimize_bswap : public gimple_opt_pass
+{
+public:
+  pass_optimize_bswap (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_optimize_bswap, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *)
+    {
+      return flag_expensive_optimizations && optimize;
+    }
+
+  virtual unsigned int execute (function *);
+
+}; // class pass_optimize_bswap
+
+unsigned int
+pass_optimize_bswap::execute (function *fun)
 {
   basic_block bb;
   bool bswap16_p, bswap32_p, bswap64_p;
@@ -1940,7 +1973,7 @@ execute_optimize_bswap (void)
 
   memset (&bswap_stats, 0, sizeof (bswap_stats));
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple_stmt_iterator gsi;
 
@@ -2046,50 +2079,17 @@ execute_optimize_bswap (void)
 	}
     }
 
-  statistics_counter_event (cfun, "16-bit bswap implementations found",
+  statistics_counter_event (fun, "16-bit bswap implementations found",
 			    bswap_stats.found_16bit);
-  statistics_counter_event (cfun, "32-bit bswap implementations found",
+  statistics_counter_event (fun, "32-bit bswap implementations found",
 			    bswap_stats.found_32bit);
-  statistics_counter_event (cfun, "64-bit bswap implementations found",
+  statistics_counter_event (fun, "64-bit bswap implementations found",
 			    bswap_stats.found_64bit);
 
   return (changed ? TODO_update_ssa | TODO_verify_ssa
 	  | TODO_verify_stmts : 0);
 }
 
-namespace {
-
-const pass_data pass_data_optimize_bswap =
-{
-  GIMPLE_PASS, /* type */
-  "bswap", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_optimize_bswap : public gimple_opt_pass
-{
-public:
-  pass_optimize_bswap (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_optimize_bswap, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *)
-    {
-      return flag_expensive_optimizations && optimize;
-    }
-
-  unsigned int execute () { return execute_optimize_bswap (); }
-
-}; // class pass_optimize_bswap
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -2775,15 +2775,49 @@ convert_mult_to_fma (gimple mul_stmt, tree op1, tree op2)
    smaller types, and replace the MULT_EXPR with a WIDEN_MULT_EXPR
    where appropriate.  */
 
-static unsigned int
-execute_optimize_widening_mul (void)
+namespace {
+
+const pass_data pass_data_optimize_widening_mul =
+{
+  GIMPLE_PASS, /* type */
+  "widening_mul", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  PROP_ssa, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_verify_ssa | TODO_verify_stmts
+    | TODO_update_ssa ), /* todo_flags_finish */
+};
+
+class pass_optimize_widening_mul : public gimple_opt_pass
+{
+public:
+  pass_optimize_widening_mul (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_optimize_widening_mul, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *)
+    {
+      return flag_expensive_optimizations && optimize;
+    }
+
+  virtual unsigned int execute (function *);
+
+}; // class pass_optimize_widening_mul
+
+unsigned int
+pass_optimize_widening_mul::execute (function *fun)
 {
   basic_block bb;
   bool cfg_changed = false;
 
   memset (&widen_mul_stats, 0, sizeof (widen_mul_stats));
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple_stmt_iterator gsi;
 
@@ -2854,50 +2888,16 @@ execute_optimize_widening_mul (void)
 	}
     }
 
-  statistics_counter_event (cfun, "widening multiplications inserted",
+  statistics_counter_event (fun, "widening multiplications inserted",
 			    widen_mul_stats.widen_mults_inserted);
-  statistics_counter_event (cfun, "widening maccs inserted",
+  statistics_counter_event (fun, "widening maccs inserted",
 			    widen_mul_stats.maccs_inserted);
-  statistics_counter_event (cfun, "fused multiply-adds inserted",
+  statistics_counter_event (fun, "fused multiply-adds inserted",
 			    widen_mul_stats.fmas_inserted);
 
   return cfg_changed ? TODO_cleanup_cfg : 0;
 }
 
-namespace {
-
-const pass_data pass_data_optimize_widening_mul =
-{
-  GIMPLE_PASS, /* type */
-  "widening_mul", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_verify_ssa | TODO_verify_stmts
-    | TODO_update_ssa ), /* todo_flags_finish */
-};
-
-class pass_optimize_widening_mul : public gimple_opt_pass
-{
-public:
-  pass_optimize_widening_mul (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_optimize_widening_mul, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *)
-    {
-      return flag_expensive_optimizations && optimize;
-    }
-
-  unsigned int execute () { return execute_optimize_widening_mul (); }
-
-}; // class pass_optimize_widening_mul
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 1ee39a5..9b5b563 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -59,7 +59,6 @@ along with GCC; see the file COPYING3.  If not see
 #define HAVE_conditional_move (0)
 #endif
 
-static unsigned int tree_ssa_phiopt (void);
 static unsigned int tree_ssa_phiopt_worker (bool, bool);
 static bool conditional_replacement (basic_block, basic_block,
 				     edge, edge, gimple, tree, tree);
@@ -80,162 +79,6 @@ static void hoist_adjacent_loads (basic_block, basic_block,
 				  basic_block, basic_block);
 static bool gate_hoist_loads (void);
 
-/* This pass tries to replaces an if-then-else block with an
-   assignment.  We have four kinds of transformations.  Some of these
-   transformations are also performed by the ifcvt RTL optimizer.
-
-   Conditional Replacement
-   -----------------------
-
-   This transformation, implemented in conditional_replacement,
-   replaces
-
-     bb0:
-      if (cond) goto bb2; else goto bb1;
-     bb1:
-     bb2:
-      x = PHI <0 (bb1), 1 (bb0), ...>;
-
-   with
-
-     bb0:
-      x' = cond;
-      goto bb2;
-     bb2:
-      x = PHI <x' (bb0), ...>;
-
-   We remove bb1 as it becomes unreachable.  This occurs often due to
-   gimplification of conditionals.
-
-   Value Replacement
-   -----------------
-
-   This transformation, implemented in value_replacement, replaces
-
-     bb0:
-       if (a != b) goto bb2; else goto bb1;
-     bb1:
-     bb2:
-       x = PHI <a (bb1), b (bb0), ...>;
-
-   with
-
-     bb0:
-     bb2:
-       x = PHI <b (bb0), ...>;
-
-   This opportunity can sometimes occur as a result of other
-   optimizations.
-
-
-   Another case caught by value replacement looks like this:
-
-     bb0:
-       t1 = a == CONST;
-       t2 = b > c;
-       t3 = t1 & t2;
-       if (t3 != 0) goto bb1; else goto bb2;
-     bb1:
-     bb2:
-       x = PHI (CONST, a)
-
-   Gets replaced with:
-     bb0:
-     bb2:
-       t1 = a == CONST;
-       t2 = b > c;
-       t3 = t1 & t2;
-       x = a;
-
-   ABS Replacement
-   ---------------
-
-   This transformation, implemented in abs_replacement, replaces
-
-     bb0:
-       if (a >= 0) goto bb2; else goto bb1;
-     bb1:
-       x = -a;
-     bb2:
-       x = PHI <x (bb1), a (bb0), ...>;
-
-   with
-
-     bb0:
-       x' = ABS_EXPR< a >;
-     bb2:
-       x = PHI <x' (bb0), ...>;
-
-   MIN/MAX Replacement
-   -------------------
-
-   This transformation, minmax_replacement replaces
-
-     bb0:
-       if (a <= b) goto bb2; else goto bb1;
-     bb1:
-     bb2:
-       x = PHI <b (bb1), a (bb0), ...>;
-
-   with
-
-     bb0:
-       x' = MIN_EXPR (a, b)
-     bb2:
-       x = PHI <x' (bb0), ...>;
-
-   A similar transformation is done for MAX_EXPR.
-
-
-   This pass also performs a fifth transformation of a slightly different
-   flavor.
-
-   Adjacent Load Hoisting
-   ----------------------
-
-   This transformation replaces
-
-     bb0:
-       if (...) goto bb2; else goto bb1;
-     bb1:
-       x1 = (<expr>).field1;
-       goto bb3;
-     bb2:
-       x2 = (<expr>).field2;
-     bb3:
-       # x = PHI <x1, x2>;
-
-   with
-
-     bb0:
-       x1 = (<expr>).field1;
-       x2 = (<expr>).field2;
-       if (...) goto bb2; else goto bb1;
-     bb1:
-       goto bb3;
-     bb2:
-     bb3:
-       # x = PHI <x1, x2>;
-
-   The purpose of this transformation is to enable generation of conditional
-   move instructions such as Intel CMOVE or PowerPC ISEL.  Because one of
-   the loads is speculative, the transformation is restricted to very
-   specific cases to avoid introducing a page fault.  We are looking for
-   the common idiom:
-
-     if (...)
-       x = y->left;
-     else
-       x = y->right;
-
-   where left and right are typically adjacent pointers in a tree structure.  */
-
-static unsigned int
-tree_ssa_phiopt (void)
-{
-  return tree_ssa_phiopt_worker (false, gate_hoist_loads ());
-}
-
 /* This pass tries to transform conditional stores into unconditional
    ones, enabling further simplifications with the simpler then and else
    blocks.  In particular it replaces this:
@@ -2200,8 +2043,155 @@ gate_hoist_loads (void)
 	  && HAVE_conditional_move);
 }
 
-/* Always do these optimizations if we have SSA
-   trees to work on.  */
+/* This pass tries to replaces an if-then-else block with an
+   assignment.  We have four kinds of transformations.  Some of these
+   transformations are also performed by the ifcvt RTL optimizer.
+
+   Conditional Replacement
+   -----------------------
+
+   This transformation, implemented in conditional_replacement,
+   replaces
+
+     bb0:
+      if (cond) goto bb2; else goto bb1;
+     bb1:
+     bb2:
+      x = PHI <0 (bb1), 1 (bb0), ...>;
+
+   with
+
+     bb0:
+      x' = cond;
+      goto bb2;
+     bb2:
+      x = PHI <x' (bb0), ...>;
+
+   We remove bb1 as it becomes unreachable.  This occurs often due to
+   gimplification of conditionals.
+
+   Value Replacement
+   -----------------
+
+   This transformation, implemented in value_replacement, replaces
+
+     bb0:
+       if (a != b) goto bb2; else goto bb1;
+     bb1:
+     bb2:
+       x = PHI <a (bb1), b (bb0), ...>;
+
+   with
+
+     bb0:
+     bb2:
+       x = PHI <b (bb0), ...>;
+
+   This opportunity can sometimes occur as a result of other
+   optimizations.
+
+
+   Another case caught by value replacement looks like this:
+
+     bb0:
+       t1 = a == CONST;
+       t2 = b > c;
+       t3 = t1 & t2;
+       if (t3 != 0) goto bb1; else goto bb2;
+     bb1:
+     bb2:
+       x = PHI (CONST, a)
+
+   Gets replaced with:
+     bb0:
+     bb2:
+       t1 = a == CONST;
+       t2 = b > c;
+       t3 = t1 & t2;
+       x = a;
+
+   ABS Replacement
+   ---------------
+
+   This transformation, implemented in abs_replacement, replaces
+
+     bb0:
+       if (a >= 0) goto bb2; else goto bb1;
+     bb1:
+       x = -a;
+     bb2:
+       x = PHI <x (bb1), a (bb0), ...>;
+
+   with
+
+     bb0:
+       x' = ABS_EXPR< a >;
+     bb2:
+       x = PHI <x' (bb0), ...>;
+
+   MIN/MAX Replacement
+   -------------------
+
+   This transformation, minmax_replacement replaces
+
+     bb0:
+       if (a <= b) goto bb2; else goto bb1;
+     bb1:
+     bb2:
+       x = PHI <b (bb1), a (bb0), ...>;
+
+   with
+
+     bb0:
+       x' = MIN_EXPR (a, b)
+     bb2:
+       x = PHI <x' (bb0), ...>;
+
+   A similar transformation is done for MAX_EXPR.
+
+
+   This pass also performs a fifth transformation of a slightly different
+   flavor.
+
+   Adjacent Load Hoisting
+   ----------------------
+
+   This transformation replaces
+
+     bb0:
+       if (...) goto bb2; else goto bb1;
+     bb1:
+       x1 = (<expr>).field1;
+       goto bb3;
+     bb2:
+       x2 = (<expr>).field2;
+     bb3:
+       # x = PHI <x1, x2>;
+
+   with
+
+     bb0:
+       x1 = (<expr>).field1;
+       x2 = (<expr>).field2;
+       if (...) goto bb2; else goto bb1;
+     bb1:
+       goto bb3;
+     bb2:
+     bb3:
+       # x = PHI <x1, x2>;
+
+   The purpose of this transformation is to enable generation of conditional
+   move instructions such as Intel CMOVE or PowerPC ISEL.  Because one of
+   the loads is speculative, the transformation is restricted to very
+   specific cases to avoid introducing a page fault.  We are looking for
+   the common idiom:
+
+     if (...)
+       x = y->left;
+     else
+       x = y->right;
+
+   where left and right are typically adjacent pointers in a tree structure.  */
 
 namespace {
 
@@ -2229,7 +2219,10 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_phiopt (m_ctxt); }
-  unsigned int execute () { return tree_ssa_phiopt (); }
+  virtual unsigned int execute (function *)
+    {
+      return tree_ssa_phiopt_worker (false, gate_hoist_loads ());
+    }
 
 }; // class pass_phiopt
 
@@ -2267,7 +2260,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tree_cselim; }
-  unsigned int execute () { return tree_ssa_cs_elim (); }
+  virtual unsigned int execute (function *) { return tree_ssa_cs_elim (); }
 
 }; // class pass_cselim
 
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index cbdbc6e..0154b47 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -374,8 +374,37 @@ next:;
 
 /* Main entry for phiprop pass.  */
 
-static unsigned int
-tree_ssa_phiprop (void)
+namespace {
+
+const pass_data pass_data_phiprop =
+{
+  GIMPLE_PASS, /* type */
+  "phiprop", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_PHIPROP, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
+};
+
+class pass_phiprop : public gimple_opt_pass
+{
+public:
+  pass_phiprop (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_phiprop, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *) { return flag_tree_phiprop; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_phiprop
+
+unsigned int
+pass_phiprop::execute (function *fun)
 {
   vec<basic_block> bbs;
   struct phiprop_d *phivn;
@@ -393,7 +422,7 @@ tree_ssa_phiprop (void)
 
   /* Walk the dominator tree in preorder.  */
   bbs = get_all_dominated_blocks (CDI_DOMINATORS,
-				  single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
+				  single_succ (ENTRY_BLOCK_PTR_FOR_FN (fun)));
   FOR_EACH_VEC_ELT (bbs, i, bb)
     for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
       did_something |= propagate_with_phi (bb, gsi_stmt (gsi), phivn, n);
@@ -409,35 +438,6 @@ tree_ssa_phiprop (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_phiprop =
-{
-  GIMPLE_PASS, /* type */
-  "phiprop", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_PHIPROP, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
-};
-
-class pass_phiprop : public gimple_opt_pass
-{
-public:
-  pass_phiprop (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_phiprop, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *) { return flag_tree_phiprop; }
-  unsigned int execute () { return tree_ssa_phiprop (); }
-
-}; // class pass_phiprop
-
 } // anon namespace
 
 gimple_opt_pass *
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 *
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 92a215a..84b681e 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -4693,7 +4693,7 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_reassoc (m_ctxt); }
   virtual bool gate (function *) { return flag_tree_reassoc != 0; }
-  unsigned int execute () { return execute_reassoc (); }
+  virtual unsigned int execute (function *) { return execute_reassoc (); }
 
 }; // class pass_reassoc
 
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index 6803160..7992ced 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -563,31 +563,6 @@ sink_code_in_bb (basic_block bb)
    Note that this reduces the number of computations of a = b + c to 1
    when we take the else edge, instead of 2.
 */
-static void
-execute_sink_code (void)
-{
-  loop_optimizer_init (LOOPS_NORMAL);
-  split_critical_edges ();
-  connect_infinite_loops_to_exit ();
-  memset (&sink_stats, 0, sizeof (sink_stats));
-  calculate_dominance_info (CDI_DOMINATORS);
-  calculate_dominance_info (CDI_POST_DOMINATORS);
-  sink_code_in_bb (EXIT_BLOCK_PTR_FOR_FN (cfun));
-  statistics_counter_event (cfun, "Sunk statements", sink_stats.sunk);
-  free_dominance_info (CDI_POST_DOMINATORS);
-  remove_fake_exit_edges ();
-  loop_optimizer_finalize ();
-}
-
-/* Gate and execute functions for PRE.  */
-
-static unsigned int
-do_sink (void)
-{
-  execute_sink_code ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_sink_code =
@@ -598,7 +573,7 @@ const pass_data pass_data_sink_code =
   true, /* has_execute */
   TV_TREE_SINK, /* tv_id */
   /* PROP_no_crit_edges is ensured by running split_critical_edges in
-     execute_sink_code.  */
+     pass_data_sink_code::execute ().  */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
   0, /* properties_provided */
   0, /* properties_destroyed */
@@ -616,10 +591,28 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tree_sink != 0; }
-  unsigned int execute () { return do_sink (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_sink_code
 
+unsigned int
+pass_sink_code::execute (function *fun)
+{
+  loop_optimizer_init (LOOPS_NORMAL);
+  split_critical_edges ();
+  connect_infinite_loops_to_exit ();
+  memset (&sink_stats, 0, sizeof (sink_stats));
+  calculate_dominance_info (CDI_DOMINATORS);
+  calculate_dominance_info (CDI_POST_DOMINATORS);
+  sink_code_in_bb (EXIT_BLOCK_PTR_FOR_FN (fun));
+  statistics_counter_event (fun, "Sunk statements", sink_stats.sunk);
+  free_dominance_info (CDI_POST_DOMINATORS);
+  remove_fake_exit_edges ();
+  loop_optimizer_finalize ();
+
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index fb83093..1cc36d8 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -2061,34 +2061,6 @@ strlen_dom_walker::after_dom_children (basic_block bb)
 
 /* Main entry point.  */
 
-static unsigned int
-tree_ssa_strlen (void)
-{
-  ssa_ver_to_stridx.safe_grow_cleared (num_ssa_names);
-  max_stridx = 1;
-  strinfo_pool = create_alloc_pool ("strinfo_struct pool",
-				    sizeof (struct strinfo_struct), 64);
-
-  calculate_dominance_info (CDI_DOMINATORS);
-
-  /* String length optimization is implemented as a walk of the dominator
-     tree and a forward walk of statements within each block.  */
-  strlen_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
-
-  ssa_ver_to_stridx.release ();
-  free_alloc_pool (strinfo_pool);
-  if (decl_to_stridxlist_htab.is_created ())
-    {
-      obstack_free (&stridx_obstack, NULL);
-      decl_to_stridxlist_htab.dispose ();
-    }
-  laststmt.stmt = NULL;
-  laststmt.len = NULL_TREE;
-  laststmt.stridx = 0;
-
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_strlen =
@@ -2114,10 +2086,38 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_optimize_strlen != 0; }
-  unsigned int execute () { return tree_ssa_strlen (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_strlen
 
+unsigned int
+pass_strlen::execute (function *fun)
+{
+  ssa_ver_to_stridx.safe_grow_cleared (num_ssa_names);
+  max_stridx = 1;
+  strinfo_pool = create_alloc_pool ("strinfo_struct pool",
+				    sizeof (struct strinfo_struct), 64);
+
+  calculate_dominance_info (CDI_DOMINATORS);
+
+  /* String length optimization is implemented as a walk of the dominator
+     tree and a forward walk of statements within each block.  */
+  strlen_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr);
+
+  ssa_ver_to_stridx.release ();
+  free_alloc_pool (strinfo_pool);
+  if (decl_to_stridxlist_htab.is_created ())
+    {
+      obstack_free (&stridx_obstack, NULL);
+      decl_to_stridxlist_htab.dispose ();
+    }
+  laststmt.stmt = NULL;
+  laststmt.len = NULL_TREE;
+  laststmt.stridx = 0;
+
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 3548ac5..2686ba6 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -7444,7 +7444,7 @@ public:
 	      && !seen_error ());
     }
 
-  unsigned int execute () { return ipa_pta_execute (); }
+  virtual unsigned int execute (function *) { return ipa_pta_execute (); }
 
 }; // class pass_ipa_pta
 
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index e39ce88..52c568a 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -383,47 +383,6 @@ private:
   auto_vec<tree, 2> m_equiv_stack;
 };
 
-/* Main driver for un-cprop.  */
-
-static unsigned int
-tree_ssa_uncprop (void)
-{
-  basic_block bb;
-
-  associate_equivalences_with_edges ();
-
-  /* Create our global data structures.  */
-  val_ssa_equiv.create (1024);
-
-  /* We're going to do a dominator walk, so ensure that we have
-     dominance information.  */
-  calculate_dominance_info (CDI_DOMINATORS);
-
-  /* Recursively walk the dominator tree undoing unprofitable
-     constant/copy propagations.  */
-  uncprop_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
-
-  /* we just need to empty elements out of the hash table, and cleanup the
-    AUX field on the edges.  */
-  val_ssa_equiv.dispose ();
-  FOR_EACH_BB_FN (bb, cfun)
-    {
-      edge e;
-      edge_iterator ei;
-
-      FOR_EACH_EDGE (e, ei, bb->succs)
-	{
-	  if (e->aux)
-	    {
-	      free (e->aux);
-	      e->aux = NULL;
-	    }
-	}
-    }
-  return 0;
-}
-
-
 /* We have finished processing the dominator children of BB, perform
    any finalization actions in preparation for leaving this node in
    the dominator tree.  */
@@ -607,10 +566,48 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_uncprop (m_ctxt); }
   virtual bool gate (function *) { return flag_tree_dom != 0; }
-  unsigned int execute () { return tree_ssa_uncprop (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_uncprop
 
+unsigned int
+pass_uncprop::execute (function *fun)
+{
+  basic_block bb;
+
+  associate_equivalences_with_edges ();
+
+  /* Create our global data structures.  */
+  val_ssa_equiv.create (1024);
+
+  /* We're going to do a dominator walk, so ensure that we have
+     dominance information.  */
+  calculate_dominance_info (CDI_DOMINATORS);
+
+  /* Recursively walk the dominator tree undoing unprofitable
+     constant/copy propagations.  */
+  uncprop_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr);
+
+  /* we just need to empty elements out of the hash table, and cleanup the
+    AUX field on the edges.  */
+  val_ssa_equiv.dispose ();
+  FOR_EACH_BB_FN (bb, fun)
+    {
+      edge e;
+      edge_iterator ei;
+
+      FOR_EACH_EDGE (e, ei, bb->succs)
+	{
+	  if (e->aux)
+	    {
+	      free (e->aux);
+	      e->aux = NULL;
+	    }
+	}
+    }
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 03ff3b8..5477bb8 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -2282,11 +2282,44 @@ warn_uninitialized_phi (gimple phi, vec<gimple> *worklist,
 
 }
 
+static bool
+gate_warn_uninitialized (void)
+{
+  return warn_uninitialized || warn_maybe_uninitialized;
+}
 
-/* Entry point to the late uninitialized warning pass.  */
+namespace {
 
-static unsigned int
-execute_late_warn_uninitialized (void)
+const pass_data pass_data_late_warn_uninitialized =
+{
+  GIMPLE_PASS, /* type */
+  "uninit", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  PROP_ssa, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_late_warn_uninitialized : public gimple_opt_pass
+{
+public:
+  pass_late_warn_uninitialized (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_late_warn_uninitialized, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
+  virtual bool gate (function *) { return gate_warn_uninitialized (); }
+  virtual unsigned int execute (function *);
+
+}; // class pass_late_warn_uninitialized
+
+unsigned int
+pass_late_warn_uninitialized::execute (function *fun)
 {
   basic_block bb;
   gimple_stmt_iterator gsi;
@@ -2306,34 +2339,34 @@ execute_late_warn_uninitialized (void)
   added_to_worklist = pointer_set_create ();
 
   /* Initialize worklist  */
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
       {
-        gimple phi = gsi_stmt (gsi);
-        size_t n, i;
-
-        n = gimple_phi_num_args (phi);
-
-        /* Don't look at virtual operands.  */
-        if (virtual_operand_p (gimple_phi_result (phi)))
-          continue;
-
-        for (i = 0; i < n; ++i)
-          {
-            tree op = gimple_phi_arg_def (phi, i);
-            if (TREE_CODE (op) == SSA_NAME
-                && uninit_undefined_value_p (op))
-              {
-                worklist.safe_push (phi);
+	gimple phi = gsi_stmt (gsi);
+	size_t n, i;
+
+	n = gimple_phi_num_args (phi);
+
+	/* Don't look at virtual operands.  */
+	if (virtual_operand_p (gimple_phi_result (phi)))
+	  continue;
+
+	for (i = 0; i < n; ++i)
+	  {
+	    tree op = gimple_phi_arg_def (phi, i);
+	    if (TREE_CODE (op) == SSA_NAME
+		&& uninit_undefined_value_p (op))
+	      {
+		worklist.safe_push (phi);
 		pointer_set_insert (added_to_worklist, phi);
-                if (dump_file && (dump_flags & TDF_DETAILS))
-                  {
-                    fprintf (dump_file, "[WORKLIST]: add to initial list: ");
-                    print_gimple_stmt (dump_file, phi, 0, 0);
-                  }
-                break;
-              }
-          }
+		if (dump_file && (dump_flags & TDF_DETAILS))
+		  {
+		    fprintf (dump_file, "[WORKLIST]: add to initial list: ");
+		    print_gimple_stmt (dump_file, phi, 0, 0);
+		  }
+		break;
+	      }
+	  }
       }
 
   while (worklist.length () != 0)
@@ -2352,42 +2385,6 @@ execute_late_warn_uninitialized (void)
   return 0;
 }
 
-static bool
-gate_warn_uninitialized (void)
-{
-  return warn_uninitialized || warn_maybe_uninitialized;
-}
-
-namespace {
-
-const pass_data pass_data_late_warn_uninitialized =
-{
-  GIMPLE_PASS, /* type */
-  "uninit", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_late_warn_uninitialized : public gimple_opt_pass
-{
-public:
-  pass_late_warn_uninitialized (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_late_warn_uninitialized, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
-  virtual bool gate (function *) { return gate_warn_uninitialized (); }
-  unsigned int execute () { return execute_late_warn_uninitialized (); }
-
-}; // class pass_late_warn_uninitialized
-
 } // anon namespace
 
 gimple_opt_pass *
@@ -2442,7 +2439,10 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return gate_warn_uninitialized (); }
-  unsigned int execute () { return execute_early_warn_uninitialized (); }
+  virtual unsigned int execute (function *)
+    {
+      return execute_early_warn_uninitialized ();
+    }
 
 }; // class pass_early_warn_uninitialized
 
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 52126ca..1ea639d 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1169,7 +1169,10 @@ public:
       return !(fun->curr_properties & PROP_ssa);
     }
 
-  unsigned int execute () { return execute_init_datastructures (); }
+  virtual unsigned int execute (function *)
+    {
+      return execute_init_datastructures ();
+    }
 
 }; // class pass_init_datastructures
 
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index b18b688..02db6a5 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -569,39 +569,6 @@ replace_ssa_name_symbol (tree ssa_name, tree sym)
 /* Return SSA names that are unused to GGC memory and compact the SSA
    version namespace.  This is used to keep footprint of compiler during
    interprocedural optimization.  */
-static unsigned int
-release_dead_ssa_names (void)
-{
-  unsigned i, j;
-  int n = vec_safe_length (FREE_SSANAMES (cfun));
-
-  /* Now release the freelist.  */
-  vec_free (FREE_SSANAMES (cfun));
-
-  /* And compact the SSA number space.  We make sure to not change the
-     relative order of SSA versions.  */
-  for (i = 1, j = 1; i < cfun->gimple_df->ssa_names->length (); ++i)
-    {
-      tree name = ssa_name (i);
-      if (name)
-	{
-	  if (i != j)
-	    {
-	      SSA_NAME_VERSION (name) = j;
-	      (*cfun->gimple_df->ssa_names)[j] = name;
-	    }
-	  j++;
-	}
-    }
-  cfun->gimple_df->ssa_names->truncate (j);
-
-  statistics_counter_event (cfun, "SSA names released", n);
-  statistics_counter_event (cfun, "SSA name holes removed", i - j);
-  if (dump_file)
-    fprintf (dump_file, "Released %i names, %.2f%%, removed %i holes\n",
-	     n, n * 100.0 / num_ssa_names, i - j);
-  return 0;
-}
 
 namespace {
 
@@ -627,10 +594,44 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return release_dead_ssa_names (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_release_ssa_names
 
+unsigned int
+pass_release_ssa_names::execute (function *fun)
+{
+  unsigned i, j;
+  int n = vec_safe_length (FREE_SSANAMES (fun));
+
+  /* Now release the freelist.  */
+  vec_free (FREE_SSANAMES (fun));
+
+  /* And compact the SSA number space.  We make sure to not change the
+     relative order of SSA versions.  */
+  for (i = 1, j = 1; i < fun->gimple_df->ssa_names->length (); ++i)
+    {
+      tree name = ssa_name (i);
+      if (name)
+	{
+	  if (i != j)
+	    {
+	      SSA_NAME_VERSION (name) = j;
+	      (*fun->gimple_df->ssa_names)[j] = name;
+	    }
+	  j++;
+	}
+    }
+  fun->gimple_df->ssa_names->truncate (j);
+
+  statistics_counter_event (fun, "SSA names released", n);
+  statistics_counter_event (fun, "SSA name holes removed", i - j);
+  if (dump_file)
+    fprintf (dump_file, "Released %i names, %.2f%%, removed %i holes\n",
+	     n, n * 100.0 / num_ssa_names, i - j);
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 710711b..1cdf0ed 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -663,10 +663,43 @@ check_all_va_list_escapes (struct stdarg_info *si)
   return false;
 }
 
-/* Entry point to the stdarg optimization pass.  */
 
-static unsigned int
-execute_optimize_stdarg (void)
+namespace {
+
+const pass_data pass_data_stdarg =
+{
+  GIMPLE_PASS, /* type */
+  "stdarg", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_NONE, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_stdarg : public gimple_opt_pass
+{
+public:
+  pass_stdarg (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_stdarg, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *fun)
+    {
+      /* This optimization is only for stdarg functions.  */
+      return fun->stdarg != 0;
+    }
+
+  virtual unsigned int execute (function *);
+
+}; // class pass_stdarg
+
+unsigned int
+pass_stdarg::execute (function *fun)
 {
   basic_block bb;
   bool va_list_escapes = false;
@@ -676,8 +709,8 @@ execute_optimize_stdarg (void)
   const char *funcname = NULL;
   tree cfun_va_list;
 
-  cfun->va_list_gpr_size = 0;
-  cfun->va_list_fpr_size = 0;
+  fun->va_list_gpr_size = 0;
+  fun->va_list_fpr_size = 0;
   memset (&si, 0, sizeof (si));
   si.va_list_vars = BITMAP_ALLOC (NULL);
   si.va_list_escape_vars = BITMAP_ALLOC (NULL);
@@ -685,13 +718,13 @@ execute_optimize_stdarg (void)
   if (dump_file)
     funcname = lang_hooks.decl_printable_name (current_function_decl, 2);
 
-  cfun_va_list = targetm.fn_abi_va_list (cfun->decl);
+  cfun_va_list = targetm.fn_abi_va_list (fun->decl);
   va_list_simple_ptr = POINTER_TYPE_P (cfun_va_list)
 		       && (TREE_TYPE (cfun_va_list) == void_type_node
 			   || TREE_TYPE (cfun_va_list) == char_type_node);
   gcc_assert (is_gimple_reg_type (cfun_va_list) == va_list_simple_ptr);
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple_stmt_iterator i;
 
@@ -740,7 +773,7 @@ execute_optimize_stdarg (void)
 	      ap = TREE_OPERAND (ap, 0);
 	    }
 	  if (TYPE_MAIN_VARIANT (TREE_TYPE (ap))
-	      != TYPE_MAIN_VARIANT (targetm.fn_abi_va_list (cfun->decl))
+	      != TYPE_MAIN_VARIANT (targetm.fn_abi_va_list (fun->decl))
 	      || TREE_CODE (ap) != VAR_DECL)
 	    {
 	      va_list_escapes = true;
@@ -795,13 +828,13 @@ execute_optimize_stdarg (void)
   /* For void * or char * va_list there is just one counter
      (va_list itself).  Use VA_LIST_GPR_SIZE for it.  */
   if (va_list_simple_ptr)
-    cfun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
+    fun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
 
   calculate_dominance_info (CDI_DOMINATORS);
   memset (&wi, 0, sizeof (wi));
   wi.info = si.va_list_vars;
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       gimple_stmt_iterator i;
 
@@ -962,8 +995,8 @@ execute_optimize_stdarg (void)
 finish:
   if (va_list_escapes)
     {
-      cfun->va_list_gpr_size = VA_LIST_MAX_GPR_SIZE;
-      cfun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
+      fun->va_list_gpr_size = VA_LIST_MAX_GPR_SIZE;
+      fun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
     }
   BITMAP_FREE (si.va_list_vars);
   BITMAP_FREE (si.va_list_escape_vars);
@@ -972,12 +1005,12 @@ finish:
     {
       fprintf (dump_file, "%s: va_list escapes %d, needs to save ",
 	       funcname, (int) va_list_escapes);
-      if (cfun->va_list_gpr_size >= VA_LIST_MAX_GPR_SIZE)
+      if (fun->va_list_gpr_size >= VA_LIST_MAX_GPR_SIZE)
 	fputs ("all", dump_file);
       else
 	fprintf (dump_file, "%d", cfun->va_list_gpr_size);
       fputs (" GPR units and ", dump_file);
-      if (cfun->va_list_fpr_size >= VA_LIST_MAX_FPR_SIZE)
+      if (fun->va_list_fpr_size >= VA_LIST_MAX_FPR_SIZE)
 	fputs ("all", dump_file);
       else
 	fprintf (dump_file, "%d", cfun->va_list_fpr_size);
@@ -986,41 +1019,6 @@ finish:
   return 0;
 }
 
-
-namespace {
-
-const pass_data pass_data_stdarg =
-{
-  GIMPLE_PASS, /* type */
-  "stdarg", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_NONE, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_stdarg : public gimple_opt_pass
-{
-public:
-  pass_stdarg (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_stdarg, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *fun)
-    {
-      /* This optimization is only for stdarg functions.  */
-      return fun->stdarg != 0;
-    }
-
-  unsigned int execute () { return execute_optimize_stdarg (); }
-
-}; // class pass_stdarg
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index a0f9d19..34edc64 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1414,12 +1414,43 @@ process_switch (gimple swtch)
 /* The main function of the pass scans statements for switches and invokes
    process_switch on them.  */
 
-static unsigned int
-do_switchconv (void)
+namespace {
+
+const pass_data pass_data_convert_switch =
+{
+  GIMPLE_PASS, /* type */
+  "switchconv", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_SWITCH_CONVERSION, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_update_ssa | TODO_verify_ssa
+    | TODO_verify_stmts
+    | TODO_verify_flow ), /* todo_flags_finish */
+};
+
+class pass_convert_switch : public gimple_opt_pass
+{
+public:
+  pass_convert_switch (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_convert_switch, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *) { return flag_tree_switch_conversion != 0; }
+  virtual unsigned int execute (function *);
+
+}; // class pass_convert_switch
+
+unsigned int
+pass_convert_switch::execute (function *fun)
 {
   basic_block bb;
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
   {
     const char *failure_reason;
     gimple stmt = last_stmt (bb);
@@ -1465,37 +1496,6 @@ do_switchconv (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_convert_switch =
-{
-  GIMPLE_PASS, /* type */
-  "switchconv", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_SWITCH_CONVERSION, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_update_ssa | TODO_verify_ssa
-    | TODO_verify_stmts
-    | TODO_verify_flow ), /* todo_flags_finish */
-};
-
-class pass_convert_switch : public gimple_opt_pass
-{
-public:
-  pass_convert_switch (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_convert_switch, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *) { return flag_tree_switch_conversion != 0; }
-  unsigned int execute () { return do_switchconv (); }
-
-}; // class pass_convert_switch
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 84cdbde..11a2965 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -1065,12 +1065,6 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
   return 0;
 }
 
-static unsigned int
-execute_tail_recursion (void)
-{
-  return tree_optimize_tail_calls_1 (false);
-}
-
 static bool
 gate_tail_calls (void)
 {
@@ -1109,7 +1103,10 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_tail_recursion (m_ctxt); }
   virtual bool gate (function *) { return gate_tail_calls (); }
-  unsigned int execute () { return execute_tail_recursion (); }
+  virtual unsigned int execute (function *)
+    {
+      return tree_optimize_tail_calls_1 (false);
+    }
 
 }; // class pass_tail_recursion
 
@@ -1146,7 +1143,7 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return gate_tail_calls (); }
-  unsigned int execute () { return execute_tail_calls (); }
+  virtual unsigned int execute (function *) { return execute_tail_calls (); }
 
 }; // class pass_tail_calls
 
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index 4274417..d8b2200 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -1585,7 +1585,10 @@ public:
       return !(fun->curr_properties & PROP_gimple_lvec);
     }
 
-  unsigned int execute () { return expand_vector_operations (); }
+  virtual unsigned int execute (function *)
+    {
+      return expand_vector_operations ();
+    }
 
 }; // class pass_lower_vector
 
@@ -1625,7 +1628,10 @@ public:
 
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_lower_vector_ssa (m_ctxt); }
-  unsigned int execute () { return expand_vector_operations (); }
+  virtual unsigned int execute (function *)
+    {
+      return expand_vector_operations ();
+    }
 
 }; // class pass_lower_vector_ssa
 
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 7b5691a..d7de964 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -586,33 +586,6 @@ vectorize_loops (void)
 
 /*  Entry point to basic block SLP phase.  */
 
-static unsigned int
-execute_vect_slp (void)
-{
-  basic_block bb;
-
-  init_stmt_vec_info_vec ();
-
-  FOR_EACH_BB_FN (bb, cfun)
-    {
-      vect_location = find_bb_location (bb);
-
-      if (vect_slp_analyze_bb (bb))
-        {
-          if (!dbg_cnt (vect_slp))
-            break;
-
-          vect_slp_transform_bb (bb);
-          if (dump_enabled_p ())
-            dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
-			     "basic block vectorized\n");
-        }
-    }
-
-  free_stmt_vec_info_vec ();
-  return 0;
-}
-
 namespace {
 
 const pass_data pass_data_slp_vectorize =
@@ -639,10 +612,37 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tree_slp_vectorize != 0; }
-  unsigned int execute () { return execute_vect_slp (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_slp_vectorize
 
+unsigned int
+pass_slp_vectorize::execute (function *fun)
+{
+  basic_block bb;
+
+  init_stmt_vec_info_vec ();
+
+  FOR_EACH_BB_FN (bb, fun)
+    {
+      vect_location = find_bb_location (bb);
+
+      if (vect_slp_analyze_bb (bb))
+        {
+          if (!dbg_cnt (vect_slp))
+            break;
+
+          vect_slp_transform_bb (bb);
+          if (dump_enabled_p ())
+            dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
+			     "basic block vectorized\n");
+        }
+    }
+
+  free_stmt_vec_info_vec ();
+  return 0;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
@@ -725,7 +725,7 @@ public:
       return flag_section_anchors && flag_tree_loop_vectorize;
     }
 
-  unsigned int execute () { return increase_alignment (); }
+  virtual unsigned int execute (function *) { return increase_alignment (); }
 
 }; // class pass_ipa_increase_alignment
 
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 80f3888..34255ce 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -9922,7 +9922,7 @@ public:
   /* opt_pass methods: */
   opt_pass * clone () { return new pass_vrp (m_ctxt); }
   virtual bool gate (function *) { return flag_tree_vrp != 0; }
-  unsigned int execute () { return execute_vrp (); }
+  virtual unsigned int execute (function *) { return execute_vrp (); }
 
 }; // class pass_vrp
 
diff --git a/gcc/tree.c b/gcc/tree.c
index b897988..8b44ecc 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5642,7 +5642,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  unsigned int execute () { return free_lang_data (); }
+  virtual unsigned int execute (function *) { return free_lang_data (); }
 
 }; // class pass_ipa_free_lang_data
 
diff --git a/gcc/tsan.c b/gcc/tsan.c
index b413bb5..d9f5718 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -762,7 +762,7 @@ public:
   return (flag_sanitize & SANITIZE_THREAD) != 0;
 }
 
-  unsigned int execute () { return tsan_pass (); }
+  virtual unsigned int execute (function *) { return tsan_pass (); }
 
 }; // class pass_tsan
 
@@ -803,7 +803,7 @@ public:
       return (flag_sanitize & SANITIZE_THREAD) != 0 && !optimize;
     }
 
-  unsigned int execute () { return tsan_pass (); }
+  virtual unsigned int execute (function *) { return tsan_pass (); }
 
 }; // class pass_tsan_O0
 
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index 8e7dda5..cf25aa3 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -859,17 +859,49 @@ instrument_bool_enum_load (gimple_stmt_iterator *gsi)
   gsi_insert_before (&gsi2, g, GSI_SAME_STMT);
 }
 
-/* Gate and execute functions for ubsan pass.  */
+namespace {
 
-static unsigned int
-ubsan_pass (void)
+const pass_data pass_data_ubsan =
+{
+  GIMPLE_PASS, /* type */
+  "ubsan", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_TREE_UBSAN, /* tv_id */
+  ( PROP_cfg | PROP_ssa ), /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  TODO_update_ssa, /* todo_flags_finish */
+};
+
+class pass_ubsan : public gimple_opt_pass
+{
+public:
+  pass_ubsan (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_ubsan, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *)
+    {
+      return flag_sanitize & (SANITIZE_NULL | SANITIZE_SI_OVERFLOW
+			      | SANITIZE_BOOL | SANITIZE_ENUM);
+    }
+
+  virtual unsigned int execute (function *);
+
+}; // class pass_ubsan
+
+unsigned int
+pass_ubsan::execute (function *fun)
 {
   basic_block bb;
   gimple_stmt_iterator gsi;
 
   initialize_sanitizer_builtins ();
 
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fun)
     {
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
 	{
@@ -902,40 +934,6 @@ ubsan_pass (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_ubsan =
-{
-  GIMPLE_PASS, /* type */
-  "ubsan", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_TREE_UBSAN, /* tv_id */
-  ( PROP_cfg | PROP_ssa ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_update_ssa, /* todo_flags_finish */
-};
-
-class pass_ubsan : public gimple_opt_pass
-{
-public:
-  pass_ubsan (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_ubsan, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *)
-    {
-      return flag_sanitize & (SANITIZE_NULL | SANITIZE_SI_OVERFLOW
-			      | SANITIZE_BOOL | SANITIZE_ENUM);
-    }
-
-  unsigned int execute () { return ubsan_pass (); }
-
-}; // class pass_ubsan
-
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 4586afc..3937340 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -10373,7 +10373,10 @@ public:
       return (flag_var_tracking && !targetm.delay_vartrack);
     }
 
-  unsigned int execute () { return variable_tracking_main (); }
+  virtual unsigned int execute (function *)
+    {
+      return variable_tracking_main ();
+    }
 
 }; // class pass_variable_tracking
 
diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
index 601b2ce..b99ff6c 100644
--- a/gcc/vtable-verify.c
+++ b/gcc/vtable-verify.c
@@ -723,23 +723,6 @@ verify_bb_vtables (basic_block bb)
     }
 }
 
-/* Main function, called from pass->excute().  Loop through all the
-   basic blocks in the current function, passing them to
-   verify_bb_vtables, which searches for virtual calls, and inserts
-   calls to __VLTVerifyVtablePointer.  */
-
-unsigned int
-vtable_verify_main (void)
-{
-  unsigned int ret = 1;
-  basic_block bb;
-
-  FOR_ALL_BB_FN (bb, cfun)
-      verify_bb_vtables (bb);
-
-  return ret;
-}
-
 /* Definition of this optimization pass.  */
 
 namespace {
@@ -767,10 +750,26 @@ public:
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return (flag_vtable_verify); }
-  unsigned int execute () { return vtable_verify_main (); }
+  virtual unsigned int execute (function *);
 
 }; // class pass_vtable_verify
 
+/* Loop through all the basic blocks in the current function, passing them to
+   verify_bb_vtables, which searches for virtual calls, and inserts
+   calls to __VLTVerifyVtablePointer.  */
+
+unsigned int
+pass_vtable_verify::execute (function *fun)
+{
+  unsigned int ret = 1;
+  basic_block bb;
+
+  FOR_ALL_BB_FN (bb, fun)
+      verify_bb_vtables (bb);
+
+  return ret;
+}
+
 } // anon namespace
 
 gimple_opt_pass *
diff --git a/gcc/web.c b/gcc/web.c
index 50fc9e6..46a6ff7 100644
--- a/gcc/web.c
+++ b/gcc/web.c
@@ -325,10 +325,37 @@ replace_ref (df_ref ref, rtx reg)
 }
 
 \f
-/* Main entry point.  */
+namespace {
+
+const pass_data pass_data_web =
+{
+  RTL_PASS, /* type */
+  "web", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  true, /* has_execute */
+  TV_WEB, /* tv_id */
+  0, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_df_finish | TODO_verify_rtl_sharing ), /* todo_flags_finish */
+};
+
+class pass_web : public rtl_opt_pass
+{
+public:
+  pass_web (gcc::context *ctxt)
+    : rtl_opt_pass (pass_data_web, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *) { return (optimize > 0 && flag_web); }
+  virtual unsigned int execute (function *);
 
-static unsigned int
-web_main (void)
+}; // class pass_web
+
+unsigned int
+pass_web::execute (function *fun)
 {
   struct web_entry *def_entry;
   struct web_entry *use_entry;
@@ -345,7 +372,7 @@ web_main (void)
   df_set_flags (DF_DEFER_INSN_RESCAN);
 
   /* Assign ids to the uses.  */
-  FOR_ALL_BB_FN (bb, cfun)
+  FOR_ALL_BB_FN (bb, fun)
     FOR_BB_INSNS (bb, insn)
     {
       unsigned int uid = INSN_UID (insn);
@@ -373,7 +400,7 @@ web_main (void)
   use_entry = XCNEWVEC (struct web_entry, uses_num);
 
   /* Produce the web.  */
-  FOR_ALL_BB_FN (bb, cfun)
+  FOR_ALL_BB_FN (bb, fun)
     FOR_BB_INSNS (bb, insn)
     {
       unsigned int uid = INSN_UID (insn);
@@ -398,7 +425,7 @@ web_main (void)
 
   /* Update the instruction stream, allocating new registers for split pseudos
      in progress.  */
-  FOR_ALL_BB_FN (bb, cfun)
+  FOR_ALL_BB_FN (bb, fun)
     FOR_BB_INSNS (bb, insn)
     {
       unsigned int uid = INSN_UID (insn);
@@ -443,35 +470,6 @@ web_main (void)
   return 0;
 }
 \f
-namespace {
-
-const pass_data pass_data_web =
-{
-  RTL_PASS, /* type */
-  "web", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  true, /* has_execute */
-  TV_WEB, /* tv_id */
-  0, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  ( TODO_df_finish | TODO_verify_rtl_sharing ), /* todo_flags_finish */
-};
-
-class pass_web : public rtl_opt_pass
-{
-public:
-  pass_web (gcc::context *ctxt)
-    : rtl_opt_pass (pass_data_web, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *) { return (optimize > 0 && flag_web); }
-  unsigned int execute () { return web_main (); }
-
-}; // class pass_web
-
 } // anon namespace
 
 rtl_opt_pass *
-- 
1.9.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/6] remove properties stuff from register_dump_files_1
  2014-04-17  8:38 [PATCH 1/6] remove properties stuff from register_dump_files_1 tsaunders
                   ` (3 preceding siblings ...)
  2014-04-17  8:38 ` [PATCH 2/6] merge register_dump_files_1 into register_dump_files tsaunders
@ 2014-04-17  8:53 ` Richard Biener
  2014-04-17 13:10   ` Trevor Saunders
  2014-04-17  8:53 ` [PATCH 6/6] pass cfun to pass::execute tsaunders
  5 siblings, 1 reply; 13+ messages in thread
From: Richard Biener @ 2014-04-17  8:53 UTC (permalink / raw)
  To: tsaunders; +Cc: GCC Patches

On Thu, Apr 17, 2014 at 10:37 AM,  <tsaunders@mozilla.com> wrote:
> From: Trevor Saunders <tsaunders@mozilla.com>
>
> Hi,
>
> just removing some dead code.
>
> bootstrapped + regtested against r209414 on x86_64-unknown-linux-gnu, ok?

Ok.

Thanks,
Richard.

> Trev
>
> 2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>
>
>         * pass_manager.h (pass_manager::register_dump_files_1): Adjust.
>         * passes.c (pass_manager::register_dump_files_1): Remove dead code
>         dealing with properties.
>         (pass_manager::register_dump_files): Adjust.
>
> diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
> index e1d8143..8309567 100644
> --- a/gcc/pass_manager.h
> +++ b/gcc/pass_manager.h
> @@ -91,7 +91,7 @@ public:
>
>  private:
>    void set_pass_for_id (int id, opt_pass *pass);
> -  int register_dump_files_1 (opt_pass *pass, int properties);
> +  void register_dump_files_1 (opt_pass *pass);
>    void register_dump_files (opt_pass *pass, int properties);
>
>  private:
> diff --git a/gcc/passes.c b/gcc/passes.c
> index 60fb135..3f9590a 100644
> --- a/gcc/passes.c
> +++ b/gcc/passes.c
> @@ -708,33 +708,21 @@ pass_manager::register_one_dump_file (opt_pass *pass)
>
>  /* Recursive worker function for register_dump_files.  */
>
> -int
> +void
>  pass_manager::
> -register_dump_files_1 (opt_pass *pass, int properties)
> +register_dump_files_1 (opt_pass *pass)
>  {
>    do
>      {
> -      int new_properties = (properties | pass->properties_provided)
> -                          & ~pass->properties_destroyed;
> -
>        if (pass->name && pass->name[0] != '*')
>          register_one_dump_file (pass);
>
>        if (pass->sub)
> -        new_properties = register_dump_files_1 (pass->sub, new_properties);
> -
> -      /* If we have a gate, combine the properties that we could have with
> -         and without the pass being examined.  */
> -      if (pass->has_gate)
> -        properties &= new_properties;
> -      else
> -        properties = new_properties;
> +        register_dump_files_1 (pass->sub);
>
>        pass = pass->next;
>      }
>    while (pass);
> -
> -  return properties;
>  }
>
>  /* Register the dump files for the pass_manager starting at PASS.
> @@ -746,7 +734,7 @@ pass_manager::
>  register_dump_files (opt_pass *pass,int properties)
>  {
>    pass->properties_required |= properties;
> -  register_dump_files_1 (pass, properties);
> +  register_dump_files_1 (pass);
>  }
>
>  struct pass_registry
> --
> 1.9.2
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/6] merge register_dump_files_1 into register_dump_files
  2014-04-17  8:38 ` [PATCH 2/6] merge register_dump_files_1 into register_dump_files tsaunders
@ 2014-04-17  8:54   ` Richard Biener
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Biener @ 2014-04-17  8:54 UTC (permalink / raw)
  To: tsaunders; +Cc: GCC Patches

On Thu, Apr 17, 2014 at 10:37 AM,  <tsaunders@mozilla.com> wrote:
> From: Trevor Saunders <tsaunders@mozilla.com>
>
> Hi,
>
> simplification allowed by previous patch.
>
> bootstrap + regtest passed on x86_64-unknown-linux-gnu, ok?

Ok.

Thanks,
Richard.

> Trev
>
> 2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>
>
>         * pass_manager.h (pass_manager::register_dump_files_1): Remove declaration.
>         * passes.c (pass_manager::register_dump_files_1): Merge into
>         (pass_manager::register_dump_files): this, and remove its handling of
>         properties since the pass always has the properties anyway.
>         (pass_manager::pass_manager): Adjust.
>
>
> diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
> index 8309567..9f4d67b 100644
> --- a/gcc/pass_manager.h
> +++ b/gcc/pass_manager.h
> @@ -91,8 +91,7 @@ public:
>
>  private:
>    void set_pass_for_id (int id, opt_pass *pass);
> -  void register_dump_files_1 (opt_pass *pass);
> -  void register_dump_files (opt_pass *pass, int properties);
> +  void register_dump_files (opt_pass *pass);
>
>  private:
>    context *m_ctxt;
> diff --git a/gcc/passes.c b/gcc/passes.c
> index 3f9590a..7508771 100644
> --- a/gcc/passes.c
> +++ b/gcc/passes.c
> @@ -706,11 +706,10 @@ pass_manager::register_one_dump_file (opt_pass *pass)
>    free (CONST_CAST (char *, full_name));
>  }
>
> -/* Recursive worker function for register_dump_files.  */
> +/* Register the dump files for the pass_manager starting at PASS. */
>
>  void
> -pass_manager::
> -register_dump_files_1 (opt_pass *pass)
> +pass_manager::register_dump_files (opt_pass *pass)
>  {
>    do
>      {
> @@ -718,25 +717,13 @@ register_dump_files_1 (opt_pass *pass)
>          register_one_dump_file (pass);
>
>        if (pass->sub)
> -        register_dump_files_1 (pass->sub);
> +        register_dump_files (pass->sub);
>
>        pass = pass->next;
>      }
>    while (pass);
>  }
>
> -/* Register the dump files for the pass_manager starting at PASS.
> -   PROPERTIES reflects the properties that are guaranteed to be available at
> -   the beginning of the pipeline.  */
> -
> -void
> -pass_manager::
> -register_dump_files (opt_pass *pass,int properties)
> -{
> -  pass->properties_required |= properties;
> -  register_dump_files_1 (pass);
> -}
> -
>  struct pass_registry
>  {
>    const char* unique_name;
> @@ -1536,19 +1523,11 @@ pass_manager::pass_manager (context *ctxt)
>  #undef TERMINATE_PASS_LIST
>
>    /* Register the passes with the tree dump code.  */
> -  register_dump_files (all_lowering_passes, PROP_gimple_any);
> -  register_dump_files (all_small_ipa_passes,
> -                      PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
> -                      | PROP_cfg);
> -  register_dump_files (all_regular_ipa_passes,
> -                      PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
> -                      | PROP_cfg);
> -  register_dump_files (all_late_ipa_passes,
> -                      PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
> -                      | PROP_cfg);
> -  register_dump_files (all_passes,
> -                      PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
> -                      | PROP_cfg);
> +  register_dump_files (all_lowering_passes);
> +  register_dump_files (all_small_ipa_passes);
> +  register_dump_files (all_regular_ipa_passes);
> +  register_dump_files (all_late_ipa_passes);
> +  register_dump_files (all_passes);
>  }
>
>  /* If we are in IPA mode (i.e., current_function_decl is NULL), call
> --
> 1.9.2
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/6] remove has_gate
  2014-04-17  8:38 ` [PATCH 3/6] remove has_gate tsaunders
@ 2014-04-17  8:56   ` Richard Biener
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Biener @ 2014-04-17  8:56 UTC (permalink / raw)
  To: tsaunders; +Cc: GCC Patches

On Thu, Apr 17, 2014 at 10:37 AM,  <tsaunders@mozilla.com> wrote:
> From: Trevor Saunders <tsaunders@mozilla.com>
>
>
> 2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>
>
> gcc/
>         * pass_manager.h (pass_manager::register_dump_files_1): Remove declaration.
>         * passes.c (pass_manager::register_dump_files_1): Merge into
>         (pass_manager::register_dump_files): this, and remove its handling of
>         properties since the pass always has the properties anyway.
>         (pass_manager::pass_manager): Adjust.
>
> 2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>
>
> gcc/
>         * passes.c (dump_one_pass): don't check pass->has_gate.
>         (execute_ipa_summary_passes): Likewise.
>         (execute_one_pass): Likewise.
>         (ipa_write_summaries_2): Likewise.
>         (ipa_write_optimization_summaries_1): Likewise.
>         (ipa_read_optimization_summaries_1): Likewise.
>         (execute_ipa_stmt_fixups): Likewise.
>         * tree-pass.h (pass_data::has_gate): Remove.
>         * 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/sh/sh_optimize_sett_clrt.cc, config/sh/sh_treg_combine.cc,
>         config/sparc/sparc.c, cprop.c, cse.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,
>         modulo-sched.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-profile.c,
>         tree-sra.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.
>
> gcc/testsuite/
>         * g++.dg/plugin/dumb_plugin.c, g++.dg/plugin/selfassign.c,
>         gcc/plugin/one_time_plugin.c, gcc.dg/plugin/selfassign.c: Adjust.

Ok.

Thanks,
Richard.

> diff --git a/gcc/asan.c b/gcc/asan.c
> index 53992a8..e26ce41 100644
> --- a/gcc/asan.c
> +++ b/gcc/asan.c
> @@ -2485,7 +2485,6 @@ const pass_data pass_data_asan =
>    GIMPLE_PASS, /* type */
>    "asan", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
> @@ -2531,7 +2530,6 @@ const pass_data pass_data_asan_O0 =
>    GIMPLE_PASS, /* type */
>    "asan0", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
> @@ -2614,7 +2612,6 @@ const pass_data pass_data_sanopt =
>    GIMPLE_PASS, /* type */
>    "sanopt", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
> diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
> index 47f516d..4346e85 100644
> --- a/gcc/auto-inc-dec.c
> +++ b/gcc/auto-inc-dec.c
> @@ -1513,7 +1513,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 */
> diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
> index fa6f62f..6ac0242 100644
> --- a/gcc/bb-reorder.c
> +++ b/gcc/bb-reorder.c
> @@ -2338,7 +2338,6 @@ const pass_data pass_data_reorder_blocks =
>    RTL_PASS, /* type */
>    "bbro", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_REORDER_BLOCKS, /* tv_id */
>    0, /* properties_required */
> @@ -2511,7 +2510,6 @@ const pass_data pass_data_duplicate_computed_gotos =
>    RTL_PASS, /* type */
>    "compgotos", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_REORDER_BLOCKS, /* tv_id */
>    0, /* properties_required */
> @@ -2735,7 +2733,6 @@ const pass_data pass_data_partition_blocks =
>    RTL_PASS, /* type */
>    "bbpart", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_REORDER_BLOCKS, /* tv_id */
>    PROP_cfglayout, /* properties_required */
> diff --git a/gcc/bt-load.c b/gcc/bt-load.c
> index 4fa68f1..d44917f 100644
> --- a/gcc/bt-load.c
> +++ b/gcc/bt-load.c
> @@ -1515,7 +1515,6 @@ const pass_data pass_data_branch_target_load_optimize1 =
>    RTL_PASS, /* type */
>    "btl1", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -1584,7 +1583,6 @@ const pass_data pass_data_branch_target_load_optimize2 =
>    RTL_PASS, /* type */
>    "btl2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
> index 77196ee..d5d68bf 100644
> --- a/gcc/cfgcleanup.c
> +++ b/gcc/cfgcleanup.c
> @@ -3096,7 +3096,6 @@ const pass_data pass_data_jump =
>    RTL_PASS, /* type */
>    "jump", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_JUMP, /* tv_id */
>    0, /* properties_required */
> @@ -3140,7 +3139,6 @@ const pass_data pass_data_jump2 =
>    RTL_PASS, /* type */
>    "jump2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_JUMP, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
> index b7f6360..c60703f 100644
> --- a/gcc/cfgexpand.c
> +++ b/gcc/cfgexpand.c
> @@ -5923,7 +5923,6 @@ const pass_data pass_data_expand =
>    RTL_PASS, /* type */
>    "expand", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_EXPAND, /* tv_id */
>    ( PROP_ssa | PROP_gimple_leh | PROP_cfg
> diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
> index 60b0c06..0404d08 100644
> --- a/gcc/cfgrtl.c
> +++ b/gcc/cfgrtl.c
> @@ -469,7 +469,6 @@ const pass_data pass_data_free_cfg =
>    RTL_PASS, /* type */
>    "*free_cfg", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -3495,7 +3494,6 @@ const pass_data pass_data_into_cfg_layout_mode =
>    RTL_PASS, /* type */
>    "into_cfglayout", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_CFG, /* tv_id */
>    0, /* properties_required */
> @@ -3532,7 +3530,6 @@ const pass_data pass_data_outof_cfg_layout_mode =
>    RTL_PASS, /* type */
>    "outof_cfglayout", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_CFG, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
> index 19961e2..9c6d46d 100644
> --- a/gcc/cgraphbuild.c
> +++ b/gcc/cgraphbuild.c
> @@ -388,7 +388,6 @@ const pass_data pass_data_build_cgraph_edges =
>    GIMPLE_PASS, /* type */
>    "*build_cgraph_edges", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> @@ -522,7 +521,6 @@ const pass_data pass_data_rebuild_cgraph_edges =
>    GIMPLE_PASS, /* type */
>    "*rebuild_cgraph_edges", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_CGRAPH, /* tv_id */
>    PROP_cfg, /* properties_required */
> @@ -570,7 +568,6 @@ const pass_data pass_data_remove_cgraph_callee_edges =
>    GIMPLE_PASS, /* type */
>    "*remove_cgraph_callee_edges", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
> index 69fd5ea..ec22ab3 100644
> --- a/gcc/combine-stack-adj.c
> +++ b/gcc/combine-stack-adj.c
> @@ -650,7 +650,6 @@ const pass_data pass_data_stack_adjustments =
>    RTL_PASS, /* type */
>    "csa", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_COMBINE_STACK_ADJUST, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/combine.c b/gcc/combine.c
> index f7a279e..63933c0 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -13897,7 +13897,6 @@ const pass_data pass_data_combine =
>    RTL_PASS, /* type */
>    "combine", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_COMBINE, /* tv_id */
>    PROP_cfglayout, /* properties_required */
> diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c
> index 3fbe140..e66b1c6 100644
> --- a/gcc/compare-elim.c
> +++ b/gcc/compare-elim.c
> @@ -659,7 +659,6 @@ const pass_data pass_data_compare_elim_after_reload =
>    RTL_PASS, /* type */
>    "cmpelim", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index 604a2ec..eddc55e 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -605,7 +605,6 @@ const pass_data pass_data_arc_ifcvt =
>    RTL_PASS,
>    "arc_ifcvt",                         /* name */
>    OPTGROUP_NONE,                       /* optinfo_flags */
> -  false,                               /* has_gate */
>    true,                                        /* has_execute */
>    TV_IFCVT2,                           /* tv_id */
>    0,                                   /* properties_required */
> @@ -644,7 +643,6 @@ const pass_data pass_data_arc_predicate_delay_insns =
>    RTL_PASS,
>    "arc_predicate_delay_insns",         /* name */
>    OPTGROUP_NONE,                       /* optinfo_flags */
> -  false,                               /* has_gate */
>    true,                                        /* has_execute */
>    TV_IFCVT2,                           /* tv_id */
>    0,                                   /* properties_required */
> diff --git a/gcc/config/epiphany/mode-switch-use.c b/gcc/config/epiphany/mode-switch-use.c
> index a0aa249..d893934 100644
> --- a/gcc/config/epiphany/mode-switch-use.c
> +++ b/gcc/config/epiphany/mode-switch-use.c
> @@ -78,7 +78,6 @@ const pass_data pass_data_mode_switch_use =
>    RTL_PASS, /* type */
>    "mode_switch_use", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
> index 1684918..486330c 100644
> --- a/gcc/config/epiphany/resolve-sw-modes.c
> +++ b/gcc/config/epiphany/resolve-sw-modes.c
> @@ -168,7 +168,6 @@ const pass_data pass_data_resolve_sw_modes =
>    RTL_PASS, /* type */
>    "resolve_sw_modes", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_MODE_SWITCH, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index f2e6957..6dd1bbe 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -2525,7 +2525,6 @@ const pass_data pass_data_insert_vzeroupper =
>    RTL_PASS, /* type */
>    "vzeroupper", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
> index 83fe55b..6c0b3c2 100644
> --- a/gcc/config/mips/mips.c
> +++ b/gcc/config/mips/mips.c
> @@ -16533,7 +16533,6 @@ const pass_data pass_data_mips_machine_reorg2 =
>    RTL_PASS, /* type */
>    "mach2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_MACH_DEP, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
> index b5cd2ad..88b030f 100644
> --- a/gcc/config/rl78/rl78.c
> +++ b/gcc/config/rl78/rl78.c
> @@ -142,7 +142,6 @@ const pass_data pass_data_rl78_devirt =
>    RTL_PASS, /* type */
>    "devirt", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_MACH_DEP, /* tv_id */
>    0, /* properties_required */
> @@ -226,7 +225,6 @@ const pass_data pass_data_rl78_move_elim =
>    RTL_PASS, /* type */
>    "move_elim", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_MACH_DEP, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
> index aac8de8..77e163f 100644
> --- a/gcc/config/s390/s390.c
> +++ b/gcc/config/s390/s390.c
> @@ -8665,7 +8665,6 @@ const pass_data pass_data_s390_early_mach =
>    RTL_PASS, /* type */
>    "early_mach", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_MACH_DEP, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/config/sh/sh_optimize_sett_clrt.cc b/gcc/config/sh/sh_optimize_sett_clrt.cc
> index 313e5b5..85cb6a1 100644
> --- a/gcc/config/sh/sh_optimize_sett_clrt.cc
> +++ b/gcc/config/sh/sh_optimize_sett_clrt.cc
> @@ -138,7 +138,6 @@ const pass_data sh_optimize_sett_clrt::default_pass_data =
>    RTL_PASS,            // type
>    "",                  // name (overwritten by the constructor)
>    OPTGROUP_NONE,       // optinfo_flags
> -  true,                        // has_gate
>    true,                        // has_execute
>    TV_OPTIMIZE,         // tv_id
>    0,                   // properties_required
> diff --git a/gcc/config/sh/sh_treg_combine.cc b/gcc/config/sh/sh_treg_combine.cc
> index e736040..1285ba2 100644
> --- a/gcc/config/sh/sh_treg_combine.cc
> +++ b/gcc/config/sh/sh_treg_combine.cc
> @@ -593,7 +593,6 @@ const pass_data sh_treg_combine::default_pass_data =
>    RTL_PASS,            // type
>    "",                  // name (overwritten by the constructor)
>    OPTGROUP_NONE,       // optinfo_flags
> -  true,                        // has_gate
>    true,                        // has_execute
>    TV_OPTIMIZE,         // tv_id
>    0,                   // properties_required
> diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
> index f52b976..a63e813 100644
> --- a/gcc/config/sparc/sparc.c
> +++ b/gcc/config/sparc/sparc.c
> @@ -1129,7 +1129,6 @@ const pass_data pass_data_work_around_errata =
>    RTL_PASS, /* type */
>    "errata", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_MACH_DEP, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/cprop.c b/gcc/cprop.c
> index c3acb05..f22cde7 100644
> --- a/gcc/cprop.c
> +++ b/gcc/cprop.c
> @@ -1925,7 +1925,6 @@ const pass_data pass_data_rtl_cprop =
>    RTL_PASS, /* type */
>    "cprop", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_CPROP, /* tv_id */
>    PROP_cfglayout, /* properties_required */
> diff --git a/gcc/cse.c b/gcc/cse.c
> index b8223f7..6edea01 100644
> --- a/gcc/cse.c
> +++ b/gcc/cse.c
> @@ -7497,7 +7497,6 @@ const pass_data pass_data_cse =
>    RTL_PASS, /* type */
>    "cse1", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_CSE, /* tv_id */
>    0, /* properties_required */
> @@ -7577,7 +7576,6 @@ const pass_data pass_data_cse2 =
>    RTL_PASS, /* type */
>    "cse2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_CSE2, /* tv_id */
>    0, /* properties_required */
> @@ -7655,7 +7653,6 @@ const pass_data pass_data_cse_after_global_opts =
>    RTL_PASS, /* type */
>    "cse_local", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_CSE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/dce.c b/gcc/dce.c
> index 07592f4..33cdefd 100644
> --- a/gcc/dce.c
> +++ b/gcc/dce.c
> @@ -793,7 +793,6 @@ const pass_data pass_data_ud_rtl_dce =
>    RTL_PASS, /* type */
>    "ud_dce", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_DCE, /* tv_id */
>    0, /* properties_required */
> @@ -1226,7 +1225,6 @@ const pass_data pass_data_fast_rtl_dce =
>    RTL_PASS, /* type */
>    "rtl_dce", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_DCE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/df-core.c b/gcc/df-core.c
> index edb3b25..9909ac3 100644
> --- a/gcc/df-core.c
> +++ b/gcc/df-core.c
> @@ -754,7 +754,6 @@ const pass_data pass_data_df_initialize_opt =
>    RTL_PASS, /* type */
>    "dfinit", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_DF_SCAN, /* tv_id */
>    0, /* properties_required */
> @@ -800,7 +799,6 @@ const pass_data pass_data_df_initialize_no_opt =
>    RTL_PASS, /* type */
>    "no-opt dfinit", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_DF_SCAN, /* tv_id */
>    0, /* properties_required */
> @@ -866,7 +864,6 @@ const pass_data pass_data_df_finish =
>    RTL_PASS, /* type */
>    "dfinish", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/dse.c b/gcc/dse.c
> index 09dc5df..a3a66b1 100644
> --- a/gcc/dse.c
> +++ b/gcc/dse.c
> @@ -3733,7 +3733,6 @@ const pass_data pass_data_rtl_dse1 =
>    RTL_PASS, /* type */
>    "dse1", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_DSE1, /* tv_id */
>    0, /* properties_required */
> @@ -3771,7 +3770,6 @@ const pass_data pass_data_rtl_dse2 =
>    RTL_PASS, /* type */
>    "dse2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_DSE2, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
> index abcdeb3..d278a27 100644
> --- a/gcc/dwarf2cfi.c
> +++ b/gcc/dwarf2cfi.c
> @@ -3399,7 +3399,6 @@ const pass_data pass_data_dwarf2_frame =
>    RTL_PASS, /* type */
>    "dwarf2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_FINAL, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/except.c b/gcc/except.c
> index 908954c..cf3cd5f 100644
> --- a/gcc/except.c
> +++ b/gcc/except.c
> @@ -2008,7 +2008,6 @@ const pass_data pass_data_set_nothrow_function_flags =
>    RTL_PASS, /* type */
>    "nothrow", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -2639,7 +2638,6 @@ const pass_data pass_data_convert_to_eh_region_ranges =
>    RTL_PASS, /* type */
>    "eh_ranges", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/final.c b/gcc/final.c
> index 83abee2..91b8ccc 100644
> --- a/gcc/final.c
> +++ b/gcc/final.c
> @@ -852,7 +852,6 @@ const pass_data pass_data_compute_alignments =
>    RTL_PASS, /* type */
>    "alignments", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -4481,7 +4480,6 @@ const pass_data pass_data_final =
>    RTL_PASS, /* type */
>    "final", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_FINAL, /* tv_id */
>    0, /* properties_required */
> @@ -4527,7 +4525,6 @@ const pass_data pass_data_shorten_branches =
>    RTL_PASS, /* type */
>    "shorten", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_SHORTEN_BRANCH, /* tv_id */
>    0, /* properties_required */
> @@ -4691,7 +4688,6 @@ const pass_data pass_data_clean_state =
>    RTL_PASS, /* type */
>    "*clean_state", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_FINAL, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/function.c b/gcc/function.c
> index a61e475..cf07255 100644
> --- a/gcc/function.c
> +++ b/gcc/function.c
> @@ -1950,7 +1950,6 @@ const pass_data pass_data_instantiate_virtual_regs =
>    RTL_PASS, /* type */
>    "vregs", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -6949,7 +6948,6 @@ const pass_data pass_data_leaf_regs =
>    RTL_PASS, /* type */
>    "*leaf_regs", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -7009,7 +7007,6 @@ const pass_data pass_data_thread_prologue_and_epilogue =
>    RTL_PASS, /* type */
>    "pro_and_epilogue", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_THREAD_PROLOGUE_AND_EPILOGUE, /* tv_id */
>    0, /* properties_required */
> @@ -7229,7 +7226,6 @@ const pass_data pass_data_match_asm_constraints =
>    RTL_PASS, /* type */
>    "asmcons", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/fwprop.c b/gcc/fwprop.c
> index 4317f51..061d533 100644
> --- a/gcc/fwprop.c
> +++ b/gcc/fwprop.c
> @@ -1490,7 +1490,6 @@ const pass_data pass_data_rtl_fwprop =
>    RTL_PASS, /* type */
>    "fwprop1", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_FWPROP, /* tv_id */
>    0, /* properties_required */
> @@ -1557,7 +1556,6 @@ const pass_data pass_data_rtl_fwprop_addr =
>    RTL_PASS, /* type */
>    "fwprop2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_FWPROP, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/gcse.c b/gcc/gcse.c
> index b852aa1..6797b08 100644
> --- a/gcc/gcse.c
> +++ b/gcc/gcse.c
> @@ -4220,7 +4220,6 @@ const pass_data pass_data_rtl_pre =
>    RTL_PASS, /* type */
>    "rtl pre", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_PRE, /* tv_id */
>    PROP_cfglayout, /* properties_required */
> @@ -4259,7 +4258,6 @@ const pass_data pass_data_rtl_hoist =
>    RTL_PASS, /* type */
>    "hoist", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_HOIST, /* tv_id */
>    PROP_cfglayout, /* properties_required */
> diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
> index da3fb9f..66ea322 100644
> --- a/gcc/gimple-low.c
> +++ b/gcc/gimple-low.c
> @@ -163,7 +163,6 @@ const pass_data pass_data_lower_cf =
>    GIMPLE_PASS, /* type */
>    "lower", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_gimple_any, /* properties_required */
> diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
> index 56fcfc8..e0ce2ec 100644
> --- a/gcc/gimple-ssa-isolate-paths.c
> +++ b/gcc/gimple-ssa-isolate-paths.c
> @@ -429,7 +429,6 @@ const pass_data pass_data_isolate_erroneous_paths =
>    GIMPLE_PASS, /* type */
>    "isolate-paths", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_ISOLATE_ERRONEOUS_PATHS, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
> index 9ad1b4f..8d19031 100644
> --- a/gcc/gimple-ssa-strength-reduction.c
> +++ b/gcc/gimple-ssa-strength-reduction.c
> @@ -3659,7 +3659,6 @@ const pass_data pass_data_strength_reduction =
>    GIMPLE_PASS, /* type */
>    "slsr", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_GIMPLE_SLSR, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/graphite.c b/gcc/graphite.c
> index 311b7e3..03a7161 100644
> --- a/gcc/graphite.c
> +++ b/gcc/graphite.c
> @@ -357,7 +357,6 @@ const pass_data pass_data_graphite =
>    GIMPLE_PASS, /* type */
>    "graphite0", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_GRAPHITE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -394,7 +393,6 @@ const pass_data pass_data_graphite_transforms =
>    GIMPLE_PASS, /* type */
>    "graphite", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_GRAPHITE_TRANSFORMS, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
> index 0d1adce..5c0843d 100644
> --- a/gcc/ifcvt.c
> +++ b/gcc/ifcvt.c
> @@ -4545,7 +4545,6 @@ const pass_data pass_data_rtl_ifcvt =
>    RTL_PASS, /* type */
>    "ce1", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IFCVT, /* tv_id */
>    0, /* properties_required */
> @@ -4600,7 +4599,6 @@ const pass_data pass_data_if_after_combine =
>    RTL_PASS, /* type */
>    "ce2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IFCVT, /* tv_id */
>    0, /* properties_required */
> @@ -4654,7 +4652,6 @@ const pass_data pass_data_if_after_reload =
>    RTL_PASS, /* type */
>    "ce3", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IFCVT2, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/init-regs.c b/gcc/init-regs.c
> index fcc6e2c..265fed7 100644
> --- a/gcc/init-regs.c
> +++ b/gcc/init-regs.c
> @@ -145,7 +145,6 @@ const pass_data pass_data_initialize_regs =
>    RTL_PASS, /* type */
>    "init-regs", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
> index 689378a..1f28b69 100644
> --- a/gcc/ipa-cp.c
> +++ b/gcc/ipa-cp.c
> @@ -3779,7 +3779,6 @@ const pass_data pass_data_ipa_cp =
>    IPA_PASS, /* type */
>    "cp", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_CONSTANT_PROP, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
> index 3a5432e..19369c6 100644
> --- a/gcc/ipa-devirt.c
> +++ b/gcc/ipa-devirt.c
> @@ -1928,7 +1928,6 @@ const pass_data pass_data_ipa_devirt =
>    IPA_PASS, /* type */
>    "devirt", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_DEVIRT, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
> index 8e0f5dd..8783caa 100644
> --- a/gcc/ipa-inline-analysis.c
> +++ b/gcc/ipa-inline-analysis.c
> @@ -2920,7 +2920,6 @@ const pass_data pass_data_inline_parameters =
>    GIMPLE_PASS, /* type */
>    "inline_param", /* name */
>    OPTGROUP_INLINE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_INLINE_PARAMETERS, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
> index 4051819..da02afc 100644
> --- a/gcc/ipa-inline.c
> +++ b/gcc/ipa-inline.c
> @@ -2340,7 +2340,6 @@ const pass_data pass_data_early_inline =
>    GIMPLE_PASS, /* type */
>    "einline", /* name */
>    OPTGROUP_INLINE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_EARLY_INLINING, /* tv_id */
>    PROP_ssa, /* properties_required */
> @@ -2377,7 +2376,6 @@ const pass_data pass_data_ipa_inline =
>    IPA_PASS, /* type */
>    "inline", /* name */
>    OPTGROUP_INLINE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_INLINING, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
> index 17de687..f2a72de 100644
> --- a/gcc/ipa-profile.c
> +++ b/gcc/ipa-profile.c
> @@ -724,7 +724,6 @@ const pass_data pass_data_ipa_profile =
>    IPA_PASS, /* type */
>    "profile_estimate", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_PROFILE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
> index 7d35880..eac3636 100644
> --- a/gcc/ipa-pure-const.c
> +++ b/gcc/ipa-pure-const.c
> @@ -1515,7 +1515,6 @@ const pass_data pass_data_ipa_pure_const =
>    IPA_PASS, /* type */
>    "pure-const", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_PURE_CONST, /* tv_id */
>    0, /* properties_required */
> @@ -1699,7 +1698,6 @@ const pass_data pass_data_local_pure_const =
>    GIMPLE_PASS, /* type */
>    "local-pure-const", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_PURE_CONST, /* tv_id */
>    0, /* properties_required */
> @@ -1755,7 +1753,6 @@ const pass_data pass_data_warn_function_noreturn =
>    GIMPLE_PASS, /* type */
>    "*warn_function_noreturn", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
> index dbe32e4..126948e 100644
> --- a/gcc/ipa-reference.c
> +++ b/gcc/ipa-reference.c
> @@ -1163,7 +1163,6 @@ const pass_data pass_data_ipa_reference =
>    IPA_PASS, /* type */
>    "static-var", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_REFERENCE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
> index 38bd883..ebb9197 100644
> --- a/gcc/ipa-split.c
> +++ b/gcc/ipa-split.c
> @@ -1664,7 +1664,6 @@ const pass_data pass_data_split_functions =
>    GIMPLE_PASS, /* type */
>    "fnsplit", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_FNSPLIT, /* tv_id */
>    PROP_cfg, /* properties_required */
> @@ -1724,7 +1723,6 @@ const pass_data pass_data_feedback_split_functions =
>    GIMPLE_PASS, /* type */
>    "feedback_fnsplit", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_FNSPLIT, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/ipa.c b/gcc/ipa.c
> index 26e9b03..5e06509 100644
> --- a/gcc/ipa.c
> +++ b/gcc/ipa.c
> @@ -1195,7 +1195,6 @@ const pass_data pass_data_ipa_function_and_variable_visibility =
>    SIMPLE_IPA_PASS, /* type */
>    "visibility", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_CGRAPHOPT, /* tv_id */
>    0, /* properties_required */
> @@ -1244,7 +1243,6 @@ const pass_data pass_data_ipa_free_inline_summary =
>    SIMPLE_IPA_PASS, /* type */
>    "*free_inline_summary", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_FREE_INLINE_SUMMARY, /* tv_id */
>    0, /* properties_required */
> @@ -1300,7 +1298,6 @@ const pass_data pass_data_ipa_whole_program_visibility =
>    IPA_PASS, /* type */
>    "whole-program", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_CGRAPHOPT, /* tv_id */
>    0, /* properties_required */
> @@ -1633,7 +1630,6 @@ const pass_data pass_data_ipa_cdtor_merge =
>    IPA_PASS, /* type */
>    "cdtor", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_CGRAPHOPT, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/ira.c b/gcc/ira.c
> index 4d91d21..da0f453 100644
> --- a/gcc/ira.c
> +++ b/gcc/ira.c
> @@ -5562,7 +5562,6 @@ const pass_data pass_data_ira =
>    RTL_PASS, /* type */
>    "ira", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_IRA, /* tv_id */
>    0, /* properties_required */
> @@ -5606,7 +5605,6 @@ const pass_data pass_data_reload =
>    RTL_PASS, /* type */
>    "reload", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_RELOAD, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/jump.c b/gcc/jump.c
> index e6dabd0..7361101 100644
> --- a/gcc/jump.c
> +++ b/gcc/jump.c
> @@ -146,7 +146,6 @@ const pass_data pass_data_cleanup_barriers =
>    RTL_PASS, /* type */
>    "barriers", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/loop-init.c b/gcc/loop-init.c
> index 2c2c269..d0bd4ec 100644
> --- a/gcc/loop-init.c
> +++ b/gcc/loop-init.c
> @@ -320,7 +320,6 @@ const pass_data pass_data_loop2 =
>    RTL_PASS, /* type */
>    "loop2", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_LOOP, /* tv_id */
>    0, /* properties_required */
> @@ -374,7 +373,6 @@ const pass_data pass_data_rtl_loop_init =
>    RTL_PASS, /* type */
>    "loop2_init", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_LOOP, /* tv_id */
>    0, /* properties_required */
> @@ -432,7 +430,6 @@ const pass_data pass_data_rtl_loop_done =
>    RTL_PASS, /* type */
>    "loop2_done", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_LOOP, /* tv_id */
>    0, /* properties_required */
> @@ -485,7 +482,6 @@ const pass_data pass_data_rtl_move_loop_invariants =
>    RTL_PASS, /* type */
>    "loop2_invariant", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_LOOP_MOVE_INVARIANTS, /* tv_id */
>    0, /* properties_required */
> @@ -540,7 +536,6 @@ const pass_data pass_data_rtl_unswitch =
>    RTL_PASS, /* type */
>    "loop2_unswitch", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_LOOP_UNSWITCH, /* tv_id */
>    0, /* properties_required */
> @@ -607,7 +602,6 @@ const pass_data pass_data_rtl_unroll_and_peel_loops =
>    RTL_PASS, /* type */
>    "loop2_unroll", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_LOOP_UNROLL, /* tv_id */
>    0, /* properties_required */
> @@ -667,7 +661,6 @@ const pass_data pass_data_rtl_doloop =
>    RTL_PASS, /* type */
>    "loop2_doloop", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_LOOP_DOLOOP, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
> index a1331c0..53ef1d9 100644
> --- a/gcc/lower-subreg.c
> +++ b/gcc/lower-subreg.c
> @@ -1720,7 +1720,6 @@ const pass_data pass_data_lower_subreg =
>    RTL_PASS, /* type */
>    "subreg1", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_LOWER_SUBREG, /* tv_id */
>    0, /* properties_required */
> @@ -1758,7 +1757,6 @@ const pass_data pass_data_lower_subreg2 =
>    RTL_PASS, /* type */
>    "subreg2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_LOWER_SUBREG, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
> index 2848da3..d73135a 100644
> --- a/gcc/mode-switching.c
> +++ b/gcc/mode-switching.c
> @@ -816,7 +816,6 @@ const pass_data pass_data_mode_switching =
>    RTL_PASS, /* type */
>    "mode_sw", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_MODE_SWITCH, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
> index 7ba3ddb..a097df3 100644
> --- a/gcc/modulo-sched.c
> +++ b/gcc/modulo-sched.c
> @@ -3362,7 +3362,6 @@ const pass_data pass_data_sms =
>    RTL_PASS, /* type */
>    "sms", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_SMS, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> index ed4e218..cadec81 100644
> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -8340,7 +8340,6 @@ const pass_data pass_data_expand_omp =
>    GIMPLE_PASS, /* type */
>    "ompexp", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_gimple_any, /* properties_required */
> @@ -10201,7 +10200,6 @@ const pass_data pass_data_lower_omp =
>    GIMPLE_PASS, /* type */
>    "omplower", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_gimple_any, /* properties_required */
> @@ -10632,7 +10630,6 @@ const pass_data pass_data_diagnose_omp_blocks =
>    GIMPLE_PASS, /* type */
>    "*diagnose_omp_blocks", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_gimple_any, /* properties_required */
> @@ -11797,7 +11794,6 @@ const pass_data pass_data_omp_simd_clone =
>    SIMPLE_IPA_PASS,             /* type */
>    "simdclone",                 /* name */
>    OPTGROUP_NONE,               /* optinfo_flags */
> -  true,                                /* has_gate */
>    true,                                /* has_execute */
>    TV_NONE,                     /* tv_id */
>    ( PROP_ssa | PROP_cfg ),     /* properties_required */
> diff --git a/gcc/passes.c b/gcc/passes.c
> index 7508771..5d5a94c 100644
> --- a/gcc/passes.c
> +++ b/gcc/passes.c
> @@ -353,7 +353,6 @@ const pass_data pass_data_early_local_passes =
>    SIMPLE_IPA_PASS, /* type */
>    "early_local_cleanups", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_EARLY_LOCAL, /* tv_id */
>    0, /* properties_required */
> @@ -401,7 +400,6 @@ const pass_data pass_data_all_early_optimizations =
>    GIMPLE_PASS, /* type */
>    "early_optimizations", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -446,7 +444,6 @@ const pass_data pass_data_all_optimizations =
>    GIMPLE_PASS, /* type */
>    "*all_optimizations", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_OPTIMIZE, /* tv_id */
>    0, /* properties_required */
> @@ -491,7 +488,6 @@ const pass_data pass_data_all_optimizations_g =
>    GIMPLE_PASS, /* type */
>    "*all_optimizations_g", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_OPTIMIZE, /* tv_id */
>    0, /* properties_required */
> @@ -536,7 +532,6 @@ const pass_data pass_data_rest_of_compilation =
>    RTL_PASS, /* type */
>    "*rest_of_compilation", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_REST_OF_COMPILATION, /* tv_id */
>    PROP_rtl, /* properties_required */
> @@ -579,7 +574,6 @@ const pass_data pass_data_postreload =
>    RTL_PASS, /* type */
>    "*all-postreload", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_POSTRELOAD, /* tv_id */
>    PROP_rtl, /* properties_required */
> @@ -829,7 +823,7 @@ dump_one_pass (opt_pass *pass, int pass_indent)
>    const char *pn;
>    bool is_on, is_really_on;
>
> -  is_on = pass->has_gate ? pass->gate () : true;
> +  is_on = pass->gate ();
>    is_really_on = override_gate_status (pass, current_function_decl, is_on);
>
>    if (pass->static_pass_number <= 0)
> @@ -1982,7 +1976,7 @@ execute_ipa_summary_passes (ipa_opt_pass_d *ipa_pass)
>
>        /* Execute all of the IPA_PASSes in the list.  */
>        if (ipa_pass->type == IPA_PASS
> -         && ((!pass->has_gate) || pass->gate ())
> +         && pass->gate ()
>           && ipa_pass->generate_summary)
>         {
>           pass_init_dump_file (pass);
> @@ -2134,7 +2128,7 @@ execute_one_pass (opt_pass *pass)
>
>    /* Check whether gate check should be avoided.
>       User controls the value of the gate through the parameter "gate_status". */
> -  gate_status = pass->has_gate ? pass->gate () : true;
> +  gate_status = pass->gate ();
>    gate_status = override_gate_status (pass, current_function_decl, gate_status);
>
>    /* Override gate with plugin.  */
> @@ -2280,7 +2274,7 @@ ipa_write_summaries_2 (opt_pass *pass, struct lto_out_decl_state *state)
>        gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
>        if (pass->type == IPA_PASS
>           && ipa_pass->write_summary
> -         && ((!pass->has_gate) || pass->gate ()))
> +         && pass->gate ())
>         {
>           /* If a timevar is present, start it.  */
>           if (pass->tv_id)
> @@ -2398,7 +2392,7 @@ ipa_write_optimization_summaries_1 (opt_pass *pass,
>        gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
>        if (pass->type == IPA_PASS
>           && ipa_pass->write_optimization_summary
> -         && ((!pass->has_gate) || pass->gate ()))
> +         && pass->gate ())
>         {
>           /* If a timevar is present, start it.  */
>           if (pass->tv_id)
> @@ -2476,7 +2470,7 @@ ipa_read_summaries_1 (opt_pass *pass)
>        gcc_assert (!cfun);
>        gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
>
> -      if ((!pass->has_gate) || pass->gate ())
> +      if (pass->gate ())
>         {
>           if (pass->type == IPA_PASS && ipa_pass->read_summary)
>             {
> @@ -2526,7 +2520,7 @@ ipa_read_optimization_summaries_1 (opt_pass *pass)
>        gcc_assert (!cfun);
>        gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
>
> -      if ((!pass->has_gate) || pass->gate ())
> +      if (pass->gate ())
>         {
>           if (pass->type == IPA_PASS && ipa_pass->read_optimization_summary)
>             {
> @@ -2603,7 +2597,7 @@ execute_ipa_stmt_fixups (opt_pass *pass,
>      {
>        /* Execute all of the IPA_PASSes in the list.  */
>        if (pass->type == IPA_PASS
> -         && ((!pass->has_gate) || pass->gate ()))
> +         && pass->gate ())
>         {
>           ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass;
>
> diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
> index 5555794..264bd9a 100644
> --- a/gcc/postreload-gcse.c
> +++ b/gcc/postreload-gcse.c
> @@ -1331,7 +1331,6 @@ const pass_data pass_data_gcse2 =
>    RTL_PASS, /* type */
>    "gcse2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_GCSE_AFTER_RELOAD, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/postreload.c b/gcc/postreload.c
> index 9bfffe5..0870183 100644
> --- a/gcc/postreload.c
> +++ b/gcc/postreload.c
> @@ -2346,7 +2346,6 @@ const pass_data pass_data_postreload_cse =
>    RTL_PASS, /* type */
>    "postreload", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_RELOAD_CSE_REGS, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/predict.c b/gcc/predict.c
> index 249433f..dccde72 100644
> --- a/gcc/predict.c
> +++ b/gcc/predict.c
> @@ -3160,7 +3160,6 @@ const pass_data pass_data_profile =
>    GIMPLE_PASS, /* type */
>    "profile_estimate", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_BRANCH_PROB, /* tv_id */
>    PROP_cfg, /* properties_required */
> @@ -3198,7 +3197,6 @@ const pass_data pass_data_strip_predict_hints =
>    GIMPLE_PASS, /* type */
>    "*strip_predict_hints", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_BRANCH_PROB, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/recog.c b/gcc/recog.c
> index f2647e3..b7113aa 100644
> --- a/gcc/recog.c
> +++ b/gcc/recog.c
> @@ -3832,7 +3832,6 @@ const pass_data pass_data_peephole2 =
>    RTL_PASS, /* type */
>    "peephole2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_PEEPHOLE2, /* tv_id */
>    0, /* properties_required */
> @@ -3880,7 +3879,6 @@ const pass_data pass_data_split_all_insns =
>    RTL_PASS, /* type */
>    "split1", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -3931,7 +3929,6 @@ const pass_data pass_data_split_after_reload =
>    RTL_PASS, /* type */
>    "split2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -3993,7 +3990,6 @@ const pass_data pass_data_split_before_regstack =
>    RTL_PASS, /* type */
>    "split3", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -4052,7 +4048,6 @@ const pass_data pass_data_split_before_sched2 =
>    RTL_PASS, /* type */
>    "split4", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> @@ -4102,7 +4097,6 @@ const pass_data pass_data_split_for_shorten_branches =
>    RTL_PASS, /* type */
>    "split5", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/ree.c b/gcc/ree.c
> index fcde9a0..09dfa61 100644
> --- a/gcc/ree.c
> +++ b/gcc/ree.c
> @@ -1108,7 +1108,6 @@ const pass_data pass_data_ree =
>    RTL_PASS, /* type */
>    "ree", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_REE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
> index a92830b..02e3e09 100644
> --- a/gcc/reg-stack.c
> +++ b/gcc/reg-stack.c
> @@ -3302,7 +3302,6 @@ const pass_data pass_data_stack_regs =
>    RTL_PASS, /* type */
>    "*stack_regs", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_REG_STACK, /* tv_id */
>    0, /* properties_required */
> @@ -3351,7 +3350,6 @@ const pass_data pass_data_stack_regs_run =
>    RTL_PASS, /* type */
>    "stack", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_REG_STACK, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/regcprop.c b/gcc/regcprop.c
> index 101de76..a7dbbc3 100644
> --- a/gcc/regcprop.c
> +++ b/gcc/regcprop.c
> @@ -1261,7 +1261,6 @@ const pass_data pass_data_cprop_hardreg =
>    RTL_PASS, /* type */
>    "cprop_hardreg", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_CPROP_REGISTERS, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/reginfo.c b/gcc/reginfo.c
> index bdb980d..82b6081 100644
> --- a/gcc/reginfo.c
> +++ b/gcc/reginfo.c
> @@ -968,7 +968,6 @@ const pass_data pass_data_reginfo_init =
>    RTL_PASS, /* type */
>    "reginfo", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/regrename.c b/gcc/regrename.c
> index 6517f4e..30f7abc 100644
> --- a/gcc/regrename.c
> +++ b/gcc/regrename.c
> @@ -1849,7 +1849,6 @@ const pass_data pass_data_regrename =
>    RTL_PASS, /* type */
>    "rnreg", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_RENAME_REGISTERS, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/reorg.c b/gcc/reorg.c
> index 054304a..fff342f 100644
> --- a/gcc/reorg.c
> +++ b/gcc/reorg.c
> @@ -3891,7 +3891,6 @@ const pass_data pass_data_delay_slots =
>    RTL_PASS, /* type */
>    "dbr", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_DBR_SCHED, /* tv_id */
>    0, /* properties_required */
> @@ -3944,7 +3943,6 @@ const pass_data pass_data_machine_reorg =
>    RTL_PASS, /* type */
>    "mach", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_MACH_DEP, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
> index dc6fa16..18b50a4 100644
> --- a/gcc/sched-rgn.c
> +++ b/gcc/sched-rgn.c
> @@ -3681,7 +3681,6 @@ const pass_data pass_data_live_range_shrinkage =
>    RTL_PASS, /* type */
>    "lr_shrinkage", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_LIVE_RANGE_SHRINKAGE, /* tv_id */
>    0, /* properties_required */
> @@ -3720,7 +3719,6 @@ const pass_data pass_data_sched =
>    RTL_PASS, /* type */
>    "sched1", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_SCHED, /* tv_id */
>    0, /* properties_required */
> @@ -3759,7 +3757,6 @@ const pass_data pass_data_sched2 =
>    RTL_PASS, /* type */
>    "sched2", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_SCHED2, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c
> index 6b78085..d1375a4 100644
> --- a/gcc/stack-ptr-mod.c
> +++ b/gcc/stack-ptr-mod.c
> @@ -97,7 +97,6 @@ const pass_data pass_data_stack_ptr_mod =
>    RTL_PASS, /* type */
>    "*stack_ptr_mod", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/store-motion.c b/gcc/store-motion.c
> index f383ca5..5aacaad 100644
> --- a/gcc/store-motion.c
> +++ b/gcc/store-motion.c
> @@ -1248,7 +1248,6 @@ const pass_data pass_data_rtl_store_motion =
>    RTL_PASS, /* type */
>    "store_motion", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_LSM, /* tv_id */
>    PROP_cfglayout, /* properties_required */
> diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
> index e197d66..d73bea8 100644
> --- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
> +++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
> @@ -65,7 +65,6 @@ const pass_data pass_data_dumb_plugin_example =
>    GIMPLE_PASS, /* type */
>    "dumb_plugin_example", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
> index 041f25d..8df8579 100644
> --- a/gcc/testsuite/g++.dg/plugin/selfassign.c
> +++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
> @@ -285,7 +285,6 @@ const pass_data pass_data_warn_self_assign =
>    GIMPLE_PASS, /* type */
>    "warn_self_assign", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_ssa, /* properties_required */
> diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
> index f80719a..33106ad 100644
> --- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
> +++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
> @@ -31,7 +31,6 @@ const pass_data pass_data_one_pass =
>    GIMPLE_PASS, /* type */
>    "cfg", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_gimple_any, /* properties_required */
> diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
> index 041f25d..8df8579 100644
> --- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
> +++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
> @@ -285,7 +285,6 @@ const pass_data pass_data_warn_self_assign =
>    GIMPLE_PASS, /* type */
>    "warn_self_assign", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_ssa, /* properties_required */
> diff --git a/gcc/tracer.c b/gcc/tracer.c
> index f036c19..73e3209 100644
> --- a/gcc/tracer.c
> +++ b/gcc/tracer.c
> @@ -411,7 +411,6 @@ const pass_data pass_data_tracer =
>    GIMPLE_PASS, /* type */
>    "tracer", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TRACER, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
> index fe6dc28..a259b77 100644
> --- a/gcc/trans-mem.c
> +++ b/gcc/trans-mem.c
> @@ -846,7 +846,6 @@ const pass_data pass_data_diagnose_tm_blocks =
>    GIMPLE_PASS, /* type */
>    "*diagnose_tm_blocks", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TRANS_MEM, /* tv_id */
>    PROP_gimple_any, /* properties_required */
> @@ -1769,7 +1768,6 @@ const pass_data pass_data_lower_tm =
>    GIMPLE_PASS, /* type */
>    "tmlower", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TRANS_MEM, /* tv_id */
>    PROP_gimple_lcf, /* properties_required */
> @@ -2047,7 +2045,6 @@ const pass_data pass_data_tm_init =
>    GIMPLE_PASS, /* type */
>    "*tminit", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_TRANS_MEM, /* tv_id */
>    ( PROP_ssa | PROP_cfg ), /* properties_required */
> @@ -3023,7 +3020,6 @@ const pass_data pass_data_tm_mark =
>    GIMPLE_PASS, /* type */
>    "tmmark", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_TRANS_MEM, /* tv_id */
>    ( PROP_ssa | PROP_cfg ), /* properties_required */
> @@ -3206,7 +3202,6 @@ const pass_data pass_data_tm_edges =
>    GIMPLE_PASS, /* type */
>    "tmedge", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_TRANS_MEM, /* tv_id */
>    ( PROP_ssa | PROP_cfg ), /* properties_required */
> @@ -3947,7 +3942,6 @@ const pass_data pass_data_tm_memopt =
>    GIMPLE_PASS, /* type */
>    "tmmemopt", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TRANS_MEM, /* tv_id */
>    ( PROP_ssa | PROP_cfg ), /* properties_required */
> @@ -5583,7 +5577,6 @@ const pass_data pass_data_ipa_tm =
>    SIMPLE_IPA_PASS, /* type */
>    "tmipa", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TRANS_MEM, /* tv_id */
>    ( PROP_ssa | PROP_cfg ), /* properties_required */
> diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
> index 4b2ad87..3293493 100644
> --- a/gcc/tree-call-cdce.c
> +++ b/gcc/tree-call-cdce.c
> @@ -933,7 +933,6 @@ const pass_data pass_data_call_cdce =
>    GIMPLE_PASS, /* type */
>    "cdce", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_CALL_CDCE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
> index cd35d55..739ca54 100644
> --- a/gcc/tree-cfg.c
> +++ b/gcc/tree-cfg.c
> @@ -351,7 +351,6 @@ const pass_data pass_data_build_cfg =
>    GIMPLE_PASS, /* type */
>    "cfg", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_CFG, /* tv_id */
>    PROP_gimple_leh, /* properties_required */
> @@ -8084,7 +8083,6 @@ const pass_data pass_data_split_crit_edges =
>    GIMPLE_PASS, /* type */
>    "crited", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_SPLIT_EDGES, /* tv_id */
>    PROP_cfg, /* properties_required */
> @@ -8256,7 +8254,6 @@ const pass_data pass_data_warn_function_return =
>    GIMPLE_PASS, /* type */
>    "*warn_function_return", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> @@ -8371,7 +8368,6 @@ const pass_data pass_data_warn_unused_result =
>    GIMPLE_PASS, /* type */
>    "*warn_unused_result", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_gimple_any, /* properties_required */
> @@ -8514,7 +8510,6 @@ const pass_data pass_data_fixup_cfg =
>    GIMPLE_PASS, /* type */
>    "*free_cfg_annotations", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
> index b7882cf..914523d 100644
> --- a/gcc/tree-cfgcleanup.c
> +++ b/gcc/tree-cfgcleanup.c
> @@ -1048,7 +1048,6 @@ const pass_data pass_data_merge_phi =
>    GIMPLE_PASS, /* type */
>    "mergephi", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_MERGE_PHI, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -1133,7 +1132,6 @@ const pass_data pass_data_cleanup_cfg_post_optimizing =
>    GIMPLE_PASS, /* type */
>    "optimized", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_CLEANUP_CFG, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
> index 4a657c0..283c827 100644
> --- a/gcc/tree-complex.c
> +++ b/gcc/tree-complex.c
> @@ -1662,7 +1662,6 @@ const pass_data pass_data_lower_complex =
>    GIMPLE_PASS, /* type */
>    "cplxlower", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_ssa, /* properties_required */
> @@ -1709,7 +1708,6 @@ const pass_data pass_data_lower_complex_O0 =
>    GIMPLE_PASS, /* type */
>    "cplxlower0", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
> index 14ed52a..f51f18c 100644
> --- a/gcc/tree-eh.c
> +++ b/gcc/tree-eh.c
> @@ -2170,7 +2170,6 @@ const pass_data pass_data_lower_eh =
>    GIMPLE_PASS, /* type */
>    "eh", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_EH, /* tv_id */
>    PROP_gimple_lcf, /* properties_required */
> @@ -3129,7 +3128,6 @@ const pass_data pass_data_refactor_eh =
>    GIMPLE_PASS, /* type */
>    "ehopt", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_EH, /* tv_id */
>    PROP_gimple_lcf, /* properties_required */
> @@ -3356,7 +3354,6 @@ const pass_data pass_data_lower_resx =
>    GIMPLE_PASS, /* type */
>    "resx", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_EH, /* tv_id */
>    PROP_gimple_lcf, /* properties_required */
> @@ -3765,7 +3762,6 @@ const pass_data pass_data_lower_eh_dispatch =
>    GIMPLE_PASS, /* type */
>    "ehdisp", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_EH, /* tv_id */
>    PROP_gimple_lcf, /* properties_required */
> @@ -4613,7 +4609,6 @@ const pass_data pass_data_cleanup_eh =
>    GIMPLE_PASS, /* type */
>    "ehcleanup", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_EH, /* tv_id */
>    PROP_gimple_lcf, /* properties_required */
> diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
> index 3391cc3..84aa008 100644
> --- a/gcc/tree-emutls.c
> +++ b/gcc/tree-emutls.c
> @@ -831,7 +831,6 @@ const pass_data pass_data_ipa_lower_emutls =
>    SIMPLE_IPA_PASS, /* type */
>    "emutls", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_OPT, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
> index 7ff2132..b87c476 100644
> --- a/gcc/tree-if-conv.c
> +++ b/gcc/tree-if-conv.c
> @@ -2031,7 +2031,6 @@ const pass_data pass_data_if_conversion =
>    GIMPLE_PASS, /* type */
>    "ifcvt", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
> index 3ca2bd1..dec5a5b 100644
> --- a/gcc/tree-into-ssa.c
> +++ b/gcc/tree-into-ssa.c
> @@ -2381,7 +2381,6 @@ const pass_data pass_data_build_ssa =
>    GIMPLE_PASS, /* type */
>    "ssa", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_SSA_OTHER, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
> index 9db92db..dcc61c7 100644
> --- a/gcc/tree-loop-distribution.c
> +++ b/gcc/tree-loop-distribution.c
> @@ -1804,7 +1804,6 @@ const pass_data pass_data_loop_distribution =
>    GIMPLE_PASS, /* type */
>    "ldist", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_LOOP_DISTRIBUTION, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
> index b443388..a39bc5e 100644
> --- a/gcc/tree-nrv.c
> +++ b/gcc/tree-nrv.c
> @@ -285,7 +285,6 @@ const pass_data pass_data_nrv =
>    GIMPLE_PASS, /* type */
>    "nrv", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_NRV, /* tv_id */
>    ( PROP_ssa | PROP_cfg ), /* properties_required */
> @@ -389,7 +388,6 @@ const pass_data pass_data_return_slot =
>    GIMPLE_PASS, /* type */
>    "retslot", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_ssa, /* properties_required */
> diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
> index 994845b..23f7250 100644
> --- a/gcc/tree-object-size.c
> +++ b/gcc/tree-object-size.c
> @@ -1288,7 +1288,6 @@ const pass_data pass_data_object_sizes =
>    GIMPLE_PASS, /* type */
>    "objsz", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
> index 47179a9..e346074 100644
> --- a/gcc/tree-parloops.c
> +++ b/gcc/tree-parloops.c
> @@ -2277,7 +2277,6 @@ const pass_data pass_data_parallelize_loops =
>    GIMPLE_PASS, /* type */
>    "parloops", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_PARALLELIZE_LOOPS, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
> index 3b86770..9bb6455 100644
> --- a/gcc/tree-pass.h
> +++ b/gcc/tree-pass.h
> @@ -47,10 +47,6 @@ struct pass_data
>    /* The -fopt-info optimization group flags as defined in dumpfile.h. */
>    unsigned int optinfo_flags;
>
> -  /* If true, this pass has its own implementation of the opt_pass::gate
> -     method.  */
> -  bool has_gate;
> -
>    /* If true, this pass has its own implementation of the opt_pass::execute
>       method.  */
>    bool has_execute;
> @@ -90,9 +86,8 @@ public:
>       The default implementation prints an error message and aborts.  */
>    virtual opt_pass *clone ();
>
> -  /* If has_gate is set, this pass and all sub-passes are executed only if
> -     the function returns true.
> -     The default implementation returns true.  */
> +  /* This pass and all sub-passes are executed only if the function returns
> +     true.  The default implementation returns true.  */
>    virtual bool gate ();
>
>    /* This is the code to run.  If has_execute is false, then there should
> diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
> index 730bad4..859a112 100644
> --- a/gcc/tree-predcom.c
> +++ b/gcc/tree-predcom.c
> @@ -2586,7 +2586,6 @@ const pass_data pass_data_predcom =
>    GIMPLE_PASS, /* type */
>    "pcom", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_PREDCOM, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
> index 02e9ff2..0372c92 100644
> --- a/gcc/tree-profile.c
> +++ b/gcc/tree-profile.c
> @@ -680,7 +680,6 @@ const pass_data pass_data_ipa_tree_profile =
>    SIMPLE_IPA_PASS, /* type */
>    "profile", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_PROFILE, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
> index 91286b4..acca2a7 100644
> --- a/gcc/tree-sra.c
> +++ b/gcc/tree-sra.c
> @@ -3507,7 +3507,6 @@ const pass_data pass_data_sra_early =
>    GIMPLE_PASS, /* type */
>    "esra", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_SRA, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -3545,7 +3544,6 @@ const pass_data pass_data_sra =
>    GIMPLE_PASS, /* type */
>    "sra", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_SRA, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -5067,7 +5065,6 @@ const pass_data pass_data_early_ipa_sra =
>    GIMPLE_PASS, /* type */
>    "eipa_sra", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_SRA, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
> index eeefeaf..c7a7e89 100644
> --- a/gcc/tree-ssa-ccp.c
> +++ b/gcc/tree-ssa-ccp.c
> @@ -2301,7 +2301,6 @@ const pass_data pass_data_ccp =
>    GIMPLE_PASS, /* type */
>    "ccp", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_CCP, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -2719,7 +2718,6 @@ const pass_data pass_data_fold_builtins =
>    GIMPLE_PASS, /* type */
>    "fab", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
> index 02f4743..fc26d03 100644
> --- a/gcc/tree-ssa-copy.c
> +++ b/gcc/tree-ssa-copy.c
> @@ -657,7 +657,6 @@ const pass_data pass_data_copy_prop =
>    GIMPLE_PASS, /* type */
>    "copyprop", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_COPY_PROP, /* tv_id */
>    ( PROP_ssa | PROP_cfg ), /* properties_required */
> diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
> index bc947b6..0da3d82 100644
> --- a/gcc/tree-ssa-copyrename.c
> +++ b/gcc/tree-ssa-copyrename.c
> @@ -450,7 +450,6 @@ const pass_data pass_data_rename_ssa_copies =
>    GIMPLE_PASS, /* type */
>    "copyrename", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_COPY_RENAME, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
> index 13a71ce..8db149e 100644
> --- a/gcc/tree-ssa-dce.c
> +++ b/gcc/tree-ssa-dce.c
> @@ -1517,7 +1517,6 @@ const pass_data pass_data_dce =
>    GIMPLE_PASS, /* type */
>    "dce", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_DCE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -1556,7 +1555,6 @@ const pass_data pass_data_dce_loop =
>    GIMPLE_PASS, /* type */
>    "dceloop", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_DCE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -1595,7 +1593,6 @@ const pass_data pass_data_cd_dce =
>    GIMPLE_PASS, /* type */
>    "cddce", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_CD_DCE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
> index 91253dc..8101a54 100644
> --- a/gcc/tree-ssa-dom.c
> +++ b/gcc/tree-ssa-dom.c
> @@ -965,7 +965,6 @@ const pass_data pass_data_dominator =
>    GIMPLE_PASS, /* type */
>    "dom", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_SSA_DOMINATOR_OPTS, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -3123,7 +3122,6 @@ const pass_data pass_data_phi_only_cprop =
>    GIMPLE_PASS, /* type */
>    "phicprop", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_PHI_CPROP, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
> index 2c2f3f7..0096b4c 100644
> --- a/gcc/tree-ssa-dse.c
> +++ b/gcc/tree-ssa-dse.c
> @@ -376,7 +376,6 @@ const pass_data pass_data_dse =
>    GIMPLE_PASS, /* type */
>    "dse", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_DSE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
> index b6bedfe..66ae113 100644
> --- a/gcc/tree-ssa-forwprop.c
> +++ b/gcc/tree-ssa-forwprop.c
> @@ -3845,7 +3845,6 @@ const pass_data pass_data_forwprop =
>    GIMPLE_PASS, /* type */
>    "forwprop", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_FORWPROP, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
> index be28fb0..ef0c0c4 100644
> --- a/gcc/tree-ssa-ifcombine.c
> +++ b/gcc/tree-ssa-ifcombine.c
> @@ -769,7 +769,6 @@ const pass_data pass_data_tree_ifcombine =
>    GIMPLE_PASS, /* type */
>    "ifcombine", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_IFCOMBINE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
> index 0a6b1c1..99cc39c 100644
> --- a/gcc/tree-ssa-loop-ch.c
> +++ b/gcc/tree-ssa-loop-ch.c
> @@ -270,7 +270,6 @@ const pass_data pass_data_ch =
>    GIMPLE_PASS, /* type */
>    "ch", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_CH, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
> index c75f257..aab521e 100644
> --- a/gcc/tree-ssa-loop-im.c
> +++ b/gcc/tree-ssa-loop-im.c
> @@ -2551,7 +2551,6 @@ const pass_data pass_data_lim =
>    GIMPLE_PASS, /* type */
>    "lim", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_LIM, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
> index cdf1559..177666d 100644
> --- a/gcc/tree-ssa-loop-ivcanon.c
> +++ b/gcc/tree-ssa-loop-ivcanon.c
> @@ -1278,7 +1278,6 @@ const pass_data pass_data_iv_canon =
>    GIMPLE_PASS, /* type */
>    "ivcanon", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_LOOP_IVCANON, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -1335,7 +1334,6 @@ const pass_data pass_data_complete_unroll =
>    GIMPLE_PASS, /* type */
>    "cunroll", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_COMPLETE_UNROLL, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -1400,7 +1398,6 @@ const pass_data pass_data_complete_unrolli =
>    GIMPLE_PASS, /* type */
>    "cunrolli", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_COMPLETE_UNROLL, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
> index c0968c8..dd52703 100644
> --- a/gcc/tree-ssa-loop-prefetch.c
> +++ b/gcc/tree-ssa-loop-prefetch.c
> @@ -2026,7 +2026,6 @@ const pass_data pass_data_loop_prefetch =
>    GIMPLE_PASS, /* type */
>    "aprefetch", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_PREFETCH, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
> index 5031378..e755b62 100644
> --- a/gcc/tree-ssa-loop-unswitch.c
> +++ b/gcc/tree-ssa-loop-unswitch.c
> @@ -424,7 +424,6 @@ const pass_data pass_data_tree_unswitch =
>    GIMPLE_PASS, /* type */
>    "unswitch", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_LOOP_UNSWITCH, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
> index 4008b2b..84e24a1 100644
> --- a/gcc/tree-ssa-loop.c
> +++ b/gcc/tree-ssa-loop.c
> @@ -57,7 +57,6 @@ const pass_data pass_data_tree_loop =
>    GIMPLE_PASS, /* type */
>    "loop", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_TREE_LOOP, /* tv_id */
>    PROP_cfg, /* properties_required */
> @@ -113,7 +112,6 @@ const pass_data pass_data_tree_loop_init =
>    GIMPLE_PASS, /* type */
>    "loopinit", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> @@ -167,7 +165,6 @@ const pass_data pass_data_vectorize =
>    GIMPLE_PASS, /* type */
>    "vect", /* name */
>    OPTGROUP_LOOP | OPTGROUP_VEC, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_VECTORIZATION, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -223,7 +220,6 @@ const pass_data pass_data_check_data_deps =
>    GIMPLE_PASS, /* type */
>    "ckdd", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_CHECK_DATA_DEPS, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -269,7 +265,6 @@ const pass_data pass_data_scev_cprop =
>    GIMPLE_PASS, /* type */
>    "sccp", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_SCEV_CONST, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -321,7 +316,6 @@ const pass_data pass_data_record_bounds =
>    GIMPLE_PASS, /* type */
>    "*record_bounds", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_LOOP_BOUNDS, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -376,7 +370,6 @@ const pass_data pass_data_iv_optimize =
>    GIMPLE_PASS, /* type */
>    "ivopts", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_LOOP_IVOPTS, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -425,7 +418,6 @@ const pass_data pass_data_tree_loop_done =
>    GIMPLE_PASS, /* type */
>    "loopdone", /* name */
>    OPTGROUP_LOOP, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
> index 63aba8e..f63c75d 100644
> --- a/gcc/tree-ssa-math-opts.c
> +++ b/gcc/tree-ssa-math-opts.c
> @@ -660,7 +660,6 @@ const pass_data pass_data_cse_reciprocals =
>    GIMPLE_PASS, /* type */
>    "recip", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_ssa, /* properties_required */
> @@ -1578,7 +1577,6 @@ const pass_data pass_data_cse_sincos =
>    GIMPLE_PASS, /* type */
>    "sincos", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_ssa, /* properties_required */
> @@ -2080,7 +2078,6 @@ const pass_data pass_data_optimize_bswap =
>    GIMPLE_PASS, /* type */
>    "bswap", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_ssa, /* properties_required */
> @@ -2890,7 +2887,6 @@ const pass_data pass_data_optimize_widening_mul =
>    GIMPLE_PASS, /* type */
>    "widening_mul", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_ssa, /* properties_required */
> diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
> index f1aa14d..3892317 100644
> --- a/gcc/tree-ssa-phiopt.c
> +++ b/gcc/tree-ssa-phiopt.c
> @@ -2215,7 +2215,6 @@ const pass_data pass_data_phiopt =
>    GIMPLE_PASS, /* type */
>    "phiopt", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_PHIOPT, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -2261,7 +2260,6 @@ const pass_data pass_data_cselim =
>    GIMPLE_PASS, /* type */
>    "cselim", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_PHIOPT, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
> index 4d66c12..d67f488 100644
> --- a/gcc/tree-ssa-phiprop.c
> +++ b/gcc/tree-ssa-phiprop.c
> @@ -422,7 +422,6 @@ const pass_data pass_data_phiprop =
>    GIMPLE_PASS, /* type */
>    "phiprop", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_PHIPROP, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
> index df9ff23..1329fe2 100644
> --- a/gcc/tree-ssa-pre.c
> +++ b/gcc/tree-ssa-pre.c
> @@ -4784,7 +4784,6 @@ const pass_data pass_data_pre =
>    GIMPLE_PASS, /* type */
>    "pre", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_PRE, /* tv_id */
>    /* PROP_no_crit_edges is ensured by placing pass_split_crit_edges before
> @@ -4856,7 +4855,6 @@ const pass_data pass_data_fre =
>    GIMPLE_PASS, /* type */
>    "fre", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_FRE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
> index e9e29e5..0b37b7b 100644
> --- a/gcc/tree-ssa-reassoc.c
> +++ b/gcc/tree-ssa-reassoc.c
> @@ -4678,7 +4678,6 @@ const pass_data pass_data_reassoc =
>    GIMPLE_PASS, /* type */
>    "reassoc", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_REASSOC, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
> index 6d02975..4a7410d 100644
> --- a/gcc/tree-ssa-sink.c
> +++ b/gcc/tree-ssa-sink.c
> @@ -601,7 +601,6 @@ const pass_data pass_data_sink_code =
>    GIMPLE_PASS, /* type */
>    "sink", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_SINK, /* tv_id */
>    /* PROP_no_crit_edges is ensured by running split_critical_edges in
> diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
> index f55b7ee..aa6b6b9 100644
> --- a/gcc/tree-ssa-strlen.c
> +++ b/gcc/tree-ssa-strlen.c
> @@ -2102,7 +2102,6 @@ const pass_data pass_data_strlen =
>    GIMPLE_PASS, /* type */
>    "strlen", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_STRLEN, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
> index 70133cf..9e1cdbc 100644
> --- a/gcc/tree-ssa-structalias.c
> +++ b/gcc/tree-ssa-structalias.c
> @@ -7005,7 +7005,6 @@ const pass_data pass_data_build_alias =
>    GIMPLE_PASS, /* type */
>    "alias", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -7045,7 +7044,6 @@ const pass_data pass_data_build_ealias =
>    GIMPLE_PASS, /* type */
>    "ealias", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    false, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -7437,7 +7435,6 @@ const pass_data pass_data_ipa_pta =
>    SIMPLE_IPA_PASS, /* type */
>    "pta", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_PTA, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
> index a43dd1a..41f4bd8 100644
> --- a/gcc/tree-ssa-uncprop.c
> +++ b/gcc/tree-ssa-uncprop.c
> @@ -594,7 +594,6 @@ const pass_data pass_data_uncprop =
>    GIMPLE_PASS, /* type */
>    "uncprop", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_SSA_UNCPROP, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
> index eee83f7..86d84a1 100644
> --- a/gcc/tree-ssa-uninit.c
> +++ b/gcc/tree-ssa-uninit.c
> @@ -2365,7 +2365,6 @@ const pass_data pass_data_late_warn_uninitialized =
>    GIMPLE_PASS, /* type */
>    "uninit", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_ssa, /* properties_required */
> @@ -2425,7 +2424,6 @@ const pass_data pass_data_early_warn_uninitialized =
>    GIMPLE_PASS, /* type */
>    "*early_warn_uninitialized", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_UNINIT, /* tv_id */
>    PROP_ssa, /* properties_required */
> diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
> index 20f061f..ecc8da3 100644
> --- a/gcc/tree-ssa.c
> +++ b/gcc/tree-ssa.c
> @@ -1155,7 +1155,6 @@ const pass_data pass_data_init_datastructures =
>    GIMPLE_PASS, /* type */
>    "*init_datastructures", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> @@ -1686,7 +1685,6 @@ const pass_data pass_data_update_address_taken =
>    GIMPLE_PASS, /* type */
>    "addressables", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    false, /* has_execute */
>    TV_ADDRESS_TAKEN, /* tv_id */
>    PROP_ssa, /* properties_required */
> diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
> index 2b535a1..b18b688 100644
> --- a/gcc/tree-ssanames.c
> +++ b/gcc/tree-ssanames.c
> @@ -610,7 +610,6 @@ const pass_data pass_data_release_ssa_names =
>    GIMPLE_PASS, /* type */
>    "release_ssa", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_SSA_OTHER, /* tv_id */
>    PROP_ssa, /* properties_required */
> diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
> index feb6ece..7da36c4 100644
> --- a/gcc/tree-stdarg.c
> +++ b/gcc/tree-stdarg.c
> @@ -1006,7 +1006,6 @@ const pass_data pass_data_stdarg =
>    GIMPLE_PASS, /* type */
>    "stdarg", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
> index 5540ed3..cf2e763 100644
> --- a/gcc/tree-switch-conversion.c
> +++ b/gcc/tree-switch-conversion.c
> @@ -1480,7 +1480,6 @@ const pass_data pass_data_convert_switch =
>    GIMPLE_PASS, /* type */
>    "switchconv", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_SWITCH_CONVERSION, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
> index 3488c2f..b3a6256 100644
> --- a/gcc/tree-tailcall.c
> +++ b/gcc/tree-tailcall.c
> @@ -1090,7 +1090,6 @@ const pass_data pass_data_tail_recursion =
>    GIMPLE_PASS, /* type */
>    "tailr", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> @@ -1129,7 +1128,6 @@ const pass_data pass_data_tail_calls =
>    GIMPLE_PASS, /* type */
>    "tailc", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
> index d00a4b4..035c143 100644
> --- a/gcc/tree-vect-generic.c
> +++ b/gcc/tree-vect-generic.c
> @@ -1566,7 +1566,6 @@ const pass_data pass_data_lower_vector =
>    GIMPLE_PASS, /* type */
>    "veclower", /* name */
>    OPTGROUP_VEC, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> @@ -1607,7 +1606,6 @@ const pass_data pass_data_lower_vector_ssa =
>    GIMPLE_PASS, /* type */
>    "veclower2", /* name */
>    OPTGROUP_VEC, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    PROP_cfg, /* properties_required */
> diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
> index 765e38f..17be3aa 100644
> --- a/gcc/tree-vectorizer.c
> +++ b/gcc/tree-vectorizer.c
> @@ -626,7 +626,6 @@ const pass_data pass_data_slp_vectorize =
>    GIMPLE_PASS, /* type */
>    "slp", /* name */
>    OPTGROUP_LOOP | OPTGROUP_VEC, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_SLP_VECTORIZATION, /* tv_id */
>    ( PROP_ssa | PROP_cfg ), /* properties_required */
> @@ -717,7 +716,6 @@ const pass_data pass_data_ipa_increase_alignment =
>    SIMPLE_IPA_PASS, /* type */
>    "increase_alignment", /* name */
>    OPTGROUP_LOOP | OPTGROUP_VEC, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_OPT, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
> index 14f1526..4ccb90b 100644
> --- a/gcc/tree-vrp.c
> +++ b/gcc/tree-vrp.c
> @@ -9907,7 +9907,6 @@ const pass_data pass_data_vrp =
>    GIMPLE_PASS, /* type */
>    "vrp", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_VRP, /* tv_id */
>    PROP_ssa, /* properties_required */
> diff --git a/gcc/tree.c b/gcc/tree.c
> index d829faa..b897988 100644
> --- a/gcc/tree.c
> +++ b/gcc/tree.c
> @@ -5625,7 +5625,6 @@ const pass_data pass_data_ipa_free_lang_data =
>    SIMPLE_IPA_PASS, /* type */
>    "*free_lang_data", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  false, /* has_gate */
>    true, /* has_execute */
>    TV_IPA_FREE_LANG_DATA, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/tsan.c b/gcc/tsan.c
> index 2e32cd2..f30cf57 100644
> --- a/gcc/tsan.c
> +++ b/gcc/tsan.c
> @@ -747,7 +747,6 @@ const pass_data pass_data_tsan =
>    GIMPLE_PASS, /* type */
>    "tsan", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_ssa | PROP_cfg ), /* properties_required */
> @@ -792,7 +791,6 @@ const pass_data pass_data_tsan_O0 =
>    GIMPLE_PASS, /* type */
>    "tsan0", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_NONE, /* tv_id */
>    ( PROP_ssa | PROP_cfg ), /* properties_required */
> diff --git a/gcc/ubsan.c b/gcc/ubsan.c
> index ac40c85..c205e6b 100644
> --- a/gcc/ubsan.c
> +++ b/gcc/ubsan.c
> @@ -916,7 +916,6 @@ const pass_data pass_data_ubsan =
>    GIMPLE_PASS, /* type */
>    "ubsan", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_TREE_UBSAN, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
> index 65d8285..e6ca3af 100644
> --- a/gcc/var-tracking.c
> +++ b/gcc/var-tracking.c
> @@ -10359,7 +10359,6 @@ const pass_data pass_data_variable_tracking =
>    RTL_PASS, /* type */
>    "vartrack", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_VAR_TRACKING, /* tv_id */
>    0, /* properties_required */
> diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
> index 4e4c21a..99caa88 100644
> --- a/gcc/vtable-verify.c
> +++ b/gcc/vtable-verify.c
> @@ -757,7 +757,6 @@ const pass_data pass_data_vtable_verify =
>    GIMPLE_PASS, /* type */
>    "vtable-verify", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_VTABLE_VERIFICATION, /* tv_id */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
> diff --git a/gcc/web.c b/gcc/web.c
> index d67151c..ba4172e 100644
> --- a/gcc/web.c
> +++ b/gcc/web.c
> @@ -456,7 +456,6 @@ const pass_data pass_data_web =
>    RTL_PASS, /* type */
>    "web", /* name */
>    OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_gate */
>    true, /* has_execute */
>    TV_WEB, /* tv_id */
>    0, /* properties_required */
> --
> 1.9.2
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/6] enable -Woverloaded-virtual when available
  2014-04-17  8:38 ` [PATCH 4/6] enable -Woverloaded-virtual when available tsaunders
@ 2014-04-17  9:00   ` Richard Biener
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Biener @ 2014-04-17  9:00 UTC (permalink / raw)
  To: tsaunders; +Cc: GCC Patches, Trevor Saunders

On Thu, Apr 17, 2014 at 10:37 AM,  <tsaunders@mozilla.com> wrote:
> From: Trevor Saunders <tbsaunde@mozilla.com>
>
> hi,
>
> its a useful warning, and helps catch bugs in the next two patches.
>
> bootstrap + regtest passed on x86_64-unknown-linux-gnu, ok?

Ok.

Thanks,
Richard.

> Trev
>
> 2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>
>
>         * configure.ac: Check for -Woverloaded-virtual and enable it if found.
>         * configure: Regenerate.
>
>
> diff --git a/gcc/configure b/gcc/configure
> index 415377a..1a48ca3 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -6427,6 +6427,50 @@ fi
>    done
>  CFLAGS="$save_CFLAGS"
>
> +save_CFLAGS="$CFLAGS"
> +for real_option in -Woverloaded-virtual; do
> +  # Do the check with the no- prefix removed since gcc silently
> +  # accepts any -Wno-* option on purpose
> +  case $real_option in
> +    -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
> +    *) option=$real_option ;;
> +  esac
> +  as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5
> +$as_echo_n "checking whether $CC supports $option... " >&6; }
> +if { as_var=$as_acx_Woption; eval "test \"\${$as_var+set}\" = set"; }; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  CFLAGS="$option"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +
> +int
> +main ()
> +{
> +
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  eval "$as_acx_Woption=yes"
> +else
> +  eval "$as_acx_Woption=no"
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +
> +fi
> +eval ac_res=\$$as_acx_Woption
> +              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
> +$as_echo "$ac_res" >&6; }
> +  if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then :
> +  strict_warn="$strict_warn${strict_warn:+ }$real_option"
> +fi
> +  done
> +CFLAGS="$save_CFLAGS"
> +
>  c_strict_warn=
>  save_CFLAGS="$CFLAGS"
>  for real_option in -Wold-style-definition -Wc++-compat; do
> @@ -17927,7 +17971,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 17930 "configure"
> +#line 17974 "configure"
>  #include "confdefs.h"
>
>  #if HAVE_DLFCN_H
> @@ -18033,7 +18077,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 18036 "configure"
> +#line 18080 "configure"
>  #include "confdefs.h"
>
>  #if HAVE_DLFCN_H
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index 0336066..b2726e5 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -340,6 +340,8 @@ ACX_PROG_CC_WARNING_OPTS(
>  ACX_PROG_CC_WARNING_OPTS(
>         m4_quote(m4_do([-Wmissing-format-attribute])), [strict_warn])
>  ACX_PROG_CC_WARNING_OPTS(
> +       m4_quote(m4_do([-Woverloaded-virtual])), [strict_warn])
> +ACX_PROG_CC_WARNING_OPTS(
>         m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])
>  ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(
>         m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ],
> --
> 1.9.2
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/6] pass current function to opt_pass::gate ()
  2014-04-17  8:38 ` [PATCH 5/6] pass current function to opt_pass::gate () tsaunders
@ 2014-04-17  9:00   ` Richard Biener
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Biener @ 2014-04-17  9:00 UTC (permalink / raw)
  To: tsaunders; +Cc: GCC Patches

On Thu, Apr 17, 2014 at 10:37 AM,  <tsaunders@mozilla.com> wrote:
> From: Trevor Saunders <tsaunders@mozilla.com>
>
> Hi,
>
>  This gets rid of usage of cfun, and a bunch of useless functions.
>
> bootstrap + regtest passed on x86_64-unknown-linux-gnu, ok?

Ok.

Thanks,
Richard.

> Trev
>
> 2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>
>
> gcc/
>         * passes.c (opt_pass::gate): Take function * argument.
>         (gate_all_early_local_passes): Merge into
>         (early_local_passes::gate): this.
>         (gate_all_early_optimizations): Merge into
>         (all_early_optimizations::gate): this.
>         (gate_all_optimizations): Mege into
>         (all_optimizations::gate): this.
>         (gate_all_optimizations_g): Merge into
>         (all_optimizations_g::gate): this.
>         (gate_rest_of_compilation): Mege into
>         (rest_of_compilation::gate): this.
>         (gate_postreload): Merge into
>         (postreload::gate): this.
>         (dump_one_pass): Pass cfun to the pass's gate method.
>         (execute_ipa_summary_passes): Likewise.
>         (execute_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.
>         * tree-pass.h (opt_pass::gate): Add function * argument.
>         * asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
>         combine-stack-adj.c, combine.c, compare-elim.c,
>         config/epiphany/resolve-sw-modes.c, config/i386/i386.c,
>         config/rl78/rl78.c, config/sh/sh_optimize_sett_clrt.cc,
>         config/sh/sh_treg_combine.cc, config/sparc/sparc.c, cprop.c, cse.c,
>         dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c,  fwprop.c, gcse.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-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c,
>         loop-init.c, lower-subreg.c, mode-switching.c, modulo-sched.c,
>         omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c,
>         reg-stack.c, regcprop.c, regrename.c, reorg.c, sched-rgn.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-parloops.c, tree-predcom.c, tree-profile.c,
>         tree-sra.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-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
>         tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tsan.c, ubsan.c,
>         var-tracking.c, vtable-verify.c, web.c: Adjust.
>
> gcc/testsuite/
>         * g++.dg/plugin/dumb_plugin.c, g++.dg/plugin/selfasign.c,
>         gcc.dg/plugin/one_time_plugin.c, gcc.dg/plugin/selfasign.c: Adjust.
>
>
>
> diff --git a/gcc/asan.c b/gcc/asan.c
> index e26ce41..3fe50ef 100644
> --- a/gcc/asan.c
> +++ b/gcc/asan.c
> @@ -2504,7 +2504,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_asan (m_ctxt); }
> -  bool gate () { return gate_asan (); }
> +  virtual bool gate (function *) { return gate_asan (); }
>    unsigned int execute () { return asan_instrument (); }
>
>  }; // class pass_asan
> @@ -2517,12 +2517,6 @@ make_pass_asan (gcc::context *ctxt)
>    return new pass_asan (ctxt);
>  }
>
> -static bool
> -gate_asan_O0 (void)
> -{
> -  return !optimize && gate_asan ();
> -}
> -
>  namespace {
>
>  const pass_data pass_data_asan_O0 =
> @@ -2548,7 +2542,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_asan_O0 (); }
> +  virtual bool gate (function *) { return !optimize && gate_asan (); }
>    unsigned int execute () { return asan_instrument (); }
>
>  }; // class pass_asan_O0
> @@ -2599,12 +2593,6 @@ execute_sanopt (void)
>    return 0;
>  }
>
> -static bool
> -gate_sanopt (void)
> -{
> -  return flag_sanitize;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_sanopt =
> @@ -2630,7 +2618,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_sanopt (); }
> +  virtual bool gate (function *) { return flag_sanitize; }
>    unsigned int execute () { return execute_sanopt (); }
>
>  }; // class pass_sanopt
> diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
> index 4346e85..e1485a3 100644
> --- a/gcc/auto-inc-dec.c
> +++ b/gcc/auto-inc-dec.c
> @@ -1495,17 +1495,6 @@ rest_of_handle_auto_inc_dec (void)
>
>  /* 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 =
> @@ -1530,7 +1519,16 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_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 () { return rest_of_handle_auto_inc_dec (); }
>
>  }; // class pass_inc_dec
> diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
> index 6ac0242..57103bd 100644
> --- a/gcc/bb-reorder.c
> +++ b/gcc/bb-reorder.c
> @@ -2302,15 +2302,6 @@ insert_section_boundary_note (void)
>      }
>  }
>
> -static bool
> -gate_handle_reorder_blocks (void)
> -{
> -  if (targetm.cannot_modify_jumps_p ())
> -    return false;
> -  return (optimize > 0
> -         && (flag_reorder_blocks || flag_reorder_blocks_and_partition));
> -}
> -
>  static unsigned int
>  rest_of_handle_reorder_blocks (void)
>  {
> @@ -2355,7 +2346,14 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_reorder_blocks (); }
> +  virtual bool gate (function *)
> +    {
> +      if (targetm.cannot_modify_jumps_p ())
> +       return false;
> +      return (optimize > 0
> +             && (flag_reorder_blocks || flag_reorder_blocks_and_partition));
> +    }
> +
>    unsigned int execute () { return rest_of_handle_reorder_blocks (); }
>
>  }; // class pass_reorder_blocks
> @@ -2374,16 +2372,6 @@ make_pass_reorder_blocks (gcc::context *ctxt)
>     which can seriously pessimize code with many computed jumps in the source
>     code, such as interpreters.  See e.g. PR15242.  */
>
> -static bool
> -gate_duplicate_computed_gotos (void)
> -{
> -  if (targetm.cannot_modify_jumps_p ())
> -    return false;
> -  return (optimize > 0
> -         && flag_expensive_optimizations
> -         && ! optimize_function_for_size_p (cfun));
> -}
> -
>
>  static unsigned int
>  duplicate_computed_gotos (void)
> @@ -2527,11 +2515,21 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_duplicate_computed_gotos (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return duplicate_computed_gotos (); }
>
>  }; // class pass_duplicate_computed_gotos
>
> +bool
> +pass_duplicate_computed_gotos::gate (function *fun)
> +{
> +  if (targetm.cannot_modify_jumps_p ())
> +    return false;
> +  return (optimize > 0
> +         && flag_expensive_optimizations
> +         && ! optimize_function_for_size_p (fun));
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -2540,22 +2538,6 @@ make_pass_duplicate_computed_gotos (gcc::context *ctxt)
>    return new pass_duplicate_computed_gotos (ctxt);
>  }
>
> -static bool
> -gate_handle_partition_blocks (void)
> -{
> -  /* The optimization to partition hot/cold basic blocks into separate
> -     sections of the .o file does not work well with linkonce or with
> -     user defined section attributes.  Don't call it if either case
> -     arises.  */
> -  return (flag_reorder_blocks_and_partition
> -          && optimize
> -         /* See gate_handle_reorder_blocks.  We should not partition if
> -            we are going to omit the reordering.  */
> -         && optimize_function_for_speed_p (cfun)
> -         && !DECL_ONE_ONLY (current_function_decl)
> -         && !user_defined_section_attribute);
> -}
> -
>  /* This function is the main 'entrance' for the optimization that
>     partitions hot and cold basic blocks into separate sections of the
>     .o file (to improve performance and cache locality).  Ideally it
> @@ -2750,11 +2732,27 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_partition_blocks (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return partition_hot_cold_basic_blocks (); }
>
>  }; // class pass_partition_blocks
>
> +bool
> +pass_partition_blocks::gate (function *fun)
> +{
> +  /* The optimization to partition hot/cold basic blocks into separate
> +     sections of the .o file does not work well with linkonce or with
> +     user defined section attributes.  Don't call it if either case
> +     arises.  */
> +  return (flag_reorder_blocks_and_partition
> +         && optimize
> +         /* See gate_handle_reorder_blocks.  We should not partition if
> +            we are going to omit the reordering.  */
> +         && optimize_function_for_speed_p (fun)
> +         && !DECL_ONE_ONLY (current_function_decl)
> +         && !user_defined_section_attribute);
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/bt-load.c b/gcc/bt-load.c
> index d44917f..fc2aea7 100644
> --- a/gcc/bt-load.c
> +++ b/gcc/bt-load.c
> @@ -1494,12 +1494,6 @@ branch_target_load_optimize (bool after_prologue_epilogue_gen)
>      }
>  }
>
> -static bool
> -gate_handle_branch_target_load_optimize1 (void)
> -{
> -  return flag_branch_target_load_optimize;
> -}
> -
>
>  static unsigned int
>  rest_of_handle_branch_target_load_optimize1 (void)
> @@ -1532,7 +1526,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_branch_target_load_optimize1 (); }
> +  virtual bool gate (function *) { return flag_branch_target_load_optimize; }
>    unsigned int execute () {
>      return rest_of_handle_branch_target_load_optimize1 ();
>    }
> @@ -1547,12 +1541,6 @@ make_pass_branch_target_load_optimize1 (gcc::context *ctxt)
>    return new pass_branch_target_load_optimize1 (ctxt);
>  }
>
> -static bool
> -gate_handle_branch_target_load_optimize2 (void)
> -{
> -  return (optimize > 0 && flag_branch_target_load_optimize2);
> -}
> -
>
>  static unsigned int
>  rest_of_handle_branch_target_load_optimize2 (void)
> @@ -1600,7 +1588,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_branch_target_load_optimize2 (); }
> +  virtual bool gate (function *)
> +    {
> +      return (optimize > 0 && flag_branch_target_load_optimize2);
> +    }
> +
>    unsigned int execute () {
>      return rest_of_handle_branch_target_load_optimize2 ();
>    }
> diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
> index ec22ab3..37fc7a5 100644
> --- a/gcc/combine-stack-adj.c
> +++ b/gcc/combine-stack-adj.c
> @@ -619,21 +619,6 @@ combine_stack_adjustments_for_block (basic_block bb)
>      free_csa_reflist (reflist);
>  }
>
> -
> -static bool
> -gate_handle_stack_adjustments (void)
> -{
> -  /* This is kind of a heuristic.  We need to run combine_stack_adjustments
> -     even for machines with possibly nonzero TARGET_RETURN_POPS_ARGS
> -     and ACCUMULATE_OUTGOING_ARGS.  We expect that only ports having
> -     push instructions will have popping returns.  */
> -#ifndef PUSH_ROUNDING
> -  if (ACCUMULATE_OUTGOING_ARGS)
> -    return false;
> -#endif
> -  return flag_combine_stack_adjustments;
> -}
> -
>  static unsigned int
>  rest_of_handle_stack_adjustments (void)
>  {
> @@ -667,11 +652,25 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_stack_adjustments (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return rest_of_handle_stack_adjustments (); }
>
>  }; // class pass_stack_adjustments
>
> +bool
> +pass_stack_adjustments::gate (function *)
> +{
> +  /* This is kind of a heuristic.  We need to run combine_stack_adjustments
> +     even for machines with possibly nonzero TARGET_RETURN_POPS_ARGS
> +     and ACCUMULATE_OUTGOING_ARGS.  We expect that only ports having
> +     push instructions will have popping returns.  */
> +#ifndef PUSH_ROUNDING
> +  if (ACCUMULATE_OUTGOING_ARGS)
> +    return false;
> +#endif
> +  return flag_combine_stack_adjustments;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/combine.c b/gcc/combine.c
> index 63933c0..1b1e33c 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -13854,12 +13854,6 @@ dump_combine_total_stats (FILE *file)
>       total_attempts, total_merges, total_extras, total_successes);
>  }
>
> -static bool
> -gate_handle_combine (void)
> -{
> -  return (optimize > 0);
> -}
> -
>  /* Try combining insns through substitution.  */
>  static unsigned int
>  rest_of_handle_combine (void)
> @@ -13914,7 +13908,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_combine (); }
> +  virtual bool gate (function *) { return (optimize > 0); }
>    unsigned int execute () { return rest_of_handle_combine (); }
>
>  }; // class pass_combine
> diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c
> index e66b1c6..9cddb7a 100644
> --- a/gcc/compare-elim.c
> +++ b/gcc/compare-elim.c
> @@ -643,15 +643,6 @@ execute_compare_elim_after_reload (void)
>    return 0;
>  }
>
> -static bool
> -gate_compare_elim_after_reload (void)
> -{
> -  /* Setting this target hook value is how a backend indicates the need.  */
> -  if (targetm.flags_regnum == INVALID_REGNUM)
> -    return false;
> -  return flag_compare_elim_after_reload;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_compare_elim_after_reload =
> @@ -677,7 +668,14 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_compare_elim_after_reload (); }
> +  virtual bool gate (function *)
> +    {
> +      /* Setting this target hook value is how a backend indicates the need.  */
> +      if (targetm.flags_regnum == INVALID_REGNUM)
> +       return false;
> +      return flag_compare_elim_after_reload;
> +    }
> +
>    unsigned int execute () { return execute_compare_elim_after_reload (); }
>
>  }; // class pass_compare_elim_after_reload
> diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
> index 486330c..31928fd 100644
> --- a/gcc/config/epiphany/resolve-sw-modes.c
> +++ b/gcc/config/epiphany/resolve-sw-modes.c
> @@ -45,12 +45,6 @@ along with GCC; see the file COPYING3.  If not see
>     insert new mode setting insns on the edges where the other mode
>     becomes unambigous.  */
>
> -static bool
> -gate_resolve_sw_modes (void)
> -{
> -  return optimize;
> -}
> -
>  static unsigned
>  resolve_sw_modes (void)
>  {
> @@ -185,7 +179,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_resolve_sw_modes (); }
> +  virtual bool gate (function *) { return optimize; }
>    unsigned int execute () { return resolve_sw_modes (); }
>
>  }; // class pass_resolve_sw_modes
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 6dd1bbe..8cfdaf6 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -2493,12 +2493,6 @@ static const struct ptt processor_target_table[PROCESSOR_max] =
>    {"btver2", &btver2_cost, 16, 10, 16, 7, 11}
>  };
>
> -static bool
> -gate_insert_vzeroupper (void)
> -{
> -  return TARGET_AVX && !TARGET_AVX512F && TARGET_VZEROUPPER;
> -}
> -
>  static unsigned int
>  rest_of_handle_insert_vzeroupper (void)
>  {
> @@ -2542,7 +2536,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_insert_vzeroupper (); }
> +  virtual bool gate (function *)
> +    {
> +      return TARGET_AVX && !TARGET_AVX512F && TARGET_VZEROUPPER;
> +    }
> +
>    unsigned int execute () { return rest_of_handle_insert_vzeroupper (); }
>
>  }; // class pass_insert_vzeroupper
> diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
> index 88b030f..988e1cd 100644
> --- a/gcc/config/rl78/rl78.c
> +++ b/gcc/config/rl78/rl78.c
> @@ -117,13 +117,6 @@ rl78_init_machine_status (void)
>    return m;
>  }
>
> -/* Returns whether to run the devirtualization pass.  */
> -static bool
> -devirt_gate (void)
> -{
> -  return true;
> -}
> -
>  /* Runs the devirtualization pass.  */
>  static unsigned int
>  devirt_pass (void)
> @@ -160,7 +153,6 @@ public:
>    }
>
>    /* opt_pass methods: */
> -  bool gate () { return devirt_gate (); }
>    unsigned int execute () { return devirt_pass (); }
>  };
>
> @@ -243,7 +235,6 @@ public:
>    }
>
>    /* opt_pass methods: */
> -  bool gate () { return devirt_gate (); }
>    unsigned int execute () { return move_elim_pass (); }
>  };
>
> diff --git a/gcc/config/sh/sh_optimize_sett_clrt.cc b/gcc/config/sh/sh_optimize_sett_clrt.cc
> index 85cb6a1..5b1afcd 100644
> --- a/gcc/config/sh/sh_optimize_sett_clrt.cc
> +++ b/gcc/config/sh/sh_optimize_sett_clrt.cc
> @@ -79,7 +79,7 @@ class sh_optimize_sett_clrt : public rtl_opt_pass
>  public:
>    sh_optimize_sett_clrt (gcc::context* ctx, const char* name);
>    virtual ~sh_optimize_sett_clrt (void);
> -  virtual bool gate (void);
> +  virtual bool gate (function *);
>    virtual unsigned int execute (void);
>
>  private:
> @@ -161,7 +161,7 @@ sh_optimize_sett_clrt::~sh_optimize_sett_clrt (void)
>  }
>
>  bool
> -sh_optimize_sett_clrt::gate (void)
> +sh_optimize_sett_clrt::gate (function *)
>  {
>    return optimize > 0;
>  }
> diff --git a/gcc/config/sh/sh_treg_combine.cc b/gcc/config/sh/sh_treg_combine.cc
> index 1285ba2..57eddd2 100644
> --- a/gcc/config/sh/sh_treg_combine.cc
> +++ b/gcc/config/sh/sh_treg_combine.cc
> @@ -424,7 +424,7 @@ class sh_treg_combine : public rtl_opt_pass
>  public:
>    sh_treg_combine (gcc::context* ctx, bool split_insns, const char* name);
>    virtual ~sh_treg_combine (void);
> -  virtual bool gate (void);
> +  virtual bool gate (function *);
>    virtual unsigned int execute (void);
>
>  private:
> @@ -1435,7 +1435,7 @@ sh_treg_combine::try_optimize_cbranch (rtx insn)
>  }
>
>  bool
> -sh_treg_combine::gate (void)
> +sh_treg_combine::gate (function *)
>  {
>    return optimize > 0;
>  }
> diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
> index a63e813..5578cb8 100644
> --- a/gcc/config/sparc/sparc.c
> +++ b/gcc/config/sparc/sparc.c
> @@ -871,13 +871,6 @@ mem_ref (rtx x)
>     pass runs as late as possible.  The pass is inserted in the pass pipeline
>     at the end of sparc_option_override.  */
>
> -static bool
> -sparc_gate_work_around_errata (void)
> -{
> -  /* The only errata we handle are those of the AT697F and UT699.  */
> -  return sparc_fix_at697f != 0 || sparc_fix_ut699 != 0;
> -}
> -
>  static unsigned int
>  sparc_do_work_around_errata (void)
>  {
> @@ -1146,7 +1139,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return sparc_gate_work_around_errata (); }
> +  virtual bool gate (function *)
> +    {
> +      /* The only errata we handle are those of the AT697F and UT699.  */
> +      return sparc_fix_at697f != 0 || sparc_fix_ut699 != 0;
> +    }
> +
>    unsigned int execute () { return sparc_do_work_around_errata (); }
>
>  }; // class pass_work_around_errata
> diff --git a/gcc/cprop.c b/gcc/cprop.c
> index f22cde7..9802b8a 100644
> --- a/gcc/cprop.c
> +++ b/gcc/cprop.c
> @@ -1896,14 +1896,6 @@ one_cprop_pass (void)
>     setjmp.
>     FIXME: Should just handle setjmp via REG_SETJMP notes.  */
>
> -static bool
> -gate_rtl_cprop (void)
> -{
> -  return optimize > 0 && flag_gcse
> -    && !cfun->calls_setjmp
> -    && dbg_cnt (cprop);
> -}
> -
>  static unsigned int
>  execute_rtl_cprop (void)
>  {
> @@ -1944,7 +1936,13 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_rtl_cprop (m_ctxt); }
> -  bool gate () { return gate_rtl_cprop (); }
> +  virtual bool gate (function *fun)
> +    {
> +      return optimize > 0 && flag_gcse
> +       && !fun->calls_setjmp
> +       && dbg_cnt (cprop);
> +    }
> +
>    unsigned int execute () { return execute_rtl_cprop (); }
>
>  }; // class pass_rtl_cprop
> diff --git a/gcc/cse.c b/gcc/cse.c
> index 6edea01..60ec9a9 100644
> --- a/gcc/cse.c
> +++ b/gcc/cse.c
> @@ -7457,12 +7457,6 @@ cse_condition_code_reg (void)
>  /* Perform common subexpression elimination.  Nonzero value from
>     `cse_main' means that jumps were simplified and some code may now
>     be unreachable, so do jump optimization again.  */
> -static bool
> -gate_handle_cse (void)
> -{
> -  return optimize > 0;
> -}
> -
>  static unsigned int
>  rest_of_handle_cse (void)
>  {
> @@ -7515,7 +7509,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_cse (); }
> +  virtual bool gate (function *) { return optimize > 0; }
>    unsigned int execute () { return rest_of_handle_cse (); }
>
>  }; // class pass_cse
> @@ -7529,12 +7523,6 @@ make_pass_cse (gcc::context *ctxt)
>  }
>
>
> -static bool
> -gate_handle_cse2 (void)
> -{
> -  return optimize > 0 && flag_rerun_cse_after_loop;
> -}
> -
>  /* Run second CSE pass after loop optimizations.  */
>  static unsigned int
>  rest_of_handle_cse2 (void)
> @@ -7594,7 +7582,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_cse2 (); }
> +  virtual bool gate (function *)
> +    {
> +      return optimize > 0 && flag_rerun_cse_after_loop;
> +    }
> +
>    unsigned int execute () { return rest_of_handle_cse2 (); }
>
>  }; // class pass_cse2
> @@ -7607,12 +7599,6 @@ make_pass_cse2 (gcc::context *ctxt)
>    return new pass_cse2 (ctxt);
>  }
>
> -static bool
> -gate_handle_cse_after_global_opts (void)
> -{
> -  return optimize > 0 && flag_rerun_cse_after_global_opts;
> -}
> -
>  /* Run second CSE pass after loop optimizations.  */
>  static unsigned int
>  rest_of_handle_cse_after_global_opts (void)
> @@ -7671,7 +7657,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_cse_after_global_opts (); }
> +  virtual bool gate (function *)
> +    {
> +      return optimize > 0 && flag_rerun_cse_after_global_opts;
> +    }
> +
>    unsigned int execute () {
>      return rest_of_handle_cse_after_global_opts ();
>    }
> diff --git a/gcc/dce.c b/gcc/dce.c
> index 33cdefd..1d290e3 100644
> --- a/gcc/dce.c
> +++ b/gcc/dce.c
> @@ -779,13 +779,6 @@ rest_of_handle_ud_dce (void)
>  }
>
>
> -static bool
> -gate_ud_dce (void)
> -{
> -  return optimize > 1 && flag_dce
> -    && dbg_cnt (dce_ud);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ud_rtl_dce =
> @@ -810,7 +803,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_ud_dce (); }
> +  virtual bool gate (function *)
> +    {
> +      return optimize > 1 && flag_dce && dbg_cnt (dce_ud);
> +    }
> +
>    unsigned int execute () { return rest_of_handle_ud_dce (); }
>
>  }; // class pass_ud_rtl_dce
> @@ -1211,13 +1208,6 @@ run_fast_dce (void)
>  }
>
>
> -static bool
> -gate_fast_dce (void)
> -{
> -  return optimize > 0 && flag_dce
> -    && dbg_cnt (dce_fast);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_fast_rtl_dce =
> @@ -1242,7 +1232,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_fast_dce (); }
> +  virtual bool gate (function *)
> +    {
> +      return optimize > 0 && flag_dce && dbg_cnt (dce_fast);
> +    }
> +
>    unsigned int execute () { return rest_of_handle_fast_dce (); }
>
>  }; // class pass_fast_rtl_dce
> diff --git a/gcc/df-core.c b/gcc/df-core.c
> index 9909ac3..bd3cb31 100644
> --- a/gcc/df-core.c
> +++ b/gcc/df-core.c
> @@ -740,13 +740,6 @@ rest_of_handle_df_initialize (void)
>  }
>
>
> -static bool
> -gate_opt (void)
> -{
> -  return optimize > 0;
> -}
> -
> -
>  namespace {
>
>  const pass_data pass_data_df_initialize_opt =
> @@ -771,7 +764,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_opt (); }
> +  virtual bool gate (function *) { return optimize > 0; }
>    unsigned int execute () { return rest_of_handle_df_initialize (); }
>
>  }; // class pass_df_initialize_opt
> @@ -785,13 +778,6 @@ make_pass_df_initialize_opt (gcc::context *ctxt)
>  }
>
>
> -static bool
> -gate_no_opt (void)
> -{
> -  return optimize == 0;
> -}
> -
> -
>  namespace {
>
>  const pass_data pass_data_df_initialize_no_opt =
> @@ -816,7 +802,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_no_opt (); }
> +  virtual bool gate (function *) { return optimize == 0; }
>    unsigned int execute () { return rest_of_handle_df_initialize (); }
>
>  }; // class pass_df_initialize_no_opt
> diff --git a/gcc/dse.c b/gcc/dse.c
> index a3a66b1..a80c025 100644
> --- a/gcc/dse.c
> +++ b/gcc/dse.c
> @@ -608,11 +608,6 @@ static bitmap kill_on_calls;
>
>  /* The number of bits used in the global bitmaps.  */
>  static unsigned int current_position;
> -
> -
> -static bool gate_dse1 (void);
> -static bool gate_dse2 (void);
> -
>
>  /*----------------------------------------------------------------------------
>     Zeroth step.
> @@ -3712,20 +3707,6 @@ rest_of_handle_dse (void)
>    return 0;
>  }
>
> -static bool
> -gate_dse1 (void)
> -{
> -  return optimize > 0 && flag_dse
> -    && dbg_cnt (dse1);
> -}
> -
> -static bool
> -gate_dse2 (void)
> -{
> -  return optimize > 0 && flag_dse
> -    && dbg_cnt (dse2);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_rtl_dse1 =
> @@ -3750,7 +3731,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_dse1 (); }
> +  virtual bool gate (function *)
> +    {
> +      return optimize > 0 && flag_dse && dbg_cnt (dse1);
> +    }
> +
>    unsigned int execute () { return rest_of_handle_dse (); }
>
>  }; // class pass_rtl_dse1
> @@ -3787,7 +3772,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_dse2 (); }
> +  virtual bool gate (function *)
> +    {
> +      return optimize > 0 && flag_dse && dbg_cnt (dse2);
> +    }
> +
>    unsigned int execute () { return rest_of_handle_dse (); }
>
>  }; // class pass_rtl_dse2
> diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
> index d278a27..3749277 100644
> --- a/gcc/dwarf2cfi.c
> +++ b/gcc/dwarf2cfi.c
> @@ -3377,21 +3377,6 @@ dwarf2out_do_cfi_asm (void)
>    return true;
>  }
>
> -static bool
> -gate_dwarf2_frame (void)
> -{
> -#ifndef HAVE_prologue
> -  /* Targets which still implement the prologue in assembler text
> -     cannot use the generic dwarf2 unwinding.  */
> -  return false;
> -#endif
> -
> -  /* ??? What to do for UI_TARGET unwinding?  They might be able to benefit
> -     from the optimized shrink-wrapping annotations that we will compute.
> -     For now, only produce the CFI notes for dwarf2.  */
> -  return dwarf2out_do_frame ();
> -}
> -
>  namespace {
>
>  const pass_data pass_data_dwarf2_frame =
> @@ -3416,11 +3401,26 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_dwarf2_frame (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return execute_dwarf2_frame (); }
>
>  }; // class pass_dwarf2_frame
>
> +bool
> +pass_dwarf2_frame::gate (function *)
> +{
> +#ifndef HAVE_prologue
> +  /* Targets which still implement the prologue in assembler text
> +     cannot use the generic dwarf2 unwinding.  */
> +  return false;
> +#endif
> +
> +  /* ??? What to do for UI_TARGET unwinding?  They might be able to benefit
> +     from the optimized shrink-wrapping annotations that we will compute.
> +     For now, only produce the CFI notes for dwarf2.  */
> +  return dwarf2out_do_frame ();
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/except.c b/gcc/except.c
> index cf3cd5f..2015809 100644
> --- a/gcc/except.c
> +++ b/gcc/except.c
> @@ -2620,17 +2620,6 @@ convert_to_eh_region_ranges (void)
>    return 0;
>  }
>
> -static bool
> -gate_convert_to_eh_region_ranges (void)
> -{
> -  /* Nothing to do for SJLJ exceptions or if no regions created.  */
> -  if (cfun->eh->region_tree == NULL)
> -    return false;
> -  if (targetm_common.except_unwind_info (&global_options) == UI_SJLJ)
> -    return false;
> -  return true;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_convert_to_eh_region_ranges =
> @@ -2655,11 +2644,22 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_convert_to_eh_region_ranges (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return convert_to_eh_region_ranges (); }
>
>  }; // class pass_convert_to_eh_region_ranges
>
> +bool
> +pass_convert_to_eh_region_ranges::gate (function *)
> +{
> +  /* Nothing to do for SJLJ exceptions or if no regions created.  */
> +  if (cfun->eh->region_tree == NULL)
> +    return false;
> +  if (targetm_common.except_unwind_info (&global_options) == UI_SJLJ)
> +    return false;
> +  return true;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/fwprop.c b/gcc/fwprop.c
> index 061d533..c6fa4ee 100644
> --- a/gcc/fwprop.c
> +++ b/gcc/fwprop.c
> @@ -1508,7 +1508,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_fwprop (); }
> +  virtual bool gate (function *) { return gate_fwprop (); }
>    unsigned int execute () { return fwprop (); }
>
>  }; // class pass_rtl_fwprop
> @@ -1573,7 +1573,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_fwprop (); }
> +  virtual bool gate (function *) { return gate_fwprop (); }
>    unsigned int execute () { return fwprop_addr (); }
>
>  }; // class pass_rtl_fwprop_addr
> diff --git a/gcc/gcse.c b/gcc/gcse.c
> index 6797b08..942ea64 100644
> --- a/gcc/gcse.c
> +++ b/gcc/gcse.c
> @@ -4157,24 +4157,6 @@ is_too_expensive (const char *pass)
>    return false;
>  }
>
> -/* All the passes implemented in this file.  Each pass has its
> -   own gate and execute function, and at the end of the file a
> -   pass definition for passes.c.
> -
> -   We do not construct an accurate cfg in functions which call
> -   setjmp, so none of these passes runs if the function calls
> -   setjmp.
> -   FIXME: Should just handle setjmp via REG_SETJMP notes.  */
> -
> -static bool
> -gate_rtl_pre (void)
> -{
> -  return optimize > 0 && flag_gcse
> -    && !cfun->calls_setjmp
> -    && optimize_function_for_speed_p (cfun)
> -    && dbg_cnt (pre);
> -}
> -
>  static unsigned int
>  execute_rtl_pre (void)
>  {
> @@ -4188,18 +4170,6 @@ execute_rtl_pre (void)
>    return 0;
>  }
>
> -static bool
> -gate_rtl_hoist (void)
> -{
> -  return optimize > 0 && flag_gcse
> -    && !cfun->calls_setjmp
> -    /* It does not make sense to run code hoisting unless we are optimizing
> -       for code size -- it rarely makes programs faster, and can make then
> -       bigger if we did PRE (when optimizing for space, we don't run PRE).  */
> -    && optimize_function_for_size_p (cfun)
> -    && dbg_cnt (hoist);
> -}
> -
>  static unsigned int
>  execute_rtl_hoist (void)
>  {
> @@ -4238,11 +4208,25 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_rtl_pre (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return execute_rtl_pre (); }
>
>  }; // class pass_rtl_pre
>
> +/* We do not construct an accurate cfg in functions which call
> +   setjmp, so none of these passes runs if the function calls
> +   setjmp.
> +   FIXME: Should just handle setjmp via REG_SETJMP notes.  */
> +
> +bool
> +pass_rtl_pre::gate (function *fun)
> +{
> +  return optimize > 0 && flag_gcse
> +    && !fun->calls_setjmp
> +    && optimize_function_for_speed_p (fun)
> +    && dbg_cnt (pre);
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -4276,11 +4260,23 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_rtl_hoist (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return execute_rtl_hoist (); }
>
>  }; // class pass_rtl_hoist
>
> +bool
> +pass_rtl_hoist::gate (function *)
> +{
> +  return optimize > 0 && flag_gcse
> +    && !cfun->calls_setjmp
> +    /* It does not make sense to run code hoisting unless we are optimizing
> +       for code size -- it rarely makes programs faster, and can make then
> +       bigger if we did PRE (when optimizing for space, we don't run PRE).  */
> +    && optimize_function_for_size_p (cfun)
> +    && dbg_cnt (hoist);
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
> index e0ce2ec..ab6185c 100644
> --- a/gcc/gimple-ssa-isolate-paths.c
> +++ b/gcc/gimple-ssa-isolate-paths.c
> @@ -414,15 +414,6 @@ gimple_ssa_isolate_erroneous_paths (void)
>    return 0;
>  }
>
> -static bool
> -gate_isolate_erroneous_paths (void)
> -{
> -  /* If we do not have a suitable builtin function for the trap statement,
> -     then do not perform the optimization.  */
> -  return (flag_isolate_erroneous_paths_dereference != 0
> -         || flag_isolate_erroneous_paths_attribute != 0);
> -}
> -
>  namespace {
>  const pass_data pass_data_isolate_erroneous_paths =
>  {
> @@ -447,7 +438,14 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_isolate_erroneous_paths (m_ctxt); }
> -  bool gate () { return gate_isolate_erroneous_paths (); }
> +  virtual bool gate (function *)
> +    {
> +      /* If we do not have a suitable builtin function for the trap statement,
> +        then do not perform the optimization.  */
> +      return (flag_isolate_erroneous_paths_dereference != 0
> +             || flag_isolate_erroneous_paths_attribute != 0);
> +    }
> +
>    unsigned int execute () { return gimple_ssa_isolate_erroneous_paths (); }
>
>  }; // class pass_isolate_erroneous_paths
> diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
> index 8d19031..a8596e0 100644
> --- a/gcc/gimple-ssa-strength-reduction.c
> +++ b/gcc/gimple-ssa-strength-reduction.c
> @@ -3646,12 +3646,6 @@ execute_strength_reduction (void)
>    return 0;
>  }
>
> -static bool
> -gate_strength_reduction (void)
> -{
> -  return flag_tree_slsr;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_strength_reduction =
> @@ -3676,7 +3670,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_strength_reduction (); }
> +  virtual bool gate (function *) { return flag_tree_slsr; }
>    unsigned int execute () { return execute_strength_reduction (); }
>
>  }; // class pass_strength_reduction
> diff --git a/gcc/graphite.c b/gcc/graphite.c
> index 03a7161..68c9390 100644
> --- a/gcc/graphite.c
> +++ b/gcc/graphite.c
> @@ -374,7 +374,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_graphite_transforms (); }
> +  virtual bool gate (function *) { return gate_graphite_transforms (); }
>
>  }; // class pass_graphite
>
> @@ -410,7 +410,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_graphite_transforms (); }
> +  virtual bool gate (function *) { return gate_graphite_transforms (); }
>    unsigned int execute () { return graphite_transforms (); }
>
>  }; // class pass_graphite_transforms
> diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
> index 5c0843d..657b585 100644
> --- a/gcc/ifcvt.c
> +++ b/gcc/ifcvt.c
> @@ -4512,13 +4512,6 @@ if_convert (bool after_combine)
>  #endif
>  }
>
> -static bool
> -gate_handle_if_conversion (void)
> -{
> -  return (optimize > 0)
> -    && dbg_cnt (if_conversion);
> -}
> -
>  /* If-conversion and CFG cleanup.  */
>  static unsigned int
>  rest_of_handle_if_conversion (void)
> @@ -4562,7 +4555,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_if_conversion (); }
> +  virtual bool gate (function *)
> +    {
> +      return (optimize > 0) && dbg_cnt (if_conversion);
> +    }
> +
>    unsigned int execute () { return rest_of_handle_if_conversion (); }
>
>  }; // class pass_rtl_ifcvt
> @@ -4575,13 +4572,6 @@ make_pass_rtl_ifcvt (gcc::context *ctxt)
>    return new pass_rtl_ifcvt (ctxt);
>  }
>
> -static bool
> -gate_handle_if_after_combine (void)
> -{
> -  return optimize > 0 && flag_if_conversion
> -    && dbg_cnt (if_after_combine);
> -}
> -
>
>  /* Rerun if-conversion, as combine may have simplified things enough
>     to now meet sequence length restrictions.  */
> @@ -4616,7 +4606,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_if_after_combine (); }
> +  virtual bool gate (function *)
> +    {
> +      return optimize > 0 && flag_if_conversion
> +       && dbg_cnt (if_after_combine);
> +    }
> +
>    unsigned int execute () { return rest_of_handle_if_after_combine (); }
>
>  }; // class pass_if_after_combine
> @@ -4630,13 +4625,6 @@ make_pass_if_after_combine (gcc::context *ctxt)
>  }
>
>
> -static bool
> -gate_handle_if_after_reload (void)
> -{
> -  return optimize > 0 && flag_if_conversion2
> -    && dbg_cnt (if_after_reload);
> -}
> -
>  static unsigned int
>  rest_of_handle_if_after_reload (void)
>  {
> @@ -4669,7 +4657,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_if_after_reload (); }
> +  virtual bool gate (function *)
> +    {
> +      return optimize > 0 && flag_if_conversion2
> +       && dbg_cnt (if_after_reload);
> +    }
> +
>    unsigned int execute () { return rest_of_handle_if_after_reload (); }
>
>  }; // class pass_if_after_reload
> diff --git a/gcc/init-regs.c b/gcc/init-regs.c
> index 265fed7..2025b77 100644
> --- a/gcc/init-regs.c
> +++ b/gcc/init-regs.c
> @@ -125,12 +125,6 @@ initialize_uninitialized_regs (void)
>    BITMAP_FREE (already_genned);
>  }
>
> -static bool
> -gate_initialize_regs (void)
> -{
> -  return optimize > 0;
> -}
> -
>  static unsigned int
>  rest_of_handle_initialize_regs (void)
>  {
> @@ -162,7 +156,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_initialize_regs (); }
> +  virtual bool gate (function *) { return optimize > 0; }
>    unsigned int execute () { return rest_of_handle_initialize_regs (); }
>
>  }; // class pass_initialize_regs
> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
> index 1f28b69..ee48fc0 100644
> --- a/gcc/ipa-cp.c
> +++ b/gcc/ipa-cp.c
> @@ -3762,16 +3762,6 @@ ipcp_read_summary (void)
>    ipa_prop_read_jump_functions ();
>  }
>
> -/* Gate for IPCP optimization.  */
> -
> -static bool
> -cgraph_gate_cp (void)
> -{
> -  /* FIXME: We should remove the optimize check after we ensure we never run
> -     IPA passes when not optimizing.  */
> -  return flag_ipa_cp && optimize;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ipa_cp =
> @@ -3807,7 +3797,13 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return cgraph_gate_cp (); }
> +  virtual bool gate (function *)
> +    {
> +      /* FIXME: We should remove the optimize check after we ensure we never run
> +        IPA passes when not optimizing.  */
> +      return flag_ipa_cp && optimize;
> +    }
> +
>    unsigned int execute () { return ipcp_driver (); }
>
>  }; // class pass_ipa_cp
> diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
> index 19369c6..3bc6815 100644
> --- a/gcc/ipa-devirt.c
> +++ b/gcc/ipa-devirt.c
> @@ -1911,16 +1911,6 @@ ipa_devirt (void)
>    return ndevirtualized ? TODO_remove_functions : 0;
>  }
>
> -/* Gate for speculative IPA devirtualization optimization.  */
> -
> -static bool
> -gate_ipa_devirt (void)
> -{
> -  return (flag_devirtualize
> -         && flag_devirtualize_speculatively
> -         && optimize);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ipa_devirt =
> @@ -1954,7 +1944,13 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_ipa_devirt (); }
> +  virtual bool gate (function *)
> +    {
> +      return (flag_devirtualize
> +             && flag_devirtualize_speculatively
> +             && optimize);
> +    }
> +
>    unsigned int execute () { return ipa_devirt (); }
>
>  }; // class pass_ipa_devirt
> diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
> index f2a72de..7b58716 100644
> --- a/gcc/ipa-profile.c
> +++ b/gcc/ipa-profile.c
> @@ -711,12 +711,6 @@ ipa_profile (void)
>    return 0;
>  }
>
> -static bool
> -gate_ipa_profile (void)
> -{
> -  return flag_ipa_profile;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ipa_profile =
> @@ -750,7 +744,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_ipa_profile (); }
> +  virtual bool gate (function *) { return flag_ipa_profile; }
>    unsigned int execute () { return ipa_profile (); }
>
>  }; // class pass_ipa_profile
> diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
> index eac3636..eab7633 100644
> --- a/gcc/ipa-pure-const.c
> +++ b/gcc/ipa-pure-const.c
> @@ -1541,7 +1541,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_pure_const (); }
> +  virtual bool gate (function *) { return gate_pure_const (); }
>    unsigned int execute () { return propagate (); }
>
>  }; // class pass_ipa_pure_const
> @@ -1716,7 +1716,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_local_pure_const (m_ctxt); }
> -  bool gate () { return gate_pure_const (); }
> +  virtual bool gate (function *) { return gate_pure_const (); }
>    unsigned int execute () { return local_pure_const (); }
>
>  }; // class pass_local_pure_const
> @@ -1740,12 +1740,6 @@ execute_warn_function_noreturn (void)
>    return 0;
>  }
>
> -static bool
> -gate_warn_function_noreturn (void)
> -{
> -  return warn_suggest_attribute_noreturn;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_warn_function_noreturn =
> @@ -1770,7 +1764,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_warn_function_noreturn (); }
> +  virtual bool gate (function *) { return warn_suggest_attribute_noreturn; }
>    unsigned int execute () { return execute_warn_function_noreturn (); }
>
>  }; // class pass_warn_function_noreturn
> diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
> index 126948e..51a57ac 100644
> --- a/gcc/ipa-reference.c
> +++ b/gcc/ipa-reference.c
> @@ -1148,14 +1148,6 @@ ipa_reference_read_optimization_summary (void)
>      }
>  }
>
> -static bool
> -gate_reference (void)
> -{
> -  return (flag_ipa_reference
> -         /* Don't bother doing anything if the program has errors.  */
> -         && !seen_error ());
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ipa_reference =
> @@ -1191,7 +1183,13 @@ public:
>      {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_reference (); }
> +  virtual bool gate (function *)
> +    {
> +      return (flag_ipa_reference
> +             /* Don't bother doing anything if the program has errors.  */
> +             && !seen_error ());
> +    }
> +
>    unsigned int execute () { return propagate (); }
>
>  }; // class pass_ipa_reference
> diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
> index ebb9197..187dc98 100644
> --- a/gcc/ipa-split.c
> +++ b/gcc/ipa-split.c
> @@ -1646,17 +1646,6 @@ execute_split_functions (void)
>    return todo;
>  }
>
> -/* Gate function splitting pass.  When doing profile feedback, we want
> -   to execute the pass after profiling is read.  So disable one in
> -   early optimization.  */
> -
> -static bool
> -gate_split_functions (void)
> -{
> -  return (flag_partial_inlining
> -         && !profile_arc_flag && !flag_branch_probabilities);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_split_functions =
> @@ -1681,11 +1670,20 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_split_functions (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return execute_split_functions (); }
>
>  }; // class pass_split_functions
>
> +bool
> +pass_split_functions::gate (function *)
> +{
> +  /* When doing profile feedback, we want to execute the pass after profiling
> +     is read.  So disable one in early optimization.  */
> +  return (flag_partial_inlining
> +         && !profile_arc_flag && !flag_branch_probabilities);
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -1694,17 +1692,6 @@ make_pass_split_functions (gcc::context *ctxt)
>    return new pass_split_functions (ctxt);
>  }
>
> -/* Gate feedback driven function splitting pass.
> -   We don't need to split when profiling at all, we are producing
> -   lousy code anyway.  */
> -
> -static bool
> -gate_feedback_split_functions (void)
> -{
> -  return (flag_partial_inlining
> -         && flag_branch_probabilities);
> -}
> -
>  /* Execute function splitting pass.  */
>
>  static unsigned int
> @@ -1740,11 +1727,20 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_feedback_split_functions (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return execute_feedback_split_functions (); }
>
>  }; // class pass_feedback_split_functions
>
> +bool
> +pass_feedback_split_functions::gate (function *)
> +{
> +  /* We don't need to split when profiling at all, we are producing
> +     lousy code anyway.  */
> +  return (flag_partial_inlining
> +         && flag_branch_probabilities);
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/ipa.c b/gcc/ipa.c
> index 5e06509..7af2584 100644
> --- a/gcc/ipa.c
> +++ b/gcc/ipa.c
> @@ -1272,14 +1272,6 @@ make_pass_ipa_free_inline_summary (gcc::context *ctxt)
>    return new pass_ipa_free_inline_summary (ctxt);
>  }
>
> -/* Do not re-run on ltrans stage.  */
> -
> -static bool
> -gate_whole_program_function_and_variable_visibility (void)
> -{
> -  return !flag_ltrans;
> -}
> -
>  /* Bring functionss local at LTO time with -fwhole-program.  */
>
>  static unsigned int
> @@ -1324,9 +1316,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () {
> -    return gate_whole_program_function_and_variable_visibility ();
> -  }
> +
> +  virtual bool gate (function *)
> +    {
> +      /* Do not re-run on ltrans stage.  */
> +      return !flag_ltrans;
> +    }
>    unsigned int execute () {
>      return whole_program_function_and_variable_visibility ();
>    }
> @@ -1613,16 +1608,6 @@ ipa_cdtor_merge (void)
>    return 0;
>  }
>
> -/* Perform the pass when we have no ctors/dtors support
> -   or at LTO time to merge multiple constructors into single
> -   function.  */
> -
> -static bool
> -gate_ipa_cdtor_merge (void)
> -{
> -  return !targetm.have_ctors_dtors || (optimize && in_lto_p);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ipa_cdtor_merge =
> @@ -1656,11 +1641,20 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_ipa_cdtor_merge (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return ipa_cdtor_merge (); }
>
>  }; // class pass_ipa_cdtor_merge
>
> +bool
> +pass_ipa_cdtor_merge::gate (function *)
> +{
> +  /* Perform the pass when we have no ctors/dtors support
> +     or at LTO time to merge multiple constructors into single
> +     function.  */
> +  return !targetm.have_ctors_dtors || (optimize && in_lto_p);
> +}
> +
>  } // anon namespace
>
>  ipa_opt_pass_d *
> diff --git a/gcc/loop-init.c b/gcc/loop-init.c
> index d0bd4ec..6da29d3 100644
> --- a/gcc/loop-init.c
> +++ b/gcc/loop-init.c
> @@ -287,31 +287,8 @@ fix_loop_structure (bitmap changed_bbs)
>    return number_of_loops (cfun) - old_nloops;
>  }
>
> -/* Gate for the RTL loop superpass.  The actual passes are subpasses.
> -   See passes.c for more on that.  */
> -
> -static bool
> -gate_handle_loop2 (void)
> -{
> -  if (optimize > 0
> -      && (flag_move_loop_invariants
> -         || flag_unswitch_loops
> -         || flag_peel_loops
> -         || flag_unroll_loops
> -#ifdef HAVE_doloop_end
> -         || (flag_branch_on_count_reg && HAVE_doloop_end)
> -#endif
> -        ))
> -    return true;
> -  else
> -    {
> -      /* No longer preserve loops, remove them now.  */
> -      cfun->curr_properties &= ~PROP_loops;
> -      if (current_loops)
> -       loop_optimizer_finalize ();
> -      return false;
> -    }
> -}
> +/* The RTL loop superpass.  The actual passes are subpasses.  See passes.c for
> +   more on that.  */
>
>  namespace {
>
> @@ -337,10 +314,33 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_loop2 (); }
> +  virtual bool gate (function *);
>
>  }; // class pass_loop2
>
> +bool
> +pass_loop2::gate (function *fun)
> +{
> +  if (optimize > 0
> +      && (flag_move_loop_invariants
> +         || flag_unswitch_loops
> +         || flag_peel_loops
> +         || flag_unroll_loops
> +#ifdef HAVE_doloop_end
> +         || (flag_branch_on_count_reg && HAVE_doloop_end)
> +#endif
> +      ))
> +    return true;
> +  else
> +    {
> +      /* No longer preserve loops, remove them now.  */
> +      fun->curr_properties &= ~PROP_loops;
> +      if (current_loops)
> +       loop_optimizer_finalize ();
> +      return false;
> +    }
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -461,12 +461,6 @@ make_pass_rtl_loop_done (gcc::context *ctxt)
>
>
>  /* Loop invariant code motion.  */
> -static bool
> -gate_rtl_move_loop_invariants (void)
> -{
> -  return flag_move_loop_invariants;
> -}
> -
>  static unsigned int
>  rtl_move_loop_invariants (void)
>  {
> @@ -500,7 +494,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_rtl_move_loop_invariants (); }
> +  virtual bool gate (function *) { return flag_move_loop_invariants; }
>    unsigned int execute () { return rtl_move_loop_invariants (); }
>
>  }; // class pass_rtl_move_loop_invariants
> @@ -514,13 +508,6 @@ make_pass_rtl_move_loop_invariants (gcc::context *ctxt)
>  }
>
>
> -/* Loop unswitching for RTL.  */
> -static bool
> -gate_rtl_unswitch (void)
> -{
> -  return flag_unswitch_loops;
> -}
> -
>  static unsigned int
>  rtl_unswitch (void)
>  {
> @@ -553,7 +540,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_rtl_unswitch (); }
> +  virtual bool gate (function *) { return flag_unswitch_loops; }
>    unsigned int execute () { return rtl_unswitch (); }
>
>  }; // class pass_rtl_unswitch
> @@ -567,13 +554,6 @@ make_pass_rtl_unswitch (gcc::context *ctxt)
>  }
>
>
> -/* Loop unswitching for RTL.  */
> -static bool
> -gate_rtl_unroll_and_peel_loops (void)
> -{
> -  return (flag_peel_loops || flag_unroll_loops || flag_unroll_all_loops);
> -}
> -
>  static unsigned int
>  rtl_unroll_and_peel_loops (void)
>  {
> @@ -619,7 +599,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_rtl_unroll_and_peel_loops (); }
> +  virtual bool gate (function *)
> +    {
> +      return (flag_peel_loops || flag_unroll_loops || flag_unroll_all_loops);
> +    }
> +
>    unsigned int execute () { return rtl_unroll_and_peel_loops (); }
>
>  }; // class pass_rtl_unroll_and_peel_loops
> @@ -633,17 +617,6 @@ make_pass_rtl_unroll_and_peel_loops (gcc::context *ctxt)
>  }
>
>
> -/* The doloop optimization.  */
> -static bool
> -gate_rtl_doloop (void)
> -{
> -#ifdef HAVE_doloop_end
> -  return (flag_branch_on_count_reg && HAVE_doloop_end);
> -#else
> -  return 0;
> -#endif
> -}
> -
>  static unsigned int
>  rtl_doloop (void)
>  {
> @@ -678,11 +651,21 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_rtl_doloop (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return rtl_doloop (); }
>
>  }; // class pass_rtl_doloop
>
> +bool
> +pass_rtl_doloop::gate (function *)
> +{
> +#ifdef HAVE_doloop_end
> +  return (flag_branch_on_count_reg && HAVE_doloop_end);
> +#else
> +  return false;
> +#endif
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
> index 53ef1d9..89d9763 100644
> --- a/gcc/lower-subreg.c
> +++ b/gcc/lower-subreg.c
> @@ -1687,14 +1687,6 @@ decompose_multiword_subregs (bool decompose_copies)
>    BITMAP_FREE (subreg_context);
>  }
>
> -/* Gate function for lower subreg pass.  */
> -
> -static bool
> -gate_handle_lower_subreg (void)
> -{
> -  return flag_split_wide_types != 0;
> -}
> -
>  /* Implement first lower subreg pass.  */
>
>  static unsigned int
> @@ -1737,7 +1729,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_lower_subreg (); }
> +  virtual bool gate (function *) { return flag_split_wide_types != 0; }
>    unsigned int execute () { return rest_of_handle_lower_subreg (); }
>
>  }; // class pass_lower_subreg
> @@ -1775,7 +1767,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_lower_subreg (); }
> +  virtual bool gate (function *) { return flag_split_wide_types != 0; }
>    unsigned int execute () { return rest_of_handle_lower_subreg2 (); }
>
>  }; // class pass_lower_subreg2
> diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
> index d73135a..e73d6ee 100644
> --- a/gcc/mode-switching.c
> +++ b/gcc/mode-switching.c
> @@ -789,16 +789,6 @@ optimize_mode_switching (void)
>
>  #endif /* OPTIMIZE_MODE_SWITCHING */
>
> -static bool
> -gate_mode_switching (void)
> -{
> -#ifdef OPTIMIZE_MODE_SWITCHING
> -  return true;
> -#else
> -  return false;
> -#endif
> -}
> -
>  static unsigned int
>  rest_of_handle_mode_switching (void)
>  {
> @@ -836,7 +826,15 @@ public:
>    /* The epiphany backend creates a second instance of this pass, so we need
>       a clone method.  */
>    opt_pass * clone () { return new pass_mode_switching (m_ctxt); }
> -  bool gate () { return gate_mode_switching (); }
> +  virtual bool gate (function *)
> +    {
> +#ifdef OPTIMIZE_MODE_SWITCHING
> +      return true;
> +#else
> +      return false;
> +#endif
> +    }
> +
>    unsigned int execute () { return rest_of_handle_mode_switching (); }
>
>  }; // class pass_mode_switching
> diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
> index a097df3..20e2e62 100644
> --- a/gcc/modulo-sched.c
> +++ b/gcc/modulo-sched.c
> @@ -3323,13 +3323,6 @@ rotate_partial_schedule (partial_schedule_ptr ps, int start_cycle)
>
>  #endif /* INSN_SCHEDULING */
>
> -static bool
> -gate_handle_sms (void)
> -{
> -  return (optimize > 0 && flag_modulo_sched);
> -}
> -
> -
>  /* Run instruction scheduler.  */
>  /* Perform SMS module scheduling.  */
>  static unsigned int
> @@ -3380,7 +3373,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_sms (); }
> +  virtual bool gate (function *)
> +{
> +  return (optimize > 0 && flag_modulo_sched);
> +}
> +
>    unsigned int execute () { return rest_of_handle_sms (); }
>
>  }; // class pass_sms
> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> index cadec81..0e96b88 100644
> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -8326,13 +8326,6 @@ execute_expand_omp (void)
>
>  /* OMP expansion -- the default pass, run before creation of SSA form.  */
>
> -static bool
> -gate_expand_omp (void)
> -{
> -  return ((flag_openmp != 0 || flag_openmp_simd != 0
> -          || flag_cilkplus != 0) && !seen_error ());
> -}
> -
>  namespace {
>
>  const pass_data pass_data_expand_omp =
> @@ -8357,7 +8350,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_expand_omp (); }
> +  virtual bool gate (function *)
> +    {
> +      return ((flag_openmp != 0 || flag_openmp_simd != 0
> +              || flag_cilkplus != 0) && !seen_error ());
> +    }
> +
>    unsigned int execute () { return execute_expand_omp (); }
>
>  }; // class pass_expand_omp
> @@ -10617,12 +10615,6 @@ diagnose_omp_structured_block_errors (void)
>    return 0;
>  }
>
> -static bool
> -gate_diagnose_omp_blocks (void)
> -{
> -  return flag_openmp || flag_cilkplus;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_diagnose_omp_blocks =
> @@ -10647,7 +10639,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_diagnose_omp_blocks (); }
> +  virtual bool gate (function *) { return flag_openmp || flag_cilkplus; }
>    unsigned int execute () {
>      return diagnose_omp_structured_block_errors ();
>    }
> @@ -11811,13 +11803,19 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return ((flag_openmp || flag_openmp_simd
> -                         || flag_cilkplus || (in_lto_p && !flag_wpa))
> -                        && (targetm.simd_clone.compute_vecsize_and_simdlen
> -                            != NULL)); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return ipa_omp_simd_clone (); }
>  };
>
> +bool
> +pass_omp_simd_clone::gate (function *)
> +{
> +  return ((flag_openmp || flag_openmp_simd
> +          || flag_cilkplus
> +          || (in_lto_p && !flag_wpa))
> +         && (targetm.simd_clone.compute_vecsize_and_simdlen != NULL));
> +}
> +
>  } // anon namespace
>
>  simple_ipa_opt_pass *
> diff --git a/gcc/passes.c b/gcc/passes.c
> index 5d5a94c..b71c11e 100644
> --- a/gcc/passes.c
> +++ b/gcc/passes.c
> @@ -108,7 +108,7 @@ opt_pass::clone ()
>  }
>
>  bool
> -opt_pass::gate ()
> +opt_pass::gate (function *)
>  {
>    return true;
>  }
> @@ -337,15 +337,6 @@ execute_all_early_local_passes (void)
>    return 0;
>  }
>
> -/* Gate: execute, or not, all of the non-trivial optimizations.  */
> -
> -static bool
> -gate_all_early_local_passes (void)
> -{
> -         /* Don't bother doing anything if the program has errors.  */
> -  return (!seen_error () && !in_lto_p);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_early_local_passes =
> @@ -370,7 +361,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_all_early_local_passes (); }
> +  virtual bool gate (function *)
> +    {
> +      /* Don't bother doing anything if the program has errors.  */
> +      return (!seen_error () && !in_lto_p);
> +    }
> +
>    unsigned int execute () { return execute_all_early_local_passes (); }
>
>  }; // class pass_early_local_passes
> @@ -383,16 +379,6 @@ make_pass_early_local_passes (gcc::context *ctxt)
>    return new pass_early_local_passes (ctxt);
>  }
>
> -/* Gate: execute, or not, all of the non-trivial optimizations.  */
> -
> -static bool
> -gate_all_early_optimizations (void)
> -{
> -  return (optimize >= 1
> -         /* Don't bother doing anything if the program has errors.  */
> -         && !seen_error ());
> -}
> -
>  namespace {
>
>  const pass_data pass_data_all_early_optimizations =
> @@ -417,7 +403,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_all_early_optimizations (); }
> +  virtual bool gate (function *)
> +    {
> +      return (optimize >= 1
> +             /* Don't bother doing anything if the program has errors.  */
> +             && !seen_error ());
> +    }
>
>  }; // class pass_all_early_optimizations
>
> @@ -429,14 +420,6 @@ make_pass_all_early_optimizations (gcc::context *ctxt)
>    return new pass_all_early_optimizations (ctxt);
>  }
>
> -/* Gate: execute, or not, all of the non-trivial optimizations.  */
> -
> -static bool
> -gate_all_optimizations (void)
> -{
> -  return optimize >= 1 && !optimize_debug;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_all_optimizations =
> @@ -461,7 +444,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_all_optimizations (); }
> +  virtual bool gate (function *) { return optimize >= 1 && !optimize_debug; }
>
>  }; // class pass_all_optimizations
>
> @@ -473,14 +456,6 @@ make_pass_all_optimizations (gcc::context *ctxt)
>    return new pass_all_optimizations (ctxt);
>  }
>
> -/* Gate: execute, or not, all of the non-trivial optimizations.  */
> -
> -static bool
> -gate_all_optimizations_g (void)
> -{
> -  return optimize >= 1 && optimize_debug;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_all_optimizations_g =
> @@ -505,7 +480,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_all_optimizations_g (); }
> +  virtual bool gate (function *) { return optimize >= 1 && optimize_debug; }
>
>  }; // class pass_all_optimizations_g
>
> @@ -517,14 +492,6 @@ make_pass_all_optimizations_g (gcc::context *ctxt)
>    return new pass_all_optimizations_g (ctxt);
>  }
>
> -static bool
> -gate_rest_of_compilation (void)
> -{
> -  /* Early return if there were errors.  We can run afoul of our
> -     consistency checks, and there's not really much point in fixing them.  */
> -  return !(rtl_dump_and_exit || flag_syntax_only || seen_error ());
> -}
> -
>  namespace {
>
>  const pass_data pass_data_rest_of_compilation =
> @@ -549,7 +516,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_rest_of_compilation (); }
> +  virtual bool gate (function *)
> +    {
> +      /* Early return if there were errors.  We can run afoul of our
> +        consistency checks, and there's not really much point in fixing them.  */
> +      return !(rtl_dump_and_exit || flag_syntax_only || seen_error ());
> +    }
>
>  }; // class pass_rest_of_compilation
>
> @@ -561,12 +533,6 @@ make_pass_rest_of_compilation (gcc::context *ctxt)
>    return new pass_rest_of_compilation (ctxt);
>  }
>
> -static bool
> -gate_postreload (void)
> -{
> -  return reload_completed;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_postreload =
> @@ -591,7 +557,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_postreload (); }
> +  virtual bool gate (function *) { return reload_completed; }
>
>  }; // class pass_postreload
>
> @@ -823,7 +789,7 @@ dump_one_pass (opt_pass *pass, int pass_indent)
>    const char *pn;
>    bool is_on, is_really_on;
>
> -  is_on = pass->gate ();
> +  is_on = pass->gate (cfun);
>    is_really_on = override_gate_status (pass, current_function_decl, is_on);
>
>    if (pass->static_pass_number <= 0)
> @@ -1976,7 +1942,7 @@ execute_ipa_summary_passes (ipa_opt_pass_d *ipa_pass)
>
>        /* Execute all of the IPA_PASSes in the list.  */
>        if (ipa_pass->type == IPA_PASS
> -         && pass->gate ()
> +         && pass->gate (cfun)
>           && ipa_pass->generate_summary)
>         {
>           pass_init_dump_file (pass);
> @@ -2128,7 +2094,7 @@ execute_one_pass (opt_pass *pass)
>
>    /* Check whether gate check should be avoided.
>       User controls the value of the gate through the parameter "gate_status". */
> -  gate_status = pass->gate ();
> +  gate_status = pass->gate (cfun);
>    gate_status = override_gate_status (pass, current_function_decl, gate_status);
>
>    /* Override gate with plugin.  */
> @@ -2274,7 +2240,7 @@ ipa_write_summaries_2 (opt_pass *pass, struct lto_out_decl_state *state)
>        gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
>        if (pass->type == IPA_PASS
>           && ipa_pass->write_summary
> -         && pass->gate ())
> +         && pass->gate (cfun))
>         {
>           /* If a timevar is present, start it.  */
>           if (pass->tv_id)
> @@ -2392,7 +2358,7 @@ ipa_write_optimization_summaries_1 (opt_pass *pass,
>        gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
>        if (pass->type == IPA_PASS
>           && ipa_pass->write_optimization_summary
> -         && pass->gate ())
> +         && pass->gate (cfun))
>         {
>           /* If a timevar is present, start it.  */
>           if (pass->tv_id)
> @@ -2470,7 +2436,7 @@ ipa_read_summaries_1 (opt_pass *pass)
>        gcc_assert (!cfun);
>        gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
>
> -      if (pass->gate ())
> +      if (pass->gate (cfun))
>         {
>           if (pass->type == IPA_PASS && ipa_pass->read_summary)
>             {
> @@ -2520,7 +2486,7 @@ ipa_read_optimization_summaries_1 (opt_pass *pass)
>        gcc_assert (!cfun);
>        gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
>
> -      if (pass->gate ())
> +      if (pass->gate (cfun))
>         {
>           if (pass->type == IPA_PASS && ipa_pass->read_optimization_summary)
>             {
> @@ -2597,7 +2563,7 @@ execute_ipa_stmt_fixups (opt_pass *pass,
>      {
>        /* Execute all of the IPA_PASSes in the list.  */
>        if (pass->type == IPA_PASS
> -         && pass->gate ())
> +         && pass->gate (cfun))
>         {
>           ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass;
>
> diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
> index 264bd9a..8a804fb 100644
> --- a/gcc/postreload-gcse.c
> +++ b/gcc/postreload-gcse.c
> @@ -1308,13 +1308,6 @@ gcse_after_reload_main (rtx f ATTRIBUTE_UNUSED)
>  }
>
>
> -static bool
> -gate_handle_gcse2 (void)
> -{
> -  return (optimize > 0 && flag_gcse_after_reload
> -         && optimize_function_for_speed_p (cfun));
> -}
> -
>
>  static unsigned int
>  rest_of_handle_gcse2 (void)
> @@ -1348,7 +1341,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_gcse2 (); }
> +  virtual bool gate (function *fun)
> +    {
> +      return (optimize > 0 && flag_gcse_after_reload
> +             && optimize_function_for_speed_p (fun));
> +    }
> +
>    unsigned int execute () { return rest_of_handle_gcse2 (); }
>
>  }; // class pass_gcse2
> diff --git a/gcc/postreload.c b/gcc/postreload.c
> index 0870183..0568c53 100644
> --- a/gcc/postreload.c
> +++ b/gcc/postreload.c
> @@ -2315,13 +2315,6 @@ move2add_note_store (rtx dst, const_rtx set, void *data)
>      }
>  }
>
> -static bool
> -gate_handle_postreload (void)
> -{
> -  return (optimize > 0 && reload_completed);
> -}
> -
> -
>  static unsigned int
>  rest_of_handle_postreload (void)
>  {
> @@ -2363,7 +2356,8 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_postreload (); }
> +  virtual bool gate (function *) { return (optimize > 0 && reload_completed); }
> +
>    unsigned int execute () { return rest_of_handle_postreload (); }
>
>  }; // class pass_postreload_cse
> diff --git a/gcc/predict.c b/gcc/predict.c
> index dccde72..068c187 100644
> --- a/gcc/predict.c
> +++ b/gcc/predict.c
> @@ -3131,12 +3131,6 @@ compute_function_frequency (void)
>      }
>  }
>
> -static bool
> -gate_estimate_probability (void)
> -{
> -  return flag_guess_branch_prob;
> -}
> -
>  /* Build PREDICT_EXPR.  */
>  tree
>  build_predict_expr (enum br_predictor predictor, enum prediction taken)
> @@ -3177,7 +3171,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_estimate_probability (); }
> +  virtual bool gate (function *) { return flag_guess_branch_prob; }
>    unsigned int execute () { return tree_estimate_probability_driver (); }
>
>  }; // class pass_profile
> diff --git a/gcc/recog.c b/gcc/recog.c
> index b7113aa..8afea7e 100644
> --- a/gcc/recog.c
> +++ b/gcc/recog.c
> @@ -3810,12 +3810,6 @@ if_test_bypass_p (rtx out_insn, rtx in_insn)
>    return true;
>  }
>
> -static bool
> -gate_handle_peephole2 (void)
> -{
> -  return (optimize > 0 && flag_peephole2);
> -}
> -
>  static unsigned int
>  rest_of_handle_peephole2 (void)
>  {
> @@ -3852,7 +3846,7 @@ public:
>    /* The epiphany backend creates a second instance of this pass, so we need
>       a clone method.  */
>    opt_pass * clone () { return new pass_peephole2 (m_ctxt); }
> -  bool gate () { return gate_handle_peephole2 (); }
> +  virtual bool gate (function *) { return (optimize > 0 && flag_peephole2); }
>    unsigned int execute () { return rest_of_handle_peephole2 (); }
>
>  }; // class pass_peephole2
> @@ -3958,24 +3952,6 @@ make_pass_split_after_reload (gcc::context *ctxt)
>    return new pass_split_after_reload (ctxt);
>  }
>
> -static bool
> -gate_handle_split_before_regstack (void)
> -{
> -#if HAVE_ATTR_length && defined (STACK_REGS)
> -  /* If flow2 creates new instructions which need splitting
> -     and scheduling after reload is not done, they might not be
> -     split until final which doesn't allow splitting
> -     if HAVE_ATTR_length.  */
> -# ifdef INSN_SCHEDULING
> -  return (optimize && !flag_schedule_insns_after_reload);
> -# else
> -  return (optimize);
> -# endif
> -#else
> -  return 0;
> -#endif
> -}
> -
>  static unsigned int
>  rest_of_handle_split_before_regstack (void)
>  {
> @@ -4007,13 +3983,31 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_split_before_regstack (); }
> +  virtual bool gate (function *);
>    unsigned int execute () {
>      return rest_of_handle_split_before_regstack ();
>    }
>
>  }; // class pass_split_before_regstack
>
> +bool
> +pass_split_before_regstack::gate (function *)
> +{
> +#if HAVE_ATTR_length && defined (STACK_REGS)
> +  /* If flow2 creates new instructions which need splitting
> +     and scheduling after reload is not done, they might not be
> +     split until final which doesn't allow splitting
> +     if HAVE_ATTR_length.  */
> +# ifdef INSN_SCHEDULING
> +  return (optimize && !flag_schedule_insns_after_reload);
> +# else
> +  return (optimize);
> +# endif
> +#else
> +  return 0;
> +#endif
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -4022,16 +4016,6 @@ make_pass_split_before_regstack (gcc::context *ctxt)
>    return new pass_split_before_regstack (ctxt);
>  }
>
> -static bool
> -gate_handle_split_before_sched2 (void)
> -{
> -#ifdef INSN_SCHEDULING
> -  return optimize > 0 && flag_schedule_insns_after_reload;
> -#else
> -  return 0;
> -#endif
> -}
> -
>  static unsigned int
>  rest_of_handle_split_before_sched2 (void)
>  {
> @@ -4065,7 +4049,15 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_split_before_sched2 (); }
> +  virtual bool gate (function *)
> +    {
> +#ifdef INSN_SCHEDULING
> +      return optimize > 0 && flag_schedule_insns_after_reload;
> +#else
> +      return false;
> +#endif
> +    }
> +
>    unsigned int execute () { return rest_of_handle_split_before_sched2 (); }
>
>  }; // class pass_split_before_sched2
> @@ -4078,18 +4070,6 @@ make_pass_split_before_sched2 (gcc::context *ctxt)
>    return new pass_split_before_sched2 (ctxt);
>  }
>
> -/* The placement of the splitting that we do for shorten_branches
> -   depends on whether regstack is used by the target or not.  */
> -static bool
> -gate_do_final_split (void)
> -{
> -#if HAVE_ATTR_length && !defined (STACK_REGS)
> -  return 1;
> -#else
> -  return 0;
> -#endif
> -}
> -
>  namespace {
>
>  const pass_data pass_data_split_for_shorten_branches =
> @@ -4114,7 +4094,17 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_do_final_split (); }
> +  virtual bool gate (function *)
> +    {
> +      /* The placement of the splitting that we do for shorten_branches
> +        depends on whether regstack is used by the target or not.  */
> +#if HAVE_ATTR_length && !defined (STACK_REGS)
> +      return true;
> +#else
> +      return false;
> +#endif
> +    }
> +
>    unsigned int execute () { return split_all_insns_noflow (); }
>
>  }; // class pass_split_for_shorten_branches
> diff --git a/gcc/ree.c b/gcc/ree.c
> index 09dfa61..435bb88 100644
> --- a/gcc/ree.c
> +++ b/gcc/ree.c
> @@ -1093,14 +1093,6 @@ rest_of_handle_ree (void)
>    return 0;
>  }
>
> -/* Run REE pass when flag_ree is set at optimization level > 0.  */
> -
> -static bool
> -gate_handle_ree (void)
> -{
> -  return (optimize > 0 && flag_ree);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ree =
> @@ -1125,7 +1117,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_ree (); }
> +  virtual bool gate (function *) { return (optimize > 0 && flag_ree); }
>    unsigned int execute () { return rest_of_handle_ree (); }
>
>  }; // class pass_ree
> diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
> index 02e3e09..f8f8658 100644
> --- a/gcc/reg-stack.c
> +++ b/gcc/reg-stack.c
> @@ -3285,16 +3285,6 @@ reg_to_stack (void)
>  }
>  #endif /* STACK_REGS */
>
> -static bool
> -gate_handle_stack_regs (void)
> -{
> -#ifdef STACK_REGS
> -  return 1;
> -#else
> -  return 0;
> -#endif
> -}
> -
>  namespace {
>
>  const pass_data pass_data_stack_regs =
> @@ -3319,7 +3309,14 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_stack_regs (); }
> +  virtual bool gate (function *)
> +    {
> +#ifdef STACK_REGS
> +      return true;
> +#else
> +      return false;
> +#endif
> +    }
>
>  }; // class pass_stack_regs
>
> diff --git a/gcc/regcprop.c b/gcc/regcprop.c
> index a7dbbc3..24992e4 100644
> --- a/gcc/regcprop.c
> +++ b/gcc/regcprop.c
> @@ -1247,13 +1247,6 @@ validate_value_data (struct value_data *vd)
>  }
>  #endif
>
> -static bool
> -gate_handle_cprop (void)
> -{
> -  return (optimize > 0 && (flag_cprop_registers));
> -}
> -
> -
>  namespace {
>
>  const pass_data pass_data_cprop_hardreg =
> @@ -1278,7 +1271,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_cprop (); }
> +  virtual bool gate (function *)
> +    {
> +      return (optimize > 0 && (flag_cprop_registers));
> +    }
> +
>    unsigned int execute () { return copyprop_hardreg_forward (); }
>
>  }; // class pass_cprop_hardreg
> diff --git a/gcc/regrename.c b/gcc/regrename.c
> index 30f7abc..321d5bf 100644
> --- a/gcc/regrename.c
> +++ b/gcc/regrename.c
> @@ -1836,12 +1836,6 @@ regrename_optimize (void)
>    return 0;
>  }
>
> -static bool
> -gate_handle_regrename (void)
> -{
> -  return (optimize > 0 && (flag_rename_registers));
> -}
> -
>  namespace {
>
>  const pass_data pass_data_regrename =
> @@ -1866,7 +1860,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_regrename (); }
> +  virtual bool gate (function *)
> +    {
> +      return (optimize > 0 && (flag_rename_registers));
> +    }
> +
>    unsigned int execute () { return regrename_optimize (); }
>
>  }; // class pass_regrename
> diff --git a/gcc/reorg.c b/gcc/reorg.c
> index fff342f..22f0b5a 100644
> --- a/gcc/reorg.c
> +++ b/gcc/reorg.c
> @@ -3863,17 +3863,6 @@ dbr_schedule (rtx first)
>  }
>  #endif /* DELAY_SLOTS */
>
> -static bool
> -gate_handle_delay_slots (void)
> -{
> -#ifdef DELAY_SLOTS
> -  /* At -O0 dataflow info isn't updated after RA.  */
> -  return optimize > 0 && flag_delayed_branch && !crtl->dbr_scheduled_p;
> -#else
> -  return 0;
> -#endif
> -}
> -
>  /* Run delay slot optimization.  */
>  static unsigned int
>  rest_of_handle_delay_slots (void)
> @@ -3908,11 +3897,22 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_delay_slots (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return rest_of_handle_delay_slots (); }
>
>  }; // class pass_delay_slots
>
> +bool
> +pass_delay_slots::gate (function *)
> +{
> +#ifdef DELAY_SLOTS
> +  /* At -O0 dataflow info isn't updated after RA.  */
> +  return optimize > 0 && flag_delayed_branch && !crtl->dbr_scheduled_p;
> +#else
> +  return 0;
> +#endif
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -3922,12 +3922,6 @@ make_pass_delay_slots (gcc::context *ctxt)
>  }
>
>  /* Machine dependent reorg pass.  */
> -static bool
> -gate_handle_machine_reorg (void)
> -{
> -  return targetm.machine_dependent_reorg != 0;
> -}
> -
>
>  static unsigned int
>  rest_of_handle_machine_reorg (void)
> @@ -3960,7 +3954,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_machine_reorg (); }
> +  virtual bool gate (function *)
> +    {
> +      return targetm.machine_dependent_reorg != 0;
> +    }
> +
>    unsigned int execute () { return rest_of_handle_machine_reorg (); }
>
>  }; // class pass_machine_reorg
> diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
> index 18b50a4..e0a80c2 100644
> --- a/gcc/sched-rgn.c
> +++ b/gcc/sched-rgn.c
> @@ -3591,16 +3591,6 @@ advance_target_bb (basic_block bb, rtx insn)
>
>  #endif
>
> -static bool
> -gate_handle_live_range_shrinkage (void)
> -{
> -#ifdef INSN_SCHEDULING
> -  return flag_live_range_shrinkage;
> -#else
> -  return 0;
> -#endif
> -}
> -
>  /* Run instruction scheduler.  */
>  static unsigned int
>  rest_of_handle_live_range_shrinkage (void)
> @@ -3618,16 +3608,6 @@ rest_of_handle_live_range_shrinkage (void)
>    return 0;
>  }
>
> -static bool
> -gate_handle_sched (void)
> -{
> -#ifdef INSN_SCHEDULING
> -  return optimize > 0 && flag_schedule_insns && dbg_cnt (sched_func);
> -#else
> -  return 0;
> -#endif
> -}
> -
>  /* Run instruction scheduler.  */
>  static unsigned int
>  rest_of_handle_sched (void)
> @@ -3642,17 +3622,6 @@ rest_of_handle_sched (void)
>    return 0;
>  }
>
> -static bool
> -gate_handle_sched2 (void)
> -{
> -#ifdef INSN_SCHEDULING
> -  return optimize > 0 && flag_schedule_insns_after_reload
> -    && !targetm.delay_sched2 && dbg_cnt (sched2_func);
> -#else
> -  return 0;
> -#endif
> -}
> -
>  /* Run second scheduling pass after reload.  */
>  static unsigned int
>  rest_of_handle_sched2 (void)
> @@ -3699,7 +3668,15 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_live_range_shrinkage (); }
> +  virtual bool gate (function *)
> +    {
> +#ifdef INSN_SCHEDULING
> +      return flag_live_range_shrinkage;
> +#else
> +      return 0;
> +#endif
> +    }
> +
>    unsigned int execute () { return rest_of_handle_live_range_shrinkage (); }
>
>  }; // class pass_live_range_shrinkage
> @@ -3737,11 +3714,21 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_sched (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return rest_of_handle_sched (); }
>
>  }; // class pass_sched
>
> +bool
> +pass_sched::gate (function *)
> +{
> +#ifdef INSN_SCHEDULING
> +  return optimize > 0 && flag_schedule_insns && dbg_cnt (sched_func);
> +#else
> +  return 0;
> +#endif
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -3775,11 +3762,22 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_sched2 (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return rest_of_handle_sched2 (); }
>
>  }; // class pass_sched2
>
> +bool
> +pass_sched2::gate (function *)
> +{
> +#ifdef INSN_SCHEDULING
> +  return optimize > 0 && flag_schedule_insns_after_reload
> +    && !targetm.delay_sched2 && dbg_cnt (sched2_func);
> +#else
> +  return 0;
> +#endif
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/store-motion.c b/gcc/store-motion.c
> index 5aacaad..7c57754 100644
> --- a/gcc/store-motion.c
> +++ b/gcc/store-motion.c
> @@ -1223,15 +1223,6 @@ one_store_motion_pass (void)
>  }
>
>
> -static bool
> -gate_rtl_store_motion (void)
> -{
> -  return optimize > 0 && flag_gcse_sm
> -    && !cfun->calls_setjmp
> -    && optimize_function_for_speed_p (cfun)
> -    && dbg_cnt (store_motion);
> -}
> -
>  static unsigned int
>  execute_rtl_store_motion (void)
>  {
> @@ -1266,11 +1257,20 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_rtl_store_motion (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return execute_rtl_store_motion (); }
>
>  }; // class pass_rtl_store_motion
>
> +bool
> +pass_rtl_store_motion::gate (function *fun)
> +{
> +  return optimize > 0 && flag_gcse_sm
> +    && !fun->calls_setjmp
> +    && optimize_function_for_speed_p (fun)
> +    && dbg_cnt (store_motion);
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
> index d73bea8..a3b04a2 100644
> --- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
> +++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
> @@ -52,12 +52,6 @@ execute_dumb_plugin_example (void)
>    return 0;
>  }
>
> -static bool
> -gate_dumb_plugin_example (void)
> -{
> -  return true;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_dumb_plugin_example =
> @@ -82,7 +76,6 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_dumb_plugin_example (); }
>    unsigned int execute () { return execute_dumb_plugin_example (); }
>
>  }; // class pass_dumb_plugin_example
> diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
> index 8df8579..033047b 100644
> --- a/gcc/testsuite/g++.dg/plugin/selfassign.c
> +++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
> @@ -270,14 +270,6 @@ execute_warn_self_assign (void)
>    return 0;
>  }
>
> -/* Pass gate function. Currently always returns true.  */
> -
> -static bool
> -gate_warn_self_assign (void)
> -{
> -  return true;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_warn_self_assign =
> @@ -302,7 +294,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_warn_self_assign (); }
> +  bool gate (function *) { return true; }
>    unsigned int execute () { return execute_warn_self_assign (); }
>
>  }; // class pass_warn_self_assign
> diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
> index 33106ad..18e8b07 100644
> --- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
> +++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
> @@ -49,7 +49,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate ();
> +  virtual bool gate (function *);
>    unsigned int execute ();
>
>  private:
> @@ -58,7 +58,7 @@ private:
>
>  } // anon namespace
>
> -bool one_pass::gate (void)
> +bool one_pass::gate (function *)
>  {
>    return true;
>  }
> diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
> index 8df8579..098df06 100644
> --- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
> +++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
> @@ -270,14 +270,6 @@ execute_warn_self_assign (void)
>    return 0;
>  }
>
> -/* Pass gate function. Currently always returns true.  */
> -
> -static bool
> -gate_warn_self_assign (void)
> -{
> -  return true;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_warn_self_assign =
> @@ -302,7 +294,6 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_warn_self_assign (); }
>    unsigned int execute () { return execute_warn_self_assign (); }
>
>  }; // class pass_warn_self_assign
> diff --git a/gcc/tracer.c b/gcc/tracer.c
> index 73e3209..794d385 100644
> --- a/gcc/tracer.c
> +++ b/gcc/tracer.c
> @@ -398,12 +398,6 @@ tracer (void)
>    return changed ? TODO_cleanup_cfg : 0;
>  }
>
> -static bool
> -gate_tracer (void)
> -{
> -  return (optimize > 0 && flag_tracer && flag_reorder_blocks);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_tracer =
> @@ -428,7 +422,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tracer (); }
> +  virtual bool gate (function *)
> +    {
> +      return (optimize > 0 && flag_tracer && flag_reorder_blocks);
> +    }
> +
>    unsigned int execute () { return tracer (); }
>
>  }; // class pass_tracer
> diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
> index a259b77..be876f5 100644
> --- a/gcc/trans-mem.c
> +++ b/gcc/trans-mem.c
> @@ -456,14 +456,6 @@ build_tm_abort_call (location_t loc, bool is_outer)
>                                              AR_USERABORT
>                                              | (is_outer ? AR_OUTERABORT : 0)));
>  }
> -
> -/* Common gateing function for several of the TM passes.  */
> -
> -static bool
> -gate_tm (void)
> -{
> -  return flag_tm;
> -}
>
>  /* Map for aribtrary function replacement under TM, as created
>     by the tm_wrap attribute.  */
> @@ -863,7 +855,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tm (); }
> +  virtual bool gate (function *) { return flag_tm; }
>    unsigned int execute () { return diagnose_tm_blocks (); }
>
>  }; // class pass_diagnose_tm_blocks
> @@ -1785,7 +1777,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tm (); }
> +  virtual bool gate (function *) { return flag_tm; }
>    unsigned int execute () { return execute_lower_tm (); }
>
>  }; // class pass_lower_tm
> @@ -2062,7 +2054,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tm_init (); }
> +  virtual bool gate (function *) { return gate_tm_init (); }
>
>  }; // class pass_tm_init
>
> @@ -3929,12 +3921,6 @@ execute_tm_memopt (void)
>    return 0;
>  }
>
> -static bool
> -gate_tm_memopt (void)
> -{
> -  return flag_tm && optimize > 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_tm_memopt =
> @@ -3959,7 +3945,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tm_memopt (); }
> +  virtual bool gate (function *) { return flag_tm && optimize > 0; }
>    unsigned int execute () { return execute_tm_memopt (); }
>
>  }; // class pass_tm_memopt
> @@ -5594,7 +5580,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tm (); }
> +  virtual bool gate (function *) { return flag_tm; }
>    unsigned int execute () { return ipa_tm_execute (); }
>
>  }; // class pass_ipa_tm
> diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
> index 3293493..c271493 100644
> --- a/gcc/tree-call-cdce.c
> +++ b/gcc/tree-call-cdce.c
> @@ -917,15 +917,6 @@ tree_call_cdce (void)
>    return 0;
>  }
>
> -static bool
> -gate_call_cdce (void)
> -{
> -  /* The limit constants used in the implementation
> -     assume IEEE floating point format.  Other formats
> -     can be supported in the future if needed.  */
> -  return flag_tree_builtin_call_dce != 0 && optimize_function_for_speed_p (cfun);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_call_cdce =
> @@ -950,7 +941,15 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_call_cdce (); }
> +  virtual bool gate (function *fun)
> +    {
> +      /* The limit constants used in the implementation
> +        assume IEEE floating point format.  Other formats
> +        can be supported in the future if needed.  */
> +      return flag_tree_builtin_call_dce != 0
> +               && optimize_function_for_speed_p (fun);
> +    }
> +
>    unsigned int execute () { return tree_call_cdce (); }
>
>  }; // class pass_call_cdce
> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
> index 739ca54..08e0280 100644
> --- a/gcc/tree-cfg.c
> +++ b/gcc/tree-cfg.c
> @@ -8355,12 +8355,6 @@ run_warn_unused_result (void)
>    return 0;
>  }
>
> -static bool
> -gate_warn_unused_result (void)
> -{
> -  return flag_warn_unused_result;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_warn_unused_result =
> @@ -8385,7 +8379,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_warn_unused_result (); }
> +  virtual bool gate (function *) { return flag_warn_unused_result; }
>    unsigned int execute () { return run_warn_unused_result (); }
>
>  }; // class pass_warn_unused_result
> diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
> index 914523d..19433f9 100644
> --- a/gcc/tree-cfgcleanup.c
> +++ b/gcc/tree-cfgcleanup.c
> @@ -1035,12 +1035,6 @@ merge_phi_nodes (void)
>    return 0;
>  }
>
> -static bool
> -gate_merge_phi (void)
> -{
> -  return 1;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_merge_phi =
> @@ -1066,7 +1060,6 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_merge_phi (m_ctxt); }
> -  bool gate () { return gate_merge_phi (); }
>    unsigned int execute () { return merge_phi_nodes (); }
>
>  }; // class pass_merge_phi
> diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
> index 283c827..9ec83d9 100644
> --- a/gcc/tree-complex.c
> +++ b/gcc/tree-complex.c
> @@ -1693,14 +1693,6 @@ make_pass_lower_complex (gcc::context *ctxt)
>  }
>
>
> -static bool
> -gate_no_optimization (void)
> -{
> -  /* With errors, normal optimization passes are not run.  If we don't
> -     lower complex operations at all, rtl expansion will abort.  */
> -  return !(cfun->curr_properties & PROP_gimple_lcx);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_lower_complex_O0 =
> @@ -1725,7 +1717,13 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_no_optimization (); }
> +  virtual bool gate (function *fun)
> +    {
> +      /* With errors, normal optimization passes are not run.  If we don't
> +        lower complex operations at all, rtl expansion will abort.  */
> +      return !(fun->curr_properties & PROP_gimple_lcx);
> +    }
> +
>    unsigned int execute () { return tree_lower_complex (); }
>
>  }; // class pass_lower_complex_O0
> diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
> index f51f18c..41f96c4 100644
> --- a/gcc/tree-eh.c
> +++ b/gcc/tree-eh.c
> @@ -3115,12 +3115,6 @@ refactor_eh (void)
>    return 0;
>  }
>
> -static bool
> -gate_refactor_eh (void)
> -{
> -  return flag_exceptions != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_refactor_eh =
> @@ -3145,7 +3139,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_refactor_eh (); }
> +  virtual bool gate (function *) { return flag_exceptions != 0; }
>    unsigned int execute () { return refactor_eh (); }
>
>  }; // class pass_refactor_eh
> @@ -3341,12 +3335,6 @@ execute_lower_resx (void)
>    return any_rewritten ? TODO_update_ssa_only_virtuals : 0;
>  }
>
> -static bool
> -gate_lower_resx (void)
> -{
> -  return flag_exceptions != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_lower_resx =
> @@ -3371,7 +3359,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_lower_resx (); }
> +  virtual bool gate (function *) { return flag_exceptions != 0; }
>    unsigned int execute () { return execute_lower_resx (); }
>
>  }; // class pass_lower_resx
> @@ -3749,12 +3737,6 @@ execute_lower_eh_dispatch (void)
>    return flags;
>  }
>
> -static bool
> -gate_lower_eh_dispatch (void)
> -{
> -  return cfun->eh->region_tree != NULL;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_lower_eh_dispatch =
> @@ -3779,7 +3761,8 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_lower_eh_dispatch (); }
> +  virtual bool gate (function *fun) { return fun->eh->region_tree != NULL; }
> +
>    unsigned int execute () { return execute_lower_eh_dispatch (); }
>
>  }; // class pass_lower_eh_dispatch
> @@ -4596,12 +4579,6 @@ execute_cleanup_eh (void)
>    return ret;
>  }
>
> -static bool
> -gate_cleanup_eh (void)
> -{
> -  return cfun->eh != NULL && cfun->eh->region_tree != NULL;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_cleanup_eh =
> @@ -4627,7 +4604,11 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_cleanup_eh (m_ctxt); }
> -  bool gate () { return gate_cleanup_eh (); }
> +  virtual bool gate (function *fun)
> +    {
> +      return fun->eh != NULL && fun->eh->region_tree != NULL;
> +    }
> +
>    unsigned int execute () { return execute_cleanup_eh (); }
>
>  }; // class pass_cleanup_eh
> diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
> index 84aa008..280a606 100644
> --- a/gcc/tree-emutls.c
> +++ b/gcc/tree-emutls.c
> @@ -816,14 +816,6 @@ ipa_lower_emutls (void)
>    return TODO_verify_all;
>  }
>
> -/* If the target supports TLS natively, we need do nothing here.  */
> -
> -static bool
> -gate_emutls (void)
> -{
> -  return !targetm.have_tls;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ipa_lower_emutls =
> @@ -848,7 +840,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_emutls (); }
> +  virtual bool gate (function *)
> +    {
> +      /* If the target supports TLS natively, we need do nothing here.  */
> +      return !targetm.have_tls;
> +    }
> +
>    unsigned int execute () { return ipa_lower_emutls (); }
>
>  }; // class pass_ipa_lower_emutls
> diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
> index b87c476..90b62a8 100644
> --- a/gcc/tree-if-conv.c
> +++ b/gcc/tree-if-conv.c
> @@ -2013,17 +2013,6 @@ main_tree_if_conversion (void)
>    return todo;
>  }
>
> -/* Returns true when the if-conversion pass is enabled.  */
> -
> -static bool
> -gate_tree_if_conversion (void)
> -{
> -  return (((flag_tree_loop_vectorize || cfun->has_force_vectorize_loops)
> -          && flag_tree_loop_if_convert != 0)
> -         || flag_tree_loop_if_convert == 1
> -         || flag_tree_loop_if_convert_stores == 1);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_if_conversion =
> @@ -2049,11 +2038,20 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_if_conversion (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return main_tree_if_conversion (); }
>
>  }; // class pass_if_conversion
>
> +bool
> +pass_if_conversion::gate (function *fun)
> +{
> +  return (((flag_tree_loop_vectorize || fun->has_force_vectorize_loops)
> +          && flag_tree_loop_if_convert != 0)
> +         || flag_tree_loop_if_convert == 1
> +         || flag_tree_loop_if_convert_stores == 1);
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
> index dec5a5b..332901d 100644
> --- a/gcc/tree-into-ssa.c
> +++ b/gcc/tree-into-ssa.c
> @@ -2365,15 +2365,6 @@ rewrite_into_ssa (void)
>    return 0;
>  }
>
> -/* Gate for IPCP optimization.  */
> -
> -static bool
> -gate_into_ssa (void)
> -{
> -  /* Do nothing for funcions that was produced already in SSA form.  */
> -  return !(cfun->curr_properties & PROP_ssa);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_build_ssa =
> @@ -2398,7 +2389,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_into_ssa (); }
> +  virtual bool gate (function *fun)
> +    {
> +      /* Do nothing for funcions that was produced already in SSA form.  */
> +      return !(fun->curr_properties & PROP_ssa);
> +    }
> +
>    unsigned int execute () { return rewrite_into_ssa (); }
>
>  }; // class pass_build_ssa
> diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
> index dcc61c7..0a15412 100644
> --- a/gcc/tree-loop-distribution.c
> +++ b/gcc/tree-loop-distribution.c
> @@ -1790,13 +1790,6 @@ out:
>    return 0;
>  }
>
> -static bool
> -gate_tree_loop_distribution (void)
> -{
> -  return flag_tree_loop_distribution
> -    || flag_tree_loop_distribute_patterns;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_loop_distribution =
> @@ -1821,7 +1814,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_loop_distribution (); }
> +  virtual bool gate (function *)
> +    {
> +      return flag_tree_loop_distribution
> +       || flag_tree_loop_distribute_patterns;
> +    }
> +
>    unsigned int execute () { return tree_loop_distribution (); }
>
>  }; // class pass_loop_distribution
> diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
> index a39bc5e..71f8d68 100644
> --- a/gcc/tree-nrv.c
> +++ b/gcc/tree-nrv.c
> @@ -272,12 +272,6 @@ tree_nrv (void)
>    return 0;
>  }
>
> -static bool
> -gate_pass_return_slot (void)
> -{
> -  return optimize > 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_nrv =
> @@ -302,7 +296,8 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_pass_return_slot (); }
> +  virtual bool gate (function *) { return optimize > 0; }
> +
>    unsigned int execute () { return tree_nrv (); }
>
>  }; // class pass_nrv
> diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
> index e346074..a46fa51 100644
> --- a/gcc/tree-parloops.c
> +++ b/gcc/tree-parloops.c
> @@ -2253,12 +2253,6 @@ parallelize_loops (void)
>
>  /* Parallelization.  */
>
> -static bool
> -gate_tree_parallelize_loops (void)
> -{
> -  return flag_tree_parallelize_loops > 1;
> -}
> -
>  static unsigned
>  tree_parallelize_loops (void)
>  {
> @@ -2294,7 +2288,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_parallelize_loops (); }
> +  virtual bool gate (function *) { return flag_tree_parallelize_loops > 1; }
>    unsigned int execute () { return tree_parallelize_loops (); }
>
>  }; // class pass_parallelize_loops
> diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
> index 9bb6455..9de2822 100644
> --- a/gcc/tree-pass.h
> +++ b/gcc/tree-pass.h
> @@ -25,6 +25,8 @@ along with GCC; see the file COPYING3.  If not see
>  #include "timevar.h"
>  #include "dumpfile.h"
>
> +struct function;
> +
>  /* Optimization pass type.  */
>  enum opt_pass_type
>  {
> @@ -88,7 +90,7 @@ public:
>
>    /* This pass and all sub-passes are executed only if the function returns
>       true.  The default implementation returns true.  */
> -  virtual bool gate ();
> +  virtual bool gate (function *fun);
>
>    /* This is the code to run.  If has_execute is false, then there should
>       be sub-passes otherwise this pass does nothing.
> diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
> index 859a112..7dd86e1 100644
> --- a/gcc/tree-predcom.c
> +++ b/gcc/tree-predcom.c
> @@ -2573,12 +2573,6 @@ run_tree_predictive_commoning (void)
>    return tree_predictive_commoning ();
>  }
>
> -static bool
> -gate_tree_predictive_commoning (void)
> -{
> -  return flag_predictive_commoning != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_predcom =
> @@ -2603,7 +2597,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_predictive_commoning (); }
> +  virtual bool gate (function *) { return flag_predictive_commoning != 0; }
>    unsigned int execute () { return run_tree_predictive_commoning (); }
>
>  }; // class pass_predcom
> diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
> index 0372c92..b7d0466 100644
> --- a/gcc/tree-profile.c
> +++ b/gcc/tree-profile.c
> @@ -663,16 +663,6 @@ tree_profiling (void)
>    return 0;
>  }
>
> -/* When profile instrumentation, use or test coverage shall be performed.  */
> -
> -static bool
> -gate_tree_profile_ipa (void)
> -{
> -  return (!in_lto_p
> -         && (flag_branch_probabilities || flag_test_coverage
> -             || profile_arc_flag));
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ipa_tree_profile =
> @@ -697,11 +687,20 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_profile_ipa (); }
> +  virtual bool gate (function *);
>    unsigned int execute () { return tree_profiling (); }
>
>  }; // class pass_ipa_tree_profile
>
> +bool
> +pass_ipa_tree_profile::gate (function *)
> +{
> +  /* When profile instrumentation, use or test coverage shall be performed.  */
> +  return (!in_lto_p
> +         && (flag_branch_probabilities || flag_test_coverage
> +             || profile_arc_flag));
> +}
> +
>  } // anon namespace
>
>  simple_ipa_opt_pass *
> diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
> index acca2a7..27f71a3 100644
> --- a/gcc/tree-sra.c
> +++ b/gcc/tree-sra.c
> @@ -3524,7 +3524,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_intra_sra (); }
> +  virtual bool gate (function *) { return gate_intra_sra (); }
>    unsigned int execute () { return early_intra_sra (); }
>
>  }; // class pass_sra_early
> @@ -3561,7 +3561,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_intra_sra (); }
> +  virtual bool gate (function *) { return gate_intra_sra (); }
>    unsigned int execute () { return late_intra_sra (); }
>
>  }; // class pass_sra
> @@ -5051,13 +5051,6 @@ ipa_early_sra (void)
>    return ret;
>  }
>
> -/* Return if early ipa sra shall be performed.  */
> -static bool
> -ipa_early_sra_gate (void)
> -{
> -  return flag_ipa_sra && dbg_cnt (eipa_sra);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_early_ipa_sra =
> @@ -5082,7 +5075,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return ipa_early_sra_gate (); }
> +  virtual bool gate (function *) { return flag_ipa_sra && dbg_cnt (eipa_sra); }
>    unsigned int execute () { return ipa_early_sra (); }
>
>  }; // class pass_early_ipa_sra
> diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
> index c7a7e89..c4a5c71 100644
> --- a/gcc/tree-ssa-ccp.c
> +++ b/gcc/tree-ssa-ccp.c
> @@ -2287,13 +2287,6 @@ do_ssa_ccp (void)
>  }
>
>
> -static bool
> -gate_ccp (void)
> -{
> -  return flag_tree_ccp != 0;
> -}
> -
> -
>  namespace {
>
>  const pass_data pass_data_ccp =
> @@ -2320,7 +2313,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_ccp (m_ctxt); }
> -  bool gate () { return gate_ccp (); }
> +  virtual bool gate (function *) { return flag_tree_ccp != 0; }
>    unsigned int execute () { return do_ssa_ccp (); }
>
>  }; // class pass_ccp
> diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
> index fc26d03..bd6ac04 100644
> --- a/gcc/tree-ssa-copy.c
> +++ b/gcc/tree-ssa-copy.c
> @@ -644,12 +644,6 @@ execute_copy_prop (void)
>    return 0;
>  }
>
> -static bool
> -gate_copy_prop (void)
> -{
> -  return flag_tree_copy_prop != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_copy_prop =
> @@ -676,7 +670,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_copy_prop (m_ctxt); }
> -  bool gate () { return gate_copy_prop (); }
> +  virtual bool gate (function *) { return flag_tree_copy_prop != 0; }
>    unsigned int execute () { return execute_copy_prop (); }
>
>  }; // class pass_copy_prop
> diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
> index 0da3d82..65d8044 100644
> --- a/gcc/tree-ssa-copyrename.c
> +++ b/gcc/tree-ssa-copyrename.c
> @@ -435,14 +435,6 @@ rename_ssa_copies (void)
>    return 0;
>  }
>
> -/* Return true if copy rename is to be performed.  */
> -
> -static bool
> -gate_copyrename (void)
> -{
> -  return flag_tree_copyrename != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_rename_ssa_copies =
> @@ -468,7 +460,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_rename_ssa_copies (m_ctxt); }
> -  bool gate () { return gate_copyrename (); }
> +  virtual bool gate (function *) { return flag_tree_copyrename != 0; }
>    unsigned int execute () { return rename_ssa_copies (); }
>
>  }; // class pass_rename_ssa_copies
> diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
> index 8db149e..e5799b9 100644
> --- a/gcc/tree-ssa-dce.c
> +++ b/gcc/tree-ssa-dce.c
> @@ -1504,12 +1504,6 @@ tree_ssa_cd_dce (void)
>    return perform_tree_ssa_dce (/*aggressive=*/optimize >= 2);
>  }
>
> -static bool
> -gate_dce (void)
> -{
> -  return flag_tree_dce != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_dce =
> @@ -1535,7 +1529,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_dce (m_ctxt); }
> -  bool gate () { return gate_dce (); }
> +  virtual bool gate (function *) { return flag_tree_dce != 0; }
>    unsigned int execute () { return tree_ssa_dce (); }
>
>  }; // class pass_dce
> @@ -1573,7 +1567,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_dce_loop (m_ctxt); }
> -  bool gate () { return gate_dce (); }
> +  virtual bool gate (function *) { return flag_tree_dce != 0; }
>    unsigned int execute () { return tree_ssa_dce_loop (); }
>
>  }; // class pass_dce_loop
> @@ -1611,7 +1605,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_cd_dce (m_ctxt); }
> -  bool gate () { return gate_dce (); }
> +  virtual bool gate (function *) { return flag_tree_dce != 0; }
>    unsigned int execute () { return tree_ssa_cd_dce (); }
>
>  }; // class pass_cd_dce
> diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
> index 8101a54..b9cc5cc 100644
> --- a/gcc/tree-ssa-dom.c
> +++ b/gcc/tree-ssa-dom.c
> @@ -952,12 +952,6 @@ tree_ssa_dominator_optimize (void)
>    return 0;
>  }
>
> -static bool
> -gate_dominator (void)
> -{
> -  return flag_tree_dom != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_dominator =
> @@ -985,7 +979,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_dominator (m_ctxt); }
> -  bool gate () { return gate_dominator (); }
> +  virtual bool gate (function *) { return flag_tree_dom != 0; }
>    unsigned int execute () { return tree_ssa_dominator_optimize (); }
>
>  }; // class pass_dominator
> @@ -3142,7 +3136,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_phi_only_cprop (m_ctxt); }
> -  bool gate () { return gate_dominator (); }
> +  virtual bool gate (function *) { return flag_tree_dom != 0; }
>    unsigned int execute () { return eliminate_degenerate_phis (); }
>
>  }; // class pass_phi_only_cprop
> diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
> index 0096b4c..b6fbdaf 100644
> --- a/gcc/tree-ssa-dse.c
> +++ b/gcc/tree-ssa-dse.c
> @@ -80,7 +80,6 @@ along with GCC; see the file COPYING3.  If not see
>     remove their dead edges eventually.  */
>  static bitmap need_eh_cleanup;
>
> -static bool gate_dse (void);
>  static unsigned int tree_ssa_dse (void);
>
>
> @@ -363,12 +362,6 @@ tree_ssa_dse (void)
>    return 0;
>  }
>
> -static bool
> -gate_dse (void)
> -{
> -  return flag_tree_dse != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_dse =
> @@ -394,7 +387,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_dse (m_ctxt); }
> -  bool gate () { return gate_dse (); }
> +  virtual bool gate (function *) { return flag_tree_dse != 0; }
>    unsigned int execute () { return tree_ssa_dse (); }
>
>  }; // class pass_dse
> diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
> index 66ae113..8d5ca5f 100644
> --- a/gcc/tree-ssa-forwprop.c
> +++ b/gcc/tree-ssa-forwprop.c
> @@ -3831,13 +3831,6 @@ ssa_forward_propagate_and_combine (void)
>    return todoflags;
>  }
>
> -
> -static bool
> -gate_forwprop (void)
> -{
> -  return flag_tree_forwprop;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_forwprop =
> @@ -3863,7 +3856,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_forwprop (m_ctxt); }
> -  bool gate () { return gate_forwprop (); }
> +  virtual bool gate (function *) { return flag_tree_forwprop; }
>    unsigned int execute () { return ssa_forward_propagate_and_combine (); }
>
>  }; // class pass_forwprop
> diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
> index ef0c0c4..b901f37 100644
> --- a/gcc/tree-ssa-ifcombine.c
> +++ b/gcc/tree-ssa-ifcombine.c
> @@ -756,12 +756,6 @@ tree_ssa_ifcombine (void)
>    return cfg_changed ? TODO_cleanup_cfg : 0;
>  }
>
> -static bool
> -gate_ifcombine (void)
> -{
> -  return 1;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_tree_ifcombine =
> @@ -786,7 +780,6 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_ifcombine (); }
>    unsigned int execute () { return tree_ssa_ifcombine (); }
>
>  }; // class pass_tree_ifcombine
> diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
> index 99cc39c..34d1f70 100644
> --- a/gcc/tree-ssa-loop-ch.c
> +++ b/gcc/tree-ssa-loop-ch.c
> @@ -257,12 +257,6 @@ copy_loop_headers (void)
>    return 0;
>  }
>
> -static bool
> -gate_ch (void)
> -{
> -  return flag_tree_ch != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ch =
> @@ -288,7 +282,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_ch (); }
> +  virtual bool gate (function *) { return flag_tree_ch != 0; }
>    unsigned int execute () { return copy_loop_headers (); }
>
>  }; // class pass_ch
> diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
> index aab521e..f38ee95 100644
> --- a/gcc/tree-ssa-loop-im.c
> +++ b/gcc/tree-ssa-loop-im.c
> @@ -2538,12 +2538,6 @@ tree_ssa_loop_im (void)
>    return tree_ssa_lim ();
>  }
>
> -static bool
> -gate_tree_ssa_loop_im (void)
> -{
> -  return flag_tree_loop_im != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_lim =
> @@ -2569,7 +2563,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_lim (m_ctxt); }
> -  bool gate () { return gate_tree_ssa_loop_im (); }
> +  virtual bool gate (function *) { return flag_tree_loop_im != 0; }
>    unsigned int execute () { return tree_ssa_loop_im (); }
>
>  }; // class pass_lim
> diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
> index 177666d..df82816 100644
> --- a/gcc/tree-ssa-loop-ivcanon.c
> +++ b/gcc/tree-ssa-loop-ivcanon.c
> @@ -1265,12 +1265,6 @@ tree_ssa_loop_ivcanon (void)
>    return canonicalize_induction_variables ();
>  }
>
> -static bool
> -gate_tree_ssa_loop_ivcanon (void)
> -{
> -  return flag_tree_loop_ivcanon != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_iv_canon =
> @@ -1295,7 +1289,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_ssa_loop_ivcanon (); }
> +  virtual bool gate (function *) { return flag_tree_loop_ivcanon != 0; }
>    unsigned int execute () { return tree_ssa_loop_ivcanon (); }
>
>  }; // class pass_iv_canon
> @@ -1321,12 +1315,6 @@ tree_complete_unroll (void)
>                                        || optimize >= 3, true);
>  }
>
> -static bool
> -gate_tree_complete_unroll (void)
> -{
> -  return true;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_complete_unroll =
> @@ -1351,7 +1339,6 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_complete_unroll (); }
>    unsigned int execute () { return tree_complete_unroll (); }
>
>  }; // class pass_complete_unroll
> @@ -1385,12 +1372,6 @@ tree_complete_unroll_inner (void)
>    return ret;
>  }
>
> -static bool
> -gate_tree_complete_unroll_inner (void)
> -{
> -  return optimize >= 2;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_complete_unrolli =
> @@ -1415,7 +1396,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_complete_unroll_inner (); }
> +  virtual bool gate (function *) { return optimize >= 2; }
>    unsigned int execute () { return tree_complete_unroll_inner (); }
>
>  }; // class pass_complete_unrolli
> diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
> index dd52703..17b13d1 100644
> --- a/gcc/tree-ssa-loop-prefetch.c
> +++ b/gcc/tree-ssa-loop-prefetch.c
> @@ -2013,12 +2013,6 @@ tree_ssa_loop_prefetch (void)
>    return tree_ssa_prefetch_arrays ();
>  }
>
> -static bool
> -gate_tree_ssa_loop_prefetch (void)
> -{
> -  return flag_prefetch_loop_arrays > 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_loop_prefetch =
> @@ -2043,7 +2037,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_ssa_loop_prefetch (); }
> +  virtual bool gate (function *) { return flag_prefetch_loop_arrays > 0; }
>    unsigned int execute () { return tree_ssa_loop_prefetch (); }
>
>  }; // class pass_loop_prefetch
> diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
> index e755b62..90bb205 100644
> --- a/gcc/tree-ssa-loop-unswitch.c
> +++ b/gcc/tree-ssa-loop-unswitch.c
> @@ -411,12 +411,6 @@ tree_ssa_loop_unswitch (void)
>    return tree_ssa_unswitch_loops ();
>  }
>
> -static bool
> -gate_tree_ssa_loop_unswitch (void)
> -{
> -  return flag_unswitch_loops != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_tree_unswitch =
> @@ -441,7 +435,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_ssa_loop_unswitch (); }
> +  virtual bool gate (function *) { return flag_unswitch_loops != 0; }
>    unsigned int execute () { return tree_ssa_loop_unswitch (); }
>
>  }; // class pass_tree_unswitch
> diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
> index 84e24a1..38e7b13 100644
> --- a/gcc/tree-ssa-loop.c
> +++ b/gcc/tree-ssa-loop.c
> @@ -44,12 +44,6 @@ along with GCC; see the file COPYING3.  If not see
>
>  /* The loop superpass.  */
>
> -static bool
> -gate_tree_loop (void)
> -{
> -  return flag_tree_loop_optimize != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_tree_loop =
> @@ -74,7 +68,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_loop (); }
> +  virtual bool gate (function *) { return flag_tree_loop_optimize != 0; }
>
>  }; // class pass_tree_loop
>
> @@ -152,12 +146,6 @@ tree_loop_vectorize (void)
>    return vectorize_loops ();
>  }
>
> -static bool
> -gate_tree_loop_vectorize (void)
> -{
> -  return flag_tree_loop_vectorize || cfun->has_force_vectorize_loops;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_vectorize =
> @@ -182,7 +170,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_loop_vectorize (); }
> +  virtual bool gate (function *fun)
> +    {
> +      return flag_tree_loop_vectorize || fun->has_force_vectorize_loops;
> +    }
> +
>    unsigned int execute () { return tree_loop_vectorize (); }
>
>  }; // class pass_vectorize
> @@ -207,12 +199,6 @@ check_data_deps (void)
>    return 0;
>  }
>
> -static bool
> -gate_check_data_deps (void)
> -{
> -  return flag_check_data_deps != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_check_data_deps =
> @@ -237,7 +223,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_check_data_deps (); }
> +  virtual bool gate (function *) { return flag_check_data_deps != 0; }
>    unsigned int execute () { return check_data_deps (); }
>
>  }; // class pass_check_data_deps
> @@ -252,12 +238,6 @@ make_pass_check_data_deps (gcc::context *ctxt)
>
>  /* Propagation of constants using scev.  */
>
> -static bool
> -gate_scev_const_prop (void)
> -{
> -  return flag_tree_scev_cprop;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_scev_cprop =
> @@ -283,7 +263,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_scev_const_prop (); }
> +  virtual bool gate (function *) { return flag_tree_scev_cprop; }
>    unsigned int execute () { return scev_const_prop (); }
>
>  }; // class pass_scev_cprop
> @@ -357,12 +337,6 @@ tree_ssa_loop_ivopts (void)
>    return 0;
>  }
>
> -static bool
> -gate_tree_ssa_loop_ivopts (void)
> -{
> -  return flag_ivopts != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_iv_optimize =
> @@ -387,7 +361,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_ssa_loop_ivopts (); }
> +  virtual bool gate (function *) { return flag_ivopts != 0; }
>    unsigned int execute () { return tree_ssa_loop_ivopts (); }
>
>  }; // class pass_iv_optimize
> diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
> index f63c75d..fef1b1e 100644
> --- a/gcc/tree-ssa-math-opts.c
> +++ b/gcc/tree-ssa-math-opts.c
> @@ -504,12 +504,6 @@ execute_cse_reciprocals_1 (gimple_stmt_iterator *def_gsi, tree def)
>    occ_head = NULL;
>  }
>
> -static bool
> -gate_cse_reciprocals (void)
> -{
> -  return optimize && flag_reciprocal_math;
> -}
> -
>  /* Go through all the floating-point SSA_NAMEs, and call
>     execute_cse_reciprocals_1 on each of them.  */
>  static unsigned int
> @@ -678,7 +672,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_cse_reciprocals (); }
> +  virtual bool gate (function *) { return optimize && flag_reciprocal_math; }
>    unsigned int execute () { return execute_cse_reciprocals (); }
>
>  }; // class pass_cse_reciprocals
> @@ -1562,14 +1556,6 @@ execute_cse_sincos (void)
>    return cfg_changed ? TODO_cleanup_cfg : 0;
>  }
>
> -static bool
> -gate_cse_sincos (void)
> -{
> -  /* We no longer require either sincos or cexp, since powi expansion
> -     piggybacks on this pass.  */
> -  return optimize;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_cse_sincos =
> @@ -1595,7 +1581,13 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_cse_sincos (); }
> +  virtual bool gate (function *)
> +    {
> +      /* We no longer require either sincos or cexp, since powi expansion
> +        piggybacks on this pass.  */
> +      return optimize;
> +    }
> +
>    unsigned int execute () { return execute_cse_sincos (); }
>
>  }; // class pass_cse_sincos
> @@ -2065,12 +2057,6 @@ execute_optimize_bswap (void)
>           | TODO_verify_stmts : 0);
>  }
>
> -static bool
> -gate_optimize_bswap (void)
> -{
> -  return flag_expensive_optimizations && optimize;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_optimize_bswap =
> @@ -2095,7 +2081,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_optimize_bswap (); }
> +  virtual bool gate (function *)
> +    {
> +      return flag_expensive_optimizations && optimize;
> +    }
> +
>    unsigned int execute () { return execute_optimize_bswap (); }
>
>  }; // class pass_optimize_bswap
> @@ -2874,12 +2864,6 @@ execute_optimize_widening_mul (void)
>    return cfg_changed ? TODO_cleanup_cfg : 0;
>  }
>
> -static bool
> -gate_optimize_widening_mul (void)
> -{
> -  return flag_expensive_optimizations && optimize;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_optimize_widening_mul =
> @@ -2905,7 +2889,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_optimize_widening_mul (); }
> +  virtual bool gate (function *)
> +    {
> +      return flag_expensive_optimizations && optimize;
> +    }
> +
>    unsigned int execute () { return execute_optimize_widening_mul (); }
>
>  }; // class pass_optimize_widening_mul
> diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
> index 3892317..1ee39a5 100644
> --- a/gcc/tree-ssa-phiopt.c
> +++ b/gcc/tree-ssa-phiopt.c
> @@ -2202,11 +2202,6 @@ gate_hoist_loads (void)
>
>  /* Always do these optimizations if we have SSA
>     trees to work on.  */
> -static bool
> -gate_phiopt (void)
> -{
> -  return 1;
> -}
>
>  namespace {
>
> @@ -2234,7 +2229,6 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_phiopt (m_ctxt); }
> -  bool gate () { return gate_phiopt (); }
>    unsigned int execute () { return tree_ssa_phiopt (); }
>
>  }; // class pass_phiopt
> @@ -2247,12 +2241,6 @@ make_pass_phiopt (gcc::context *ctxt)
>    return new pass_phiopt (ctxt);
>  }
>
> -static bool
> -gate_cselim (void)
> -{
> -  return flag_tree_cselim;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_cselim =
> @@ -2278,7 +2266,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_cselim (); }
> +  virtual bool gate (function *) { return flag_tree_cselim; }
>    unsigned int execute () { return tree_ssa_cs_elim (); }
>
>  }; // class pass_cselim
> diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
> index d67f488..cbdbc6e 100644
> --- a/gcc/tree-ssa-phiprop.c
> +++ b/gcc/tree-ssa-phiprop.c
> @@ -409,12 +409,6 @@ tree_ssa_phiprop (void)
>    return 0;
>  }
>
> -static bool
> -gate_phiprop (void)
> -{
> -  return flag_tree_phiprop;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_phiprop =
> @@ -439,7 +433,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_phiprop (); }
> +  virtual bool gate (function *) { return flag_tree_phiprop; }
>    unsigned int execute () { return tree_ssa_phiprop (); }
>
>  }; // class pass_phiprop
> diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
> index 1329fe2..cda315a 100644
> --- a/gcc/tree-ssa-pre.c
> +++ b/gcc/tree-ssa-pre.c
> @@ -4771,12 +4771,6 @@ do_pre (void)
>    return todo;
>  }
>
> -static bool
> -gate_pre (void)
> -{
> -  return flag_tree_pre != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_pre =
> @@ -4803,7 +4797,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_pre (); }
> +  virtual bool gate (function *) { return flag_tree_pre != 0; }
>    unsigned int execute () { return do_pre (); }
>
>  }; // class pass_pre
> @@ -4842,12 +4836,6 @@ execute_fre (void)
>    return todo;
>  }
>
> -static bool
> -gate_fre (void)
> -{
> -  return flag_tree_fre != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_fre =
> @@ -4873,7 +4861,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_fre (m_ctxt); }
> -  bool gate () { return gate_fre (); }
> +  virtual bool gate (function *) { return flag_tree_fre != 0; }
>    unsigned int execute () { return execute_fre (); }
>
>  }; // class pass_fre
> diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
> index 0b37b7b..92a215a 100644
> --- a/gcc/tree-ssa-reassoc.c
> +++ b/gcc/tree-ssa-reassoc.c
> @@ -4665,12 +4665,6 @@ execute_reassoc (void)
>    return 0;
>  }
>
> -static bool
> -gate_tree_ssa_reassoc (void)
> -{
> -  return flag_tree_reassoc != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_reassoc =
> @@ -4698,7 +4692,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_reassoc (m_ctxt); }
> -  bool gate () { return gate_tree_ssa_reassoc (); }
> +  virtual bool gate (function *) { return flag_tree_reassoc != 0; }
>    unsigned int execute () { return execute_reassoc (); }
>
>  }; // class pass_reassoc
> diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
> index 4a7410d..6803160 100644
> --- a/gcc/tree-ssa-sink.c
> +++ b/gcc/tree-ssa-sink.c
> @@ -588,12 +588,6 @@ do_sink (void)
>    return 0;
>  }
>
> -static bool
> -gate_sink (void)
> -{
> -  return flag_tree_sink != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_sink_code =
> @@ -621,7 +615,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_sink (); }
> +  virtual bool gate (function *) { return flag_tree_sink != 0; }
>    unsigned int execute () { return do_sink (); }
>
>  }; // class pass_sink_code
> diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
> index aa6b6b9..fb83093 100644
> --- a/gcc/tree-ssa-strlen.c
> +++ b/gcc/tree-ssa-strlen.c
> @@ -2089,12 +2089,6 @@ tree_ssa_strlen (void)
>    return 0;
>  }
>
> -static bool
> -gate_strlen (void)
> -{
> -  return flag_optimize_strlen != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_strlen =
> @@ -2119,7 +2113,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_strlen (); }
> +  virtual bool gate (function *) { return flag_optimize_strlen != 0; }
>    unsigned int execute () { return tree_ssa_strlen (); }
>
>  }; // class pass_strlen
> diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
> index 9e1cdbc..3548ac5 100644
> --- a/gcc/tree-ssa-structalias.c
> +++ b/gcc/tree-ssa-structalias.c
> @@ -6989,12 +6989,6 @@ compute_may_aliases (void)
>    return 0;
>  }
>
> -static bool
> -gate_tree_pta (void)
> -{
> -  return flag_tree_pta;
> -}
> -
>  /* A dummy pass to cause points-to information to be computed via
>     TODO_rebuild_alias.  */
>
> @@ -7022,7 +7016,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_pta (); }
> +  virtual bool gate (function *) { return flag_tree_pta; }
>
>  }; // class pass_build_alias
>
> @@ -7061,7 +7055,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_pta (); }
> +  virtual bool gate (function *) { return flag_tree_pta; }
>
>  }; // class pass_build_ealias
>
> @@ -7074,16 +7068,6 @@ make_pass_build_ealias (gcc::context *ctxt)
>  }
>
>
> -/* Return true if we should execute IPA PTA.  */
> -static bool
> -gate_ipa_pta (void)
> -{
> -  return (optimize
> -         && flag_ipa_pta
> -         /* Don't bother doing anything if the program has errors.  */
> -         && !seen_error ());
> -}
> -
>  /* IPA PTA solutions for ESCAPED.  */
>  struct pt_solution ipa_escaped_pt
>    = { true, false, false, false, false, false, false, false, NULL };
> @@ -7452,7 +7436,14 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_ipa_pta (); }
> +  virtual bool gate (function *)
> +    {
> +      return (optimize
> +             && flag_ipa_pta
> +             /* Don't bother doing anything if the program has errors.  */
> +             && !seen_error ());
> +    }
> +
>    unsigned int execute () { return ipa_pta_execute (); }
>
>  }; // class pass_ipa_pta
> diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
> index 41f4bd8..e39ce88 100644
> --- a/gcc/tree-ssa-uncprop.c
> +++ b/gcc/tree-ssa-uncprop.c
> @@ -581,12 +581,6 @@ uncprop_dom_walker::before_dom_children (basic_block bb)
>    uncprop_into_successor_phis (bb);
>  }
>
> -static bool
> -gate_uncprop (void)
> -{
> -  return flag_tree_dom != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_uncprop =
> @@ -612,7 +606,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_uncprop (m_ctxt); }
> -  bool gate () { return gate_uncprop (); }
> +  virtual bool gate (function *) { return flag_tree_dom != 0; }
>    unsigned int execute () { return tree_ssa_uncprop (); }
>
>  }; // class pass_uncprop
> diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
> index 86d84a1..03ff3b8 100644
> --- a/gcc/tree-ssa-uninit.c
> +++ b/gcc/tree-ssa-uninit.c
> @@ -2383,7 +2383,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
> -  bool gate () { return gate_warn_uninitialized (); }
> +  virtual bool gate (function *) { return gate_warn_uninitialized (); }
>    unsigned int execute () { return execute_late_warn_uninitialized (); }
>
>  }; // class pass_late_warn_uninitialized
> @@ -2441,7 +2441,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_warn_uninitialized (); }
> +  virtual bool gate (function *) { return gate_warn_uninitialized (); }
>    unsigned int execute () { return execute_early_warn_uninitialized (); }
>
>  }; // class pass_early_warn_uninitialized
> diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
> index ecc8da3..52126ca 100644
> --- a/gcc/tree-ssa.c
> +++ b/gcc/tree-ssa.c
> @@ -1139,15 +1139,6 @@ execute_init_datastructures (void)
>    return 0;
>  }
>
> -/* Gate for IPCP optimization.  */
> -
> -static bool
> -gate_init_datastructures (void)
> -{
> -  /* Do nothing for funcions that was produced already in SSA form.  */
> -  return !(cfun->curr_properties & PROP_ssa);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_init_datastructures =
> @@ -1172,7 +1163,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_init_datastructures (); }
> +  virtual bool gate (function *fun)
> +    {
> +      /* Do nothing for funcions that was produced already in SSA form.  */
> +      return !(fun->curr_properties & PROP_ssa);
> +    }
> +
>    unsigned int execute () { return execute_init_datastructures (); }
>
>  }; // class pass_init_datastructures
> diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
> index 7da36c4..710711b 100644
> --- a/gcc/tree-stdarg.c
> +++ b/gcc/tree-stdarg.c
> @@ -663,18 +663,6 @@ check_all_va_list_escapes (struct stdarg_info *si)
>    return false;
>  }
>
> -
> -/* Return true if this optimization pass should be done.
> -   It makes only sense for stdarg functions.  */
> -
> -static bool
> -gate_optimize_stdarg (void)
> -{
> -  /* This optimization is only for stdarg functions.  */
> -  return cfun->stdarg != 0;
> -}
> -
> -
>  /* Entry point to the stdarg optimization pass.  */
>
>  static unsigned int
> @@ -1023,7 +1011,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_optimize_stdarg (); }
> +  virtual bool gate (function *fun)
> +    {
> +      /* This optimization is only for stdarg functions.  */
> +      return fun->stdarg != 0;
> +    }
> +
>    unsigned int execute () { return execute_optimize_stdarg (); }
>
>  }; // class pass_stdarg
> diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
> index cf2e763..a0f9d19 100644
> --- a/gcc/tree-switch-conversion.c
> +++ b/gcc/tree-switch-conversion.c
> @@ -1465,14 +1465,6 @@ do_switchconv (void)
>    return 0;
>  }
>
> -/* The pass gate. */
> -
> -static bool
> -switchconv_gate (void)
> -{
> -  return flag_tree_switch_conversion != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_convert_switch =
> @@ -1499,7 +1491,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return switchconv_gate (); }
> +  virtual bool gate (function *) { return flag_tree_switch_conversion != 0; }
>    unsigned int execute () { return do_switchconv (); }
>
>  }; // class pass_convert_switch
> diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
> index b3a6256..84cdbde 100644
> --- a/gcc/tree-tailcall.c
> +++ b/gcc/tree-tailcall.c
> @@ -1108,7 +1108,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_tail_recursion (m_ctxt); }
> -  bool gate () { return gate_tail_calls (); }
> +  virtual bool gate (function *) { return gate_tail_calls (); }
>    unsigned int execute () { return execute_tail_recursion (); }
>
>  }; // class pass_tail_recursion
> @@ -1145,7 +1145,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tail_calls (); }
> +  virtual bool gate (function *) { return gate_tail_calls (); }
>    unsigned int execute () { return execute_tail_calls (); }
>
>  }; // class pass_tail_calls
> diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
> index 035c143..4274417 100644
> --- a/gcc/tree-vect-generic.c
> +++ b/gcc/tree-vect-generic.c
> @@ -1528,12 +1528,6 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
>  /* Use this to lower vector operations introduced by the vectorizer,
>     if it may need the bit-twiddling tricks implemented in this file.  */
>
> -static bool
> -gate_expand_vector_operations_ssa (void)
> -{
> -  return !(cfun->curr_properties & PROP_gimple_lvec);
> -}
> -
>  static unsigned int
>  expand_vector_operations (void)
>  {
> @@ -1586,7 +1580,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_expand_vector_operations_ssa (); }
> +  virtual bool gate (function *fun)
> +    {
> +      return !(fun->curr_properties & PROP_gimple_lvec);
> +    }
> +
>    unsigned int execute () { return expand_vector_operations (); }
>
>  }; // class pass_lower_vector
> diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
> index 17be3aa..7b5691a 100644
> --- a/gcc/tree-vectorizer.c
> +++ b/gcc/tree-vectorizer.c
> @@ -613,12 +613,6 @@ execute_vect_slp (void)
>    return 0;
>  }
>
> -static bool
> -gate_vect_slp (void)
> -{
> -  return flag_tree_slp_vectorize != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_slp_vectorize =
> @@ -644,7 +638,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_vect_slp (); }
> +  virtual bool gate (function *) { return flag_tree_slp_vectorize != 0; }
>    unsigned int execute () { return execute_vect_slp (); }
>
>  }; // class pass_slp_vectorize
> @@ -702,13 +696,6 @@ increase_alignment (void)
>  }
>
>
> -static bool
> -gate_increase_alignment (void)
> -{
> -  return flag_section_anchors && flag_tree_loop_vectorize;
> -}
> -
> -
>  namespace {
>
>  const pass_data pass_data_ipa_increase_alignment =
> @@ -733,7 +720,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_increase_alignment (); }
> +  virtual bool gate (function *)
> +    {
> +      return flag_section_anchors && flag_tree_loop_vectorize;
> +    }
> +
>    unsigned int execute () { return increase_alignment (); }
>
>  }; // class pass_ipa_increase_alignment
> diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
> index 4ccb90b..80f3888 100644
> --- a/gcc/tree-vrp.c
> +++ b/gcc/tree-vrp.c
> @@ -9894,12 +9894,6 @@ execute_vrp (void)
>    return 0;
>  }
>
> -static bool
> -gate_vrp (void)
> -{
> -  return flag_tree_vrp != 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_vrp =
> @@ -9927,7 +9921,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_vrp (m_ctxt); }
> -  bool gate () { return gate_vrp (); }
> +  virtual bool gate (function *) { return flag_tree_vrp != 0; }
>    unsigned int execute () { return execute_vrp (); }
>
>  }; // class pass_vrp
> diff --git a/gcc/tsan.c b/gcc/tsan.c
> index f30cf57..b413bb5 100644
> --- a/gcc/tsan.c
> +++ b/gcc/tsan.c
> @@ -715,14 +715,6 @@ tsan_pass (void)
>    return 0;
>  }
>
> -/* The pass's gate.  */
> -
> -static bool
> -tsan_gate (void)
> -{
> -  return (flag_sanitize & SANITIZE_THREAD) != 0;
> -}
> -
>  /* Inserts __tsan_init () into the list of CTORs.  */
>
>  void
> @@ -765,7 +757,11 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_tsan (m_ctxt); }
> -  bool gate () { return tsan_gate (); }
> +  virtual bool gate (function *)
> +{
> +  return (flag_sanitize & SANITIZE_THREAD) != 0;
> +}
> +
>    unsigned int execute () { return tsan_pass (); }
>
>  }; // class pass_tsan
> @@ -778,12 +774,6 @@ make_pass_tsan (gcc::context *ctxt)
>    return new pass_tsan (ctxt);
>  }
>
> -static bool
> -tsan_gate_O0 (void)
> -{
> -  return (flag_sanitize & SANITIZE_THREAD) != 0 && !optimize;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_tsan_O0 =
> @@ -808,7 +798,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return tsan_gate_O0 (); }
> +  virtual bool gate (function *)
> +    {
> +      return (flag_sanitize & SANITIZE_THREAD) != 0 && !optimize;
> +    }
> +
>    unsigned int execute () { return tsan_pass (); }
>
>  }; // class pass_tsan_O0
> diff --git a/gcc/ubsan.c b/gcc/ubsan.c
> index c205e6b..8e7dda5 100644
> --- a/gcc/ubsan.c
> +++ b/gcc/ubsan.c
> @@ -902,13 +902,6 @@ ubsan_pass (void)
>    return 0;
>  }
>
> -static bool
> -gate_ubsan (void)
> -{
> -  return flag_sanitize & (SANITIZE_NULL | SANITIZE_SI_OVERFLOW
> -                         | SANITIZE_BOOL | SANITIZE_ENUM);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ubsan =
> @@ -933,7 +926,12 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_ubsan (); }
> +  virtual bool gate (function *)
> +    {
> +      return flag_sanitize & (SANITIZE_NULL | SANITIZE_SI_OVERFLOW
> +                             | SANITIZE_BOOL | SANITIZE_ENUM);
> +    }
> +
>    unsigned int execute () { return ubsan_pass (); }
>
>  }; // class pass_ubsan
> diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
> index e6ca3af..4586afc 100644
> --- a/gcc/var-tracking.c
> +++ b/gcc/var-tracking.c
> @@ -10344,14 +10344,6 @@ variable_tracking_main (void)
>    return ret;
>  }
>
> -static bool
> -gate_handle_var_tracking (void)
> -{
> -  return (flag_var_tracking && !targetm.delay_vartrack);
> -}
> -
> -
> -
>  namespace {
>
>  const pass_data pass_data_variable_tracking =
> @@ -10376,7 +10368,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_var_tracking (); }
> +  virtual bool gate (function *)
> +    {
> +      return (flag_var_tracking && !targetm.delay_vartrack);
> +    }
> +
>    unsigned int execute () { return variable_tracking_main (); }
>
>  }; // class pass_variable_tracking
> diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
> index 99caa88..601b2ce 100644
> --- a/gcc/vtable-verify.c
> +++ b/gcc/vtable-verify.c
> @@ -740,14 +740,6 @@ vtable_verify_main (void)
>    return ret;
>  }
>
> -/* Gate function for the pass.  */
> -
> -static bool
> -gate_tree_vtable_verify (void)
> -{
> -  return (flag_vtable_verify);
> -}
> -
>  /* Definition of this optimization pass.  */
>
>  namespace {
> @@ -774,7 +766,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_tree_vtable_verify (); }
> +  virtual bool gate (function *) { return (flag_vtable_verify); }
>    unsigned int execute () { return vtable_verify_main (); }
>
>  }; // class pass_vtable_verify
> diff --git a/gcc/web.c b/gcc/web.c
> index ba4172e..50fc9e6 100644
> --- a/gcc/web.c
> +++ b/gcc/web.c
> @@ -325,12 +325,6 @@ replace_ref (df_ref ref, rtx reg)
>  }
>
>
> -static bool
> -gate_handle_web (void)
> -{
> -  return (optimize > 0 && flag_web);
> -}
> -
>  /* Main entry point.  */
>
>  static unsigned int
> @@ -473,7 +467,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  bool gate () { return gate_handle_web (); }
> +  virtual bool gate (function *) { return (optimize > 0 && flag_web); }
>    unsigned int execute () { return web_main (); }
>
>  }; // class pass_web
> --
> 1.9.2
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/6] pass cfun to pass::execute
  2014-04-17  8:53 ` [PATCH 6/6] pass cfun to pass::execute tsaunders
@ 2014-04-17  9:01   ` Richard Biener
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Biener @ 2014-04-17  9:01 UTC (permalink / raw)
  To: tsaunders; +Cc: GCC Patches

On Thu, Apr 17, 2014 at 10:37 AM,  <tsaunders@mozilla.com> wrote:
> From: Trevor Saunders <tsaunders@mozilla.com>
>
> Hi,
>
> same as the previous patch.
>
> bootstrap + regtest passed on x86_64-unknown-linux-gnu, ok?

Ok.

Thanks,
Richard.

> Trev
>
> 2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>
>
>         * 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.
>
> diff --git a/gcc/asan.c b/gcc/asan.c
> index 3fe50ef..9f29807 100644
> --- a/gcc/asan.c
> +++ b/gcc/asan.c
> @@ -2505,7 +2505,7 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_asan (m_ctxt); }
>    virtual bool gate (function *) { return gate_asan (); }
> -  unsigned int execute () { return asan_instrument (); }
> +  virtual unsigned int execute (function *) { return asan_instrument (); }
>
>  }; // class pass_asan
>
> @@ -2543,7 +2543,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return !optimize && gate_asan (); }
> -  unsigned int execute () { return asan_instrument (); }
> +  virtual unsigned int execute (function *) { return asan_instrument (); }
>
>  }; // class pass_asan_O0
>
> @@ -2557,12 +2557,42 @@ make_pass_asan_O0 (gcc::context *ctxt)
>
>  /* Perform optimization of sanitize functions.  */
>
> -static unsigned int
> -execute_sanopt (void)
> +namespace {
> +
> +const pass_data pass_data_sanopt =
> +{
> +  GIMPLE_PASS, /* type */
> +  "sanopt", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_verify_flow | TODO_verify_stmts
> +    | TODO_update_ssa ), /* todo_flags_finish */
> +};
> +
> +class pass_sanopt : public gimple_opt_pass
> +{
> +public:
> +  pass_sanopt (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_sanopt, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *) { return flag_sanitize; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_sanopt
> +
> +unsigned int
> +pass_sanopt::execute (function *fun)
>  {
>    basic_block bb;
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator gsi;
>        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> @@ -2593,36 +2623,6 @@ execute_sanopt (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_sanopt =
> -{
> -  GIMPLE_PASS, /* type */
> -  "sanopt", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_verify_flow | TODO_verify_stmts
> -    | TODO_update_ssa ), /* todo_flags_finish */
> -};
> -
> -class pass_sanopt : public gimple_opt_pass
> -{
> -public:
> -  pass_sanopt (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_sanopt, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *) { return flag_sanitize; }
> -  unsigned int execute () { return execute_sanopt (); }
> -
> -}; // class pass_sanopt
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
> index e1485a3..0314d18 100644
> --- a/gcc/auto-inc-dec.c
> +++ b/gcc/auto-inc-dec.c
> @@ -1462,37 +1462,6 @@ 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.  */
>
>  namespace {
> @@ -1529,10 +1498,40 @@ public:
>      }
>
>
> -  unsigned int execute () { return rest_of_handle_auto_inc_dec (); }
> +  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 *
> diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
> index 57103bd..db490f1 100644
> --- a/gcc/bb-reorder.c
> +++ b/gcc/bb-reorder.c
> @@ -2302,26 +2302,6 @@ insert_section_boundary_note (void)
>      }
>  }
>
> -static unsigned int
> -rest_of_handle_reorder_blocks (void)
> -{
> -  basic_block bb;
> -
> -  /* Last attempt to optimize CFG, as scheduling, peepholing and insn
> -     splitting possibly introduced more crossjumping opportunities.  */
> -  cfg_layout_initialize (CLEANUP_EXPENSIVE);
> -
> -  reorder_basic_blocks ();
> -  cleanup_cfg (CLEANUP_EXPENSIVE);
> -
> -  FOR_EACH_BB_FN (bb, cfun)
> -    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
> -      bb->aux = bb->next_bb;
> -  cfg_layout_finalize ();
> -
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_reorder_blocks =
> @@ -2354,10 +2334,30 @@ public:
>               && (flag_reorder_blocks || flag_reorder_blocks_and_partition));
>      }
>
> -  unsigned int execute () { return rest_of_handle_reorder_blocks (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_reorder_blocks
>
> +unsigned int
> +pass_reorder_blocks::execute (function *fun)
> +{
> +  basic_block bb;
> +
> +  /* Last attempt to optimize CFG, as scheduling, peepholing and insn
> +     splitting possibly introduced more crossjumping opportunities.  */
> +  cfg_layout_initialize (CLEANUP_EXPENSIVE);
> +
> +  reorder_basic_blocks ();
> +  cleanup_cfg (CLEANUP_EXPENSIVE);
> +
> +  FOR_EACH_BB_FN (bb, fun)
> +    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (fun))
> +      bb->aux = bb->next_bb;
> +  cfg_layout_finalize ();
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -2372,16 +2372,54 @@ make_pass_reorder_blocks (gcc::context *ctxt)
>     which can seriously pessimize code with many computed jumps in the source
>     code, such as interpreters.  See e.g. PR15242.  */
>
> +namespace {
>
> -static unsigned int
> -duplicate_computed_gotos (void)
> +const pass_data pass_data_duplicate_computed_gotos =
> +{
> +  RTL_PASS, /* type */
> +  "compgotos", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_REORDER_BLOCKS, /* tv_id */
> +  0, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  TODO_verify_rtl_sharing, /* todo_flags_finish */
> +};
> +
> +class pass_duplicate_computed_gotos : public rtl_opt_pass
> +{
> +public:
> +  pass_duplicate_computed_gotos (gcc::context *ctxt)
> +    : rtl_opt_pass (pass_data_duplicate_computed_gotos, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *);
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_duplicate_computed_gotos
> +
> +bool
> +pass_duplicate_computed_gotos::gate (function *fun)
> +{
> +  if (targetm.cannot_modify_jumps_p ())
> +    return false;
> +  return (optimize > 0
> +         && flag_expensive_optimizations
> +         && ! optimize_function_for_size_p (fun));
> +}
> +
> +unsigned int
> +pass_duplicate_computed_gotos::execute (function *fun)
>  {
>    basic_block bb, new_bb;
>    bitmap candidates;
>    int max_size;
>    bool changed = false;
>
> -  if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1)
> +  if (n_basic_blocks_for_fn (fun) <= NUM_FIXED_BLOCKS + 1)
>      return 0;
>
>    clear_bb_flags ();
> @@ -2400,7 +2438,7 @@ duplicate_computed_gotos (void)
>    /* Look for blocks that end in a computed jump, and see if such blocks
>       are suitable for unfactoring.  If a block is a candidate for unfactoring,
>       mark it in the candidates.  */
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        rtx insn;
>        edge e;
> @@ -2408,7 +2446,7 @@ duplicate_computed_gotos (void)
>        int size, all_flags;
>
>        /* Build the reorder chain for the original order of blocks.  */
> -      if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
> +      if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (fun))
>         bb->aux = bb->next_bb;
>
>        /* Obviously the block has to end in a computed jump.  */
> @@ -2447,7 +2485,7 @@ duplicate_computed_gotos (void)
>      goto done;
>
>    /* Duplicate computed gotos.  */
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        if (bb->flags & BB_VISITED)
>         continue;
> @@ -2458,7 +2496,7 @@ duplicate_computed_gotos (void)
>          the exit block or the next block.
>          The destination must have more than one predecessor.  */
>        if (!single_succ_p (bb)
> -         || single_succ (bb) == EXIT_BLOCK_PTR_FOR_FN (cfun)
> +         || single_succ (bb) == EXIT_BLOCK_PTR_FOR_FN (fun)
>           || single_succ (bb) == bb->next_bb
>           || single_pred_p (single_succ (bb)))
>         continue;
> @@ -2491,45 +2529,6 @@ done:
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_duplicate_computed_gotos =
> -{
> -  RTL_PASS, /* type */
> -  "compgotos", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_REORDER_BLOCKS, /* tv_id */
> -  0, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  TODO_verify_rtl_sharing, /* todo_flags_finish */
> -};
> -
> -class pass_duplicate_computed_gotos : public rtl_opt_pass
> -{
> -public:
> -  pass_duplicate_computed_gotos (gcc::context *ctxt)
> -    : rtl_opt_pass (pass_data_duplicate_computed_gotos, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *);
> -  unsigned int execute () { return duplicate_computed_gotos (); }
> -
> -}; // class pass_duplicate_computed_gotos
> -
> -bool
> -pass_duplicate_computed_gotos::gate (function *fun)
> -{
> -  if (targetm.cannot_modify_jumps_p ())
> -    return false;
> -  return (optimize > 0
> -         && flag_expensive_optimizations
> -         && ! optimize_function_for_size_p (fun));
> -}
> -
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -2627,12 +2626,57 @@ make_pass_duplicate_computed_gotos (gcc::context *ctxt)
>     Unconditional branches are dealt with by converting them into
>     indirect jumps.  */
>
> -static unsigned
> -partition_hot_cold_basic_blocks (void)
> +namespace {
> +
> +const pass_data pass_data_partition_blocks =
> +{
> +  RTL_PASS, /* type */
> +  "bbpart", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_REORDER_BLOCKS, /* tv_id */
> +  PROP_cfglayout, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_partition_blocks : public rtl_opt_pass
> +{
> +public:
> +  pass_partition_blocks (gcc::context *ctxt)
> +    : rtl_opt_pass (pass_data_partition_blocks, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *);
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_partition_blocks
> +
> +bool
> +pass_partition_blocks::gate (function *fun)
> +{
> +  /* The optimization to partition hot/cold basic blocks into separate
> +     sections of the .o file does not work well with linkonce or with
> +     user defined section attributes.  Don't call it if either case
> +     arises.  */
> +  return (flag_reorder_blocks_and_partition
> +         && optimize
> +         /* See gate_handle_reorder_blocks.  We should not partition if
> +            we are going to omit the reordering.  */
> +         && optimize_function_for_speed_p (fun)
> +         && !DECL_ONE_ONLY (current_function_decl)
> +         && !user_defined_section_attribute);
> +}
> +
> +unsigned
> +pass_partition_blocks::execute (function *fun)
>  {
>    vec<edge> crossing_edges;
>
> -  if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1)
> +  if (n_basic_blocks_for_fn (fun) <= NUM_FIXED_BLOCKS + 1)
>      return 0;
>
>    df_set_flags (DF_DEFER_INSN_RESCAN);
> @@ -2693,7 +2737,7 @@ partition_hot_cold_basic_blocks (void)
>
>       In the meantime, we have no other option but to throw away all
>       of the DF data and recompute it all.  */
> -  if (cfun->eh->lp_array)
> +  if (fun->eh->lp_array)
>      {
>        df_finish_pass (true);
>        df_scan_alloc (NULL);
> @@ -2708,51 +2752,6 @@ partition_hot_cold_basic_blocks (void)
>    return TODO_verify_flow | TODO_verify_rtl_sharing;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_partition_blocks =
> -{
> -  RTL_PASS, /* type */
> -  "bbpart", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_REORDER_BLOCKS, /* tv_id */
> -  PROP_cfglayout, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_partition_blocks : public rtl_opt_pass
> -{
> -public:
> -  pass_partition_blocks (gcc::context *ctxt)
> -    : rtl_opt_pass (pass_data_partition_blocks, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *);
> -  unsigned int execute () { return partition_hot_cold_basic_blocks (); }
> -
> -}; // class pass_partition_blocks
> -
> -bool
> -pass_partition_blocks::gate (function *fun)
> -{
> -  /* The optimization to partition hot/cold basic blocks into separate
> -     sections of the .o file does not work well with linkonce or with
> -     user defined section attributes.  Don't call it if either case
> -     arises.  */
> -  return (flag_reorder_blocks_and_partition
> -         && optimize
> -         /* See gate_handle_reorder_blocks.  We should not partition if
> -            we are going to omit the reordering.  */
> -         && optimize_function_for_speed_p (fun)
> -         && !DECL_ONE_ONLY (current_function_decl)
> -         && !user_defined_section_attribute);
> -}
> -
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/bt-load.c b/gcc/bt-load.c
> index fc2aea7..53c5f58 100644
> --- a/gcc/bt-load.c
> +++ b/gcc/bt-load.c
> @@ -1494,14 +1494,6 @@ branch_target_load_optimize (bool after_prologue_epilogue_gen)
>      }
>  }
>
> -
> -static unsigned int
> -rest_of_handle_branch_target_load_optimize1 (void)
> -{
> -  branch_target_load_optimize (epilogue_completed);
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_branch_target_load_optimize1 =
> @@ -1527,9 +1519,11 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_branch_target_load_optimize; }
> -  unsigned int execute () {
> -    return rest_of_handle_branch_target_load_optimize1 ();
> -  }
> +  virtual unsigned int execute (function *)
> +    {
> +      branch_target_load_optimize (epilogue_completed);
> +      return 0;
> +    }
>
>  }; // class pass_branch_target_load_optimize1
>
> @@ -1542,28 +1536,6 @@ make_pass_branch_target_load_optimize1 (gcc::context *ctxt)
>  }
>
>
> -static unsigned int
> -rest_of_handle_branch_target_load_optimize2 (void)
> -{
> -  static int warned = 0;
> -
> -  /* Leave this a warning for now so that it is possible to experiment
> -     with running this pass twice.  In 3.6, we should either make this
> -     an error, or use separate dump files.  */
> -  if (flag_branch_target_load_optimize
> -      && flag_branch_target_load_optimize2
> -      && !warned)
> -    {
> -      warning (0, "branch target register load optimization is not intended "
> -                 "to be run twice");
> -
> -      warned = 1;
> -    }
> -
> -  branch_target_load_optimize (epilogue_completed);
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_branch_target_load_optimize2 =
> @@ -1593,12 +1565,32 @@ public:
>        return (optimize > 0 && flag_branch_target_load_optimize2);
>      }
>
> -  unsigned int execute () {
> -    return rest_of_handle_branch_target_load_optimize2 ();
> -  }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_branch_target_load_optimize2
>
> +unsigned int
> +pass_branch_target_load_optimize2::execute (function *)
> +{
> +  static int warned = 0;
> +
> +  /* Leave this a warning for now so that it is possible to experiment
> +     with running this pass twice.  In 3.6, we should either make this
> +     an error, or use separate dump files.  */
> +  if (flag_branch_target_load_optimize
> +      && flag_branch_target_load_optimize2
> +      && !warned)
> +    {
> +      warning (0, "branch target register load optimization is not intended "
> +              "to be run twice");
> +
> +      warned = 1;
> +    }
> +
> +  branch_target_load_optimize (epilogue_completed);
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
> index d5d68bf..d793a70 100644
> --- a/gcc/cfgcleanup.c
> +++ b/gcc/cfgcleanup.c
> @@ -3078,17 +3078,6 @@ cleanup_cfg (int mode)
>    return changed;
>  }
>
> -static unsigned int
> -execute_jump (void)
> -{
> -  delete_trivially_dead_insns (get_insns (), max_reg_num ());
> -  if (dump_file)
> -    dump_flow_info (dump_file, dump_flags);
> -  cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0)
> -              | (flag_thread_jumps ? CLEANUP_THREADING : 0));
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_jump =
> @@ -3113,10 +3102,21 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return execute_jump (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_jump
>
> +unsigned int
> +pass_jump::execute (function *)
> +{
> +  delete_trivially_dead_insns (get_insns (), max_reg_num ());
> +  if (dump_file)
> +    dump_flow_info (dump_file, dump_flags);
> +  cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0)
> +              | (flag_thread_jumps ? CLEANUP_THREADING : 0));
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -3125,13 +3125,6 @@ make_pass_jump (gcc::context *ctxt)
>    return new pass_jump (ctxt);
>  }
>
> -static unsigned int
> -execute_jump2 (void)
> -{
> -  cleanup_cfg (flag_crossjumping ? CLEANUP_CROSSJUMP : 0);
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_jump2 =
> @@ -3156,7 +3149,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return execute_jump2 (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      cleanup_cfg (flag_crossjumping ? CLEANUP_CROSSJUMP : 0);
> +      return 0;
> +    }
>
>  }; // class pass_jump2
>
> diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
> index c60703f..f2fd5fc 100644
> --- a/gcc/cfgexpand.c
> +++ b/gcc/cfgexpand.c
> @@ -5530,8 +5530,39 @@ stack_protect_prologue (void)
>     confuse the CFG hooks, so be careful to not manipulate CFG during
>     the expansion.  */
>
> -static unsigned int
> -gimple_expand_cfg (void)
> +namespace {
> +
> +const pass_data pass_data_expand =
> +{
> +  RTL_PASS, /* type */
> +  "expand", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_EXPAND, /* tv_id */
> +  ( PROP_ssa | PROP_gimple_leh | PROP_cfg
> +    | PROP_gimple_lcx
> +    | PROP_gimple_lvec ), /* properties_required */
> +  PROP_rtl, /* properties_provided */
> +  ( PROP_ssa | PROP_trees ), /* properties_destroyed */
> +  ( TODO_verify_ssa | TODO_verify_flow
> +    | TODO_verify_stmts ), /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_expand : public rtl_opt_pass
> +{
> +public:
> +  pass_expand (gcc::context *ctxt)
> +    : rtl_opt_pass (pass_data_expand, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_expand
> +
> +unsigned int
> +pass_expand::execute (function *fun)
>  {
>    basic_block bb, init_block;
>    sbitmap blocks;
> @@ -5554,17 +5585,17 @@ gimple_expand_cfg (void)
>    /* Dominators are not kept up-to-date as we may create new basic-blocks.  */
>    free_dominance_info (CDI_DOMINATORS);
>
> -  rtl_profile_for_bb (ENTRY_BLOCK_PTR_FOR_FN (cfun));
> +  rtl_profile_for_bb (ENTRY_BLOCK_PTR_FOR_FN (fun));
>
>    insn_locations_init ();
>    if (!DECL_IS_BUILTIN (current_function_decl))
>      {
>        /* Eventually, all FEs should explicitly set function_start_locus.  */
> -      if (LOCATION_LOCUS (cfun->function_start_locus) == UNKNOWN_LOCATION)
> -       set_curr_insn_location
> -         (DECL_SOURCE_LOCATION (current_function_decl));
> +      if (LOCATION_LOCUS (fun->function_start_locus) == UNKNOWN_LOCATION)
> +       set_curr_insn_location
> +         (DECL_SOURCE_LOCATION (current_function_decl));
>        else
> -       set_curr_insn_location (cfun->function_start_locus);
> +       set_curr_insn_location (fun->function_start_locus);
>      }
>    else
>      set_curr_insn_location (UNKNOWN_LOCATION);
> @@ -5587,7 +5618,7 @@ gimple_expand_cfg (void)
>    crtl->max_used_stack_slot_alignment = STACK_BOUNDARY;
>    crtl->stack_alignment_estimated = 0;
>    crtl->preferred_stack_boundary = STACK_BOUNDARY;
> -  cfun->cfg->max_jumptable_ents = 0;
> +  fun->cfg->max_jumptable_ents = 0;
>
>    /* Resovle the function section.  Some targets, like ARM EABI rely on knowledge
>       of the function section at exapnsion time to predict distance of calls.  */
> @@ -5606,14 +5637,14 @@ gimple_expand_cfg (void)
>    /* Honor stack protection warnings.  */
>    if (warn_stack_protect)
>      {
> -      if (cfun->calls_alloca)
> +      if (fun->calls_alloca)
>         warning (OPT_Wstack_protector,
>                  "stack protector not protecting local variables: "
> -                 "variable length buffer");
> +                "variable length buffer");
>        if (has_short_buffer && !crtl->stack_protect_guard)
>         warning (OPT_Wstack_protector,
>                  "stack protector not protecting function: "
> -                 "all local arrays are less than %d bytes long",
> +                "all local arrays are less than %d bytes long",
>                  (int) PARAM_VALUE (PARAM_SSP_BUFFER_SIZE));
>      }
>
> @@ -5644,12 +5675,12 @@ gimple_expand_cfg (void)
>        gcc_assert (SA.partition_to_pseudo[i]);
>
>        /* If this decl was marked as living in multiple places, reset
> -         this now to NULL.  */
> +        this now to NULL.  */
>        if (DECL_RTL_IF_SET (var) == pc_rtx)
>         SET_DECL_RTL (var, NULL);
>
>        /* Some RTL parts really want to look at DECL_RTL(x) when x
> -         was a decl marked in REG_ATTR or MEM_ATTR.  We could use
> +        was a decl marked in REG_ATTR or MEM_ATTR.  We could use
>          SET_DECL_RTL here making this available, but that would mean
>          to select one of the potentially many RTLs for one DECL.  Instead
>          of doing that we simply reset the MEM_EXPR of the RTL in question,
> @@ -5718,11 +5749,11 @@ gimple_expand_cfg (void)
>
>    /* Clear EDGE_EXECUTABLE on the entry edge(s).  It is cleaned from the
>       remaining edges later.  */
> -  FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs)
> +  FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (fun)->succs)
>      e->flags &= ~EDGE_EXECUTABLE;
>
>    lab_rtx_for_bb = pointer_map_create ();
> -  FOR_BB_BETWEEN (bb, init_block->next_bb, EXIT_BLOCK_PTR_FOR_FN (cfun),
> +  FOR_BB_BETWEEN (bb, init_block->next_bb, EXIT_BLOCK_PTR_FOR_FN (fun),
>                   next_bb)
>      bb = expand_gimple_basic_block (bb, var_ret_seq != NULL_RTX);
>
> @@ -5740,7 +5771,7 @@ gimple_expand_cfg (void)
>
>    timevar_push (TV_POST_EXPAND);
>    /* We are no longer in SSA form.  */
> -  cfun->gimple_df->in_ssa_p = false;
> +  fun->gimple_df->in_ssa_p = false;
>    if (current_loops)
>      loops_state_clear (LOOP_CLOSED_SSA);
>
> @@ -5762,14 +5793,14 @@ gimple_expand_cfg (void)
>      }
>
>    /* Zap the tree EH table.  */
> -  set_eh_throw_stmt_table (cfun, NULL);
> +  set_eh_throw_stmt_table (fun, NULL);
>
>    /* We need JUMP_LABEL be set in order to redirect jumps, and hence
>       split edges which edge insertions might do.  */
>    rebuild_jump_labels (get_insns ());
>
> -  FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun),
> -                 EXIT_BLOCK_PTR_FOR_FN (cfun), next_bb)
> +  FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (fun),
> +                 EXIT_BLOCK_PTR_FOR_FN (fun), next_bb)
>      {
>        edge e;
>        edge_iterator ei;
> @@ -5780,8 +5811,8 @@ gimple_expand_cfg (void)
>               rebuild_jump_labels_chain (e->insns.r);
>               /* Put insns after parm birth, but before
>                  NOTE_INSNS_FUNCTION_BEG.  */
> -             if (e->src == ENTRY_BLOCK_PTR_FOR_FN (cfun)
> -                 && single_succ_p (ENTRY_BLOCK_PTR_FOR_FN (cfun)))
> +             if (e->src == ENTRY_BLOCK_PTR_FOR_FN (fun)
> +                 && single_succ_p (ENTRY_BLOCK_PTR_FOR_FN (fun)))
>                 {
>                   rtx insns = e->insns.r;
>                   e->insns.r = NULL_RTX;
> @@ -5802,8 +5833,8 @@ gimple_expand_cfg (void)
>    /* We're done expanding trees to RTL.  */
>    currently_expanding_to_rtl = 0;
>
> -  FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb,
> -                 EXIT_BLOCK_PTR_FOR_FN (cfun), next_bb)
> +  FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (fun)->next_bb,
> +                 EXIT_BLOCK_PTR_FOR_FN (fun), next_bb)
>      {
>        edge e;
>        edge_iterator ei;
> @@ -5824,7 +5855,7 @@ gimple_expand_cfg (void)
>         }
>      }
>
> -  blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
> +  blocks = sbitmap_alloc (last_basic_block_for_fn (fun));
>    bitmap_ones (blocks);
>    find_many_sub_basic_blocks (blocks);
>    sbitmap_free (blocks);
> @@ -5840,7 +5871,7 @@ gimple_expand_cfg (void)
>    /* After initial rtl generation, call back to finish generating
>       exception support code.  We need to do this before cleaning up
>       the CFG as the code does not expect dead landing pads.  */
> -  if (cfun->eh->region_tree != NULL)
> +  if (fun->eh->region_tree != NULL)
>      finish_eh_generation ();
>
>    /* Remove unreachable blocks, otherwise we cannot compute dominators
> @@ -5878,14 +5909,14 @@ gimple_expand_cfg (void)
>
>    /* If we're emitting a nested function, make sure its parent gets
>       emitted as well.  Doing otherwise confuses debug info.  */
> -  {
> -    tree parent;
> -    for (parent = DECL_CONTEXT (current_function_decl);
> -        parent != NULL_TREE;
> -        parent = get_containing_scope (parent))
> -      if (TREE_CODE (parent) == FUNCTION_DECL)
> -       TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
> -  }
> +    {
> +      tree parent;
> +      for (parent = DECL_CONTEXT (current_function_decl);
> +          parent != NULL_TREE;
> +          parent = get_containing_scope (parent))
> +       if (TREE_CODE (parent) == FUNCTION_DECL)
> +         TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
> +    }
>
>    /* We are now committed to emitting code for this function.  Do any
>       preparation, such as emitting abstract debug info for the inline
> @@ -5900,15 +5931,15 @@ gimple_expand_cfg (void)
>    naked_return_label = NULL;
>
>    /* After expanding, the tm_restart map is no longer needed.  */
> -  if (cfun->gimple_df->tm_restart)
> +  if (fun->gimple_df->tm_restart)
>      {
> -      htab_delete (cfun->gimple_df->tm_restart);
> -      cfun->gimple_df->tm_restart = NULL;
> +      htab_delete (fun->gimple_df->tm_restart);
> +      fun->gimple_df->tm_restart = NULL;
>      }
>
>    /* Tag the blocks with a depth number so that change_scope can find
>       the common parent easily.  */
> -  set_block_levels (DECL_INITIAL (cfun->decl), 0);
> +  set_block_levels (DECL_INITIAL (fun->decl), 0);
>    default_rtl_profile ();
>
>    timevar_pop (TV_POST_EXPAND);
> @@ -5916,37 +5947,6 @@ gimple_expand_cfg (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_expand =
> -{
> -  RTL_PASS, /* type */
> -  "expand", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_EXPAND, /* tv_id */
> -  ( PROP_ssa | PROP_gimple_leh | PROP_cfg
> -    | PROP_gimple_lcx
> -    | PROP_gimple_lvec ), /* properties_required */
> -  PROP_rtl, /* properties_provided */
> -  ( PROP_ssa | PROP_trees ), /* properties_destroyed */
> -  ( TODO_verify_ssa | TODO_verify_flow
> -    | TODO_verify_stmts ), /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_expand : public rtl_opt_pass
> -{
> -public:
> -  pass_expand (gcc::context *ctxt)
> -    : rtl_opt_pass (pass_data_expand, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  unsigned int execute () { return gimple_expand_cfg (); }
> -
> -}; // class pass_expand
> -
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
> index 0404d08..5dd27d2 100644
> --- a/gcc/cfgrtl.c
> +++ b/gcc/cfgrtl.c
> @@ -442,26 +442,6 @@ free_bb_for_insn (void)
>    return 0;
>  }
>
> -static unsigned int
> -rest_of_pass_free_cfg (void)
> -{
> -#ifdef DELAY_SLOTS
> -  /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
> -     valid at that point so it would be too late to call df_analyze.  */
> -  if (optimize > 0 && flag_delayed_branch)
> -    {
> -      df_note_add_problem ();
> -      df_analyze ();
> -    }
> -#endif
> -
> -  if (crtl->has_bb_partition)
> -    insert_section_boundary_note ();
> -
> -  free_bb_for_insn ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_free_cfg =
> @@ -486,10 +466,30 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_pass_free_cfg (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_free_cfg
>
> +unsigned int
> +pass_free_cfg::execute (function *)
> +{
> +#ifdef DELAY_SLOTS
> +  /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
> +     valid at that point so it would be too late to call df_analyze.  */
> +  if (optimize > 0 && flag_delayed_branch)
> +    {
> +      df_note_add_problem ();
> +      df_analyze ();
> +    }
> +#endif
> +
> +  if (crtl->has_bb_partition)
> +    insert_section_boundary_note ();
> +
> +  free_bb_for_insn ();
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -3466,27 +3466,6 @@ record_effective_endpoints (void)
>      cfg_layout_function_footer = unlink_insn_chain (cfg_layout_function_footer, get_last_insn ());
>  }
>
> -static unsigned int
> -into_cfg_layout_mode (void)
> -{
> -  cfg_layout_initialize (0);
> -  return 0;
> -}
> -
> -static unsigned int
> -outof_cfg_layout_mode (void)
> -{
> -  basic_block bb;
> -
> -  FOR_EACH_BB_FN (bb, cfun)
> -    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
> -      bb->aux = bb->next_bb;
> -
> -  cfg_layout_finalize ();
> -
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_into_cfg_layout_mode =
> @@ -3511,7 +3490,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return into_cfg_layout_mode (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      cfg_layout_initialize (0);
> +      return 0;
> +    }
>
>  }; // class pass_into_cfg_layout_mode
>
> @@ -3547,10 +3530,24 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return outof_cfg_layout_mode (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_outof_cfg_layout_mode
>
> +unsigned int
> +pass_outof_cfg_layout_mode::execute (function *fun)
> +{
> +  basic_block bb;
> +
> +  FOR_EACH_BB_FN (bb, fun)
> +    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (fun))
> +      bb->aux = bb->next_bb;
> +
> +  cfg_layout_finalize ();
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
> index 9c6d46d..6bdc8ca 100644
> --- a/gcc/cgraphbuild.c
> +++ b/gcc/cgraphbuild.c
> @@ -305,8 +305,36 @@ ipa_record_stmt_references (struct cgraph_node *node, gimple stmt)
>  /* Create cgraph edges for function calls.
>     Also look for functions and variables having addresses taken.  */
>
> -static unsigned int
> -build_cgraph_edges (void)
> +namespace {
> +
> +const pass_data pass_data_build_cgraph_edges =
> +{
> +  GIMPLE_PASS, /* type */
> +  "*build_cgraph_edges", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  PROP_cfg, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_build_cgraph_edges : public gimple_opt_pass
> +{
> +public:
> +  pass_build_cgraph_edges (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_build_cgraph_edges, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_build_cgraph_edges
> +
> +unsigned int
> +pass_build_cgraph_edges::execute (function *fun)
>  {
>    basic_block bb;
>    struct cgraph_node *node = cgraph_get_node (current_function_decl);
> @@ -317,7 +345,7 @@ build_cgraph_edges (void)
>
>    /* Create the callgraph edges and record the nodes referenced by the function.
>       body.  */
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
>         {
> @@ -370,45 +398,17 @@ build_cgraph_edges (void)
>     }
>
>    /* Look for initializers of constant variables and private statics.  */
> -  FOR_EACH_LOCAL_DECL (cfun, ix, decl)
> +  FOR_EACH_LOCAL_DECL (fun, ix, decl)
>      if (TREE_CODE (decl) == VAR_DECL
>         && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
>         && !DECL_HAS_VALUE_EXPR_P (decl))
>        varpool_finalize_decl (decl);
> -  record_eh_tables (node, cfun);
> +  record_eh_tables (node, fun);
>
>    pointer_set_destroy (visited_nodes);
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_build_cgraph_edges =
> -{
> -  GIMPLE_PASS, /* type */
> -  "*build_cgraph_edges", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  PROP_cfg, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_build_cgraph_edges : public gimple_opt_pass
> -{
> -public:
> -  pass_build_cgraph_edges (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_build_cgraph_edges, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  unsigned int execute () { return build_cgraph_edges (); }
> -
> -}; // class pass_build_cgraph_edges
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -539,7 +539,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_rebuild_cgraph_edges (m_ctxt); }
> -  unsigned int execute () { return rebuild_cgraph_edges (); }
> +  virtual unsigned int execute (function *) { return rebuild_cgraph_edges (); }
>
>  }; // class pass_rebuild_cgraph_edges
>
> @@ -552,15 +552,6 @@ make_pass_rebuild_cgraph_edges (gcc::context *ctxt)
>  }
>
>
> -static unsigned int
> -remove_cgraph_callee_edges (void)
> -{
> -  struct cgraph_node *node = cgraph_get_node (current_function_decl);
> -  cgraph_node_remove_callees (node);
> -  ipa_remove_all_references (&node->ref_list);
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_remove_cgraph_callee_edges =
> @@ -588,10 +579,19 @@ public:
>    opt_pass * clone () {
>      return new pass_remove_cgraph_callee_edges (m_ctxt);
>    }
> -  unsigned int execute () { return remove_cgraph_callee_edges (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_remove_cgraph_callee_edges
>
> +unsigned int
> +pass_remove_cgraph_callee_edges::execute (function *)
> +{
> +  struct cgraph_node *node = cgraph_get_node (current_function_decl);
> +  cgraph_node_remove_callees (node);
> +  ipa_remove_all_references (&node->ref_list);
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
> index 37fc7a5..399beb4 100644
> --- a/gcc/combine-stack-adj.c
> +++ b/gcc/combine-stack-adj.c
> @@ -653,7 +653,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return rest_of_handle_stack_adjustments (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_stack_adjustments ();
> +    }
>
>  }; // class pass_stack_adjustments
>
> diff --git a/gcc/combine.c b/gcc/combine.c
> index 1b1e33c..9a78c06 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -13909,7 +13909,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return (optimize > 0); }
> -  unsigned int execute () { return rest_of_handle_combine (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_combine ();
> +    }
>
>  }; // class pass_combine
>
> diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c
> index 9cddb7a..7555d48 100644
> --- a/gcc/compare-elim.c
> +++ b/gcc/compare-elim.c
> @@ -676,7 +676,10 @@ public:
>        return flag_compare_elim_after_reload;
>      }
>
> -  unsigned int execute () { return execute_compare_elim_after_reload (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return execute_compare_elim_after_reload ();
> +    }
>
>  }; // class pass_compare_elim_after_reload
>
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index eddc55e..64d1312 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -623,7 +623,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_arc_ifcvt (m_ctxt); }
> -  unsigned int execute () { return arc_ifcvt (); }
> +  virtual unsigned int execute (function *) { return arc_ifcvt (); }
>  };
>
>  } // anon namespace
> @@ -660,7 +660,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return arc_predicate_delay_insns (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return arc_predicate_delay_insns ();
> +    }
>  };
>
>  } // anon namespace
> diff --git a/gcc/config/epiphany/mode-switch-use.c b/gcc/config/epiphany/mode-switch-use.c
> index d893934..9617041 100644
> --- a/gcc/config/epiphany/mode-switch-use.c
> +++ b/gcc/config/epiphany/mode-switch-use.c
> @@ -95,7 +95,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return insert_uses (); }
> +  virtual unsigned int execute (function *) { return insert_uses (); }
>
>  }; // class pass_mode_switch_use
>
> diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
> index 31928fd..fa8fea5 100644
> --- a/gcc/config/epiphany/resolve-sw-modes.c
> +++ b/gcc/config/epiphany/resolve-sw-modes.c
> @@ -38,6 +38,35 @@ along with GCC; see the file COPYING3.  If not see
>  #include "insn-attr-common.h"
>  #include "tree-pass.h"
>
> +namespace {
> +
> +const pass_data pass_data_resolve_sw_modes =
> +{
> +  RTL_PASS, /* type */
> +  "resolve_sw_modes", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_MODE_SWITCH, /* tv_id */
> +  0, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_df_finish | TODO_verify_rtl_sharing | 0 ), /* todo_flags_finish */
> +};
> +
> +class pass_resolve_sw_modes : public rtl_opt_pass
> +{
> +public:
> +  pass_resolve_sw_modes(gcc::context *ctxt)
> +    : rtl_opt_pass(pass_data_resolve_sw_modes, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *) { return optimize; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_resolve_sw_modes
> +
>  /* Clean-up after mode switching:
>     Check for mode setting insns that have FP_MODE_ROUND_UNKNOWN.
>     If only one rounding mode is required, select that one.
> @@ -45,8 +74,8 @@ along with GCC; see the file COPYING3.  If not see
>     insert new mode setting insns on the edges where the other mode
>     becomes unambigous.  */
>
> -static unsigned
> -resolve_sw_modes (void)
> +unsigned
> +pass_resolve_sw_modes::execute (function *fun)
>  {
>    basic_block bb;
>    rtx insn, src;
> @@ -55,15 +84,15 @@ resolve_sw_modes (void)
>    bool need_commit = false;
>    bool finalize_fp_sets = (MACHINE_FUNCTION (cfun)->unknown_mode_sets == 0);
>
> -  todo.create (last_basic_block_for_fn (cfun));
> -  pushed = sbitmap_alloc (last_basic_block_for_fn (cfun));
> +  todo.create (last_basic_block_for_fn (fun));
> +  pushed = sbitmap_alloc (last_basic_block_for_fn (fun));
>    bitmap_clear (pushed);
>    if (!finalize_fp_sets)
>      {
>        df_note_add_problem ();
>        df_analyze ();
>      }
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      FOR_BB_INSNS (bb, insn)
>        {
>         enum attr_fp_mode selected_mode;
> @@ -155,35 +184,6 @@ resolve_sw_modes (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_resolve_sw_modes =
> -{
> -  RTL_PASS, /* type */
> -  "resolve_sw_modes", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_MODE_SWITCH, /* tv_id */
> -  0, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_df_finish | TODO_verify_rtl_sharing | 0 ), /* todo_flags_finish */
> -};
> -
> -class pass_resolve_sw_modes : public rtl_opt_pass
> -{
> -public:
> -  pass_resolve_sw_modes(gcc::context *ctxt)
> -    : rtl_opt_pass(pass_data_resolve_sw_modes, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *) { return optimize; }
> -  unsigned int execute () { return resolve_sw_modes (); }
> -
> -}; // class pass_resolve_sw_modes
> -
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 8cfdaf6..9f4e04d 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -2541,7 +2541,10 @@ public:
>        return TARGET_AVX && !TARGET_AVX512F && TARGET_VZEROUPPER;
>      }
>
> -  unsigned int execute () { return rest_of_handle_insert_vzeroupper (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_insert_vzeroupper ();
> +    }
>
>  }; // class pass_insert_vzeroupper
>
> diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
> index 6c0b3c2..45256e9 100644
> --- a/gcc/config/mips/mips.c
> +++ b/gcc/config/mips/mips.c
> @@ -16550,7 +16550,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return mips_machine_reorg2 (); }
> +  virtual unsigned int execute (function *) { return mips_machine_reorg2 (); }
>
>  }; // class pass_mips_machine_reorg2
>
> diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
> index 988e1cd..0731491 100644
> --- a/gcc/config/rl78/rl78.c
> +++ b/gcc/config/rl78/rl78.c
> @@ -117,14 +117,6 @@ rl78_init_machine_status (void)
>    return m;
>  }
>
> -/* Runs the devirtualization pass.  */
> -static unsigned int
> -devirt_pass (void)
> -{
> -  rl78_reorg ();
> -  return 0;
> -}
> -
>  /* This pass converts virtual instructions using virtual registers, to
>     real instructions using real registers.  Rather than run it as
>     reorg, we reschedule it before vartrack to help with debugging.  */
> @@ -153,7 +145,12 @@ public:
>    }
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return devirt_pass (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      rl78_reorg ();
> +      return 0;
> +    }
> +
>  };
>
>  } // anon namespace
> @@ -235,7 +232,7 @@ public:
>    }
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return move_elim_pass (); }
> +  virtual unsigned int execute (function *) { return move_elim_pass (); }
>  };
>
>  } // anon namespace
> diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
> index 77e163f..cc8f32e 100644
> --- a/gcc/config/s390/s390.c
> +++ b/gcc/config/s390/s390.c
> @@ -8631,33 +8631,6 @@ s390_restore_gprs_from_fprs (void)
>  /* A pass run immediately before shrink-wrapping and prologue and epilogue
>     generation.  */
>
> -static unsigned int
> -s390_early_mach (void)
> -{
> -  rtx insn;
> -
> -  /* Try to get rid of the FPR clobbers.  */
> -  s390_optimize_nonescaping_tx ();
> -
> -  /* Re-compute register info.  */
> -  s390_register_info ();
> -
> -  /* If we're using a base register, ensure that it is always valid for
> -     the first non-prologue instruction.  */
> -  if (cfun->machine->base_reg)
> -    emit_insn_at_entry (gen_main_pool (cfun->machine->base_reg));
> -
> -  /* Annotate all constant pool references to let the scheduler know
> -     they implicitly use the base register.  */
> -  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
> -    if (INSN_P (insn))
> -      {
> -       annotate_constant_pool_refs (&PATTERN (insn));
> -       df_insn_rescan (insn);
> -      }
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_s390_early_mach =
> @@ -8683,10 +8656,37 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return s390_early_mach (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_s390_early_mach
>
> +unsigned int
> +pass_s390_early_mach::execute (function *fun)
> +{
> +  rtx insn;
> +
> +  /* Try to get rid of the FPR clobbers.  */
> +  s390_optimize_nonescaping_tx ();
> +
> +  /* Re-compute register info.  */
> +  s390_register_info ();
> +
> +  /* If we're using a base register, ensure that it is always valid for
> +     the first non-prologue instruction.  */
> +  if (fun->machine->base_reg)
> +    emit_insn_at_entry (gen_main_pool (fun->machine->base_reg));
> +
> +  /* Annotate all constant pool references to let the scheduler know
> +     they implicitly use the base register.  */
> +  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
> +    if (INSN_P (insn))
> +      {
> +       annotate_constant_pool_refs (&PATTERN (insn));
> +       df_insn_rescan (insn);
> +      }
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  /* Expand the prologue into a bunch of separate insns.  */
> diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
> index 5578cb8..62354ee 100644
> --- a/gcc/config/sparc/sparc.c
> +++ b/gcc/config/sparc/sparc.c
> @@ -1145,7 +1145,10 @@ public:
>        return sparc_fix_at697f != 0 || sparc_fix_ut699 != 0;
>      }
>
> -  unsigned int execute () { return sparc_do_work_around_errata (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return sparc_do_work_around_errata ();
> +    }
>
>  }; // class pass_work_around_errata
>
> diff --git a/gcc/cprop.c b/gcc/cprop.c
> index 9802b8a..d29b6f6 100644
> --- a/gcc/cprop.c
> +++ b/gcc/cprop.c
> @@ -1943,7 +1943,7 @@ public:
>         && dbg_cnt (cprop);
>      }
>
> -  unsigned int execute () { return execute_rtl_cprop (); }
> +  virtual unsigned int execute (function *) { return execute_rtl_cprop (); }
>
>  }; // class pass_rtl_cprop
>
> diff --git a/gcc/cse.c b/gcc/cse.c
> index 60ec9a9..40bc2be 100644
> --- a/gcc/cse.c
> +++ b/gcc/cse.c
> @@ -7510,7 +7510,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return optimize > 0; }
> -  unsigned int execute () { return rest_of_handle_cse (); }
> +  virtual unsigned int execute (function *) { return rest_of_handle_cse (); }
>
>  }; // class pass_cse
>
> @@ -7587,7 +7587,7 @@ public:
>        return optimize > 0 && flag_rerun_cse_after_loop;
>      }
>
> -  unsigned int execute () { return rest_of_handle_cse2 (); }
> +  virtual unsigned int execute (function *) { return rest_of_handle_cse2 (); }
>
>  }; // class pass_cse2
>
> @@ -7662,9 +7662,10 @@ public:
>        return optimize > 0 && flag_rerun_cse_after_global_opts;
>      }
>
> -  unsigned int execute () {
> -    return rest_of_handle_cse_after_global_opts ();
> -  }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_cse_after_global_opts ();
> +    }
>
>  }; // class pass_cse_after_global_opts
>
> diff --git a/gcc/dce.c b/gcc/dce.c
> index 1d290e3..344e31a 100644
> --- a/gcc/dce.c
> +++ b/gcc/dce.c
> @@ -808,7 +808,10 @@ public:
>        return optimize > 1 && flag_dce && dbg_cnt (dce_ud);
>      }
>
> -  unsigned int execute () { return rest_of_handle_ud_dce (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_ud_dce ();
> +    }
>
>  }; // class pass_ud_rtl_dce
>
> @@ -1237,7 +1240,10 @@ public:
>        return optimize > 0 && flag_dce && dbg_cnt (dce_fast);
>      }
>
> -  unsigned int execute () { return rest_of_handle_fast_dce (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_fast_dce ();
> +    }
>
>  }; // class pass_fast_rtl_dce
>
> diff --git a/gcc/df-core.c b/gcc/df-core.c
> index bd3cb31..9fdf6010 100644
> --- a/gcc/df-core.c
> +++ b/gcc/df-core.c
> @@ -765,7 +765,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return optimize > 0; }
> -  unsigned int execute () { return rest_of_handle_df_initialize (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_df_initialize ();
> +    }
>
>  }; // class pass_df_initialize_opt
>
> @@ -803,7 +806,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return optimize == 0; }
> -  unsigned int execute () { return rest_of_handle_df_initialize (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_df_initialize ();
> +    }
>
>  }; // class pass_df_initialize_no_opt
>
> @@ -867,7 +873,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_handle_df_finish (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_df_finish ();
> +    }
>
>  }; // class pass_df_finish
>
> diff --git a/gcc/dse.c b/gcc/dse.c
> index a80c025..88b8c37 100644
> --- a/gcc/dse.c
> +++ b/gcc/dse.c
> @@ -3736,7 +3736,7 @@ public:
>        return optimize > 0 && flag_dse && dbg_cnt (dse1);
>      }
>
> -  unsigned int execute () { return rest_of_handle_dse (); }
> +  virtual unsigned int execute (function *) { return rest_of_handle_dse (); }
>
>  }; // class pass_rtl_dse1
>
> @@ -3777,7 +3777,7 @@ public:
>        return optimize > 0 && flag_dse && dbg_cnt (dse2);
>      }
>
> -  unsigned int execute () { return rest_of_handle_dse (); }
> +  virtual unsigned int execute (function *) { return rest_of_handle_dse (); }
>
>  }; // class pass_rtl_dse2
>
> diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
> index 3749277..4180890 100644
> --- a/gcc/dwarf2cfi.c
> +++ b/gcc/dwarf2cfi.c
> @@ -3402,7 +3402,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return execute_dwarf2_frame (); }
> +  virtual unsigned int execute (function *) { return execute_dwarf2_frame (); }
>
>  }; // class pass_dwarf2_frame
>
> diff --git a/gcc/except.c b/gcc/except.c
> index 2015809..5b33c9c 100644
> --- a/gcc/except.c
> +++ b/gcc/except.c
> @@ -2025,7 +2025,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return set_nothrow_function_flags (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return set_nothrow_function_flags ();
> +    }
>
>  }; // class pass_set_nothrow_function_flags
>
> @@ -2645,7 +2648,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return convert_to_eh_region_ranges (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return convert_to_eh_region_ranges ();
> +    }
>
>  }; // class pass_convert_to_eh_region_ranges
>
> diff --git a/gcc/final.c b/gcc/final.c
> index 91b8ccc..542886f 100644
> --- a/gcc/final.c
> +++ b/gcc/final.c
> @@ -869,7 +869,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return compute_alignments (); }
> +  virtual unsigned int execute (function *) { return compute_alignments (); }
>
>  }; // class pass_compute_alignments
>
> @@ -4497,7 +4497,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_handle_final (); }
> +  virtual unsigned int execute (function *) { return rest_of_handle_final (); }
>
>  }; // class pass_final
>
> @@ -4542,7 +4542,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_handle_shorten_branches (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_shorten_branches ();
> +    }
>
>  }; // class pass_shorten_branches
>
> @@ -4705,7 +4708,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_clean_state (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_clean_state ();
> +    }
>
>  }; // class pass_clean_state
>
> diff --git a/gcc/function.c b/gcc/function.c
> index cf07255..383a52a 100644
> --- a/gcc/function.c
> +++ b/gcc/function.c
> @@ -1967,7 +1967,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return instantiate_virtual_regs (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return instantiate_virtual_regs ();
> +    }
>
>  }; // class pass_instantiate_virtual_regs
>
> @@ -6965,7 +6968,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_handle_check_leaf_regs (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_check_leaf_regs ();
> +    }
>
>  }; // class pass_leaf_regs
>
> @@ -7025,9 +7031,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () {
> -    return rest_of_handle_thread_prologue_and_epilogue ();
> -  }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_thread_prologue_and_epilogue ();
> +    }
>
>  }; // class pass_thread_prologue_and_epilogue
>
> @@ -7184,8 +7191,36 @@ match_asm_constraints_1 (rtx insn, rtx *p_sets, int noutputs)
>      df_insn_rescan (insn);
>  }
>
> -static unsigned
> -rest_of_match_asm_constraints (void)
> +namespace {
> +
> +const pass_data pass_data_match_asm_constraints =
> +{
> +  RTL_PASS, /* type */
> +  "asmcons", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  0, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_match_asm_constraints : public rtl_opt_pass
> +{
> +public:
> +  pass_match_asm_constraints (gcc::context *ctxt)
> +    : rtl_opt_pass (pass_data_match_asm_constraints, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_match_asm_constraints
> +
> +unsigned
> +pass_match_asm_constraints::execute (function *fun)
>  {
>    basic_block bb;
>    rtx insn, pat, *p_sets;
> @@ -7195,7 +7230,7 @@ rest_of_match_asm_constraints (void)
>      return 0;
>
>    df_set_flags (DF_DEFER_INSN_RESCAN);
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        FOR_BB_INSNS (bb, insn)
>         {
> @@ -7219,34 +7254,6 @@ rest_of_match_asm_constraints (void)
>    return TODO_df_finish;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_match_asm_constraints =
> -{
> -  RTL_PASS, /* type */
> -  "asmcons", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  0, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_match_asm_constraints : public rtl_opt_pass
> -{
> -public:
> -  pass_match_asm_constraints (gcc::context *ctxt)
> -    : rtl_opt_pass (pass_data_match_asm_constraints, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_match_asm_constraints (); }
> -
> -}; // class pass_match_asm_constraints
> -
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/fwprop.c b/gcc/fwprop.c
> index c6fa4ee..6960d62 100644
> --- a/gcc/fwprop.c
> +++ b/gcc/fwprop.c
> @@ -1509,7 +1509,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return gate_fwprop (); }
> -  unsigned int execute () { return fwprop (); }
> +  virtual unsigned int execute (function *) { return fwprop (); }
>
>  }; // class pass_rtl_fwprop
>
> @@ -1574,7 +1574,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return gate_fwprop (); }
> -  unsigned int execute () { return fwprop_addr (); }
> +  virtual unsigned int execute (function *) { return fwprop_addr (); }
>
>  }; // class pass_rtl_fwprop_addr
>
> diff --git a/gcc/gcse.c b/gcc/gcse.c
> index 942ea64..d88b275 100644
> --- a/gcc/gcse.c
> +++ b/gcc/gcse.c
> @@ -4209,7 +4209,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return execute_rtl_pre (); }
> +  virtual unsigned int execute (function *) { return execute_rtl_pre (); }
>
>  }; // class pass_rtl_pre
>
> @@ -4261,7 +4261,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return execute_rtl_hoist (); }
> +  virtual unsigned int execute (function *) { return execute_rtl_hoist (); }
>
>  }; // class pass_rtl_hoist
>
> diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
> index 66ea322..eff4b4f 100644
> --- a/gcc/gimple-low.c
> +++ b/gcc/gimple-low.c
> @@ -180,7 +180,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return lower_function_body (); }
> +  virtual unsigned int execute (function *) { return lower_function_body (); }
>
>  }; // class pass_lower_cf
>
> diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
> index ab6185c..b01417d 100644
> --- a/gcc/gimple-ssa-isolate-paths.c
> +++ b/gcc/gimple-ssa-isolate-paths.c
> @@ -446,7 +446,10 @@ public:
>               || flag_isolate_erroneous_paths_attribute != 0);
>      }
>
> -  unsigned int execute () { return gimple_ssa_isolate_erroneous_paths (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return gimple_ssa_isolate_erroneous_paths ();
> +    }
>
>  }; // class pass_isolate_erroneous_paths
>  }
> diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
> index a8596e0..ff55d0e 100644
> --- a/gcc/gimple-ssa-strength-reduction.c
> +++ b/gcc/gimple-ssa-strength-reduction.c
> @@ -3594,8 +3594,37 @@ analyze_candidates_and_replace (void)
>      }
>  }
>
> -static unsigned
> -execute_strength_reduction (void)
> +namespace {
> +
> +const pass_data pass_data_strength_reduction =
> +{
> +  GIMPLE_PASS, /* type */
> +  "slsr", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_GIMPLE_SLSR, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  TODO_verify_ssa, /* todo_flags_finish */
> +};
> +
> +class pass_strength_reduction : public gimple_opt_pass
> +{
> +public:
> +  pass_strength_reduction (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_strength_reduction, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *) { return flag_tree_slsr; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_strength_reduction
> +
> +unsigned
> +pass_strength_reduction::execute (function *fun)
>  {
>    /* Create the obstack where candidates will reside.  */
>    gcc_obstack_init (&cand_obstack);
> @@ -3622,7 +3651,7 @@ execute_strength_reduction (void)
>    /* Walk the CFG in predominator order looking for strength reduction
>       candidates.  */
>    find_candidates_dom_walker (CDI_DOMINATORS)
> -    .walk (cfun->cfg->x_entry_block_ptr);
> +    .walk (fun->cfg->x_entry_block_ptr);
>
>    if (dump_file && (dump_flags & TDF_DETAILS))
>      {
> @@ -3646,35 +3675,6 @@ execute_strength_reduction (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_strength_reduction =
> -{
> -  GIMPLE_PASS, /* type */
> -  "slsr", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_GIMPLE_SLSR, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  TODO_verify_ssa, /* todo_flags_finish */
> -};
> -
> -class pass_strength_reduction : public gimple_opt_pass
> -{
> -public:
> -  pass_strength_reduction (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_strength_reduction, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *) { return flag_tree_slsr; }
> -  unsigned int execute () { return execute_strength_reduction (); }
> -
> -}; // class pass_strength_reduction
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/graphite.c b/gcc/graphite.c
> index 68c9390..2e1f439 100644
> --- a/gcc/graphite.c
> +++ b/gcc/graphite.c
> @@ -411,7 +411,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return gate_graphite_transforms (); }
> -  unsigned int execute () { return graphite_transforms (); }
> +  virtual unsigned int execute (function *) { return graphite_transforms (); }
>
>  }; // class pass_graphite_transforms
>
> diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
> index 657b585..e8a9fec 100644
> --- a/gcc/ifcvt.c
> +++ b/gcc/ifcvt.c
> @@ -4560,7 +4560,10 @@ public:
>        return (optimize > 0) && dbg_cnt (if_conversion);
>      }
>
> -  unsigned int execute () { return rest_of_handle_if_conversion (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_if_conversion ();
> +    }
>
>  }; // class pass_rtl_ifcvt
>
> @@ -4575,12 +4578,6 @@ make_pass_rtl_ifcvt (gcc::context *ctxt)
>
>  /* Rerun if-conversion, as combine may have simplified things enough
>     to now meet sequence length restrictions.  */
> -static unsigned int
> -rest_of_handle_if_after_combine (void)
> -{
> -  if_convert (true);
> -  return 0;
> -}
>
>  namespace {
>
> @@ -4612,7 +4609,11 @@ public:
>         && dbg_cnt (if_after_combine);
>      }
>
> -  unsigned int execute () { return rest_of_handle_if_after_combine (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      if_convert (true);
> +      return 0;
> +    }
>
>  }; // class pass_if_after_combine
>
> @@ -4625,14 +4626,6 @@ make_pass_if_after_combine (gcc::context *ctxt)
>  }
>
>
> -static unsigned int
> -rest_of_handle_if_after_reload (void)
> -{
> -  if_convert (true);
> -  return 0;
> -}
> -
> -
>  namespace {
>
>  const pass_data pass_data_if_after_reload =
> @@ -4663,7 +4656,11 @@ public:
>         && dbg_cnt (if_after_reload);
>      }
>
> -  unsigned int execute () { return rest_of_handle_if_after_reload (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      if_convert (true);
> +      return 0;
> +    }
>
>  }; // class pass_if_after_reload
>
> diff --git a/gcc/init-regs.c b/gcc/init-regs.c
> index 2025b77..59c5bc9 100644
> --- a/gcc/init-regs.c
> +++ b/gcc/init-regs.c
> @@ -125,13 +125,6 @@ initialize_uninitialized_regs (void)
>    BITMAP_FREE (already_genned);
>  }
>
> -static unsigned int
> -rest_of_handle_initialize_regs (void)
> -{
> -  initialize_uninitialized_regs ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_initialize_regs =
> @@ -157,7 +150,11 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return optimize > 0; }
> -  unsigned int execute () { return rest_of_handle_initialize_regs (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      initialize_uninitialized_regs ();
> +      return 0;
> +    }
>
>  }; // class pass_initialize_regs
>
> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
> index ee48fc0..479963c 100644
> --- a/gcc/ipa-cp.c
> +++ b/gcc/ipa-cp.c
> @@ -3804,7 +3804,7 @@ public:
>        return flag_ipa_cp && optimize;
>      }
>
> -  unsigned int execute () { return ipcp_driver (); }
> +  virtual unsigned int execute (function *) { return ipcp_driver (); }
>
>  }; // class pass_ipa_cp
>
> diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
> index 3bc6815..6c5e566 100644
> --- a/gcc/ipa-devirt.c
> +++ b/gcc/ipa-devirt.c
> @@ -1951,7 +1951,7 @@ public:
>               && optimize);
>      }
>
> -  unsigned int execute () { return ipa_devirt (); }
> +  virtual unsigned int execute (function *) { return ipa_devirt (); }
>
>  }; // class pass_ipa_devirt
>
> diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
> index 8783caa..c471e0c 100644
> --- a/gcc/ipa-inline-analysis.c
> +++ b/gcc/ipa-inline-analysis.c
> @@ -2938,9 +2938,10 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_inline_parameters (m_ctxt); }
> -  unsigned int execute () {
> -    return compute_inline_parameters_for_current ();
> -  }
> +  virtual unsigned int execute (function *)
> +    {
> +      return compute_inline_parameters_for_current ();
> +    }
>
>  }; // class pass_inline_parameters
>
> diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
> index da02afc..83a836a 100644
> --- a/gcc/ipa-inline.c
> +++ b/gcc/ipa-inline.c
> @@ -2231,8 +2231,37 @@ early_inline_small_functions (struct cgraph_node *node)
>  /* Do inlining of small functions.  Doing so early helps profiling and other
>     passes to be somewhat more effective and avoids some code duplication in
>     later real inlining pass for testcases with very many function calls.  */
> -static unsigned int
> -early_inliner (void)
> +
> +namespace {
> +
> +const pass_data pass_data_early_inline =
> +{
> +  GIMPLE_PASS, /* type */
> +  "einline", /* name */
> +  OPTGROUP_INLINE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_EARLY_INLINING, /* tv_id */
> +  PROP_ssa, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_early_inline : public gimple_opt_pass
> +{
> +public:
> +  pass_early_inline (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_early_inline, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_early_inline
> +
> +unsigned int
> +pass_early_inline::execute (function *fun)
>  {
>    struct cgraph_node *node = cgraph_get_node (current_function_decl);
>    struct cgraph_edge *edge;
> @@ -2328,39 +2357,11 @@ early_inliner (void)
>        timevar_pop (TV_INTEGRATION);
>      }
>
> -  cfun->always_inline_functions_inlined = true;
> +  fun->always_inline_functions_inlined = true;
>
>    return todo;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_early_inline =
> -{
> -  GIMPLE_PASS, /* type */
> -  "einline", /* name */
> -  OPTGROUP_INLINE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_EARLY_INLINING, /* tv_id */
> -  PROP_ssa, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_early_inline : public gimple_opt_pass
> -{
> -public:
> -  pass_early_inline (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_early_inline, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  unsigned int execute () { return early_inliner (); }
> -
> -}; // class pass_early_inline
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -2402,7 +2403,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return ipa_inline (); }
> +  virtual unsigned int execute (function *) { return ipa_inline (); }
>
>  }; // class pass_ipa_inline
>
> diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
> index 7b58716..71bd61b 100644
> --- a/gcc/ipa-profile.c
> +++ b/gcc/ipa-profile.c
> @@ -745,7 +745,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_ipa_profile; }
> -  unsigned int execute () { return ipa_profile (); }
> +  virtual unsigned int execute (function *) { return ipa_profile (); }
>
>  }; // class pass_ipa_profile
>
> diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
> index eab7633..0ebfe5d 100644
> --- a/gcc/ipa-pure-const.c
> +++ b/gcc/ipa-pure-const.c
> @@ -1542,7 +1542,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return gate_pure_const (); }
> -  unsigned int execute () { return propagate (); }
> +  virtual unsigned int execute (function *) { return propagate (); }
>
>  }; // class pass_ipa_pure_const
>
> @@ -1581,8 +1581,38 @@ skip_function_for_local_pure_const (struct cgraph_node *node)
>     ipa_pure_const.   This pass is effective when executed together with
>     other optimization passes in early optimization pass queue.  */
>
> -static unsigned int
> -local_pure_const (void)
> +namespace {
> +
> +const pass_data pass_data_local_pure_const =
> +{
> +  GIMPLE_PASS, /* type */
> +  "local-pure-const", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_IPA_PURE_CONST, /* tv_id */
> +  0, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_local_pure_const : public gimple_opt_pass
> +{
> +public:
> +  pass_local_pure_const (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_local_pure_const, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  opt_pass * clone () { return new pass_local_pure_const (m_ctxt); }
> +  virtual bool gate (function *) { return gate_pure_const (); }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_local_pure_const
> +
> +unsigned int
> +pass_local_pure_const::execute (function *fun)
>  {
>    bool changed = false;
>    funct_state l;
> @@ -1600,17 +1630,17 @@ local_pure_const (void)
>
>    /* Do NORETURN discovery.  */
>    if (!skip && !TREE_THIS_VOLATILE (current_function_decl)
> -      && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) == 0)
> +      && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) == 0)
>      {
> -      warn_function_noreturn (cfun->decl);
> +      warn_function_noreturn (fun->decl);
>        if (dump_file)
> -        fprintf (dump_file, "Function found to be noreturn: %s\n",
> -                current_function_name ());
> +       fprintf (dump_file, "Function found to be noreturn: %s\n",
> +                current_function_name ());
>
>        /* Update declaration and reduce profile to executed once.  */
>        TREE_THIS_VOLATILE (current_function_decl) = 1;
>        if (node->frequency > NODE_FREQUENCY_EXECUTED_ONCE)
> -        node->frequency = NODE_FREQUENCY_EXECUTED_ONCE;
> +       node->frequency = NODE_FREQUENCY_EXECUTED_ONCE;
>
>        changed = true;
>      }
> @@ -1691,36 +1721,6 @@ local_pure_const (void)
>      return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_local_pure_const =
> -{
> -  GIMPLE_PASS, /* type */
> -  "local-pure-const", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_IPA_PURE_CONST, /* tv_id */
> -  0, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_local_pure_const : public gimple_opt_pass
> -{
> -public:
> -  pass_local_pure_const (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_local_pure_const, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_local_pure_const (m_ctxt); }
> -  virtual bool gate (function *) { return gate_pure_const (); }
> -  unsigned int execute () { return local_pure_const (); }
> -
> -}; // class pass_local_pure_const
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -1731,15 +1731,6 @@ make_pass_local_pure_const (gcc::context *ctxt)
>
>  /* Emit noreturn warnings.  */
>
> -static unsigned int
> -execute_warn_function_noreturn (void)
> -{
> -  if (!TREE_THIS_VOLATILE (current_function_decl)
> -      && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) == 0)
> -    warn_function_noreturn (current_function_decl);
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_warn_function_noreturn =
> @@ -1765,7 +1756,13 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return warn_suggest_attribute_noreturn; }
> -  unsigned int execute () { return execute_warn_function_noreturn (); }
> +  virtual unsigned int execute (function *fun)
> +    {
> +      if (!TREE_THIS_VOLATILE (current_function_decl)
> +         && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) == 0)
> +       warn_function_noreturn (current_function_decl);
> +      return 0;
> +    }
>
>  }; // class pass_warn_function_noreturn
>
> diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
> index 51a57ac..dc1169d 100644
> --- a/gcc/ipa-reference.c
> +++ b/gcc/ipa-reference.c
> @@ -1190,7 +1190,7 @@ public:
>               && !seen_error ());
>      }
>
> -  unsigned int execute () { return propagate (); }
> +  virtual unsigned int execute (function *) { return propagate (); }
>
>  }; // class pass_ipa_reference
>
> diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
> index 187dc98..eefa195 100644
> --- a/gcc/ipa-split.c
> +++ b/gcc/ipa-split.c
> @@ -1671,7 +1671,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return execute_split_functions (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return execute_split_functions ();
> +    }
>
>  }; // class pass_split_functions
>
> @@ -1728,7 +1731,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return execute_feedback_split_functions (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return execute_feedback_split_functions ();
> +    }
>
>  }; // class pass_feedback_split_functions
>
> diff --git a/gcc/ipa.c b/gcc/ipa.c
> index 7af2584..e6e59fd 100644
> --- a/gcc/ipa.c
> +++ b/gcc/ipa.c
> @@ -1182,12 +1182,6 @@ function_and_variable_visibility (bool whole_program)
>  /* Local function pass handling visibilities.  This happens before LTO streaming
>     so in particular -fwhole-program should be ignored at this level.  */
>
> -static unsigned int
> -local_function_and_variable_visibility (void)
> -{
> -  return function_and_variable_visibility (flag_whole_program && !flag_lto);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ipa_function_and_variable_visibility =
> @@ -1213,9 +1207,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () {
> -    return local_function_and_variable_visibility ();
> -  }
> +  virtual unsigned int execute (function *)
> +    {
> +      return function_and_variable_visibility (flag_whole_program && !flag_lto);
> +    }
>
>  }; // class pass_ipa_function_and_variable_visibility
>
> @@ -1229,13 +1224,6 @@ make_pass_ipa_function_and_variable_visibility (gcc::context *ctxt)
>
>  /* Free inline summary.  */
>
> -static unsigned
> -free_inline_summary (void)
> -{
> -  inline_free_summary ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_ipa_free_inline_summary =
> @@ -1260,7 +1248,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return free_inline_summary (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      inline_free_summary ();
> +      return 0;
> +    }
>
>  }; // class pass_ipa_free_inline_summary
>
> @@ -1322,9 +1314,10 @@ public:
>        /* Do not re-run on ltrans stage.  */
>        return !flag_ltrans;
>      }
> -  unsigned int execute () {
> -    return whole_program_function_and_variable_visibility ();
> -  }
> +  virtual unsigned int execute (function *)
> +    {
> +      return whole_program_function_and_variable_visibility ();
> +    }
>
>  }; // class pass_ipa_whole_program_visibility
>
> @@ -1642,7 +1635,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return ipa_cdtor_merge (); }
> +  virtual unsigned int execute (function *) { return ipa_cdtor_merge (); }
>
>  }; // class pass_ipa_cdtor_merge
>
> diff --git a/gcc/ira.c b/gcc/ira.c
> index da0f453..d973001 100644
> --- a/gcc/ira.c
> +++ b/gcc/ira.c
> @@ -5548,12 +5548,6 @@ do_reload (void)
>  }
>
>  /* Run the integrated register allocator.  */
> -static unsigned int
> -rest_of_handle_ira (void)
> -{
> -  ira (dump_file);
> -  return 0;
> -}
>
>  namespace {
>
> @@ -5579,7 +5573,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_handle_ira (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      ira (dump_file);
> +      return 0;
> +    }
>
>  }; // class pass_ira
>
> @@ -5591,13 +5589,6 @@ make_pass_ira (gcc::context *ctxt)
>    return new pass_ira (ctxt);
>  }
>
> -static unsigned int
> -rest_of_handle_reload (void)
> -{
> -  do_reload ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_reload =
> @@ -5622,7 +5613,11 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_handle_reload (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      do_reload ();
> +      return 0;
> +    }
>
>  }; // class pass_reload
>
> diff --git a/gcc/jump.c b/gcc/jump.c
> index 7361101..cdea8d5 100644
> --- a/gcc/jump.c
> +++ b/gcc/jump.c
> @@ -163,7 +163,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return cleanup_barriers (); }
> +  virtual unsigned int execute (function *) { return cleanup_barriers (); }
>
>  }; // class pass_cleanup_barriers
>
> diff --git a/gcc/loop-init.c b/gcc/loop-init.c
> index 6da29d3..90453f6 100644
> --- a/gcc/loop-init.c
> +++ b/gcc/loop-init.c
> @@ -390,7 +390,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rtl_loop_init (); }
> +  virtual unsigned int execute (function *) { return rtl_loop_init (); }
>
>  }; // class pass_rtl_loop_init
>
> @@ -405,24 +405,6 @@ make_pass_rtl_loop_init (gcc::context *ctxt)
>
>  /* Finalization of the RTL loop passes.  */
>
> -static unsigned int
> -rtl_loop_done (void)
> -{
> -  /* No longer preserve loops, remove them now.  */
> -  cfun->curr_properties &= ~PROP_loops;
> -  loop_optimizer_finalize ();
> -  free_dominance_info (CDI_DOMINATORS);
> -
> -  cleanup_cfg (0);
> -  if (dump_file)
> -    {
> -      dump_reg_info (dump_file);
> -      dump_flow_info (dump_file, dump_flags);
> -    }
> -
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_rtl_loop_done =
> @@ -447,10 +429,28 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rtl_loop_done (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_rtl_loop_done
>
> +unsigned int
> +pass_rtl_loop_done::execute (function *fun)
> +{
> +  /* No longer preserve loops, remove them now.  */
> +  fun->curr_properties &= ~PROP_loops;
> +  loop_optimizer_finalize ();
> +  free_dominance_info (CDI_DOMINATORS);
> +
> +  cleanup_cfg (0);
> +  if (dump_file)
> +    {
> +      dump_reg_info (dump_file);
> +      dump_flow_info (dump_file, dump_flags);
> +    }
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -461,13 +461,6 @@ make_pass_rtl_loop_done (gcc::context *ctxt)
>
>
>  /* Loop invariant code motion.  */
> -static unsigned int
> -rtl_move_loop_invariants (void)
> -{
> -  if (number_of_loops (cfun) > 1)
> -    move_loop_invariants ();
> -  return 0;
> -}
>
>  namespace {
>
> @@ -495,7 +488,12 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_move_loop_invariants; }
> -  unsigned int execute () { return rtl_move_loop_invariants (); }
> +  virtual unsigned int execute (function *fun)
> +    {
> +      if (number_of_loops (fun) > 1)
> +       move_loop_invariants ();
> +      return 0;
> +    }
>
>  }; // class pass_rtl_move_loop_invariants
>
> @@ -508,14 +506,6 @@ make_pass_rtl_move_loop_invariants (gcc::context *ctxt)
>  }
>
>
> -static unsigned int
> -rtl_unswitch (void)
> -{
> -  if (number_of_loops (cfun) > 1)
> -    unswitch_loops ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_rtl_unswitch =
> @@ -541,7 +531,12 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_unswitch_loops; }
> -  unsigned int execute () { return rtl_unswitch (); }
> +  virtual unsigned int execute (function *fun)
> +    {
> +      if (number_of_loops (fun) > 1)
> +       unswitch_loops ();
> +      return 0;
> +    }
>
>  }; // class pass_rtl_unswitch
>
> @@ -554,27 +549,6 @@ make_pass_rtl_unswitch (gcc::context *ctxt)
>  }
>
>
> -static unsigned int
> -rtl_unroll_and_peel_loops (void)
> -{
> -  if (number_of_loops (cfun) > 1)
> -    {
> -      int flags = 0;
> -      if (dump_file)
> -       df_dump (dump_file);
> -
> -      if (flag_peel_loops)
> -       flags |= UAP_PEEL;
> -      if (flag_unroll_loops)
> -       flags |= UAP_UNROLL;
> -      if (flag_unroll_all_loops)
> -       flags |= UAP_UNROLL_ALL;
> -
> -      unroll_and_peel_loops (flags);
> -    }
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_rtl_unroll_and_peel_loops =
> @@ -604,10 +578,31 @@ public:
>        return (flag_peel_loops || flag_unroll_loops || flag_unroll_all_loops);
>      }
>
> -  unsigned int execute () { return rtl_unroll_and_peel_loops (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_rtl_unroll_and_peel_loops
>
> +unsigned int
> +pass_rtl_unroll_and_peel_loops::execute (function *fun)
> +{
> +  if (number_of_loops (fun) > 1)
> +    {
> +      int flags = 0;
> +      if (dump_file)
> +       df_dump (dump_file);
> +
> +      if (flag_peel_loops)
> +       flags |= UAP_PEEL;
> +      if (flag_unroll_loops)
> +       flags |= UAP_UNROLL;
> +      if (flag_unroll_all_loops)
> +       flags |= UAP_UNROLL_ALL;
> +
> +      unroll_and_peel_loops (flags);
> +    }
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> @@ -617,16 +612,6 @@ make_pass_rtl_unroll_and_peel_loops (gcc::context *ctxt)
>  }
>
>
> -static unsigned int
> -rtl_doloop (void)
> -{
> -#ifdef HAVE_doloop_end
> -  if (number_of_loops (cfun) > 1)
> -    doloop_optimize_loops ();
> -#endif
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_rtl_doloop =
> @@ -652,7 +637,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return rtl_doloop (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_rtl_doloop
>
> @@ -666,6 +651,16 @@ pass_rtl_doloop::gate (function *)
>  #endif
>  }
>
> +unsigned int
> +pass_rtl_doloop::execute (function *fun ATTRIBUTE_UNUSED)
> +{
> +#ifdef HAVE_doloop_end
> +  if (number_of_loops (fun) > 1)
> +    doloop_optimize_loops ();
> +#endif
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
> index 89d9763..bdad2a6 100644
> --- a/gcc/lower-subreg.c
> +++ b/gcc/lower-subreg.c
> @@ -1689,22 +1689,6 @@ decompose_multiword_subregs (bool decompose_copies)
>
>  /* Implement first lower subreg pass.  */
>
> -static unsigned int
> -rest_of_handle_lower_subreg (void)
> -{
> -  decompose_multiword_subregs (false);
> -  return 0;
> -}
> -
> -/* Implement second lower subreg pass.  */
> -
> -static unsigned int
> -rest_of_handle_lower_subreg2 (void)
> -{
> -  decompose_multiword_subregs (true);
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_lower_subreg =
> @@ -1730,7 +1714,11 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_split_wide_types != 0; }
> -  unsigned int execute () { return rest_of_handle_lower_subreg (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      decompose_multiword_subregs (false);
> +      return 0;
> +    }
>
>  }; // class pass_lower_subreg
>
> @@ -1742,6 +1730,8 @@ make_pass_lower_subreg (gcc::context *ctxt)
>    return new pass_lower_subreg (ctxt);
>  }
>
> +/* Implement second lower subreg pass.  */
> +
>  namespace {
>
>  const pass_data pass_data_lower_subreg2 =
> @@ -1768,7 +1758,11 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_split_wide_types != 0; }
> -  unsigned int execute () { return rest_of_handle_lower_subreg2 (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      decompose_multiword_subregs (true);
> +      return 0;
> +    }
>
>  }; // class pass_lower_subreg2
>
> diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
> index e73d6ee..b132cba 100644
> --- a/gcc/mode-switching.c
> +++ b/gcc/mode-switching.c
> @@ -789,16 +789,6 @@ optimize_mode_switching (void)
>
>  #endif /* OPTIMIZE_MODE_SWITCHING */
>
> -static unsigned int
> -rest_of_handle_mode_switching (void)
> -{
> -#ifdef OPTIMIZE_MODE_SWITCHING
> -  optimize_mode_switching ();
> -#endif /* OPTIMIZE_MODE_SWITCHING */
> -  return 0;
> -}
> -
> -
>  namespace {
>
>  const pass_data pass_data_mode_switching =
> @@ -835,7 +825,13 @@ public:
>  #endif
>      }
>
> -  unsigned int execute () { return rest_of_handle_mode_switching (); }
> +  virtual unsigned int execute (function *)
> +    {
> +#ifdef OPTIMIZE_MODE_SWITCHING
> +      optimize_mode_switching ();
> +#endif /* OPTIMIZE_MODE_SWITCHING */
> +      return 0;
> +    }
>
>  }; // class pass_mode_switching
>
> diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
> index 20e2e62..2e454f5 100644
> --- a/gcc/modulo-sched.c
> +++ b/gcc/modulo-sched.c
> @@ -3325,28 +3325,6 @@ rotate_partial_schedule (partial_schedule_ptr ps, int start_cycle)
>
>  /* Run instruction scheduler.  */
>  /* Perform SMS module scheduling.  */
> -static unsigned int
> -rest_of_handle_sms (void)
> -{
> -#ifdef INSN_SCHEDULING
> -  basic_block bb;
> -
> -  /* Collect loop information to be used in SMS.  */
> -  cfg_layout_initialize (0);
> -  sms_schedule ();
> -
> -  /* Update the life information, because we add pseudos.  */
> -  max_regno = max_reg_num ();
> -
> -  /* Finalize layout changes.  */
> -  FOR_EACH_BB_FN (bb, cfun)
> -    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
> -      bb->aux = bb->next_bb;
> -  free_dominance_info (CDI_DOMINATORS);
> -  cfg_layout_finalize ();
> -#endif /* INSN_SCHEDULING */
> -  return 0;
> -}
>
>  namespace {
>
> @@ -3378,10 +3356,33 @@ public:
>    return (optimize > 0 && flag_modulo_sched);
>  }
>
> -  unsigned int execute () { return rest_of_handle_sms (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_sms
>
> +unsigned int
> +pass_sms::execute (function *fun ATTRIBUTE_UNUSED)
> +{
> +#ifdef INSN_SCHEDULING
> +  basic_block bb;
> +
> +  /* Collect loop information to be used in SMS.  */
> +  cfg_layout_initialize (0);
> +  sms_schedule ();
> +
> +  /* Update the life information, because we add pseudos.  */
> +  max_regno = max_reg_num ();
> +
> +  /* Finalize layout changes.  */
> +  FOR_EACH_BB_FN (bb, fun)
> +    if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (fun))
> +      bb->aux = bb->next_bb;
> +  free_dominance_info (CDI_DOMINATORS);
> +  cfg_layout_finalize ();
> +#endif /* INSN_SCHEDULING */
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> index 0e96b88..0a46fb7 100644
> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -8356,7 +8356,7 @@ public:
>                || flag_cilkplus != 0) && !seen_error ());
>      }
>
> -  unsigned int execute () { return execute_expand_omp (); }
> +  virtual unsigned int execute (function *) { return execute_expand_omp (); }
>
>  }; // class pass_expand_omp
>
> @@ -10215,7 +10215,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return execute_lower_omp (); }
> +  virtual unsigned int execute (function *) { return execute_lower_omp (); }
>
>  }; // class pass_lower_omp
>
> @@ -10640,9 +10640,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_openmp || flag_cilkplus; }
> -  unsigned int execute () {
> -    return diagnose_omp_structured_block_errors ();
> -  }
> +  virtual unsigned int execute (function *)
> +    {
> +      return diagnose_omp_structured_block_errors ();
> +    }
>
>  }; // class pass_diagnose_omp_blocks
>
> @@ -11804,7 +11805,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return ipa_omp_simd_clone (); }
> +  virtual unsigned int execute (function *) { return ipa_omp_simd_clone (); }
>  };
>
>  bool
> diff --git a/gcc/passes.c b/gcc/passes.c
> index b71c11e..2be7856 100644
> --- a/gcc/passes.c
> +++ b/gcc/passes.c
> @@ -114,7 +114,7 @@ opt_pass::gate (function *)
>  }
>
>  unsigned int
> -opt_pass::execute ()
> +opt_pass::execute (function *)
>  {
>    return 0;
>  }
> @@ -138,7 +138,7 @@ pass_manager::execute_early_local_passes ()
>  unsigned int
>  pass_manager::execute_pass_mode_switching ()
>  {
> -  return pass_mode_switching_1->execute ();
> +  return pass_mode_switching_1->execute (cfun);
>  }
>
>
> @@ -367,7 +367,10 @@ public:
>        return (!seen_error () && !in_lto_p);
>      }
>
> -  unsigned int execute () { return execute_all_early_local_passes (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return execute_all_early_local_passes ();
> +    }
>
>  }; // class pass_early_local_passes
>
> @@ -2153,7 +2156,7 @@ execute_one_pass (opt_pass *pass)
>    /* Do it!  */
>    if (pass->has_execute)
>      {
> -      todo_after = pass->execute ();
> +      todo_after = pass->execute (cfun);
>        do_per_function (clear_last_verified, NULL);
>      }
>
> diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
> index 8a804fb..f5d5363 100644
> --- a/gcc/postreload-gcse.c
> +++ b/gcc/postreload-gcse.c
> @@ -1347,7 +1347,7 @@ public:
>               && optimize_function_for_speed_p (fun));
>      }
>
> -  unsigned int execute () { return rest_of_handle_gcse2 (); }
> +  virtual unsigned int execute (function *) { return rest_of_handle_gcse2 (); }
>
>  }; // class pass_gcse2
>
> diff --git a/gcc/postreload.c b/gcc/postreload.c
> index 0568c53..b093287 100644
> --- a/gcc/postreload.c
> +++ b/gcc/postreload.c
> @@ -2315,23 +2315,6 @@ move2add_note_store (rtx dst, const_rtx set, void *data)
>      }
>  }
>
> -static unsigned int
> -rest_of_handle_postreload (void)
> -{
> -  if (!dbg_cnt (postreload_cse))
> -    return 0;
> -
> -  /* Do a very simple CSE pass over just the hard registers.  */
> -  reload_cse_regs (get_insns ());
> -  /* Reload_cse_regs can eliminate potentially-trapping MEMs.
> -     Remove any EH edges associated with them.  */
> -  if (cfun->can_throw_non_call_exceptions
> -      && purge_all_dead_edges ())
> -    cleanup_cfg (0);
> -
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_postreload_cse =
> @@ -2358,10 +2341,27 @@ public:
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return (optimize > 0 && reload_completed); }
>
> -  unsigned int execute () { return rest_of_handle_postreload (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_postreload_cse
>
> +unsigned int
> +pass_postreload_cse::execute (function *fun)
> +{
> +  if (!dbg_cnt (postreload_cse))
> +    return 0;
> +
> +  /* Do a very simple CSE pass over just the hard registers.  */
> +  reload_cse_regs (get_insns ());
> +  /* Reload_cse_regs can eliminate potentially-trapping MEMs.
> +     Remove any EH edges associated with them.  */
> +  if (fun->can_throw_non_call_exceptions
> +      && purge_all_dead_edges ())
> +    cleanup_cfg (0);
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/predict.c b/gcc/predict.c
> index 068c187..a847ec6 100644
> --- a/gcc/predict.c
> +++ b/gcc/predict.c
> @@ -1986,59 +1986,6 @@ expr_expected_value (tree expr, bitmap visited,
>    return expr_expected_value_1 (TREE_TYPE (expr),
>                                 op0, code, op1, visited, predictor);
>  }
> -
> -
> -/* Get rid of all builtin_expect calls and GIMPLE_PREDICT statements
> -   we no longer need.  */
> -static unsigned int
> -strip_predict_hints (void)
> -{
> -  basic_block bb;
> -  gimple ass_stmt;
> -  tree var;
> -
> -  FOR_EACH_BB_FN (bb, cfun)
> -    {
> -      gimple_stmt_iterator bi;
> -      for (bi = gsi_start_bb (bb); !gsi_end_p (bi);)
> -       {
> -         gimple stmt = gsi_stmt (bi);
> -
> -         if (gimple_code (stmt) == GIMPLE_PREDICT)
> -           {
> -             gsi_remove (&bi, true);
> -             continue;
> -           }
> -         else if (is_gimple_call (stmt))
> -           {
> -             tree fndecl = gimple_call_fndecl (stmt);
> -
> -             if ((fndecl
> -                  && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
> -                  && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
> -                  && gimple_call_num_args (stmt) == 2)
> -                 || (gimple_call_internal_p (stmt)
> -                     && gimple_call_internal_fn (stmt) == IFN_BUILTIN_EXPECT))
> -               {
> -                 var = gimple_call_lhs (stmt);
> -                 if (var)
> -                   {
> -                     ass_stmt
> -                       = gimple_build_assign (var, gimple_call_arg (stmt, 0));
> -                     gsi_replace (&bi, ass_stmt, true);
> -                   }
> -                 else
> -                   {
> -                     gsi_remove (&bi, true);
> -                     continue;
> -                   }
> -               }
> -           }
> -         gsi_next (&bi);
> -       }
> -    }
> -  return 0;
> -}
>
>  /* Predict using opcode of the last statement in basic block.  */
>  static void
> @@ -2468,37 +2415,6 @@ tree_estimate_probability (void)
>    free_dominance_info (CDI_POST_DOMINATORS);
>    remove_fake_exit_edges ();
>  }
> -
> -/* Predict branch probabilities and estimate profile of the tree CFG.
> -   This is the driver function for PASS_PROFILE.  */
> -
> -static unsigned int
> -tree_estimate_probability_driver (void)
> -{
> -  unsigned nb_loops;
> -
> -  loop_optimizer_init (LOOPS_NORMAL);
> -  if (dump_file && (dump_flags & TDF_DETAILS))
> -    flow_loops_dump (dump_file, NULL, 0);
> -
> -  mark_irreducible_loops ();
> -
> -  nb_loops = number_of_loops (cfun);
> -  if (nb_loops > 1)
> -    scev_initialize ();
> -
> -  tree_estimate_probability ();
> -
> -  if (nb_loops > 1)
> -    scev_finalize ();
> -
> -  loop_optimizer_finalize ();
> -  if (dump_file && (dump_flags & TDF_DETAILS))
> -    gimple_dump_cfg (dump_file, dump_flags);
> -  if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
> -    profile_status_for_fn (cfun) = PROFILE_GUESSED;
> -  return 0;
> -}
>
>  /* Predict edges to successors of CUR whose sources are not postdominated by
>     BB by PRED and recurse to all postdominators.  */
> @@ -3147,6 +3063,8 @@ predictor_name (enum br_predictor predictor)
>    return predictor_info[predictor].name;
>  }
>
> +/* Predict branch probabilities and estimate profile of the tree CFG. */
> +
>  namespace {
>
>  const pass_data pass_data_profile =
> @@ -3172,10 +3090,38 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_guess_branch_prob; }
> -  unsigned int execute () { return tree_estimate_probability_driver (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_profile
>
> +unsigned int
> +pass_profile::execute (function *fun)
> +{
> +  unsigned nb_loops;
> +
> +  loop_optimizer_init (LOOPS_NORMAL);
> +  if (dump_file && (dump_flags & TDF_DETAILS))
> +    flow_loops_dump (dump_file, NULL, 0);
> +
> +  mark_irreducible_loops ();
> +
> +  nb_loops = number_of_loops (fun);
> +  if (nb_loops > 1)
> +    scev_initialize ();
> +
> +  tree_estimate_probability ();
> +
> +  if (nb_loops > 1)
> +    scev_finalize ();
> +
> +  loop_optimizer_finalize ();
> +  if (dump_file && (dump_flags & TDF_DETAILS))
> +    gimple_dump_cfg (dump_file, dump_flags);
> + if (profile_status_for_fn (fun) == PROFILE_ABSENT)
> +    profile_status_for_fn (fun) = PROFILE_GUESSED;
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -3209,10 +3155,62 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_strip_predict_hints (m_ctxt); }
> -  unsigned int execute () { return strip_predict_hints (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_strip_predict_hints
>
> +/* Get rid of all builtin_expect calls and GIMPLE_PREDICT statements
> +   we no longer need.  */
> +unsigned int
> +pass_strip_predict_hints::execute (function *fun)
> +{
> +  basic_block bb;
> +  gimple ass_stmt;
> +  tree var;
> +
> +  FOR_EACH_BB_FN (bb, fun)
> +    {
> +      gimple_stmt_iterator bi;
> +      for (bi = gsi_start_bb (bb); !gsi_end_p (bi);)
> +       {
> +         gimple stmt = gsi_stmt (bi);
> +
> +         if (gimple_code (stmt) == GIMPLE_PREDICT)
> +           {
> +             gsi_remove (&bi, true);
> +             continue;
> +           }
> +         else if (is_gimple_call (stmt))
> +           {
> +             tree fndecl = gimple_call_fndecl (stmt);
> +
> +             if ((fndecl
> +                  && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
> +                  && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
> +                  && gimple_call_num_args (stmt) == 2)
> +                 || (gimple_call_internal_p (stmt)
> +                     && gimple_call_internal_fn (stmt) == IFN_BUILTIN_EXPECT))
> +               {
> +                 var = gimple_call_lhs (stmt);
> +                 if (var)
> +                   {
> +                     ass_stmt
> +                       = gimple_build_assign (var, gimple_call_arg (stmt, 0));
> +                     gsi_replace (&bi, ass_stmt, true);
> +                   }
> +                 else
> +                   {
> +                     gsi_remove (&bi, true);
> +                     continue;
> +                   }
> +               }
> +           }
> +         gsi_next (&bi);
> +       }
> +    }
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/recog.c b/gcc/recog.c
> index 8afea7e..057f411 100644
> --- a/gcc/recog.c
> +++ b/gcc/recog.c
> @@ -3847,7 +3847,10 @@ public:
>       a clone method.  */
>    opt_pass * clone () { return new pass_peephole2 (m_ctxt); }
>    virtual bool gate (function *) { return (optimize > 0 && flag_peephole2); }
> -  unsigned int execute () { return rest_of_handle_peephole2 (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_peephole2 ();
> +    }
>
>  }; // class pass_peephole2
>
> @@ -3859,13 +3862,6 @@ make_pass_peephole2 (gcc::context *ctxt)
>    return new pass_peephole2 (ctxt);
>  }
>
> -static unsigned int
> -rest_of_handle_split_all_insns (void)
> -{
> -  split_all_insns ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_split_all_insns =
> @@ -3893,7 +3889,11 @@ public:
>    /* 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 (m_ctxt); }
> -  unsigned int execute () { return rest_of_handle_split_all_insns (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      split_all_insns ();
> +      return 0;
> +    }
>
>  }; // class pass_split_all_insns
>
> @@ -3940,7 +3940,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_handle_split_after_reload (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_split_after_reload ();
> +    }
>
>  }; // class pass_split_after_reload
>
> @@ -3952,13 +3955,6 @@ make_pass_split_after_reload (gcc::context *ctxt)
>    return new pass_split_after_reload (ctxt);
>  }
>
> -static unsigned int
> -rest_of_handle_split_before_regstack (void)
> -{
> -  split_all_insns ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_split_before_regstack =
> @@ -3984,9 +3980,11 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () {
> -    return rest_of_handle_split_before_regstack ();
> -  }
> +  virtual unsigned int execute (function *)
> +    {
> +      split_all_insns ();
> +      return 0;
> +    }
>
>  }; // class pass_split_before_regstack
>
> @@ -4058,7 +4056,10 @@ public:
>  #endif
>      }
>
> -  unsigned int execute () { return rest_of_handle_split_before_sched2 (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_split_before_sched2 ();
> +    }
>
>  }; // class pass_split_before_sched2
>
> @@ -4105,7 +4106,10 @@ public:
>  #endif
>      }
>
> -  unsigned int execute () { return split_all_insns_noflow (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return split_all_insns_noflow ();
> +    }
>
>  }; // class pass_split_for_shorten_branches
>
> diff --git a/gcc/ree.c b/gcc/ree.c
> index 435bb88..b471033 100644
> --- a/gcc/ree.c
> +++ b/gcc/ree.c
> @@ -1118,7 +1118,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return (optimize > 0 && flag_ree); }
> -  unsigned int execute () { return rest_of_handle_ree (); }
> +  virtual unsigned int execute (function *) { return rest_of_handle_ree (); }
>
>  }; // class pass_ree
>
> diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
> index f8f8658..7aa8a6b 100644
> --- a/gcc/reg-stack.c
> +++ b/gcc/reg-stack.c
> @@ -3364,7 +3364,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_handle_stack_regs (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_stack_regs ();
> +    }
>
>  }; // class pass_stack_regs_run
>
> diff --git a/gcc/regcprop.c b/gcc/regcprop.c
> index 24992e4..c1fbb65 100644
> --- a/gcc/regcprop.c
> +++ b/gcc/regcprop.c
> @@ -1056,93 +1056,6 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
>    return anything_changed;
>  }
>
> -/* Main entry point for the forward copy propagation optimization.  */
> -
> -static unsigned int
> -copyprop_hardreg_forward (void)
> -{
> -  struct value_data *all_vd;
> -  basic_block bb;
> -  sbitmap visited;
> -  bool analyze_called = false;
> -
> -  all_vd = XNEWVEC (struct value_data, last_basic_block_for_fn (cfun));
> -
> -  visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
> -  bitmap_clear (visited);
> -
> -  if (MAY_HAVE_DEBUG_INSNS)
> -    debug_insn_changes_pool
> -      = create_alloc_pool ("debug insn changes pool",
> -                          sizeof (struct queued_debug_insn_change), 256);
> -
> -  FOR_EACH_BB_FN (bb, cfun)
> -    {
> -      bitmap_set_bit (visited, bb->index);
> -
> -      /* If a block has a single predecessor, that we've already
> -        processed, begin with the value data that was live at
> -        the end of the predecessor block.  */
> -      /* ??? Ought to use more intelligent queuing of blocks.  */
> -      if (single_pred_p (bb)
> -         && bitmap_bit_p (visited, single_pred (bb)->index)
> -         && ! (single_pred_edge (bb)->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)))
> -       {
> -         all_vd[bb->index] = all_vd[single_pred (bb)->index];
> -         if (all_vd[bb->index].n_debug_insn_changes)
> -           {
> -             unsigned int regno;
> -
> -             for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
> -               {
> -                 if (all_vd[bb->index].e[regno].debug_insn_changes)
> -                   {
> -                     all_vd[bb->index].e[regno].debug_insn_changes = NULL;
> -                     if (--all_vd[bb->index].n_debug_insn_changes == 0)
> -                       break;
> -                   }
> -               }
> -           }
> -       }
> -      else
> -       init_value_data (all_vd + bb->index);
> -
> -      copyprop_hardreg_forward_1 (bb, all_vd + bb->index);
> -    }
> -
> -  if (MAY_HAVE_DEBUG_INSNS)
> -    {
> -      FOR_EACH_BB_FN (bb, cfun)
> -       if (bitmap_bit_p (visited, bb->index)
> -           && all_vd[bb->index].n_debug_insn_changes)
> -         {
> -           unsigned int regno;
> -           bitmap live;
> -
> -           if (!analyze_called)
> -             {
> -               df_analyze ();
> -               analyze_called = true;
> -             }
> -           live = df_get_live_out (bb);
> -           for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
> -             if (all_vd[bb->index].e[regno].debug_insn_changes)
> -               {
> -                 if (REGNO_REG_SET_P (live, regno))
> -                   apply_debug_insn_changes (all_vd + bb->index, regno);
> -                 if (all_vd[bb->index].n_debug_insn_changes == 0)
> -                   break;
> -               }
> -         }
> -
> -      free_alloc_pool (debug_insn_changes_pool);
> -    }
> -
> -  sbitmap_free (visited);
> -  free (all_vd);
> -  return 0;
> -}
> -
>  /* Dump the value chain data to stderr.  */
>
>  DEBUG_FUNCTION void
> @@ -1276,10 +1189,95 @@ public:
>        return (optimize > 0 && (flag_cprop_registers));
>      }
>
> -  unsigned int execute () { return copyprop_hardreg_forward (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_cprop_hardreg
>
> +unsigned int
> +pass_cprop_hardreg::execute (function *fun)
> +{
> +  struct value_data *all_vd;
> +  basic_block bb;
> +  sbitmap visited;
> +  bool analyze_called = false;
> +
> +  all_vd = XNEWVEC (struct value_data, last_basic_block_for_fn (fun));
> +
> +  visited = sbitmap_alloc (last_basic_block_for_fn (fun));
> +  bitmap_clear (visited);
> +
> +  if (MAY_HAVE_DEBUG_INSNS)
> +    debug_insn_changes_pool
> +      = create_alloc_pool ("debug insn changes pool",
> +                          sizeof (struct queued_debug_insn_change), 256);
> +
> +  FOR_EACH_BB_FN (bb, fun)
> +    {
> +      bitmap_set_bit (visited, bb->index);
> +
> +      /* If a block has a single predecessor, that we've already
> +        processed, begin with the value data that was live at
> +        the end of the predecessor block.  */
> +      /* ??? Ought to use more intelligent queuing of blocks.  */
> +      if (single_pred_p (bb)
> +         && bitmap_bit_p (visited, single_pred (bb)->index)
> +         && ! (single_pred_edge (bb)->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)))
> +       {
> +         all_vd[bb->index] = all_vd[single_pred (bb)->index];
> +         if (all_vd[bb->index].n_debug_insn_changes)
> +           {
> +             unsigned int regno;
> +
> +             for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
> +               {
> +                 if (all_vd[bb->index].e[regno].debug_insn_changes)
> +                   {
> +                     all_vd[bb->index].e[regno].debug_insn_changes = NULL;
> +                     if (--all_vd[bb->index].n_debug_insn_changes == 0)
> +                       break;
> +                   }
> +               }
> +           }
> +       }
> +      else
> +       init_value_data (all_vd + bb->index);
> +
> +      copyprop_hardreg_forward_1 (bb, all_vd + bb->index);
> +    }
> +
> +  if (MAY_HAVE_DEBUG_INSNS)
> +    {
> +      FOR_EACH_BB_FN (bb, fun)
> +       if (bitmap_bit_p (visited, bb->index)
> +           && all_vd[bb->index].n_debug_insn_changes)
> +         {
> +           unsigned int regno;
> +           bitmap live;
> +
> +           if (!analyze_called)
> +             {
> +               df_analyze ();
> +               analyze_called = true;
> +             }
> +           live = df_get_live_out (bb);
> +           for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
> +             if (all_vd[bb->index].e[regno].debug_insn_changes)
> +               {
> +                 if (REGNO_REG_SET_P (live, regno))
> +                   apply_debug_insn_changes (all_vd + bb->index, regno);
> +                 if (all_vd[bb->index].n_debug_insn_changes == 0)
> +                   break;
> +               }
> +         }
> +
> +      free_alloc_pool (debug_insn_changes_pool);
> +    }
> +
> +  sbitmap_free (visited);
> +  free (all_vd);
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/reginfo.c b/gcc/reginfo.c
> index 82b6081..42668a1 100644
> --- a/gcc/reginfo.c
> +++ b/gcc/reginfo.c
> @@ -985,7 +985,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return reginfo_init (); }
> +  virtual unsigned int execute (function *) { return reginfo_init (); }
>
>  }; // class pass_reginfo_init
>
> diff --git a/gcc/regrename.c b/gcc/regrename.c
> index 321d5bf..68e8ad7 100644
> --- a/gcc/regrename.c
> +++ b/gcc/regrename.c
> @@ -1865,7 +1865,7 @@ public:
>        return (optimize > 0 && (flag_rename_registers));
>      }
>
> -  unsigned int execute () { return regrename_optimize (); }
> +  virtual unsigned int execute (function *) { return regrename_optimize (); }
>
>  }; // class pass_regrename
>
> diff --git a/gcc/reorg.c b/gcc/reorg.c
> index 22f0b5a..95e942f 100644
> --- a/gcc/reorg.c
> +++ b/gcc/reorg.c
> @@ -3898,7 +3898,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return rest_of_handle_delay_slots (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_delay_slots ();
> +    }
>
>  }; // class pass_delay_slots
>
> @@ -3923,13 +3926,6 @@ make_pass_delay_slots (gcc::context *ctxt)
>
>  /* Machine dependent reorg pass.  */
>
> -static unsigned int
> -rest_of_handle_machine_reorg (void)
> -{
> -  targetm.machine_dependent_reorg ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_machine_reorg =
> @@ -3959,7 +3955,11 @@ public:
>        return targetm.machine_dependent_reorg != 0;
>      }
>
> -  unsigned int execute () { return rest_of_handle_machine_reorg (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      targetm.machine_dependent_reorg ();
> +      return 0;
> +    }
>
>  }; // class pass_machine_reorg
>
> diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
> index e0a80c2..ce3fe5d 100644
> --- a/gcc/sched-rgn.c
> +++ b/gcc/sched-rgn.c
> @@ -3677,7 +3677,10 @@ public:
>  #endif
>      }
>
> -  unsigned int execute () { return rest_of_handle_live_range_shrinkage (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_live_range_shrinkage ();
> +    }
>
>  }; // class pass_live_range_shrinkage
>
> @@ -3715,7 +3718,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return rest_of_handle_sched (); }
> +  virtual unsigned int execute (function *) { return rest_of_handle_sched (); }
>
>  }; // class pass_sched
>
> @@ -3763,7 +3766,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return rest_of_handle_sched2 (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return rest_of_handle_sched2 ();
> +    }
>
>  }; // class pass_sched2
>
> diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c
> index d1375a4..75bec2f 100644
> --- a/gcc/stack-ptr-mod.c
> +++ b/gcc/stack-ptr-mod.c
> @@ -48,48 +48,10 @@ notice_stack_pointer_modification_1 (rtx x, const_rtx pat ATTRIBUTE_UNUSED,
>      crtl->sp_is_unchanging = 0;
>  }
>
> -static void
> -notice_stack_pointer_modification (void)
> -{
> -  basic_block bb;
> -  rtx insn;
> -
> -  /* Assume that the stack pointer is unchanging if alloca hasn't
> -     been used.  */
> -  crtl->sp_is_unchanging = !cfun->calls_alloca;
> -  if (crtl->sp_is_unchanging)
> -    FOR_EACH_BB_FN (bb, cfun)
> -      FOR_BB_INSNS (bb, insn)
> -        {
> -         if (INSN_P (insn))
> -           {
> -             /* Check if insn modifies the stack pointer.  */
> -             note_stores (PATTERN (insn),
> -                          notice_stack_pointer_modification_1,
> -                          NULL);
> -             if (! crtl->sp_is_unchanging)
> -               return;
> -           }
> -       }
> -
> -  /* The value coming into this pass was 0, and the exit block uses
> -     are based on this.  If the value is now 1, we need to redo the
> -     exit block uses.  */
> -  if (df && crtl->sp_is_unchanging)
> -    df_update_exit_block_uses ();
> -}
> -
>    /* Some targets can emit simpler epilogues if they know that sp was
>       not ever modified during the function.  After reload, of course,
>       we've already emitted the epilogue so there's no sense searching.  */
>
> -static unsigned int
> -rest_of_handle_stack_ptr_mod (void)
> -{
> -  notice_stack_pointer_modification ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_stack_ptr_mod =
> @@ -114,10 +76,43 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return rest_of_handle_stack_ptr_mod (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_stack_ptr_mod
>
> +unsigned int
> +pass_stack_ptr_mod::execute (function *fun)
> +{
> +  basic_block bb;
> +  rtx insn;
> +
> +  /* Assume that the stack pointer is unchanging if alloca hasn't
> +     been used.  */
> +  crtl->sp_is_unchanging = !fun->calls_alloca;
> +  if (crtl->sp_is_unchanging)
> +    FOR_EACH_BB_FN (bb, fun)
> +      FOR_BB_INSNS (bb, insn)
> +        {
> +         if (INSN_P (insn))
> +           {
> +             /* Check if insn modifies the stack pointer.  */
> +             note_stores (PATTERN (insn),
> +                          notice_stack_pointer_modification_1,
> +                          NULL);
> +             if (! crtl->sp_is_unchanging)
> +               return 0;
> +           }
> +       }
> +
> +  /* The value coming into this pass was 0, and the exit block uses
> +     are based on this.  If the value is now 1, we need to redo the
> +     exit block uses.  */
> +  if (df && crtl->sp_is_unchanging)
> +    df_update_exit_block_uses ();
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  rtl_opt_pass *
> diff --git a/gcc/store-motion.c b/gcc/store-motion.c
> index 7c57754..920da53 100644
> --- a/gcc/store-motion.c
> +++ b/gcc/store-motion.c
> @@ -1258,7 +1258,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return execute_rtl_store_motion (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return execute_rtl_store_motion ();
> +    }
>
>  }; // class pass_rtl_store_motion
>
> diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
> index a3b04a2..35eae15 100644
> --- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
> +++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
> @@ -44,14 +44,6 @@ handle_end_of_compilation_unit (void *event_data, void *data)
>  }
>
>
> -static unsigned int
> -execute_dumb_plugin_example (void)
> -{
> -  warning (0, G_("Analyze function %s"),
> -           IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_dumb_plugin_example =
> @@ -76,10 +68,18 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return execute_dumb_plugin_example (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_dumb_plugin_example
>
> +unsigned int
> +pass_dumb_plugin_example::execute (function *)
> +{
> +  warning (0, G_("Analyze function %s"),
> +           IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  static gimple_opt_pass *
> diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
> index 033047b..59bb03a 100644
> --- a/gcc/testsuite/g++.dg/plugin/selfassign.c
> +++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
> @@ -253,23 +253,6 @@ warn_self_assign (gimple stmt)
>      }
>  }
>
> -/* Entry point for the self-assignment detection pass.  */
> -
> -static unsigned int
> -execute_warn_self_assign (void)
> -{
> -  gimple_stmt_iterator gsi;
> -  basic_block bb;
> -
> -  FOR_EACH_BB_FN (bb, cfun)
> -    {
> -      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> -        warn_self_assign (gsi_stmt (gsi));
> -    }
> -
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_warn_self_assign =
> @@ -295,10 +278,25 @@ public:
>
>    /* opt_pass methods: */
>    bool gate (function *) { return true; }
> -  unsigned int execute () { return execute_warn_self_assign (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_warn_self_assign
>
> +unsigned int
> +pass_warn_self_assign::execute (function *fun)
> +{
> +  gimple_stmt_iterator gsi;
> +  basic_block bb;
> +
> +  FOR_EACH_BB_FN (bb, fun)
> +    {
> +      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> +        warn_self_assign (gsi_stmt (gsi));
> +    }
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  static gimple_opt_pass *
> diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
> index 18e8b07..d70f558 100644
> --- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
> +++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
> @@ -50,7 +50,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute ();
> +  virtual unsigned int execute (function *);
>
>  private:
>    int counter;
> @@ -63,7 +63,8 @@ bool one_pass::gate (function *)
>    return true;
>  }
>
> -unsigned int one_pass::execute ()
> +unsigned int
> +one_pass::execute (function *)
>  {
>    if (counter > 0) {
>      printf ("Executed more than once \n");
> diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
> index 098df06..4dad0c2 100644
> --- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
> +++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
> @@ -253,23 +253,6 @@ warn_self_assign (gimple stmt)
>      }
>  }
>
> -/* Entry point for the self-assignment detection pass.  */
> -
> -static unsigned int
> -execute_warn_self_assign (void)
> -{
> -  gimple_stmt_iterator gsi;
> -  basic_block bb;
> -
> -  FOR_EACH_BB_FN (bb, cfun)
> -    {
> -      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> -        warn_self_assign (gsi_stmt (gsi));
> -    }
> -
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_warn_self_assign =
> @@ -294,10 +277,25 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return execute_warn_self_assign (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_warn_self_assign
>
> +unsigned int
> +pass_warn_self_assign::execute (function *fun)
> +{
> +  gimple_stmt_iterator gsi;
> +  basic_block bb;
> +
> +  FOR_EACH_BB_FN (bb, fun)
> +    {
> +      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> +        warn_self_assign (gsi_stmt (gsi));
> +    }
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  static gimple_opt_pass *
> diff --git a/gcc/tracer.c b/gcc/tracer.c
> index 794d385..09a8f40 100644
> --- a/gcc/tracer.c
> +++ b/gcc/tracer.c
> @@ -367,36 +367,6 @@ tail_duplicate (void)
>
>    return changed;
>  }
> -
> -/* Main entry point to this file.  */
> -
> -static unsigned int
> -tracer (void)
> -{
> -  bool changed;
> -
> -  if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1)
> -    return 0;
> -
> -  mark_dfs_back_edges ();
> -  if (dump_file)
> -    brief_dump_cfg (dump_file, dump_flags);
> -
> -  /* Trace formation is done on the fly inside tail_duplicate */
> -  changed = tail_duplicate ();
> -  if (changed)
> -    {
> -      free_dominance_info (CDI_DOMINATORS);
> -      /* If we changed the CFG schedule loops for fixup by cleanup_cfg.  */
> -      if (current_loops)
> -       loops_state_set (LOOPS_NEED_FIXUP);
> -    }
> -
> -  if (dump_file)
> -    brief_dump_cfg (dump_file, dump_flags);
> -
> -  return changed ? TODO_cleanup_cfg : 0;
> -}
>
>  namespace {
>
> @@ -427,10 +397,37 @@ public:
>        return (optimize > 0 && flag_tracer && flag_reorder_blocks);
>      }
>
> -  unsigned int execute () { return tracer (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_tracer
>
> +unsigned int
> +pass_tracer::execute (function *fun)
> +{
> +  bool changed;
> +
> +  if (n_basic_blocks_for_fn (fun) <= NUM_FIXED_BLOCKS + 1)
> +    return 0;
> +
> +  mark_dfs_back_edges ();
> +  if (dump_file)
> +    brief_dump_cfg (dump_file, dump_flags);
> +
> +  /* Trace formation is done on the fly inside tail_duplicate */
> +  changed = tail_duplicate ();
> +  if (changed)
> +    {
> +      free_dominance_info (CDI_DOMINATORS);
> +      /* If we changed the CFG schedule loops for fixup by cleanup_cfg.  */
> +      if (current_loops)
> +       loops_state_set (LOOPS_NEED_FIXUP);
> +    }
> +
> +  if (dump_file)
> +    brief_dump_cfg (dump_file, dump_flags);
> +
> +  return changed ? TODO_cleanup_cfg : 0;
> +}
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
> index be876f5..2aa8bab 100644
> --- a/gcc/trans-mem.c
> +++ b/gcc/trans-mem.c
> @@ -856,7 +856,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_tm; }
> -  unsigned int execute () { return diagnose_tm_blocks (); }
> +  virtual unsigned int execute (function *) { return diagnose_tm_blocks (); }
>
>  }; // class pass_diagnose_tm_blocks
>
> @@ -1778,7 +1778,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_tm; }
> -  unsigned int execute () { return execute_lower_tm (); }
> +  virtual unsigned int execute (function *) { return execute_lower_tm (); }
>
>  }; // class pass_lower_tm
>
> @@ -3029,7 +3029,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return execute_tm_mark (); }
> +  virtual unsigned int execute (function *) { return execute_tm_mark (); }
>
>  }; // class pass_tm_mark
>
> @@ -3162,31 +3162,6 @@ expand_block_edges (struct tm_region *const region, basic_block bb)
>
>  /* Entry point to the final expansion of transactional nodes. */
>
> -static unsigned int
> -execute_tm_edges (void)
> -{
> -  vec<tm_region_p> bb_regions
> -    = get_bb_regions_instrumented (/*traverse_clones=*/false,
> -                                  /*include_uninstrumented_p=*/true);
> -  struct tm_region *r;
> -  unsigned i;
> -
> -  FOR_EACH_VEC_ELT (bb_regions, i, r)
> -    if (r != NULL)
> -      expand_block_edges (r, BASIC_BLOCK_FOR_FN (cfun, i));
> -
> -  bb_regions.release ();
> -
> -  /* We've got to release the dominance info now, to indicate that it
> -     must be rebuilt completely.  Otherwise we'll crash trying to update
> -     the SSA web in the TODO section following this pass.  */
> -  free_dominance_info (CDI_DOMINATORS);
> -  bitmap_obstack_release (&tm_obstack);
> -  all_tm_regions = NULL;
> -
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_tm_edges =
> @@ -3211,10 +3186,35 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return execute_tm_edges (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_tm_edges
>
> +unsigned int
> +pass_tm_edges::execute (function *fun)
> +{
> +  vec<tm_region_p> bb_regions
> +    = get_bb_regions_instrumented (/*traverse_clones=*/false,
> +                                  /*include_uninstrumented_p=*/true);
> +  struct tm_region *r;
> +  unsigned i;
> +
> +  FOR_EACH_VEC_ELT (bb_regions, i, r)
> +    if (r != NULL)
> +      expand_block_edges (r, BASIC_BLOCK_FOR_FN (fun, i));
> +
> +  bb_regions.release ();
> +
> +  /* We've got to release the dominance info now, to indicate that it
> +     must be rebuilt completely.  Otherwise we'll crash trying to update
> +     the SSA web in the TODO section following this pass.  */
> +  free_dominance_info (CDI_DOMINATORS);
> +  bitmap_obstack_release (&tm_obstack);
> +  all_tm_regions = NULL;
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -3946,7 +3946,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_tm && optimize > 0; }
> -  unsigned int execute () { return execute_tm_memopt (); }
> +  virtual unsigned int execute (function *) { return execute_tm_memopt (); }
>
>  }; // class pass_tm_memopt
>
> @@ -5581,7 +5581,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_tm; }
> -  unsigned int execute () { return ipa_tm_execute (); }
> +  virtual unsigned int execute (function *) { return ipa_tm_execute (); }
>
>  }; // class pass_ipa_tm
>
> diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
> index c271493..ea1df8b 100644
> --- a/gcc/tree-call-cdce.c
> +++ b/gcc/tree-call-cdce.c
> @@ -867,16 +867,51 @@ shrink_wrap_conditional_dead_built_in_calls (vec<gimple> calls)
>    return changed;
>  }
>
> -/* Pass entry points.  */
> +namespace {
> +
> +const pass_data pass_data_call_cdce =
> +{
> +  GIMPLE_PASS, /* type */
> +  "cdce", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_CALL_CDCE, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  TODO_verify_ssa, /* todo_flags_finish */
> +};
> +
> +class pass_call_cdce : public gimple_opt_pass
> +{
> +public:
> +  pass_call_cdce (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_call_cdce, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *fun)
> +    {
> +      /* The limit constants used in the implementation
> +        assume IEEE floating point format.  Other formats
> +        can be supported in the future if needed.  */
> +      return flag_tree_builtin_call_dce != 0
> +               && optimize_function_for_speed_p (fun);
> +    }
>
> -static unsigned int
> -tree_call_cdce (void)
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_call_cdce
> +
> +unsigned int
> +pass_call_cdce::execute (function *fun)
>  {
>    basic_block bb;
>    gimple_stmt_iterator i;
>    bool something_changed = false;
>    auto_vec<gimple> cond_dead_built_in_calls;
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        /* Collect dead call candidates.  */
>        for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
> @@ -910,50 +945,13 @@ tree_call_cdce (void)
>        free_dominance_info (CDI_POST_DOMINATORS);
>        /* As we introduced new control-flow we need to insert PHI-nodes
>           for the call-clobbers of the remaining call.  */
> -      mark_virtual_operands_for_renaming (cfun);
> +      mark_virtual_operands_for_renaming (fun);
>        return TODO_update_ssa;
>      }
>
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_call_cdce =
> -{
> -  GIMPLE_PASS, /* type */
> -  "cdce", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_CALL_CDCE, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  TODO_verify_ssa, /* todo_flags_finish */
> -};
> -
> -class pass_call_cdce : public gimple_opt_pass
> -{
> -public:
> -  pass_call_cdce (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_call_cdce, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *fun)
> -    {
> -      /* The limit constants used in the implementation
> -        assume IEEE floating point format.  Other formats
> -        can be supported in the future if needed.  */
> -      return flag_tree_builtin_call_dce != 0
> -               && optimize_function_for_speed_p (fun);
> -    }
> -
> -  unsigned int execute () { return tree_call_cdce (); }
> -
> -}; // class pass_call_cdce
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
> index 08e0280..03f8748 100644
> --- a/gcc/tree-cfg.c
> +++ b/gcc/tree-cfg.c
> @@ -368,7 +368,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return execute_build_cfg (); }
> +  virtual unsigned int execute (function *) { return execute_build_cfg (); }
>
>  }; // class pass_build_cfg
>
> @@ -8100,7 +8100,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return split_critical_edges (); }
> +  virtual unsigned int execute (function *) { return split_critical_edges (); }
>
>    opt_pass * clone () { return new pass_split_crit_edges (m_ctxt); }
>  }; // class pass_split_crit_edges
> @@ -8165,64 +8165,6 @@ gimplify_build1 (gimple_stmt_iterator *gsi, enum tree_code code, tree type,
>
>
>
> -/* Emit return warnings.  */
> -
> -static unsigned int
> -execute_warn_function_return (void)
> -{
> -  source_location location;
> -  gimple last;
> -  edge e;
> -  edge_iterator ei;
> -
> -  if (!targetm.warn_func_return (cfun->decl))
> -    return 0;
> -
> -  /* If we have a path to EXIT, then we do return.  */
> -  if (TREE_THIS_VOLATILE (cfun->decl)
> -      && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) > 0)
> -    {
> -      location = UNKNOWN_LOCATION;
> -      FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
> -       {
> -         last = last_stmt (e->src);
> -         if ((gimple_code (last) == GIMPLE_RETURN
> -              || gimple_call_builtin_p (last, BUILT_IN_RETURN))
> -             && (location = gimple_location (last)) != UNKNOWN_LOCATION)
> -           break;
> -       }
> -      if (location == UNKNOWN_LOCATION)
> -       location = cfun->function_end_locus;
> -      warning_at (location, 0, "%<noreturn%> function does return");
> -    }
> -
> -  /* If we see "return;" in some basic block, then we do reach the end
> -     without returning a value.  */
> -  else if (warn_return_type
> -          && !TREE_NO_WARNING (cfun->decl)
> -          && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) > 0
> -          && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (cfun->decl))))
> -    {
> -      FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
> -       {
> -         gimple last = last_stmt (e->src);
> -         if (gimple_code (last) == GIMPLE_RETURN
> -             && gimple_return_retval (last) == NULL
> -             && !gimple_no_warning_p (last))
> -           {
> -             location = gimple_location (last);
> -             if (location == UNKNOWN_LOCATION)
> -                 location = cfun->function_end_locus;
> -             warning_at (location, OPT_Wreturn_type, "control reaches end of non-void function");
> -             TREE_NO_WARNING (cfun->decl) = 1;
> -             break;
> -           }
> -       }
> -    }
> -  return 0;
> -}
> -
> -
>  /* Given a basic block B which ends with a conditional and has
>     precisely two successors, determine which of the edges is taken if
>     the conditional is true and which is taken if the conditional is
> @@ -8247,6 +8189,8 @@ extract_true_false_edges_from_block (basic_block b,
>      }
>  }
>
> +/* Emit return warnings.  */
> +
>  namespace {
>
>  const pass_data pass_data_warn_function_return =
> @@ -8271,10 +8215,65 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return execute_warn_function_return (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_warn_function_return
>
> +unsigned int
> +pass_warn_function_return::execute (function *fun)
> +{
> +  source_location location;
> +  gimple last;
> +  edge e;
> +  edge_iterator ei;
> +
> +  if (!targetm.warn_func_return (fun->decl))
> +    return 0;
> +
> +  /* If we have a path to EXIT, then we do return.  */
> +  if (TREE_THIS_VOLATILE (fun->decl)
> +      && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0)
> +    {
> +      location = UNKNOWN_LOCATION;
> +      FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (fun)->preds)
> +       {
> +         last = last_stmt (e->src);
> +         if ((gimple_code (last) == GIMPLE_RETURN
> +              || gimple_call_builtin_p (last, BUILT_IN_RETURN))
> +             && (location = gimple_location (last)) != UNKNOWN_LOCATION)
> +           break;
> +       }
> +      if (location == UNKNOWN_LOCATION)
> +       location = cfun->function_end_locus;
> +      warning_at (location, 0, "%<noreturn%> function does return");
> +    }
> +
> +  /* If we see "return;" in some basic block, then we do reach the end
> +     without returning a value.  */
> +  else if (warn_return_type
> +          && !TREE_NO_WARNING (fun->decl)
> +          && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0
> +          && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl))))
> +    {
> +      FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (fun)->preds)
> +       {
> +         gimple last = last_stmt (e->src);
> +         if (gimple_code (last) == GIMPLE_RETURN
> +             && gimple_return_retval (last) == NULL
> +             && !gimple_no_warning_p (last))
> +           {
> +             location = gimple_location (last);
> +             if (location == UNKNOWN_LOCATION)
> +               location = fun->function_end_locus;
> +             warning_at (location, OPT_Wreturn_type, "control reaches end of non-void function");
> +             TREE_NO_WARNING (fun->decl) = 1;
> +             break;
> +           }
> +       }
> +    }
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -8348,13 +8347,6 @@ do_warn_unused_result (gimple_seq seq)
>      }
>  }
>
> -static unsigned int
> -run_warn_unused_result (void)
> -{
> -  do_warn_unused_result (gimple_body (current_function_decl));
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_warn_unused_result =
> @@ -8380,7 +8372,11 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_warn_unused_result; }
> -  unsigned int execute () { return run_warn_unused_result (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      do_warn_unused_result (gimple_body (current_function_decl));
> +      return 0;
> +    }
>
>  }; // class pass_warn_unused_result
>
> @@ -8522,7 +8518,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_fixup_cfg (m_ctxt); }
> -  unsigned int execute () { return execute_fixup_cfg (); }
> +  virtual unsigned int execute (function *) { return execute_fixup_cfg (); }
>
>  }; // class pass_fixup_cfg
>
> diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
> index 19433f9..1046207 100644
> --- a/gcc/tree-cfgcleanup.c
> +++ b/gcc/tree-cfgcleanup.c
> @@ -944,17 +944,46 @@ remove_forwarder_block_with_phi (basic_block bb)
>  <L10>:;
>  */
>
> -static unsigned int
> -merge_phi_nodes (void)
> +namespace {
> +
> +const pass_data pass_data_merge_phi =
> +{
> +  GIMPLE_PASS, /* type */
> +  "mergephi", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_MERGE_PHI, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  TODO_verify_ssa, /* todo_flags_finish */
> +};
> +
> +class pass_merge_phi : public gimple_opt_pass
>  {
> -  basic_block *worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
> +public:
> +  pass_merge_phi (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_merge_phi, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  opt_pass * clone () { return new pass_merge_phi (m_ctxt); }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_merge_phi
> +
> +unsigned int
> +pass_merge_phi::execute (function *fun)
> +{
> +  basic_block *worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (fun));
>    basic_block *current = worklist;
>    basic_block bb;
>
>    calculate_dominance_info (CDI_DOMINATORS);
>
>    /* Find all PHI nodes that we may be able to merge.  */
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        basic_block dest;
>
> @@ -1035,35 +1064,6 @@ merge_phi_nodes (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_merge_phi =
> -{
> -  GIMPLE_PASS, /* type */
> -  "mergephi", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_MERGE_PHI, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  TODO_verify_ssa, /* todo_flags_finish */
> -};
> -
> -class pass_merge_phi : public gimple_opt_pass
> -{
> -public:
> -  pass_merge_phi (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_merge_phi, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_merge_phi (m_ctxt); }
> -  unsigned int execute () { return merge_phi_nodes (); }
> -
> -}; // class pass_merge_phi
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -1142,9 +1142,10 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () {
> -    return execute_cleanup_cfg_post_optimizing ();
> -  }
> +  virtual unsigned int execute (function *)
> +    {
> +      return execute_cleanup_cfg_post_optimizing ();
> +    }
>
>  }; // class pass_cleanup_cfg_post_optimizing
>
> diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
> index 9ec83d9..a97aaf9 100644
> --- a/gcc/tree-complex.c
> +++ b/gcc/tree-complex.c
> @@ -1680,7 +1680,7 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_lower_complex (m_ctxt); }
> -  unsigned int execute () { return tree_lower_complex (); }
> +  virtual unsigned int execute (function *) { return tree_lower_complex (); }
>
>  }; // class pass_lower_complex
>
> @@ -1724,7 +1724,7 @@ public:
>        return !(fun->curr_properties & PROP_gimple_lcx);
>      }
>
> -  unsigned int execute () { return tree_lower_complex (); }
> +  virtual unsigned int execute (function *) { return tree_lower_complex (); }
>
>  }; // class pass_lower_complex_O0
>
> diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
> index 41f96c4..960c04a 100644
> --- a/gcc/tree-eh.c
> +++ b/gcc/tree-eh.c
> @@ -2121,8 +2121,36 @@ lower_eh_constructs_1 (struct leh_state *state, gimple_seq *pseq)
>      lower_eh_constructs_2 (state, &gsi);
>  }
>
> -static unsigned int
> -lower_eh_constructs (void)
> +namespace {
> +
> +const pass_data pass_data_lower_eh =
> +{
> +  GIMPLE_PASS, /* type */
> +  "eh", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_EH, /* tv_id */
> +  PROP_gimple_lcf, /* properties_required */
> +  PROP_gimple_leh, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_lower_eh : public gimple_opt_pass
> +{
> +public:
> +  pass_lower_eh (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_lower_eh, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_lower_eh
> +
> +unsigned int
> +pass_lower_eh::execute (function *fun)
>  {
>    struct leh_state null_state;
>    gimple_seq bodyp;
> @@ -2155,7 +2183,7 @@ lower_eh_constructs (void)
>
>    /* If this function needs a language specific EH personality routine
>       and the frontend didn't already set one do so now.  */
> -  if (function_needs_eh_personality (cfun) == eh_personality_lang
> +  if (function_needs_eh_personality (fun) == eh_personality_lang
>        && !DECL_FUNCTION_PERSONALITY (current_function_decl))
>      DECL_FUNCTION_PERSONALITY (current_function_decl)
>        = lang_hooks.eh_personality ();
> @@ -2163,34 +2191,6 @@ lower_eh_constructs (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_lower_eh =
> -{
> -  GIMPLE_PASS, /* type */
> -  "eh", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_EH, /* tv_id */
> -  PROP_gimple_lcf, /* properties_required */
> -  PROP_gimple_leh, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_lower_eh : public gimple_opt_pass
> -{
> -public:
> -  pass_lower_eh (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_lower_eh, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  unsigned int execute () { return lower_eh_constructs (); }
> -
> -}; // class pass_lower_eh
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -3108,13 +3108,6 @@ refactor_eh_r (gimple_seq seq)
>      }
>  }
>
> -static unsigned
> -refactor_eh (void)
> -{
> -  refactor_eh_r (gimple_body (current_function_decl));
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_refactor_eh =
> @@ -3140,7 +3133,11 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_exceptions != 0; }
> -  unsigned int execute () { return refactor_eh (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      refactor_eh_r (gimple_body (current_function_decl));
> +      return 0;
> +    }
>
>  }; // class pass_refactor_eh
>
> @@ -3304,37 +3301,6 @@ lower_resx (basic_block bb, gimple stmt, struct pointer_map_t *mnt_map)
>    return ret;
>  }
>
> -static unsigned
> -execute_lower_resx (void)
> -{
> -  basic_block bb;
> -  struct pointer_map_t *mnt_map;
> -  bool dominance_invalidated = false;
> -  bool any_rewritten = false;
> -
> -  mnt_map = pointer_map_create ();
> -
> -  FOR_EACH_BB_FN (bb, cfun)
> -    {
> -      gimple last = last_stmt (bb);
> -      if (last && is_gimple_resx (last))
> -       {
> -         dominance_invalidated |= lower_resx (bb, last, mnt_map);
> -         any_rewritten = true;
> -       }
> -    }
> -
> -  pointer_map_destroy (mnt_map);
> -
> -  if (dominance_invalidated)
> -    {
> -      free_dominance_info (CDI_DOMINATORS);
> -      free_dominance_info (CDI_POST_DOMINATORS);
> -    }
> -
> -  return any_rewritten ? TODO_update_ssa_only_virtuals : 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_lower_resx =
> @@ -3360,10 +3326,41 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_exceptions != 0; }
> -  unsigned int execute () { return execute_lower_resx (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_lower_resx
>
> +unsigned
> +pass_lower_resx::execute (function *fun)
> +{
> +  basic_block bb;
> +  struct pointer_map_t *mnt_map;
> +  bool dominance_invalidated = false;
> +  bool any_rewritten = false;
> +
> +  mnt_map = pointer_map_create ();
> +
> +  FOR_EACH_BB_FN (bb, fun)
> +    {
> +      gimple last = last_stmt (bb);
> +      if (last && is_gimple_resx (last))
> +       {
> +         dominance_invalidated |= lower_resx (bb, last, mnt_map);
> +         any_rewritten = true;
> +       }
> +    }
> +
> +  pointer_map_destroy (mnt_map);
> +
> +  if (dominance_invalidated)
> +    {
> +      free_dominance_info (CDI_DOMINATORS);
> +      free_dominance_info (CDI_POST_DOMINATORS);
> +    }
> +
> +  return any_rewritten ? TODO_update_ssa_only_virtuals : 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -3704,8 +3701,37 @@ lower_eh_dispatch (basic_block src, gimple stmt)
>    return redirected;
>  }
>
> -static unsigned
> -execute_lower_eh_dispatch (void)
> +namespace {
> +
> +const pass_data pass_data_lower_eh_dispatch =
> +{
> +  GIMPLE_PASS, /* type */
> +  "ehdisp", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_EH, /* tv_id */
> +  PROP_gimple_lcf, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  TODO_verify_flow, /* todo_flags_finish */
> +};
> +
> +class pass_lower_eh_dispatch : public gimple_opt_pass
> +{
> +public:
> +  pass_lower_eh_dispatch (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_lower_eh_dispatch, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *fun) { return fun->eh->region_tree != NULL; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_lower_eh_dispatch
> +
> +unsigned
> +pass_lower_eh_dispatch::execute (function *fun)
>  {
>    basic_block bb;
>    int flags = 0;
> @@ -3713,7 +3739,7 @@ execute_lower_eh_dispatch (void)
>
>    assign_filter_values ();
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple last = last_stmt (bb);
>        if (last == NULL)
> @@ -3737,36 +3763,6 @@ execute_lower_eh_dispatch (void)
>    return flags;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_lower_eh_dispatch =
> -{
> -  GIMPLE_PASS, /* type */
> -  "ehdisp", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_EH, /* tv_id */
> -  PROP_gimple_lcf, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  TODO_verify_flow, /* todo_flags_finish */
> -};
> -
> -class pass_lower_eh_dispatch : public gimple_opt_pass
> -{
> -public:
> -  pass_lower_eh_dispatch (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_lower_eh_dispatch, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *fun) { return fun->eh->region_tree != NULL; }
> -
> -  unsigned int execute () { return execute_lower_eh_dispatch (); }
> -
> -}; // class pass_lower_eh_dispatch
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -4564,21 +4560,6 @@ execute_cleanup_eh_1 (void)
>    return 0;
>  }
>
> -static unsigned int
> -execute_cleanup_eh (void)
> -{
> -  int ret = execute_cleanup_eh_1 ();
> -
> -  /* If the function no longer needs an EH personality routine
> -     clear it.  This exposes cross-language inlining opportunities
> -     and avoids references to a never defined personality routine.  */
> -  if (DECL_FUNCTION_PERSONALITY (current_function_decl)
> -      && function_needs_eh_personality (cfun) != eh_personality_lang)
> -    DECL_FUNCTION_PERSONALITY (current_function_decl) = NULL_TREE;
> -
> -  return ret;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_cleanup_eh =
> @@ -4609,10 +4590,25 @@ public:
>        return fun->eh != NULL && fun->eh->region_tree != NULL;
>      }
>
> -  unsigned int execute () { return execute_cleanup_eh (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_cleanup_eh
>
> +unsigned int
> +pass_cleanup_eh::execute (function *fun)
> +{
> +  int ret = execute_cleanup_eh_1 ();
> +
> +  /* If the function no longer needs an EH personality routine
> +     clear it.  This exposes cross-language inlining opportunities
> +     and avoids references to a never defined personality routine.  */
> +  if (DECL_FUNCTION_PERSONALITY (current_function_decl)
> +      && function_needs_eh_personality (fun) != eh_personality_lang)
> +    DECL_FUNCTION_PERSONALITY (current_function_decl) = NULL_TREE;
> +
> +  return ret;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
> index 280a606..0ed503a 100644
> --- a/gcc/tree-emutls.c
> +++ b/gcc/tree-emutls.c
> @@ -846,7 +846,7 @@ public:
>        return !targetm.have_tls;
>      }
>
> -  unsigned int execute () { return ipa_lower_emutls (); }
> +  virtual unsigned int execute (function *) { return ipa_lower_emutls (); }
>
>  }; // class pass_ipa_lower_emutls
>
> diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
> index 90b62a8..21a9f05 100644
> --- a/gcc/tree-if-conv.c
> +++ b/gcc/tree-if-conv.c
> @@ -1986,33 +1986,6 @@ tree_if_conversion (struct loop *loop)
>
>  /* Tree if-conversion pass management.  */
>
> -static unsigned int
> -main_tree_if_conversion (void)
> -{
> -  struct loop *loop;
> -  unsigned todo = 0;
> -
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  FOR_EACH_LOOP (loop, 0)
> -    if (flag_tree_loop_if_convert == 1
> -       || flag_tree_loop_if_convert_stores == 1
> -       || ((flag_tree_loop_vectorize || loop->force_vectorize)
> -           && !loop->dont_vectorize))
> -      todo |= tree_if_conversion (loop);
> -
> -#ifdef ENABLE_CHECKING
> -  {
> -    basic_block bb;
> -    FOR_EACH_BB_FN (bb, cfun)
> -      gcc_assert (!bb->aux);
> -  }
> -#endif
> -
> -  return todo;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_if_conversion =
> @@ -2039,7 +2012,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return main_tree_if_conversion (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_if_conversion
>
> @@ -2052,6 +2025,33 @@ pass_if_conversion::gate (function *fun)
>           || flag_tree_loop_if_convert_stores == 1);
>  }
>
> +unsigned int
> +pass_if_conversion::execute (function *fun)
> +{
> +  struct loop *loop;
> +  unsigned todo = 0;
> +
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  FOR_EACH_LOOP (loop, 0)
> +    if (flag_tree_loop_if_convert == 1
> +       || flag_tree_loop_if_convert_stores == 1
> +       || ((flag_tree_loop_vectorize || loop->force_vectorize)
> +           && !loop->dont_vectorize))
> +      todo |= tree_if_conversion (loop);
> +
> +#ifdef ENABLE_CHECKING
> +  {
> +    basic_block bb;
> +    FOR_EACH_BB_FN (bb, fun)
> +      gcc_assert (!bb->aux);
> +  }
> +#endif
> +
> +  return todo;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
> index 332901d..8fc4193 100644
> --- a/gcc/tree-into-ssa.c
> +++ b/gcc/tree-into-ssa.c
> @@ -2299,15 +2299,49 @@ fini_ssa_renamer (void)
>     Steps 3 and 4 are done using the dominator tree walker
>     (walk_dominator_tree).  */
>
> -static unsigned int
> -rewrite_into_ssa (void)
> +namespace {
> +
> +const pass_data pass_data_build_ssa =
> +{
> +  GIMPLE_PASS, /* type */
> +  "ssa", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_SSA_OTHER, /* tv_id */
> +  PROP_cfg, /* properties_required */
> +  PROP_ssa, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_verify_ssa | TODO_remove_unused_locals ), /* todo_flags_finish */
> +};
> +
> +class pass_build_ssa : public gimple_opt_pass
> +{
> +public:
> +  pass_build_ssa (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_build_ssa, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *fun)
> +    {
> +      /* Do nothing for funcions that was produced already in SSA form.  */
> +      return !(fun->curr_properties & PROP_ssa);
> +    }
> +
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_build_ssa
> +
> +unsigned int
> +pass_build_ssa::execute (function *fun)
>  {
>    bitmap_head *dfs;
>    basic_block bb;
>    unsigned i;
>
>    /* Initialize operand data structures.  */
> -  init_ssa_operands (cfun);
> +  init_ssa_operands (fun);
>
>    /* Initialize internal data needed by the renamer.  */
>    init_ssa_renamer ();
> @@ -2315,12 +2349,12 @@ rewrite_into_ssa (void)
>    /* Initialize the set of interesting blocks.  The callback
>       mark_def_sites will add to this set those blocks that the renamer
>       should process.  */
> -  interesting_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
> +  interesting_blocks = sbitmap_alloc (last_basic_block_for_fn (fun));
>    bitmap_clear (interesting_blocks);
>
>    /* Initialize dominance frontier.  */
> -  dfs = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
> -  FOR_EACH_BB_FN (bb, cfun)
> +  dfs = XNEWVEC (bitmap_head, last_basic_block_for_fn (fun));
> +  FOR_EACH_BB_FN (bb, fun)
>      bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);
>
>    /* 1- Compute dominance frontiers.  */
> @@ -2328,16 +2362,16 @@ rewrite_into_ssa (void)
>    compute_dominance_frontiers (dfs);
>
>    /* 2- Find and mark definition sites.  */
> -  mark_def_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
> +  mark_def_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr);
>
>    /* 3- Insert PHI nodes at dominance frontiers of definition blocks.  */
>    insert_phi_nodes (dfs);
>
>    /* 4- Rename all the blocks.  */
> -  rewrite_blocks (ENTRY_BLOCK_PTR_FOR_FN (cfun), REWRITE_ALL);
> +  rewrite_blocks (ENTRY_BLOCK_PTR_FOR_FN (fun), REWRITE_ALL);
>
>    /* Free allocated memory.  */
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      bitmap_clear (&dfs[bb->index]);
>    free (dfs);
>
> @@ -2365,40 +2399,6 @@ rewrite_into_ssa (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_build_ssa =
> -{
> -  GIMPLE_PASS, /* type */
> -  "ssa", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_SSA_OTHER, /* tv_id */
> -  PROP_cfg, /* properties_required */
> -  PROP_ssa, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_verify_ssa | TODO_remove_unused_locals ), /* todo_flags_finish */
> -};
> -
> -class pass_build_ssa : public gimple_opt_pass
> -{
> -public:
> -  pass_build_ssa (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_build_ssa, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *fun)
> -    {
> -      /* Do nothing for funcions that was produced already in SSA form.  */
> -      return !(fun->curr_properties & PROP_ssa);
> -    }
> -
> -  unsigned int execute () { return rewrite_into_ssa (); }
> -
> -}; // class pass_build_ssa
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
> index 0a15412..5fff7be 100644
> --- a/gcc/tree-loop-distribution.c
> +++ b/gcc/tree-loop-distribution.c
> @@ -1669,15 +1669,49 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
>
>  /* Distribute all loops in the current function.  */
>
> -static unsigned int
> -tree_loop_distribution (void)
> +namespace {
> +
> +const pass_data pass_data_loop_distribution =
> +{
> +  GIMPLE_PASS, /* type */
> +  "ldist", /* name */
> +  OPTGROUP_LOOP, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_LOOP_DISTRIBUTION, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  TODO_verify_ssa, /* todo_flags_finish */
> +};
> +
> +class pass_loop_distribution : public gimple_opt_pass
> +{
> +public:
> +  pass_loop_distribution (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_loop_distribution, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *)
> +    {
> +      return flag_tree_loop_distribution
> +       || flag_tree_loop_distribute_patterns;
> +    }
> +
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_loop_distribution
> +
> +unsigned int
> +pass_loop_distribution::execute (function *fun)
>  {
>    struct loop *loop;
>    bool changed = false;
>    basic_block bb;
>    control_dependences *cd = NULL;
>
> -  FOR_ALL_BB_FN (bb, cfun)
> +  FOR_ALL_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator gsi;
>        for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> @@ -1715,7 +1749,7 @@ tree_loop_distribution (void)
>               if (virtual_operand_p (gimple_phi_result (phi)))
>                 continue;
>               /* Distribute stmts which have defs that are used outside of
> -                the loop.  */
> +                the loop.  */
>               if (!stmt_has_scalar_dependences_outside_loop (loop, phi))
>                 continue;
>               work_list.safe_push (phi);
> @@ -1725,7 +1759,7 @@ tree_loop_distribution (void)
>               gimple stmt = gsi_stmt (gsi);
>
>               /* If there is a stmt with side-effects bail out - we
> -                cannot and should not distribute this loop.  */
> +                cannot and should not distribute this loop.  */
>               if (gimple_has_side_effects (stmt))
>                 {
>                   work_list.truncate (0);
> @@ -1733,7 +1767,7 @@ tree_loop_distribution (void)
>                 }
>
>               /* Distribute stmts which have defs that are used outside of
> -                the loop.  */
> +                the loop.  */
>               if (stmt_has_scalar_dependences_outside_loop (loop, stmt))
>                 ;
>               /* Otherwise only distribute stores for now.  */
> @@ -1779,7 +1813,7 @@ out:
>
>    if (changed)
>      {
> -      mark_virtual_operands_for_renaming (cfun);
> +      mark_virtual_operands_for_renaming (fun);
>        rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
>      }
>
> @@ -1790,40 +1824,6 @@ out:
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_loop_distribution =
> -{
> -  GIMPLE_PASS, /* type */
> -  "ldist", /* name */
> -  OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_LOOP_DISTRIBUTION, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  TODO_verify_ssa, /* todo_flags_finish */
> -};
> -
> -class pass_loop_distribution : public gimple_opt_pass
> -{
> -public:
> -  pass_loop_distribution (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_loop_distribution, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *)
> -    {
> -      return flag_tree_loop_distribution
> -       || flag_tree_loop_distribute_patterns;
> -    }
> -
> -  unsigned int execute () { return tree_loop_distribution (); }
> -
> -}; // class pass_loop_distribution
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
> index 71f8d68..45b16f4 100644
> --- a/gcc/tree-nrv.c
> +++ b/gcc/tree-nrv.c
> @@ -113,8 +113,38 @@ finalize_nrv_r (tree *tp, int *walk_subtrees, void *data)
>     then we could either have the languages register the optimization or
>     we could change the gating function to check the current language.  */
>
> -static unsigned int
> -tree_nrv (void)
> +namespace {
> +
> +const pass_data pass_data_nrv =
> +{
> +  GIMPLE_PASS, /* type */
> +  "nrv", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_NRV, /* tv_id */
> +  ( PROP_ssa | PROP_cfg ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_nrv : public gimple_opt_pass
> +{
> +public:
> +  pass_nrv (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_nrv, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *) { return optimize > 0; }
> +
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_nrv
> +
> +unsigned int
> +pass_nrv::execute (function *fun)
>  {
>    tree result = DECL_RESULT (current_function_decl);
>    tree result_type = TREE_TYPE (result);
> @@ -144,7 +174,7 @@ tree_nrv (void)
>      return 0;
>
>    /* Look through each block for assignments to the RESULT_DECL.  */
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
>         {
> @@ -238,7 +268,7 @@ tree_nrv (void)
>       RESULT.  */
>    data.var = found;
>    data.result = result;
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
>         {
> @@ -272,36 +302,6 @@ tree_nrv (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_nrv =
> -{
> -  GIMPLE_PASS, /* type */
> -  "nrv", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_NRV, /* tv_id */
> -  ( PROP_ssa | PROP_cfg ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_nrv : public gimple_opt_pass
> -{
> -public:
> -  pass_nrv (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_nrv, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *) { return optimize > 0; }
> -
> -  unsigned int execute () { return tree_nrv (); }
> -
> -}; // class pass_nrv
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -347,35 +347,6 @@ dest_safe_for_nrv_p (gimple call)
>     escaped prior to the call.  If it has, modifications to the local
>     variable will produce visible changes elsewhere, as in PR c++/19317.  */
>
> -static unsigned int
> -execute_return_slot_opt (void)
> -{
> -  basic_block bb;
> -
> -  FOR_EACH_BB_FN (bb, cfun)
> -    {
> -      gimple_stmt_iterator gsi;
> -      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> -       {
> -         gimple stmt = gsi_stmt (gsi);
> -         bool slot_opt_p;
> -
> -         if (is_gimple_call (stmt)
> -             && gimple_call_lhs (stmt)
> -             && !gimple_call_return_slot_opt_p (stmt)
> -             && aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)),
> -                                   gimple_call_fndecl (stmt)))
> -           {
> -             /* Check if the location being assigned to is
> -                clobbered by the call.  */
> -             slot_opt_p = dest_safe_for_nrv_p (stmt);
> -             gimple_call_set_return_slot_opt (stmt, slot_opt_p);
> -           }
> -       }
> -    }
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_return_slot =
> @@ -400,10 +371,39 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return execute_return_slot_opt (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_return_slot
>
> +unsigned int
> +pass_return_slot::execute (function *fun)
> +{
> +  basic_block bb;
> +
> +  FOR_EACH_BB_FN (bb, fun)
> +    {
> +      gimple_stmt_iterator gsi;
> +      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> +       {
> +         gimple stmt = gsi_stmt (gsi);
> +         bool slot_opt_p;
> +
> +         if (is_gimple_call (stmt)
> +             && gimple_call_lhs (stmt)
> +             && !gimple_call_return_slot_opt_p (stmt)
> +             && aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)),
> +                                   gimple_call_fndecl (stmt)))
> +           {
> +             /* Check if the location being assigned to is
> +                clobbered by the call.  */
> +             slot_opt_p = dest_safe_for_nrv_p (stmt);
> +             gimple_call_set_return_slot_opt (stmt, slot_opt_p);
> +           }
> +       }
> +    }
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
> index 23f7250..ec50709 100644
> --- a/gcc/tree-object-size.c
> +++ b/gcc/tree-object-size.c
> @@ -66,7 +66,6 @@ static bool merge_object_sizes (struct object_size_info *, tree, tree,
>                                 unsigned HOST_WIDE_INT);
>  static bool plus_stmt_object_size (struct object_size_info *, tree, gimple);
>  static bool cond_expr_object_size (struct object_size_info *, tree, gimple);
> -static unsigned int compute_object_sizes (void);
>  static void init_offset_limit (void);
>  static void check_for_plus_in_loops (struct object_size_info *, tree);
>  static void check_for_plus_in_loops_1 (struct object_size_info *, tree,
> @@ -1207,11 +1206,40 @@ fini_object_sizes (void)
>
>  /* Simple pass to optimize all __builtin_object_size () builtins.  */
>
> -static unsigned int
> -compute_object_sizes (void)
> +namespace {
> +
> +const pass_data pass_data_object_sizes =
> +{
> +  GIMPLE_PASS, /* type */
> +  "objsz", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  TODO_verify_ssa, /* todo_flags_finish */
> +};
> +
> +class pass_object_sizes : public gimple_opt_pass
> +{
> +public:
> +  pass_object_sizes (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_object_sizes, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  opt_pass * clone () { return new pass_object_sizes (m_ctxt); }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_object_sizes
> +
> +unsigned int
> +pass_object_sizes::execute (function *fun)
>  {
>    basic_block bb;
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator i;
>        for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
> @@ -1281,35 +1309,6 @@ compute_object_sizes (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_object_sizes =
> -{
> -  GIMPLE_PASS, /* type */
> -  "objsz", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  TODO_verify_ssa, /* todo_flags_finish */
> -};
> -
> -class pass_object_sizes : public gimple_opt_pass
> -{
> -public:
> -  pass_object_sizes (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_object_sizes, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_object_sizes (m_ctxt); }
> -  unsigned int execute () { return compute_object_sizes (); }
> -
> -}; // class pass_object_sizes
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
> index a46fa51..79b327b 100644
> --- a/gcc/tree-parloops.c
> +++ b/gcc/tree-parloops.c
> @@ -2253,17 +2253,6 @@ parallelize_loops (void)
>
>  /* Parallelization.  */
>
> -static unsigned
> -tree_parallelize_loops (void)
> -{
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  if (parallelize_loops ())
> -    return TODO_cleanup_cfg | TODO_rebuild_alias;
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_parallelize_loops =
> @@ -2289,10 +2278,21 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_tree_parallelize_loops > 1; }
> -  unsigned int execute () { return tree_parallelize_loops (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_parallelize_loops
>
> +unsigned
> +pass_parallelize_loops::execute (function *fun)
> +{
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  if (parallelize_loops ())
> +    return TODO_cleanup_cfg | TODO_rebuild_alias;
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
> index 9de2822..e63f306 100644
> --- a/gcc/tree-pass.h
> +++ b/gcc/tree-pass.h
> @@ -96,7 +96,7 @@ public:
>       be sub-passes otherwise this pass does nothing.
>       The return value contains TODOs to execute in addition to those in
>       TODO_flags_finish.   */
> -  virtual unsigned int execute ();
> +  virtual unsigned int execute (function *fun);
>
>  protected:
>    opt_pass (const pass_data&, gcc::context *);
> diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
> index 7dd86e1..4d77401 100644
> --- a/gcc/tree-predcom.c
> +++ b/gcc/tree-predcom.c
> @@ -2598,7 +2598,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_predictive_commoning != 0; }
> -  unsigned int execute () { return run_tree_predictive_commoning (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return run_tree_predictive_commoning ();
> +    }
>
>  }; // class pass_predcom
>
> diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
> index b7d0466..deefa8b 100644
> --- a/gcc/tree-profile.c
> +++ b/gcc/tree-profile.c
> @@ -688,7 +688,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *);
> -  unsigned int execute () { return tree_profiling (); }
> +  virtual unsigned int execute (function *) { return tree_profiling (); }
>
>  }; // class pass_ipa_tree_profile
>
> diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
> index 27f71a3..890234f 100644
> --- a/gcc/tree-sra.c
> +++ b/gcc/tree-sra.c
> @@ -3525,7 +3525,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return gate_intra_sra (); }
> -  unsigned int execute () { return early_intra_sra (); }
> +  virtual unsigned int execute (function *) { return early_intra_sra (); }
>
>  }; // class pass_sra_early
>
> @@ -3562,7 +3562,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return gate_intra_sra (); }
> -  unsigned int execute () { return late_intra_sra (); }
> +  virtual unsigned int execute (function *) { return late_intra_sra (); }
>
>  }; // class pass_sra
>
> @@ -5076,7 +5076,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_ipa_sra && dbg_cnt (eipa_sra); }
> -  unsigned int execute () { return ipa_early_sra (); }
> +  virtual unsigned int execute (function *) { return ipa_early_sra (); }
>
>  }; // class pass_early_ipa_sra
>
> diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
> index c4a5c71..257d108 100644
> --- a/gcc/tree-ssa-ccp.c
> +++ b/gcc/tree-ssa-ccp.c
> @@ -2314,7 +2314,7 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_ccp (m_ctxt); }
>    virtual bool gate (function *) { return flag_tree_ccp != 0; }
> -  unsigned int execute () { return do_ssa_ccp (); }
> +  virtual unsigned int execute (function *) { return do_ssa_ccp (); }
>
>  }; // class pass_ccp
>
> @@ -2559,14 +2559,43 @@ optimize_unreachable (gimple_stmt_iterator i)
>  /* A simple pass that attempts to fold all builtin functions.  This pass
>     is run after we've propagated as many constants as we can.  */
>
> -static unsigned int
> -execute_fold_all_builtins (void)
> +namespace {
> +
> +const pass_data pass_data_fold_builtins =
> +{
> +  GIMPLE_PASS, /* type */
> +  "fab", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_verify_ssa | TODO_update_ssa ), /* todo_flags_finish */
> +};
> +
> +class pass_fold_builtins : public gimple_opt_pass
> +{
> +public:
> +  pass_fold_builtins (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_fold_builtins, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  opt_pass * clone () { return new pass_fold_builtins (m_ctxt); }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_fold_builtins
> +
> +unsigned int
> +pass_fold_builtins::execute (function *fun)
>  {
>    bool cfg_changed = false;
>    basic_block bb;
>    unsigned int todoflags = 0;
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator i;
>        for (i = gsi_start_bb (bb); !gsi_end_p (i); )
> @@ -2608,7 +2637,7 @@ execute_fold_all_builtins (void)
>           result = gimple_fold_builtin (stmt);
>
>           if (result)
> -           gimple_remove_stmt_histograms (cfun, stmt);
> +           gimple_remove_stmt_histograms (fun, stmt);
>
>           if (!result)
>             switch (DECL_FUNCTION_CODE (callee))
> @@ -2703,36 +2732,6 @@ execute_fold_all_builtins (void)
>    return todoflags;
>  }
>
> -
> -namespace {
> -
> -const pass_data pass_data_fold_builtins =
> -{
> -  GIMPLE_PASS, /* type */
> -  "fab", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_verify_ssa | TODO_update_ssa ), /* todo_flags_finish */
> -};
> -
> -class pass_fold_builtins : public gimple_opt_pass
> -{
> -public:
> -  pass_fold_builtins (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_fold_builtins, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_fold_builtins (m_ctxt); }
> -  unsigned int execute () { return execute_fold_all_builtins (); }
> -
> -}; // class pass_fold_builtins
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
> index bd6ac04..6e3a569 100644
> --- a/gcc/tree-ssa-copy.c
> +++ b/gcc/tree-ssa-copy.c
> @@ -671,7 +671,7 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_copy_prop (m_ctxt); }
>    virtual bool gate (function *) { return flag_tree_copy_prop != 0; }
> -  unsigned int execute () { return execute_copy_prop (); }
> +  virtual unsigned int execute (function *) { return execute_copy_prop (); }
>
>  }; // class pass_copy_prop
>
> diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
> index 65d8044..b9c9ba3 100644
> --- a/gcc/tree-ssa-copyrename.c
> +++ b/gcc/tree-ssa-copyrename.c
> @@ -299,14 +299,44 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
>  }
>
>
> +namespace {
> +
> +const pass_data pass_data_rename_ssa_copies =
> +{
> +  GIMPLE_PASS, /* type */
> +  "copyrename", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_COPY_RENAME, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  TODO_verify_ssa, /* todo_flags_finish */
> +};
> +
> +class pass_rename_ssa_copies : public gimple_opt_pass
> +{
> +public:
> +  pass_rename_ssa_copies (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_rename_ssa_copies, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  opt_pass * clone () { return new pass_rename_ssa_copies (m_ctxt); }
> +  virtual bool gate (function *) { return flag_tree_copyrename != 0; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_rename_ssa_copies
> +
>  /* This function will make a pass through the IL, and attempt to coalesce any
>     SSA versions which occur in PHI's or copies.  Coalescing is accomplished by
>     changing the underlying root variable of all coalesced version.  This will
>     then cause the SSA->normal pass to attempt to coalesce them all to the same
>     variable.  */
>
> -static unsigned int
> -rename_ssa_copies (void)
> +unsigned int
> +pass_rename_ssa_copies::execute (function *fun)
>  {
>    var_map map;
>    basic_block bb;
> @@ -325,7 +355,7 @@ rename_ssa_copies (void)
>
>    map = init_var_map (num_ssa_names);
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        /* Scan for real copies.  */
>        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> @@ -341,7 +371,7 @@ rename_ssa_copies (void)
>         }
>      }
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        /* Treat PHI nodes as copies between the result and each argument.  */
>        for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> @@ -429,42 +459,12 @@ rename_ssa_copies (void)
>        replace_ssa_name_symbol (var, SSA_NAME_VAR (part_var));
>      }
>
> -  statistics_counter_event (cfun, "copies coalesced",
> +  statistics_counter_event (fun, "copies coalesced",
>                             stats.coalesced);
>    delete_var_map (map);
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_rename_ssa_copies =
> -{
> -  GIMPLE_PASS, /* type */
> -  "copyrename", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_COPY_RENAME, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  TODO_verify_ssa, /* todo_flags_finish */
> -};
> -
> -class pass_rename_ssa_copies : public gimple_opt_pass
> -{
> -public:
> -  pass_rename_ssa_copies (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_rename_ssa_copies, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_rename_ssa_copies (m_ctxt); }
> -  virtual bool gate (function *) { return flag_tree_copyrename != 0; }
> -  unsigned int execute () { return rename_ssa_copies (); }
> -
> -}; // class pass_rename_ssa_copies
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
> index e5799b9..6389f23 100644
> --- a/gcc/tree-ssa-dce.c
> +++ b/gcc/tree-ssa-dce.c
> @@ -1530,7 +1530,7 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_dce (m_ctxt); }
>    virtual bool gate (function *) { return flag_tree_dce != 0; }
> -  unsigned int execute () { return tree_ssa_dce (); }
> +  virtual unsigned int execute (function *) { return tree_ssa_dce (); }
>
>  }; // class pass_dce
>
> @@ -1568,7 +1568,7 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_dce_loop (m_ctxt); }
>    virtual bool gate (function *) { return flag_tree_dce != 0; }
> -  unsigned int execute () { return tree_ssa_dce_loop (); }
> +  virtual unsigned int execute (function *) { return tree_ssa_dce_loop (); }
>
>  }; // class pass_dce_loop
>
> @@ -1606,7 +1606,7 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_cd_dce (m_ctxt); }
>    virtual bool gate (function *) { return flag_tree_dce != 0; }
> -  unsigned int execute () { return tree_ssa_cd_dce (); }
> +  virtual unsigned int execute (function *) { return tree_ssa_cd_dce (); }
>
>  }; // class pass_cd_dce
>
> diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
> index b9cc5cc..15c4fb0 100644
> --- a/gcc/tree-ssa-dom.c
> +++ b/gcc/tree-ssa-dom.c
> @@ -832,8 +832,40 @@ private:
>     every new symbol exposed, its corresponding bit will be set in
>     VARS_TO_RENAME.  */
>
> -static unsigned int
> -tree_ssa_dominator_optimize (void)
> +namespace {
> +
> +const pass_data pass_data_dominator =
> +{
> +  GIMPLE_PASS, /* type */
> +  "dom", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_SSA_DOMINATOR_OPTS, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_cleanup_cfg | TODO_update_ssa
> +    | TODO_verify_ssa
> +    | TODO_verify_flow ), /* todo_flags_finish */
> +};
> +
> +class pass_dominator : public gimple_opt_pass
> +{
> +public:
> +  pass_dominator (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_dominator, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  opt_pass * clone () { return new pass_dominator (m_ctxt); }
> +  virtual bool gate (function *) { return flag_tree_dom != 0; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_dominator
> +
> +unsigned int
> +pass_dominator::execute (function *fun)
>  {
>    memset (&opt_stats, 0, sizeof (opt_stats));
>
> @@ -867,12 +899,12 @@ tree_ssa_dominator_optimize (void)
>    mark_dfs_back_edges ();
>
>    /* Recursively walk the dominator tree optimizing statements.  */
> -  dom_opt_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
> +  dom_opt_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr);
>
>    {
>      gimple_stmt_iterator gsi;
>      basic_block bb;
> -    FOR_EACH_BB_FN (bb, cfun)
> +    FOR_EACH_BB_FN (bb, fun)
>        {
>         for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
>           update_stmt_if_modified (gsi_stmt (gsi));
> @@ -908,13 +940,13 @@ tree_ssa_dominator_optimize (void)
>          iterator.  */
>        EXECUTE_IF_SET_IN_BITMAP (need_eh_cleanup, 0, i, bi)
>         {
> -         basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
> +         basic_block bb = BASIC_BLOCK_FOR_FN (fun, i);
>           if (bb == NULL)
>             continue;
>           while (single_succ_p (bb)
>                  && (single_succ_edge (bb)->flags & EDGE_EH) == 0)
>             bb = single_succ (bb);
> -         if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun))
> +         if (bb == EXIT_BLOCK_PTR_FOR_FN (fun))
>             continue;
>           if ((unsigned) bb->index != i)
>             bitmap_set_bit (need_eh_cleanup, bb->index);
> @@ -924,11 +956,11 @@ tree_ssa_dominator_optimize (void)
>        bitmap_clear (need_eh_cleanup);
>      }
>
> -  statistics_counter_event (cfun, "Redundant expressions eliminated",
> +  statistics_counter_event (fun, "Redundant expressions eliminated",
>                             opt_stats.num_re);
> -  statistics_counter_event (cfun, "Constants propagated",
> +  statistics_counter_event (fun, "Constants propagated",
>                             opt_stats.num_const_prop);
> -  statistics_counter_event (cfun, "Copies propagated",
> +  statistics_counter_event (fun, "Copies propagated",
>                             opt_stats.num_copy_prop);
>
>    /* Debugging dumps.  */
> @@ -952,38 +984,6 @@ tree_ssa_dominator_optimize (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_dominator =
> -{
> -  GIMPLE_PASS, /* type */
> -  "dom", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_SSA_DOMINATOR_OPTS, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_cleanup_cfg | TODO_update_ssa
> -    | TODO_verify_ssa
> -    | TODO_verify_flow ), /* todo_flags_finish */
> -};
> -
> -class pass_dominator : public gimple_opt_pass
> -{
> -public:
> -  pass_dominator (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_dominator, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_dominator (m_ctxt); }
> -  virtual bool gate (function *) { return flag_tree_dom != 0; }
> -  unsigned int execute () { return tree_ssa_dominator_optimize (); }
> -
> -}; // class pass_dominator
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -3025,8 +3025,40 @@ eliminate_degenerate_phis_1 (basic_block bb, bitmap interesting_names)
>     pick up the secondary optimization opportunities with minimal
>     cost.  */
>
> -static unsigned int
> -eliminate_degenerate_phis (void)
> +namespace {
> +
> +const pass_data pass_data_phi_only_cprop =
> +{
> +  GIMPLE_PASS, /* type */
> +  "phicprop", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_PHI_CPROP, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_cleanup_cfg | TODO_verify_ssa
> +    | TODO_verify_stmts
> +    | TODO_update_ssa ), /* todo_flags_finish */
> +};
> +
> +class pass_phi_only_cprop : public gimple_opt_pass
> +{
> +public:
> +  pass_phi_only_cprop (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_phi_only_cprop, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  opt_pass * clone () { return new pass_phi_only_cprop (m_ctxt); }
> +  virtual bool gate (function *) { return flag_tree_dom != 0; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_phi_only_cprop
> +
> +unsigned int
> +pass_phi_only_cprop::execute (function *fun)
>  {
>    bitmap interesting_names;
>    bitmap interesting_names1;
> @@ -3059,7 +3091,7 @@ eliminate_degenerate_phis (void)
>       phase in dominator order.  Presumably this is because walking
>       in dominator order leaves fewer PHIs for later examination
>       by the worklist phase.  */
> -  eliminate_degenerate_phis_1 (ENTRY_BLOCK_PTR_FOR_FN (cfun),
> +  eliminate_degenerate_phis_1 (ENTRY_BLOCK_PTR_FOR_FN (fun),
>                                interesting_names);
>
>    /* Second phase.  Eliminate second order degenerate PHIs as well
> @@ -3109,38 +3141,6 @@ eliminate_degenerate_phis (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_phi_only_cprop =
> -{
> -  GIMPLE_PASS, /* type */
> -  "phicprop", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_PHI_CPROP, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_cleanup_cfg | TODO_verify_ssa
> -    | TODO_verify_stmts
> -    | TODO_update_ssa ), /* todo_flags_finish */
> -};
> -
> -class pass_phi_only_cprop : public gimple_opt_pass
> -{
> -public:
> -  pass_phi_only_cprop (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_phi_only_cprop, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_phi_only_cprop (m_ctxt); }
> -  virtual bool gate (function *) { return flag_tree_dom != 0; }
> -  unsigned int execute () { return eliminate_degenerate_phis (); }
> -
> -}; // class pass_phi_only_cprop
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
> index b6fbdaf..af69063 100644
> --- a/gcc/tree-ssa-dse.c
> +++ b/gcc/tree-ssa-dse.c
> @@ -80,8 +80,6 @@ along with GCC; see the file COPYING3.  If not see
>     remove their dead edges eventually.  */
>  static bitmap need_eh_cleanup;
>
> -static unsigned int tree_ssa_dse (void);
> -
>
>  /* A helper of dse_optimize_stmt.
>     Given a GIMPLE_ASSIGN in STMT, find a candidate statement *USE_STMT that
> @@ -327,10 +325,38 @@ dse_dom_walker::before_dom_children (basic_block bb)
>      }
>  }
>
> -/* Main entry point.  */
> +namespace {
> +
> +const pass_data pass_data_dse =
> +{
> +  GIMPLE_PASS, /* type */
> +  "dse", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_DSE, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  TODO_verify_ssa, /* todo_flags_finish */
> +};
> +
> +class pass_dse : public gimple_opt_pass
> +{
> +public:
> +  pass_dse (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_dse, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  opt_pass * clone () { return new pass_dse (m_ctxt); }
> +  virtual bool gate (function *) { return flag_tree_dse != 0; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_dse
>
> -static unsigned int
> -tree_ssa_dse (void)
> +unsigned int
> +pass_dse::execute (function *fun)
>  {
>    need_eh_cleanup = BITMAP_ALLOC (NULL);
>
> @@ -345,7 +371,7 @@ tree_ssa_dse (void)
>
>    /* Dead store elimination is fundamentally a walk of the post-dominator
>       tree and a backwards walk of statements within each block.  */
> -  dse_dom_walker (CDI_POST_DOMINATORS).walk (cfun->cfg->x_exit_block_ptr);
> +  dse_dom_walker (CDI_POST_DOMINATORS).walk (fun->cfg->x_exit_block_ptr);
>
>    /* Removal of stores may make some EH edges dead.  Purge such edges from
>       the CFG as needed.  */
> @@ -362,36 +388,6 @@ tree_ssa_dse (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_dse =
> -{
> -  GIMPLE_PASS, /* type */
> -  "dse", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_DSE, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  TODO_verify_ssa, /* todo_flags_finish */
> -};
> -
> -class pass_dse : public gimple_opt_pass
> -{
> -public:
> -  pass_dse (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_dse, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_dse (m_ctxt); }
> -  virtual bool gate (function *) { return flag_tree_dse != 0; }
> -  unsigned int execute () { return tree_ssa_dse (); }
> -
> -}; // class pass_dse
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
> index 8d5ca5f..a623005 100644
> --- a/gcc/tree-ssa-forwprop.c
> +++ b/gcc/tree-ssa-forwprop.c
> @@ -3567,15 +3567,45 @@ simplify_mult (gimple_stmt_iterator *gsi)
>  /* Main entry point for the forward propagation and statement combine
>     optimizer.  */
>
> -static unsigned int
> -ssa_forward_propagate_and_combine (void)
> +namespace {
> +
> +const pass_data pass_data_forwprop =
> +{
> +  GIMPLE_PASS, /* type */
> +  "forwprop", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_FORWPROP, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
> +};
> +
> +class pass_forwprop : public gimple_opt_pass
> +{
> +public:
> +  pass_forwprop (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_forwprop, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  opt_pass * clone () { return new pass_forwprop (m_ctxt); }
> +  virtual bool gate (function *) { return flag_tree_forwprop; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_forwprop
> +
> +unsigned int
> +pass_forwprop::execute (function *fun)
>  {
>    basic_block bb;
>    unsigned int todoflags = 0;
>
>    cfg_changed = false;
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator gsi;
>
> @@ -3660,7 +3690,7 @@ ssa_forward_propagate_and_combine (void)
>           else if (TREE_CODE_CLASS (code) == tcc_comparison)
>             {
>               if (forward_propagate_comparison (&gsi))
> -               cfg_changed = true;
> +               cfg_changed = true;
>             }
>           else
>             gsi_next (&gsi);
> @@ -3831,36 +3861,6 @@ ssa_forward_propagate_and_combine (void)
>    return todoflags;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_forwprop =
> -{
> -  GIMPLE_PASS, /* type */
> -  "forwprop", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_FORWPROP, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
> -};
> -
> -class pass_forwprop : public gimple_opt_pass
> -{
> -public:
> -  pass_forwprop (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_forwprop, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_forwprop (m_ctxt); }
> -  virtual bool gate (function *) { return flag_tree_forwprop; }
> -  unsigned int execute () { return ssa_forward_propagate_and_combine (); }
> -
> -}; // class pass_forwprop
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
> index b901f37..0ce02a0 100644
> --- a/gcc/tree-ssa-ifcombine.c
> +++ b/gcc/tree-ssa-ifcombine.c
> @@ -723,8 +723,36 @@ tree_ssa_ifcombine_bb (basic_block inner_cond_bb)
>
>  /* Main entry for the tree if-conversion pass.  */
>
> -static unsigned int
> -tree_ssa_ifcombine (void)
> +namespace {
> +
> +const pass_data pass_data_tree_ifcombine =
> +{
> +  GIMPLE_PASS, /* type */
> +  "ifcombine", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_IFCOMBINE, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
> +};
> +
> +class pass_tree_ifcombine : public gimple_opt_pass
> +{
> +public:
> +  pass_tree_ifcombine (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_tree_ifcombine, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_tree_ifcombine
> +
> +unsigned int
> +pass_tree_ifcombine::execute (function *fun)
>  {
>    basic_block *bbs;
>    bool cfg_changed = false;
> @@ -741,7 +769,7 @@ tree_ssa_ifcombine (void)
>       inner ones, and also that we do not try to visit a removed
>       block.  This is opposite of PHI-OPT, because we cascade the
>       combining rather than cascading PHIs. */
> -  for (i = n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS - 1; i >= 0; i--)
> +  for (i = n_basic_blocks_for_fn (fun) - NUM_FIXED_BLOCKS - 1; i >= 0; i--)
>      {
>        basic_block bb = bbs[i];
>        gimple stmt = last_stmt (bb);
> @@ -756,34 +784,6 @@ tree_ssa_ifcombine (void)
>    return cfg_changed ? TODO_cleanup_cfg : 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_tree_ifcombine =
> -{
> -  GIMPLE_PASS, /* type */
> -  "ifcombine", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_IFCOMBINE, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
> -};
> -
> -class pass_tree_ifcombine : public gimple_opt_pass
> -{
> -public:
> -  pass_tree_ifcombine (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_tree_ifcombine, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  unsigned int execute () { return tree_ssa_ifcombine (); }
> -
> -}; // class pass_tree_ifcombine
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
> index 34d1f70..fb86de4 100644
> --- a/gcc/tree-ssa-loop-ch.c
> +++ b/gcc/tree-ssa-loop-ch.c
> @@ -131,8 +131,38 @@ do_while_loop_p (struct loop *loop)
>     of the loop.  This is beneficial since it increases efficiency of
>     code motion optimizations.  It also saves one jump on entry to the loop.  */
>
> -static unsigned int
> -copy_loop_headers (void)
> +namespace {
> +
> +const pass_data pass_data_ch =
> +{
> +  GIMPLE_PASS, /* type */
> +  "ch", /* name */
> +  OPTGROUP_LOOP, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_CH, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_cleanup_cfg | TODO_verify_ssa
> +    | TODO_verify_flow ), /* todo_flags_finish */
> +};
> +
> +class pass_ch : public gimple_opt_pass
> +{
> +public:
> +  pass_ch (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_ch, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *) { return flag_tree_ch != 0; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_ch
> +
> +unsigned int
> +pass_ch::execute (function *fun)
>  {
>    struct loop *loop;
>    basic_block header;
> @@ -143,15 +173,15 @@ copy_loop_headers (void)
>
>    loop_optimizer_init (LOOPS_HAVE_PREHEADERS
>                        | LOOPS_HAVE_SIMPLE_LATCHES);
> -  if (number_of_loops (cfun) <= 1)
> +  if (number_of_loops (fun) <= 1)
>      {
>        loop_optimizer_finalize ();
>        return 0;
>      }
>
> -  bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
> -  copied_bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
> -  bbs_size = n_basic_blocks_for_fn (cfun);
> +  bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (fun));
> +  copied_bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (fun));
> +  bbs_size = n_basic_blocks_for_fn (fun);
>
>    FOR_EACH_LOOP (loop, 0)
>      {
> @@ -257,36 +287,6 @@ copy_loop_headers (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_ch =
> -{
> -  GIMPLE_PASS, /* type */
> -  "ch", /* name */
> -  OPTGROUP_LOOP, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_CH, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_cleanup_cfg | TODO_verify_ssa
> -    | TODO_verify_flow ), /* todo_flags_finish */
> -};
> -
> -class pass_ch : public gimple_opt_pass
> -{
> -public:
> -  pass_ch (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_ch, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *) { return flag_tree_ch != 0; }
> -  unsigned int execute () { return copy_loop_headers (); }
> -
> -}; // class pass_ch
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
> index f38ee95..0b44c97 100644
> --- a/gcc/tree-ssa-loop-im.c
> +++ b/gcc/tree-ssa-loop-im.c
> @@ -2529,15 +2529,6 @@ tree_ssa_lim (void)
>
>  /* Loop invariant motion pass.  */
>
> -static unsigned int
> -tree_ssa_loop_im (void)
> -{
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  return tree_ssa_lim ();
> -}
> -
>  namespace {
>
>  const pass_data pass_data_lim =
> @@ -2564,10 +2555,19 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_lim (m_ctxt); }
>    virtual bool gate (function *) { return flag_tree_loop_im != 0; }
> -  unsigned int execute () { return tree_ssa_loop_im (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_lim
>
> +unsigned int
> +pass_lim::execute (function *fun)
> +{
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  return tree_ssa_lim ();
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
> index df82816..54ebe25 100644
> --- a/gcc/tree-ssa-loop-ivcanon.c
> +++ b/gcc/tree-ssa-loop-ivcanon.c
> @@ -1256,15 +1256,6 @@ tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer)
>
>  /* Canonical induction variable creation pass.  */
>
> -static unsigned int
> -tree_ssa_loop_ivcanon (void)
> -{
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  return canonicalize_induction_variables ();
> -}
> -
>  namespace {
>
>  const pass_data pass_data_iv_canon =
> @@ -1290,10 +1281,19 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_tree_loop_ivcanon != 0; }
> -  unsigned int execute () { return tree_ssa_loop_ivcanon (); }
> +  virtual unsigned int execute (function *fun);
>
>  }; // class pass_iv_canon
>
> +unsigned int
> +pass_iv_canon::execute (function *fun)
> +{
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  return canonicalize_induction_variables ();
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -1304,17 +1304,6 @@ make_pass_iv_canon (gcc::context *ctxt)
>
>  /* Complete unrolling of loops.  */
>
> -static unsigned int
> -tree_complete_unroll (void)
> -{
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  return tree_unroll_loops_completely (flag_unroll_loops
> -                                      || flag_peel_loops
> -                                      || optimize >= 3, true);
> -}
> -
>  namespace {
>
>  const pass_data pass_data_complete_unroll =
> @@ -1339,10 +1328,21 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return tree_complete_unroll (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_complete_unroll
>
> +unsigned int
> +pass_complete_unroll::execute (function *fun)
> +{
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  return tree_unroll_loops_completely (flag_unroll_loops
> +                                      || flag_peel_loops
> +                                      || optimize >= 3, true);
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -1353,25 +1353,6 @@ make_pass_complete_unroll (gcc::context *ctxt)
>
>  /* Complete unrolling of inner loops.  */
>
> -static unsigned int
> -tree_complete_unroll_inner (void)
> -{
> -  unsigned ret = 0;
> -
> -  loop_optimizer_init (LOOPS_NORMAL
> -                      | LOOPS_HAVE_RECORDED_EXITS);
> -  if (number_of_loops (cfun) > 1)
> -    {
> -      scev_initialize ();
> -      ret = tree_unroll_loops_completely (optimize >= 3, false);
> -      free_numbers_of_iterations_estimates ();
> -      scev_finalize ();
> -    }
> -  loop_optimizer_finalize ();
> -
> -  return ret;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_complete_unrolli =
> @@ -1397,10 +1378,29 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return optimize >= 2; }
> -  unsigned int execute () { return tree_complete_unroll_inner (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_complete_unrolli
>
> +unsigned int
> +pass_complete_unrolli::execute (function *fun)
> +{
> +  unsigned ret = 0;
> +
> +  loop_optimizer_init (LOOPS_NORMAL
> +                      | LOOPS_HAVE_RECORDED_EXITS);
> +  if (number_of_loops (fun) > 1)
> +    {
> +      scev_initialize ();
> +      ret = tree_unroll_loops_completely (optimize >= 3, false);
> +      free_numbers_of_iterations_estimates ();
> +      scev_finalize ();
> +    }
> +  loop_optimizer_finalize ();
> +
> +  return ret;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
> index 17b13d1..1cf650a 100644
> --- a/gcc/tree-ssa-loop-prefetch.c
> +++ b/gcc/tree-ssa-loop-prefetch.c
> @@ -2004,15 +2004,6 @@ tree_ssa_prefetch_arrays (void)
>
>  /* Prefetching.  */
>
> -static unsigned int
> -tree_ssa_loop_prefetch (void)
> -{
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  return tree_ssa_prefetch_arrays ();
> -}
> -
>  namespace {
>
>  const pass_data pass_data_loop_prefetch =
> @@ -2038,10 +2029,19 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_prefetch_loop_arrays > 0; }
> -  unsigned int execute () { return tree_ssa_loop_prefetch (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_loop_prefetch
>
> +unsigned int
> +pass_loop_prefetch::execute (function *fun)
> +{
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  return tree_ssa_prefetch_arrays ();
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
> index 90bb205..a9a27d7 100644
> --- a/gcc/tree-ssa-loop-unswitch.c
> +++ b/gcc/tree-ssa-loop-unswitch.c
> @@ -402,15 +402,6 @@ tree_unswitch_loop (struct loop *loop,
>
>  /* Loop unswitching pass.  */
>
> -static unsigned int
> -tree_ssa_loop_unswitch (void)
> -{
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  return tree_ssa_unswitch_loops ();
> -}
> -
>  namespace {
>
>  const pass_data pass_data_tree_unswitch =
> @@ -436,10 +427,19 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_unswitch_loops != 0; }
> -  unsigned int execute () { return tree_ssa_loop_unswitch (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_tree_unswitch
>
> +unsigned int
> +pass_tree_unswitch::execute (function *fun)
> +{
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  return tree_ssa_unswitch_loops ();
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
> index 38e7b13..ccc8121 100644
> --- a/gcc/tree-ssa-loop.c
> +++ b/gcc/tree-ssa-loop.c
> @@ -82,23 +82,6 @@ make_pass_tree_loop (gcc::context *ctxt)
>
>  /* Loop optimizer initialization.  */
>
> -static unsigned int
> -tree_ssa_loop_init (void)
> -{
> -  loop_optimizer_init (LOOPS_NORMAL
> -                      | LOOPS_HAVE_RECORDED_EXITS);
> -  rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
> -
> -  /* We might discover new loops, e.g. when turning irreducible
> -     regions into reducible.  */
> -  scev_initialize ();
> -
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_tree_loop_init =
> @@ -123,10 +106,27 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return tree_ssa_loop_init (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_tree_loop_init
>
> +unsigned int
> +pass_tree_loop_init::execute (function *fun)
> +{
> +  loop_optimizer_init (LOOPS_NORMAL
> +                      | LOOPS_HAVE_RECORDED_EXITS);
> +  rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
> +
> +  /* We might discover new loops, e.g. when turning irreducible
> +     regions into reducible.  */
> +  scev_initialize ();
> +
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -137,15 +137,6 @@ make_pass_tree_loop_init (gcc::context *ctxt)
>
>  /* Loop autovectorization.  */
>
> -static unsigned int
> -tree_loop_vectorize (void)
> -{
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  return vectorize_loops ();
> -}
> -
>  namespace {
>
>  const pass_data pass_data_vectorize =
> @@ -175,10 +166,19 @@ public:
>        return flag_tree_loop_vectorize || fun->has_force_vectorize_loops;
>      }
>
> -  unsigned int execute () { return tree_loop_vectorize (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_vectorize
>
> +unsigned int
> +pass_vectorize::execute (function *fun)
> +{
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  return vectorize_loops ();
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -189,16 +189,6 @@ make_pass_vectorize (gcc::context *ctxt)
>
>  /* Check the correctness of the data dependence analyzers.  */
>
> -static unsigned int
> -check_data_deps (void)
> -{
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  tree_check_data_deps ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_check_data_deps =
> @@ -224,10 +214,20 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_check_data_deps != 0; }
> -  unsigned int execute () { return check_data_deps (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_check_data_deps
>
> +unsigned int
> +pass_check_data_deps::execute (function *fun)
> +{
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  tree_check_data_deps ();
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -264,7 +264,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_tree_scev_cprop; }
> -  unsigned int execute () { return scev_const_prop (); }
> +  virtual unsigned int execute (function *) { return scev_const_prop (); }
>
>  }; // class pass_scev_cprop
>
> @@ -278,17 +278,6 @@ make_pass_scev_cprop (gcc::context *ctxt)
>
>  /* Record bounds on numbers of iterations of loops.  */
>
> -static unsigned int
> -tree_ssa_loop_bounds (void)
> -{
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  estimate_numbers_of_iterations ();
> -  scev_reset ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_record_bounds =
> @@ -313,10 +302,21 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return tree_ssa_loop_bounds (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_record_bounds
>
> +unsigned int
> +pass_record_bounds::execute (function *fun)
> +{
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  estimate_numbers_of_iterations ();
> +  scev_reset ();
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -327,16 +327,6 @@ make_pass_record_bounds (gcc::context *ctxt)
>
>  /* Induction variable optimizations.  */
>
> -static unsigned int
> -tree_ssa_loop_ivopts (void)
> -{
> -  if (number_of_loops (cfun) <= 1)
> -    return 0;
> -
> -  tree_ssa_iv_optimize ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_iv_optimize =
> @@ -362,10 +352,20 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_ivopts != 0; }
> -  unsigned int execute () { return tree_ssa_loop_ivopts (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_iv_optimize
>
> +unsigned int
> +pass_iv_optimize::execute (function *fun)
> +{
> +  if (number_of_loops (fun) <= 1)
> +    return 0;
> +
> +  tree_ssa_iv_optimize ();
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -409,7 +409,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return tree_ssa_loop_done (); }
> +  virtual unsigned int execute (function *) { return tree_ssa_loop_done (); }
>
>  }; // class pass_tree_loop_done
>
> diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
> index fef1b1e..b965ad1 100644
> --- a/gcc/tree-ssa-math-opts.c
> +++ b/gcc/tree-ssa-math-opts.c
> @@ -506,35 +506,65 @@ execute_cse_reciprocals_1 (gimple_stmt_iterator *def_gsi, tree def)
>
>  /* Go through all the floating-point SSA_NAMEs, and call
>     execute_cse_reciprocals_1 on each of them.  */
> -static unsigned int
> -execute_cse_reciprocals (void)
> +namespace {
> +
> +const pass_data pass_data_cse_reciprocals =
> +{
> +  GIMPLE_PASS, /* type */
> +  "recip", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  PROP_ssa, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_update_ssa | TODO_verify_ssa
> +    | TODO_verify_stmts ), /* todo_flags_finish */
> +};
> +
> +class pass_cse_reciprocals : public gimple_opt_pass
> +{
> +public:
> +  pass_cse_reciprocals (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_cse_reciprocals, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *) { return optimize && flag_reciprocal_math; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_cse_reciprocals
> +
> +unsigned int
> +pass_cse_reciprocals::execute (function *fun)
>  {
>    basic_block bb;
>    tree arg;
>
>    occ_pool = create_alloc_pool ("dominators for recip",
>                                 sizeof (struct occurrence),
> -                               n_basic_blocks_for_fn (cfun) / 3 + 1);
> +                               n_basic_blocks_for_fn (fun) / 3 + 1);
>
>    memset (&reciprocal_stats, 0, sizeof (reciprocal_stats));
>    calculate_dominance_info (CDI_DOMINATORS);
>    calculate_dominance_info (CDI_POST_DOMINATORS);
>
>  #ifdef ENABLE_CHECKING
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      gcc_assert (!bb->aux);
>  #endif
>
> -  for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = DECL_CHAIN (arg))
> +  for (arg = DECL_ARGUMENTS (fun->decl); arg; arg = DECL_CHAIN (arg))
>      if (FLOAT_TYPE_P (TREE_TYPE (arg))
>         && is_gimple_reg (arg))
>        {
> -       tree name = ssa_default_def (cfun, arg);
> +       tree name = ssa_default_def (fun, arg);
>         if (name)
>           execute_cse_reciprocals_1 (NULL, name);
>        }
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator gsi;
>        gimple phi;
> @@ -636,9 +666,9 @@ execute_cse_reciprocals (void)
>         }
>      }
>
> -  statistics_counter_event (cfun, "reciprocal divs inserted",
> +  statistics_counter_event (fun, "reciprocal divs inserted",
>                             reciprocal_stats.rdivs_inserted);
> -  statistics_counter_event (cfun, "reciprocal functions inserted",
> +  statistics_counter_event (fun, "reciprocal functions inserted",
>                             reciprocal_stats.rfuncs_inserted);
>
>    free_dominance_info (CDI_DOMINATORS);
> @@ -647,36 +677,6 @@ execute_cse_reciprocals (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_cse_reciprocals =
> -{
> -  GIMPLE_PASS, /* type */
> -  "recip", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  PROP_ssa, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_update_ssa | TODO_verify_ssa
> -    | TODO_verify_stmts ), /* todo_flags_finish */
> -};
> -
> -class pass_cse_reciprocals : public gimple_opt_pass
> -{
> -public:
> -  pass_cse_reciprocals (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_cse_reciprocals, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *) { return optimize && flag_reciprocal_math; }
> -  unsigned int execute () { return execute_cse_reciprocals (); }
> -
> -}; // class pass_cse_reciprocals
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -1403,8 +1403,44 @@ gimple_expand_builtin_cabs (gimple_stmt_iterator *gsi, location_t loc, tree arg)
>     on the SSA_NAME argument of each of them.  Also expand powi(x,n) into
>     an optimal number of multiplies, when n is a constant.  */
>
> -static unsigned int
> -execute_cse_sincos (void)
> +namespace {
> +
> +const pass_data pass_data_cse_sincos =
> +{
> +  GIMPLE_PASS, /* type */
> +  "sincos", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  PROP_ssa, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_update_ssa | TODO_verify_ssa
> +    | TODO_verify_stmts ), /* todo_flags_finish */
> +};
> +
> +class pass_cse_sincos : public gimple_opt_pass
> +{
> +public:
> +  pass_cse_sincos (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_cse_sincos, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *)
> +    {
> +      /* We no longer require either sincos or cexp, since powi expansion
> +        piggybacks on this pass.  */
> +      return optimize;
> +    }
> +
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_cse_sincos
> +
> +unsigned int
> +pass_cse_sincos::execute (function *fun)
>  {
>    basic_block bb;
>    bool cfg_changed = false;
> @@ -1412,7 +1448,7 @@ execute_cse_sincos (void)
>    calculate_dominance_info (CDI_DOMINATORS);
>    memset (&sincos_stats, 0, sizeof (sincos_stats));
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator gsi;
>        bool cleanup_eh = false;
> @@ -1549,49 +1585,13 @@ execute_cse_sincos (void)
>         cfg_changed |= gimple_purge_dead_eh_edges (bb);
>      }
>
> -  statistics_counter_event (cfun, "sincos statements inserted",
> +  statistics_counter_event (fun, "sincos statements inserted",
>                             sincos_stats.inserted);
>
>    free_dominance_info (CDI_DOMINATORS);
>    return cfg_changed ? TODO_cleanup_cfg : 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_cse_sincos =
> -{
> -  GIMPLE_PASS, /* type */
> -  "sincos", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  PROP_ssa, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_update_ssa | TODO_verify_ssa
> -    | TODO_verify_stmts ), /* todo_flags_finish */
> -};
> -
> -class pass_cse_sincos : public gimple_opt_pass
> -{
> -public:
> -  pass_cse_sincos (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_cse_sincos, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *)
> -    {
> -      /* We no longer require either sincos or cexp, since powi expansion
> -        piggybacks on this pass.  */
> -      return optimize;
> -    }
> -
> -  unsigned int execute () { return execute_cse_sincos (); }
> -
> -}; // class pass_cse_sincos
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -1893,8 +1893,41 @@ find_bswap (gimple stmt)
>  /* Find manual byte swap implementations and turn them into a bswap
>     builtin invokation.  */
>
> -static unsigned int
> -execute_optimize_bswap (void)
> +namespace {
> +
> +const pass_data pass_data_optimize_bswap =
> +{
> +  GIMPLE_PASS, /* type */
> +  "bswap", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  PROP_ssa, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_optimize_bswap : public gimple_opt_pass
> +{
> +public:
> +  pass_optimize_bswap (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_optimize_bswap, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *)
> +    {
> +      return flag_expensive_optimizations && optimize;
> +    }
> +
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_optimize_bswap
> +
> +unsigned int
> +pass_optimize_bswap::execute (function *fun)
>  {
>    basic_block bb;
>    bool bswap16_p, bswap32_p, bswap64_p;
> @@ -1940,7 +1973,7 @@ execute_optimize_bswap (void)
>
>    memset (&bswap_stats, 0, sizeof (bswap_stats));
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator gsi;
>
> @@ -2046,50 +2079,17 @@ execute_optimize_bswap (void)
>         }
>      }
>
> -  statistics_counter_event (cfun, "16-bit bswap implementations found",
> +  statistics_counter_event (fun, "16-bit bswap implementations found",
>                             bswap_stats.found_16bit);
> -  statistics_counter_event (cfun, "32-bit bswap implementations found",
> +  statistics_counter_event (fun, "32-bit bswap implementations found",
>                             bswap_stats.found_32bit);
> -  statistics_counter_event (cfun, "64-bit bswap implementations found",
> +  statistics_counter_event (fun, "64-bit bswap implementations found",
>                             bswap_stats.found_64bit);
>
>    return (changed ? TODO_update_ssa | TODO_verify_ssa
>           | TODO_verify_stmts : 0);
>  }
>
> -namespace {
> -
> -const pass_data pass_data_optimize_bswap =
> -{
> -  GIMPLE_PASS, /* type */
> -  "bswap", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  PROP_ssa, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_optimize_bswap : public gimple_opt_pass
> -{
> -public:
> -  pass_optimize_bswap (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_optimize_bswap, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *)
> -    {
> -      return flag_expensive_optimizations && optimize;
> -    }
> -
> -  unsigned int execute () { return execute_optimize_bswap (); }
> -
> -}; // class pass_optimize_bswap
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -2775,15 +2775,49 @@ convert_mult_to_fma (gimple mul_stmt, tree op1, tree op2)
>     smaller types, and replace the MULT_EXPR with a WIDEN_MULT_EXPR
>     where appropriate.  */
>
> -static unsigned int
> -execute_optimize_widening_mul (void)
> +namespace {
> +
> +const pass_data pass_data_optimize_widening_mul =
> +{
> +  GIMPLE_PASS, /* type */
> +  "widening_mul", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  PROP_ssa, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_verify_ssa | TODO_verify_stmts
> +    | TODO_update_ssa ), /* todo_flags_finish */
> +};
> +
> +class pass_optimize_widening_mul : public gimple_opt_pass
> +{
> +public:
> +  pass_optimize_widening_mul (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_optimize_widening_mul, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *)
> +    {
> +      return flag_expensive_optimizations && optimize;
> +    }
> +
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_optimize_widening_mul
> +
> +unsigned int
> +pass_optimize_widening_mul::execute (function *fun)
>  {
>    basic_block bb;
>    bool cfg_changed = false;
>
>    memset (&widen_mul_stats, 0, sizeof (widen_mul_stats));
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator gsi;
>
> @@ -2854,50 +2888,16 @@ execute_optimize_widening_mul (void)
>         }
>      }
>
> -  statistics_counter_event (cfun, "widening multiplications inserted",
> +  statistics_counter_event (fun, "widening multiplications inserted",
>                             widen_mul_stats.widen_mults_inserted);
> -  statistics_counter_event (cfun, "widening maccs inserted",
> +  statistics_counter_event (fun, "widening maccs inserted",
>                             widen_mul_stats.maccs_inserted);
> -  statistics_counter_event (cfun, "fused multiply-adds inserted",
> +  statistics_counter_event (fun, "fused multiply-adds inserted",
>                             widen_mul_stats.fmas_inserted);
>
>    return cfg_changed ? TODO_cleanup_cfg : 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_optimize_widening_mul =
> -{
> -  GIMPLE_PASS, /* type */
> -  "widening_mul", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  PROP_ssa, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_verify_ssa | TODO_verify_stmts
> -    | TODO_update_ssa ), /* todo_flags_finish */
> -};
> -
> -class pass_optimize_widening_mul : public gimple_opt_pass
> -{
> -public:
> -  pass_optimize_widening_mul (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_optimize_widening_mul, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *)
> -    {
> -      return flag_expensive_optimizations && optimize;
> -    }
> -
> -  unsigned int execute () { return execute_optimize_widening_mul (); }
> -
> -}; // class pass_optimize_widening_mul
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
> index 1ee39a5..9b5b563 100644
> --- a/gcc/tree-ssa-phiopt.c
> +++ b/gcc/tree-ssa-phiopt.c
> @@ -59,7 +59,6 @@ along with GCC; see the file COPYING3.  If not see
>  #define HAVE_conditional_move (0)
>  #endif
>
> -static unsigned int tree_ssa_phiopt (void);
>  static unsigned int tree_ssa_phiopt_worker (bool, bool);
>  static bool conditional_replacement (basic_block, basic_block,
>                                      edge, edge, gimple, tree, tree);
> @@ -80,162 +79,6 @@ static void hoist_adjacent_loads (basic_block, basic_block,
>                                   basic_block, basic_block);
>  static bool gate_hoist_loads (void);
>
> -/* This pass tries to replaces an if-then-else block with an
> -   assignment.  We have four kinds of transformations.  Some of these
> -   transformations are also performed by the ifcvt RTL optimizer.
> -
> -   Conditional Replacement
> -   -----------------------
> -
> -   This transformation, implemented in conditional_replacement,
> -   replaces
> -
> -     bb0:
> -      if (cond) goto bb2; else goto bb1;
> -     bb1:
> -     bb2:
> -      x = PHI <0 (bb1), 1 (bb0), ...>;
> -
> -   with
> -
> -     bb0:
> -      x' = cond;
> -      goto bb2;
> -     bb2:
> -      x = PHI <x' (bb0), ...>;
> -
> -   We remove bb1 as it becomes unreachable.  This occurs often due to
> -   gimplification of conditionals.
> -
> -   Value Replacement
> -   -----------------
> -
> -   This transformation, implemented in value_replacement, replaces
> -
> -     bb0:
> -       if (a != b) goto bb2; else goto bb1;
> -     bb1:
> -     bb2:
> -       x = PHI <a (bb1), b (bb0), ...>;
> -
> -   with
> -
> -     bb0:
> -     bb2:
> -       x = PHI <b (bb0), ...>;
> -
> -   This opportunity can sometimes occur as a result of other
> -   optimizations.
> -
> -
> -   Another case caught by value replacement looks like this:
> -
> -     bb0:
> -       t1 = a == CONST;
> -       t2 = b > c;
> -       t3 = t1 & t2;
> -       if (t3 != 0) goto bb1; else goto bb2;
> -     bb1:
> -     bb2:
> -       x = PHI (CONST, a)
> -
> -   Gets replaced with:
> -     bb0:
> -     bb2:
> -       t1 = a == CONST;
> -       t2 = b > c;
> -       t3 = t1 & t2;
> -       x = a;
> -
> -   ABS Replacement
> -   ---------------
> -
> -   This transformation, implemented in abs_replacement, replaces
> -
> -     bb0:
> -       if (a >= 0) goto bb2; else goto bb1;
> -     bb1:
> -       x = -a;
> -     bb2:
> -       x = PHI <x (bb1), a (bb0), ...>;
> -
> -   with
> -
> -     bb0:
> -       x' = ABS_EXPR< a >;
> -     bb2:
> -       x = PHI <x' (bb0), ...>;
> -
> -   MIN/MAX Replacement
> -   -------------------
> -
> -   This transformation, minmax_replacement replaces
> -
> -     bb0:
> -       if (a <= b) goto bb2; else goto bb1;
> -     bb1:
> -     bb2:
> -       x = PHI <b (bb1), a (bb0), ...>;
> -
> -   with
> -
> -     bb0:
> -       x' = MIN_EXPR (a, b)
> -     bb2:
> -       x = PHI <x' (bb0), ...>;
> -
> -   A similar transformation is done for MAX_EXPR.
> -
> -
> -   This pass also performs a fifth transformation of a slightly different
> -   flavor.
> -
> -   Adjacent Load Hoisting
> -   ----------------------
> -
> -   This transformation replaces
> -
> -     bb0:
> -       if (...) goto bb2; else goto bb1;
> -     bb1:
> -       x1 = (<expr>).field1;
> -       goto bb3;
> -     bb2:
> -       x2 = (<expr>).field2;
> -     bb3:
> -       # x = PHI <x1, x2>;
> -
> -   with
> -
> -     bb0:
> -       x1 = (<expr>).field1;
> -       x2 = (<expr>).field2;
> -       if (...) goto bb2; else goto bb1;
> -     bb1:
> -       goto bb3;
> -     bb2:
> -     bb3:
> -       # x = PHI <x1, x2>;
> -
> -   The purpose of this transformation is to enable generation of conditional
> -   move instructions such as Intel CMOVE or PowerPC ISEL.  Because one of
> -   the loads is speculative, the transformation is restricted to very
> -   specific cases to avoid introducing a page fault.  We are looking for
> -   the common idiom:
> -
> -     if (...)
> -       x = y->left;
> -     else
> -       x = y->right;
> -
> -   where left and right are typically adjacent pointers in a tree structure.  */
> -
> -static unsigned int
> -tree_ssa_phiopt (void)
> -{
> -  return tree_ssa_phiopt_worker (false, gate_hoist_loads ());
> -}
> -
>  /* This pass tries to transform conditional stores into unconditional
>     ones, enabling further simplifications with the simpler then and else
>     blocks.  In particular it replaces this:
> @@ -2200,8 +2043,155 @@ gate_hoist_loads (void)
>           && HAVE_conditional_move);
>  }
>
> -/* Always do these optimizations if we have SSA
> -   trees to work on.  */
> +/* This pass tries to replaces an if-then-else block with an
> +   assignment.  We have four kinds of transformations.  Some of these
> +   transformations are also performed by the ifcvt RTL optimizer.
> +
> +   Conditional Replacement
> +   -----------------------
> +
> +   This transformation, implemented in conditional_replacement,
> +   replaces
> +
> +     bb0:
> +      if (cond) goto bb2; else goto bb1;
> +     bb1:
> +     bb2:
> +      x = PHI <0 (bb1), 1 (bb0), ...>;
> +
> +   with
> +
> +     bb0:
> +      x' = cond;
> +      goto bb2;
> +     bb2:
> +      x = PHI <x' (bb0), ...>;
> +
> +   We remove bb1 as it becomes unreachable.  This occurs often due to
> +   gimplification of conditionals.
> +
> +   Value Replacement
> +   -----------------
> +
> +   This transformation, implemented in value_replacement, replaces
> +
> +     bb0:
> +       if (a != b) goto bb2; else goto bb1;
> +     bb1:
> +     bb2:
> +       x = PHI <a (bb1), b (bb0), ...>;
> +
> +   with
> +
> +     bb0:
> +     bb2:
> +       x = PHI <b (bb0), ...>;
> +
> +   This opportunity can sometimes occur as a result of other
> +   optimizations.
> +
> +
> +   Another case caught by value replacement looks like this:
> +
> +     bb0:
> +       t1 = a == CONST;
> +       t2 = b > c;
> +       t3 = t1 & t2;
> +       if (t3 != 0) goto bb1; else goto bb2;
> +     bb1:
> +     bb2:
> +       x = PHI (CONST, a)
> +
> +   Gets replaced with:
> +     bb0:
> +     bb2:
> +       t1 = a == CONST;
> +       t2 = b > c;
> +       t3 = t1 & t2;
> +       x = a;
> +
> +   ABS Replacement
> +   ---------------
> +
> +   This transformation, implemented in abs_replacement, replaces
> +
> +     bb0:
> +       if (a >= 0) goto bb2; else goto bb1;
> +     bb1:
> +       x = -a;
> +     bb2:
> +       x = PHI <x (bb1), a (bb0), ...>;
> +
> +   with
> +
> +     bb0:
> +       x' = ABS_EXPR< a >;
> +     bb2:
> +       x = PHI <x' (bb0), ...>;
> +
> +   MIN/MAX Replacement
> +   -------------------
> +
> +   This transformation, minmax_replacement replaces
> +
> +     bb0:
> +       if (a <= b) goto bb2; else goto bb1;
> +     bb1:
> +     bb2:
> +       x = PHI <b (bb1), a (bb0), ...>;
> +
> +   with
> +
> +     bb0:
> +       x' = MIN_EXPR (a, b)
> +     bb2:
> +       x = PHI <x' (bb0), ...>;
> +
> +   A similar transformation is done for MAX_EXPR.
> +
> +
> +   This pass also performs a fifth transformation of a slightly different
> +   flavor.
> +
> +   Adjacent Load Hoisting
> +   ----------------------
> +
> +   This transformation replaces
> +
> +     bb0:
> +       if (...) goto bb2; else goto bb1;
> +     bb1:
> +       x1 = (<expr>).field1;
> +       goto bb3;
> +     bb2:
> +       x2 = (<expr>).field2;
> +     bb3:
> +       # x = PHI <x1, x2>;
> +
> +   with
> +
> +     bb0:
> +       x1 = (<expr>).field1;
> +       x2 = (<expr>).field2;
> +       if (...) goto bb2; else goto bb1;
> +     bb1:
> +       goto bb3;
> +     bb2:
> +     bb3:
> +       # x = PHI <x1, x2>;
> +
> +   The purpose of this transformation is to enable generation of conditional
> +   move instructions such as Intel CMOVE or PowerPC ISEL.  Because one of
> +   the loads is speculative, the transformation is restricted to very
> +   specific cases to avoid introducing a page fault.  We are looking for
> +   the common idiom:
> +
> +     if (...)
> +       x = y->left;
> +     else
> +       x = y->right;
> +
> +   where left and right are typically adjacent pointers in a tree structure.  */
>
>  namespace {
>
> @@ -2229,7 +2219,10 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_phiopt (m_ctxt); }
> -  unsigned int execute () { return tree_ssa_phiopt (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return tree_ssa_phiopt_worker (false, gate_hoist_loads ());
> +    }
>
>  }; // class pass_phiopt
>
> @@ -2267,7 +2260,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_tree_cselim; }
> -  unsigned int execute () { return tree_ssa_cs_elim (); }
> +  virtual unsigned int execute (function *) { return tree_ssa_cs_elim (); }
>
>  }; // class pass_cselim
>
> diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
> index cbdbc6e..0154b47 100644
> --- a/gcc/tree-ssa-phiprop.c
> +++ b/gcc/tree-ssa-phiprop.c
> @@ -374,8 +374,37 @@ next:;
>
>  /* Main entry for phiprop pass.  */
>
> -static unsigned int
> -tree_ssa_phiprop (void)
> +namespace {
> +
> +const pass_data pass_data_phiprop =
> +{
> +  GIMPLE_PASS, /* type */
> +  "phiprop", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_PHIPROP, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
> +};
> +
> +class pass_phiprop : public gimple_opt_pass
> +{
> +public:
> +  pass_phiprop (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_phiprop, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *) { return flag_tree_phiprop; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_phiprop
> +
> +unsigned int
> +pass_phiprop::execute (function *fun)
>  {
>    vec<basic_block> bbs;
>    struct phiprop_d *phivn;
> @@ -393,7 +422,7 @@ tree_ssa_phiprop (void)
>
>    /* Walk the dominator tree in preorder.  */
>    bbs = get_all_dominated_blocks (CDI_DOMINATORS,
> -                                 single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
> +                                 single_succ (ENTRY_BLOCK_PTR_FOR_FN (fun)));
>    FOR_EACH_VEC_ELT (bbs, i, bb)
>      for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
>        did_something |= propagate_with_phi (bb, gsi_stmt (gsi), phivn, n);
> @@ -409,35 +438,6 @@ tree_ssa_phiprop (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_phiprop =
> -{
> -  GIMPLE_PASS, /* type */
> -  "phiprop", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_PHIPROP, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */
> -};
> -
> -class pass_phiprop : public gimple_opt_pass
> -{
> -public:
> -  pass_phiprop (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_phiprop, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *) { return flag_tree_phiprop; }
> -  unsigned int execute () { return tree_ssa_phiprop (); }
> -
> -}; // class pass_phiprop
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> 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 *
> diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
> index 92a215a..84b681e 100644
> --- a/gcc/tree-ssa-reassoc.c
> +++ b/gcc/tree-ssa-reassoc.c
> @@ -4693,7 +4693,7 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_reassoc (m_ctxt); }
>    virtual bool gate (function *) { return flag_tree_reassoc != 0; }
> -  unsigned int execute () { return execute_reassoc (); }
> +  virtual unsigned int execute (function *) { return execute_reassoc (); }
>
>  }; // class pass_reassoc
>
> diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
> index 6803160..7992ced 100644
> --- a/gcc/tree-ssa-sink.c
> +++ b/gcc/tree-ssa-sink.c
> @@ -563,31 +563,6 @@ sink_code_in_bb (basic_block bb)
>     Note that this reduces the number of computations of a = b + c to 1
>     when we take the else edge, instead of 2.
>  */
> -static void
> -execute_sink_code (void)
> -{
> -  loop_optimizer_init (LOOPS_NORMAL);
> -  split_critical_edges ();
> -  connect_infinite_loops_to_exit ();
> -  memset (&sink_stats, 0, sizeof (sink_stats));
> -  calculate_dominance_info (CDI_DOMINATORS);
> -  calculate_dominance_info (CDI_POST_DOMINATORS);
> -  sink_code_in_bb (EXIT_BLOCK_PTR_FOR_FN (cfun));
> -  statistics_counter_event (cfun, "Sunk statements", sink_stats.sunk);
> -  free_dominance_info (CDI_POST_DOMINATORS);
> -  remove_fake_exit_edges ();
> -  loop_optimizer_finalize ();
> -}
> -
> -/* Gate and execute functions for PRE.  */
> -
> -static unsigned int
> -do_sink (void)
> -{
> -  execute_sink_code ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_sink_code =
> @@ -598,7 +573,7 @@ const pass_data pass_data_sink_code =
>    true, /* has_execute */
>    TV_TREE_SINK, /* tv_id */
>    /* PROP_no_crit_edges is ensured by running split_critical_edges in
> -     execute_sink_code.  */
> +     pass_data_sink_code::execute ().  */
>    ( PROP_cfg | PROP_ssa ), /* properties_required */
>    0, /* properties_provided */
>    0, /* properties_destroyed */
> @@ -616,10 +591,28 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_tree_sink != 0; }
> -  unsigned int execute () { return do_sink (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_sink_code
>
> +unsigned int
> +pass_sink_code::execute (function *fun)
> +{
> +  loop_optimizer_init (LOOPS_NORMAL);
> +  split_critical_edges ();
> +  connect_infinite_loops_to_exit ();
> +  memset (&sink_stats, 0, sizeof (sink_stats));
> +  calculate_dominance_info (CDI_DOMINATORS);
> +  calculate_dominance_info (CDI_POST_DOMINATORS);
> +  sink_code_in_bb (EXIT_BLOCK_PTR_FOR_FN (fun));
> +  statistics_counter_event (fun, "Sunk statements", sink_stats.sunk);
> +  free_dominance_info (CDI_POST_DOMINATORS);
> +  remove_fake_exit_edges ();
> +  loop_optimizer_finalize ();
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
> index fb83093..1cc36d8 100644
> --- a/gcc/tree-ssa-strlen.c
> +++ b/gcc/tree-ssa-strlen.c
> @@ -2061,34 +2061,6 @@ strlen_dom_walker::after_dom_children (basic_block bb)
>
>  /* Main entry point.  */
>
> -static unsigned int
> -tree_ssa_strlen (void)
> -{
> -  ssa_ver_to_stridx.safe_grow_cleared (num_ssa_names);
> -  max_stridx = 1;
> -  strinfo_pool = create_alloc_pool ("strinfo_struct pool",
> -                                   sizeof (struct strinfo_struct), 64);
> -
> -  calculate_dominance_info (CDI_DOMINATORS);
> -
> -  /* String length optimization is implemented as a walk of the dominator
> -     tree and a forward walk of statements within each block.  */
> -  strlen_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
> -
> -  ssa_ver_to_stridx.release ();
> -  free_alloc_pool (strinfo_pool);
> -  if (decl_to_stridxlist_htab.is_created ())
> -    {
> -      obstack_free (&stridx_obstack, NULL);
> -      decl_to_stridxlist_htab.dispose ();
> -    }
> -  laststmt.stmt = NULL;
> -  laststmt.len = NULL_TREE;
> -  laststmt.stridx = 0;
> -
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_strlen =
> @@ -2114,10 +2086,38 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_optimize_strlen != 0; }
> -  unsigned int execute () { return tree_ssa_strlen (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_strlen
>
> +unsigned int
> +pass_strlen::execute (function *fun)
> +{
> +  ssa_ver_to_stridx.safe_grow_cleared (num_ssa_names);
> +  max_stridx = 1;
> +  strinfo_pool = create_alloc_pool ("strinfo_struct pool",
> +                                   sizeof (struct strinfo_struct), 64);
> +
> +  calculate_dominance_info (CDI_DOMINATORS);
> +
> +  /* String length optimization is implemented as a walk of the dominator
> +     tree and a forward walk of statements within each block.  */
> +  strlen_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr);
> +
> +  ssa_ver_to_stridx.release ();
> +  free_alloc_pool (strinfo_pool);
> +  if (decl_to_stridxlist_htab.is_created ())
> +    {
> +      obstack_free (&stridx_obstack, NULL);
> +      decl_to_stridxlist_htab.dispose ();
> +    }
> +  laststmt.stmt = NULL;
> +  laststmt.len = NULL_TREE;
> +  laststmt.stridx = 0;
> +
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
> index 3548ac5..2686ba6 100644
> --- a/gcc/tree-ssa-structalias.c
> +++ b/gcc/tree-ssa-structalias.c
> @@ -7444,7 +7444,7 @@ public:
>               && !seen_error ());
>      }
>
> -  unsigned int execute () { return ipa_pta_execute (); }
> +  virtual unsigned int execute (function *) { return ipa_pta_execute (); }
>
>  }; // class pass_ipa_pta
>
> diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
> index e39ce88..52c568a 100644
> --- a/gcc/tree-ssa-uncprop.c
> +++ b/gcc/tree-ssa-uncprop.c
> @@ -383,47 +383,6 @@ private:
>    auto_vec<tree, 2> m_equiv_stack;
>  };
>
> -/* Main driver for un-cprop.  */
> -
> -static unsigned int
> -tree_ssa_uncprop (void)
> -{
> -  basic_block bb;
> -
> -  associate_equivalences_with_edges ();
> -
> -  /* Create our global data structures.  */
> -  val_ssa_equiv.create (1024);
> -
> -  /* We're going to do a dominator walk, so ensure that we have
> -     dominance information.  */
> -  calculate_dominance_info (CDI_DOMINATORS);
> -
> -  /* Recursively walk the dominator tree undoing unprofitable
> -     constant/copy propagations.  */
> -  uncprop_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
> -
> -  /* we just need to empty elements out of the hash table, and cleanup the
> -    AUX field on the edges.  */
> -  val_ssa_equiv.dispose ();
> -  FOR_EACH_BB_FN (bb, cfun)
> -    {
> -      edge e;
> -      edge_iterator ei;
> -
> -      FOR_EACH_EDGE (e, ei, bb->succs)
> -       {
> -         if (e->aux)
> -           {
> -             free (e->aux);
> -             e->aux = NULL;
> -           }
> -       }
> -    }
> -  return 0;
> -}
> -
> -
>  /* We have finished processing the dominator children of BB, perform
>     any finalization actions in preparation for leaving this node in
>     the dominator tree.  */
> @@ -607,10 +566,48 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_uncprop (m_ctxt); }
>    virtual bool gate (function *) { return flag_tree_dom != 0; }
> -  unsigned int execute () { return tree_ssa_uncprop (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_uncprop
>
> +unsigned int
> +pass_uncprop::execute (function *fun)
> +{
> +  basic_block bb;
> +
> +  associate_equivalences_with_edges ();
> +
> +  /* Create our global data structures.  */
> +  val_ssa_equiv.create (1024);
> +
> +  /* We're going to do a dominator walk, so ensure that we have
> +     dominance information.  */
> +  calculate_dominance_info (CDI_DOMINATORS);
> +
> +  /* Recursively walk the dominator tree undoing unprofitable
> +     constant/copy propagations.  */
> +  uncprop_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr);
> +
> +  /* we just need to empty elements out of the hash table, and cleanup the
> +    AUX field on the edges.  */
> +  val_ssa_equiv.dispose ();
> +  FOR_EACH_BB_FN (bb, fun)
> +    {
> +      edge e;
> +      edge_iterator ei;
> +
> +      FOR_EACH_EDGE (e, ei, bb->succs)
> +       {
> +         if (e->aux)
> +           {
> +             free (e->aux);
> +             e->aux = NULL;
> +           }
> +       }
> +    }
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
> index 03ff3b8..5477bb8 100644
> --- a/gcc/tree-ssa-uninit.c
> +++ b/gcc/tree-ssa-uninit.c
> @@ -2282,11 +2282,44 @@ warn_uninitialized_phi (gimple phi, vec<gimple> *worklist,
>
>  }
>
> +static bool
> +gate_warn_uninitialized (void)
> +{
> +  return warn_uninitialized || warn_maybe_uninitialized;
> +}
>
> -/* Entry point to the late uninitialized warning pass.  */
> +namespace {
>
> -static unsigned int
> -execute_late_warn_uninitialized (void)
> +const pass_data pass_data_late_warn_uninitialized =
> +{
> +  GIMPLE_PASS, /* type */
> +  "uninit", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  PROP_ssa, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_late_warn_uninitialized : public gimple_opt_pass
> +{
> +public:
> +  pass_late_warn_uninitialized (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_late_warn_uninitialized, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
> +  virtual bool gate (function *) { return gate_warn_uninitialized (); }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_late_warn_uninitialized
> +
> +unsigned int
> +pass_late_warn_uninitialized::execute (function *fun)
>  {
>    basic_block bb;
>    gimple_stmt_iterator gsi;
> @@ -2306,34 +2339,34 @@ execute_late_warn_uninitialized (void)
>    added_to_worklist = pointer_set_create ();
>
>    /* Initialize worklist  */
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
>        {
> -        gimple phi = gsi_stmt (gsi);
> -        size_t n, i;
> -
> -        n = gimple_phi_num_args (phi);
> -
> -        /* Don't look at virtual operands.  */
> -        if (virtual_operand_p (gimple_phi_result (phi)))
> -          continue;
> -
> -        for (i = 0; i < n; ++i)
> -          {
> -            tree op = gimple_phi_arg_def (phi, i);
> -            if (TREE_CODE (op) == SSA_NAME
> -                && uninit_undefined_value_p (op))
> -              {
> -                worklist.safe_push (phi);
> +       gimple phi = gsi_stmt (gsi);
> +       size_t n, i;
> +
> +       n = gimple_phi_num_args (phi);
> +
> +       /* Don't look at virtual operands.  */
> +       if (virtual_operand_p (gimple_phi_result (phi)))
> +         continue;
> +
> +       for (i = 0; i < n; ++i)
> +         {
> +           tree op = gimple_phi_arg_def (phi, i);
> +           if (TREE_CODE (op) == SSA_NAME
> +               && uninit_undefined_value_p (op))
> +             {
> +               worklist.safe_push (phi);
>                 pointer_set_insert (added_to_worklist, phi);
> -                if (dump_file && (dump_flags & TDF_DETAILS))
> -                  {
> -                    fprintf (dump_file, "[WORKLIST]: add to initial list: ");
> -                    print_gimple_stmt (dump_file, phi, 0, 0);
> -                  }
> -                break;
> -              }
> -          }
> +               if (dump_file && (dump_flags & TDF_DETAILS))
> +                 {
> +                   fprintf (dump_file, "[WORKLIST]: add to initial list: ");
> +                   print_gimple_stmt (dump_file, phi, 0, 0);
> +                 }
> +               break;
> +             }
> +         }
>        }
>
>    while (worklist.length () != 0)
> @@ -2352,42 +2385,6 @@ execute_late_warn_uninitialized (void)
>    return 0;
>  }
>
> -static bool
> -gate_warn_uninitialized (void)
> -{
> -  return warn_uninitialized || warn_maybe_uninitialized;
> -}
> -
> -namespace {
> -
> -const pass_data pass_data_late_warn_uninitialized =
> -{
> -  GIMPLE_PASS, /* type */
> -  "uninit", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  PROP_ssa, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_late_warn_uninitialized : public gimple_opt_pass
> -{
> -public:
> -  pass_late_warn_uninitialized (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_late_warn_uninitialized, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
> -  virtual bool gate (function *) { return gate_warn_uninitialized (); }
> -  unsigned int execute () { return execute_late_warn_uninitialized (); }
> -
> -}; // class pass_late_warn_uninitialized
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -2442,7 +2439,10 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return gate_warn_uninitialized (); }
> -  unsigned int execute () { return execute_early_warn_uninitialized (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return execute_early_warn_uninitialized ();
> +    }
>
>  }; // class pass_early_warn_uninitialized
>
> diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
> index 52126ca..1ea639d 100644
> --- a/gcc/tree-ssa.c
> +++ b/gcc/tree-ssa.c
> @@ -1169,7 +1169,10 @@ public:
>        return !(fun->curr_properties & PROP_ssa);
>      }
>
> -  unsigned int execute () { return execute_init_datastructures (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return execute_init_datastructures ();
> +    }
>
>  }; // class pass_init_datastructures
>
> diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
> index b18b688..02db6a5 100644
> --- a/gcc/tree-ssanames.c
> +++ b/gcc/tree-ssanames.c
> @@ -569,39 +569,6 @@ replace_ssa_name_symbol (tree ssa_name, tree sym)
>  /* Return SSA names that are unused to GGC memory and compact the SSA
>     version namespace.  This is used to keep footprint of compiler during
>     interprocedural optimization.  */
> -static unsigned int
> -release_dead_ssa_names (void)
> -{
> -  unsigned i, j;
> -  int n = vec_safe_length (FREE_SSANAMES (cfun));
> -
> -  /* Now release the freelist.  */
> -  vec_free (FREE_SSANAMES (cfun));
> -
> -  /* And compact the SSA number space.  We make sure to not change the
> -     relative order of SSA versions.  */
> -  for (i = 1, j = 1; i < cfun->gimple_df->ssa_names->length (); ++i)
> -    {
> -      tree name = ssa_name (i);
> -      if (name)
> -       {
> -         if (i != j)
> -           {
> -             SSA_NAME_VERSION (name) = j;
> -             (*cfun->gimple_df->ssa_names)[j] = name;
> -           }
> -         j++;
> -       }
> -    }
> -  cfun->gimple_df->ssa_names->truncate (j);
> -
> -  statistics_counter_event (cfun, "SSA names released", n);
> -  statistics_counter_event (cfun, "SSA name holes removed", i - j);
> -  if (dump_file)
> -    fprintf (dump_file, "Released %i names, %.2f%%, removed %i holes\n",
> -            n, n * 100.0 / num_ssa_names, i - j);
> -  return 0;
> -}
>
>  namespace {
>
> @@ -627,10 +594,44 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return release_dead_ssa_names (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_release_ssa_names
>
> +unsigned int
> +pass_release_ssa_names::execute (function *fun)
> +{
> +  unsigned i, j;
> +  int n = vec_safe_length (FREE_SSANAMES (fun));
> +
> +  /* Now release the freelist.  */
> +  vec_free (FREE_SSANAMES (fun));
> +
> +  /* And compact the SSA number space.  We make sure to not change the
> +     relative order of SSA versions.  */
> +  for (i = 1, j = 1; i < fun->gimple_df->ssa_names->length (); ++i)
> +    {
> +      tree name = ssa_name (i);
> +      if (name)
> +       {
> +         if (i != j)
> +           {
> +             SSA_NAME_VERSION (name) = j;
> +             (*fun->gimple_df->ssa_names)[j] = name;
> +           }
> +         j++;
> +       }
> +    }
> +  fun->gimple_df->ssa_names->truncate (j);
> +
> +  statistics_counter_event (fun, "SSA names released", n);
> +  statistics_counter_event (fun, "SSA name holes removed", i - j);
> +  if (dump_file)
> +    fprintf (dump_file, "Released %i names, %.2f%%, removed %i holes\n",
> +            n, n * 100.0 / num_ssa_names, i - j);
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
> index 710711b..1cdf0ed 100644
> --- a/gcc/tree-stdarg.c
> +++ b/gcc/tree-stdarg.c
> @@ -663,10 +663,43 @@ check_all_va_list_escapes (struct stdarg_info *si)
>    return false;
>  }
>
> -/* Entry point to the stdarg optimization pass.  */
>
> -static unsigned int
> -execute_optimize_stdarg (void)
> +namespace {
> +
> +const pass_data pass_data_stdarg =
> +{
> +  GIMPLE_PASS, /* type */
> +  "stdarg", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_NONE, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  0, /* todo_flags_finish */
> +};
> +
> +class pass_stdarg : public gimple_opt_pass
> +{
> +public:
> +  pass_stdarg (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_stdarg, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *fun)
> +    {
> +      /* This optimization is only for stdarg functions.  */
> +      return fun->stdarg != 0;
> +    }
> +
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_stdarg
> +
> +unsigned int
> +pass_stdarg::execute (function *fun)
>  {
>    basic_block bb;
>    bool va_list_escapes = false;
> @@ -676,8 +709,8 @@ execute_optimize_stdarg (void)
>    const char *funcname = NULL;
>    tree cfun_va_list;
>
> -  cfun->va_list_gpr_size = 0;
> -  cfun->va_list_fpr_size = 0;
> +  fun->va_list_gpr_size = 0;
> +  fun->va_list_fpr_size = 0;
>    memset (&si, 0, sizeof (si));
>    si.va_list_vars = BITMAP_ALLOC (NULL);
>    si.va_list_escape_vars = BITMAP_ALLOC (NULL);
> @@ -685,13 +718,13 @@ execute_optimize_stdarg (void)
>    if (dump_file)
>      funcname = lang_hooks.decl_printable_name (current_function_decl, 2);
>
> -  cfun_va_list = targetm.fn_abi_va_list (cfun->decl);
> +  cfun_va_list = targetm.fn_abi_va_list (fun->decl);
>    va_list_simple_ptr = POINTER_TYPE_P (cfun_va_list)
>                        && (TREE_TYPE (cfun_va_list) == void_type_node
>                            || TREE_TYPE (cfun_va_list) == char_type_node);
>    gcc_assert (is_gimple_reg_type (cfun_va_list) == va_list_simple_ptr);
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator i;
>
> @@ -740,7 +773,7 @@ execute_optimize_stdarg (void)
>               ap = TREE_OPERAND (ap, 0);
>             }
>           if (TYPE_MAIN_VARIANT (TREE_TYPE (ap))
> -             != TYPE_MAIN_VARIANT (targetm.fn_abi_va_list (cfun->decl))
> +             != TYPE_MAIN_VARIANT (targetm.fn_abi_va_list (fun->decl))
>               || TREE_CODE (ap) != VAR_DECL)
>             {
>               va_list_escapes = true;
> @@ -795,13 +828,13 @@ execute_optimize_stdarg (void)
>    /* For void * or char * va_list there is just one counter
>       (va_list itself).  Use VA_LIST_GPR_SIZE for it.  */
>    if (va_list_simple_ptr)
> -    cfun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
> +    fun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
>
>    calculate_dominance_info (CDI_DOMINATORS);
>    memset (&wi, 0, sizeof (wi));
>    wi.info = si.va_list_vars;
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        gimple_stmt_iterator i;
>
> @@ -962,8 +995,8 @@ execute_optimize_stdarg (void)
>  finish:
>    if (va_list_escapes)
>      {
> -      cfun->va_list_gpr_size = VA_LIST_MAX_GPR_SIZE;
> -      cfun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
> +      fun->va_list_gpr_size = VA_LIST_MAX_GPR_SIZE;
> +      fun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
>      }
>    BITMAP_FREE (si.va_list_vars);
>    BITMAP_FREE (si.va_list_escape_vars);
> @@ -972,12 +1005,12 @@ finish:
>      {
>        fprintf (dump_file, "%s: va_list escapes %d, needs to save ",
>                funcname, (int) va_list_escapes);
> -      if (cfun->va_list_gpr_size >= VA_LIST_MAX_GPR_SIZE)
> +      if (fun->va_list_gpr_size >= VA_LIST_MAX_GPR_SIZE)
>         fputs ("all", dump_file);
>        else
>         fprintf (dump_file, "%d", cfun->va_list_gpr_size);
>        fputs (" GPR units and ", dump_file);
> -      if (cfun->va_list_fpr_size >= VA_LIST_MAX_FPR_SIZE)
> +      if (fun->va_list_fpr_size >= VA_LIST_MAX_FPR_SIZE)
>         fputs ("all", dump_file);
>        else
>         fprintf (dump_file, "%d", cfun->va_list_fpr_size);
> @@ -986,41 +1019,6 @@ finish:
>    return 0;
>  }
>
> -
> -namespace {
> -
> -const pass_data pass_data_stdarg =
> -{
> -  GIMPLE_PASS, /* type */
> -  "stdarg", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_NONE, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> -};
> -
> -class pass_stdarg : public gimple_opt_pass
> -{
> -public:
> -  pass_stdarg (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_stdarg, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *fun)
> -    {
> -      /* This optimization is only for stdarg functions.  */
> -      return fun->stdarg != 0;
> -    }
> -
> -  unsigned int execute () { return execute_optimize_stdarg (); }
> -
> -}; // class pass_stdarg
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
> index a0f9d19..34edc64 100644
> --- a/gcc/tree-switch-conversion.c
> +++ b/gcc/tree-switch-conversion.c
> @@ -1414,12 +1414,43 @@ process_switch (gimple swtch)
>  /* The main function of the pass scans statements for switches and invokes
>     process_switch on them.  */
>
> -static unsigned int
> -do_switchconv (void)
> +namespace {
> +
> +const pass_data pass_data_convert_switch =
> +{
> +  GIMPLE_PASS, /* type */
> +  "switchconv", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_SWITCH_CONVERSION, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_update_ssa | TODO_verify_ssa
> +    | TODO_verify_stmts
> +    | TODO_verify_flow ), /* todo_flags_finish */
> +};
> +
> +class pass_convert_switch : public gimple_opt_pass
> +{
> +public:
> +  pass_convert_switch (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_convert_switch, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *) { return flag_tree_switch_conversion != 0; }
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_convert_switch
> +
> +unsigned int
> +pass_convert_switch::execute (function *fun)
>  {
>    basic_block bb;
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>    {
>      const char *failure_reason;
>      gimple stmt = last_stmt (bb);
> @@ -1465,37 +1496,6 @@ do_switchconv (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_convert_switch =
> -{
> -  GIMPLE_PASS, /* type */
> -  "switchconv", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_SWITCH_CONVERSION, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_update_ssa | TODO_verify_ssa
> -    | TODO_verify_stmts
> -    | TODO_verify_flow ), /* todo_flags_finish */
> -};
> -
> -class pass_convert_switch : public gimple_opt_pass
> -{
> -public:
> -  pass_convert_switch (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_convert_switch, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *) { return flag_tree_switch_conversion != 0; }
> -  unsigned int execute () { return do_switchconv (); }
> -
> -}; // class pass_convert_switch
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
> index 84cdbde..11a2965 100644
> --- a/gcc/tree-tailcall.c
> +++ b/gcc/tree-tailcall.c
> @@ -1065,12 +1065,6 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
>    return 0;
>  }
>
> -static unsigned int
> -execute_tail_recursion (void)
> -{
> -  return tree_optimize_tail_calls_1 (false);
> -}
> -
>  static bool
>  gate_tail_calls (void)
>  {
> @@ -1109,7 +1103,10 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_tail_recursion (m_ctxt); }
>    virtual bool gate (function *) { return gate_tail_calls (); }
> -  unsigned int execute () { return execute_tail_recursion (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return tree_optimize_tail_calls_1 (false);
> +    }
>
>  }; // class pass_tail_recursion
>
> @@ -1146,7 +1143,7 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return gate_tail_calls (); }
> -  unsigned int execute () { return execute_tail_calls (); }
> +  virtual unsigned int execute (function *) { return execute_tail_calls (); }
>
>  }; // class pass_tail_calls
>
> diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
> index 4274417..d8b2200 100644
> --- a/gcc/tree-vect-generic.c
> +++ b/gcc/tree-vect-generic.c
> @@ -1585,7 +1585,10 @@ public:
>        return !(fun->curr_properties & PROP_gimple_lvec);
>      }
>
> -  unsigned int execute () { return expand_vector_operations (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return expand_vector_operations ();
> +    }
>
>  }; // class pass_lower_vector
>
> @@ -1625,7 +1628,10 @@ public:
>
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_lower_vector_ssa (m_ctxt); }
> -  unsigned int execute () { return expand_vector_operations (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return expand_vector_operations ();
> +    }
>
>  }; // class pass_lower_vector_ssa
>
> diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
> index 7b5691a..d7de964 100644
> --- a/gcc/tree-vectorizer.c
> +++ b/gcc/tree-vectorizer.c
> @@ -586,33 +586,6 @@ vectorize_loops (void)
>
>  /*  Entry point to basic block SLP phase.  */
>
> -static unsigned int
> -execute_vect_slp (void)
> -{
> -  basic_block bb;
> -
> -  init_stmt_vec_info_vec ();
> -
> -  FOR_EACH_BB_FN (bb, cfun)
> -    {
> -      vect_location = find_bb_location (bb);
> -
> -      if (vect_slp_analyze_bb (bb))
> -        {
> -          if (!dbg_cnt (vect_slp))
> -            break;
> -
> -          vect_slp_transform_bb (bb);
> -          if (dump_enabled_p ())
> -            dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
> -                            "basic block vectorized\n");
> -        }
> -    }
> -
> -  free_stmt_vec_info_vec ();
> -  return 0;
> -}
> -
>  namespace {
>
>  const pass_data pass_data_slp_vectorize =
> @@ -639,10 +612,37 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return flag_tree_slp_vectorize != 0; }
> -  unsigned int execute () { return execute_vect_slp (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_slp_vectorize
>
> +unsigned int
> +pass_slp_vectorize::execute (function *fun)
> +{
> +  basic_block bb;
> +
> +  init_stmt_vec_info_vec ();
> +
> +  FOR_EACH_BB_FN (bb, fun)
> +    {
> +      vect_location = find_bb_location (bb);
> +
> +      if (vect_slp_analyze_bb (bb))
> +        {
> +          if (!dbg_cnt (vect_slp))
> +            break;
> +
> +          vect_slp_transform_bb (bb);
> +          if (dump_enabled_p ())
> +            dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
> +                            "basic block vectorized\n");
> +        }
> +    }
> +
> +  free_stmt_vec_info_vec ();
> +  return 0;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> @@ -725,7 +725,7 @@ public:
>        return flag_section_anchors && flag_tree_loop_vectorize;
>      }
>
> -  unsigned int execute () { return increase_alignment (); }
> +  virtual unsigned int execute (function *) { return increase_alignment (); }
>
>  }; // class pass_ipa_increase_alignment
>
> diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
> index 80f3888..34255ce 100644
> --- a/gcc/tree-vrp.c
> +++ b/gcc/tree-vrp.c
> @@ -9922,7 +9922,7 @@ public:
>    /* opt_pass methods: */
>    opt_pass * clone () { return new pass_vrp (m_ctxt); }
>    virtual bool gate (function *) { return flag_tree_vrp != 0; }
> -  unsigned int execute () { return execute_vrp (); }
> +  virtual unsigned int execute (function *) { return execute_vrp (); }
>
>  }; // class pass_vrp
>
> diff --git a/gcc/tree.c b/gcc/tree.c
> index b897988..8b44ecc 100644
> --- a/gcc/tree.c
> +++ b/gcc/tree.c
> @@ -5642,7 +5642,7 @@ public:
>    {}
>
>    /* opt_pass methods: */
> -  unsigned int execute () { return free_lang_data (); }
> +  virtual unsigned int execute (function *) { return free_lang_data (); }
>
>  }; // class pass_ipa_free_lang_data
>
> diff --git a/gcc/tsan.c b/gcc/tsan.c
> index b413bb5..d9f5718 100644
> --- a/gcc/tsan.c
> +++ b/gcc/tsan.c
> @@ -762,7 +762,7 @@ public:
>    return (flag_sanitize & SANITIZE_THREAD) != 0;
>  }
>
> -  unsigned int execute () { return tsan_pass (); }
> +  virtual unsigned int execute (function *) { return tsan_pass (); }
>
>  }; // class pass_tsan
>
> @@ -803,7 +803,7 @@ public:
>        return (flag_sanitize & SANITIZE_THREAD) != 0 && !optimize;
>      }
>
> -  unsigned int execute () { return tsan_pass (); }
> +  virtual unsigned int execute (function *) { return tsan_pass (); }
>
>  }; // class pass_tsan_O0
>
> diff --git a/gcc/ubsan.c b/gcc/ubsan.c
> index 8e7dda5..cf25aa3 100644
> --- a/gcc/ubsan.c
> +++ b/gcc/ubsan.c
> @@ -859,17 +859,49 @@ instrument_bool_enum_load (gimple_stmt_iterator *gsi)
>    gsi_insert_before (&gsi2, g, GSI_SAME_STMT);
>  }
>
> -/* Gate and execute functions for ubsan pass.  */
> +namespace {
>
> -static unsigned int
> -ubsan_pass (void)
> +const pass_data pass_data_ubsan =
> +{
> +  GIMPLE_PASS, /* type */
> +  "ubsan", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_TREE_UBSAN, /* tv_id */
> +  ( PROP_cfg | PROP_ssa ), /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  TODO_update_ssa, /* todo_flags_finish */
> +};
> +
> +class pass_ubsan : public gimple_opt_pass
> +{
> +public:
> +  pass_ubsan (gcc::context *ctxt)
> +    : gimple_opt_pass (pass_data_ubsan, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *)
> +    {
> +      return flag_sanitize & (SANITIZE_NULL | SANITIZE_SI_OVERFLOW
> +                             | SANITIZE_BOOL | SANITIZE_ENUM);
> +    }
> +
> +  virtual unsigned int execute (function *);
> +
> +}; // class pass_ubsan
> +
> +unsigned int
> +pass_ubsan::execute (function *fun)
>  {
>    basic_block bb;
>    gimple_stmt_iterator gsi;
>
>    initialize_sanitizer_builtins ();
>
> -  FOR_EACH_BB_FN (bb, cfun)
> +  FOR_EACH_BB_FN (bb, fun)
>      {
>        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
>         {
> @@ -902,40 +934,6 @@ ubsan_pass (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_ubsan =
> -{
> -  GIMPLE_PASS, /* type */
> -  "ubsan", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_TREE_UBSAN, /* tv_id */
> -  ( PROP_cfg | PROP_ssa ), /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  TODO_update_ssa, /* todo_flags_finish */
> -};
> -
> -class pass_ubsan : public gimple_opt_pass
> -{
> -public:
> -  pass_ubsan (gcc::context *ctxt)
> -    : gimple_opt_pass (pass_data_ubsan, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *)
> -    {
> -      return flag_sanitize & (SANITIZE_NULL | SANITIZE_SI_OVERFLOW
> -                             | SANITIZE_BOOL | SANITIZE_ENUM);
> -    }
> -
> -  unsigned int execute () { return ubsan_pass (); }
> -
> -}; // class pass_ubsan
> -
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
> index 4586afc..3937340 100644
> --- a/gcc/var-tracking.c
> +++ b/gcc/var-tracking.c
> @@ -10373,7 +10373,10 @@ public:
>        return (flag_var_tracking && !targetm.delay_vartrack);
>      }
>
> -  unsigned int execute () { return variable_tracking_main (); }
> +  virtual unsigned int execute (function *)
> +    {
> +      return variable_tracking_main ();
> +    }
>
>  }; // class pass_variable_tracking
>
> diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
> index 601b2ce..b99ff6c 100644
> --- a/gcc/vtable-verify.c
> +++ b/gcc/vtable-verify.c
> @@ -723,23 +723,6 @@ verify_bb_vtables (basic_block bb)
>      }
>  }
>
> -/* Main function, called from pass->excute().  Loop through all the
> -   basic blocks in the current function, passing them to
> -   verify_bb_vtables, which searches for virtual calls, and inserts
> -   calls to __VLTVerifyVtablePointer.  */
> -
> -unsigned int
> -vtable_verify_main (void)
> -{
> -  unsigned int ret = 1;
> -  basic_block bb;
> -
> -  FOR_ALL_BB_FN (bb, cfun)
> -      verify_bb_vtables (bb);
> -
> -  return ret;
> -}
> -
>  /* Definition of this optimization pass.  */
>
>  namespace {
> @@ -767,10 +750,26 @@ public:
>
>    /* opt_pass methods: */
>    virtual bool gate (function *) { return (flag_vtable_verify); }
> -  unsigned int execute () { return vtable_verify_main (); }
> +  virtual unsigned int execute (function *);
>
>  }; // class pass_vtable_verify
>
> +/* Loop through all the basic blocks in the current function, passing them to
> +   verify_bb_vtables, which searches for virtual calls, and inserts
> +   calls to __VLTVerifyVtablePointer.  */
> +
> +unsigned int
> +pass_vtable_verify::execute (function *fun)
> +{
> +  unsigned int ret = 1;
> +  basic_block bb;
> +
> +  FOR_ALL_BB_FN (bb, fun)
> +      verify_bb_vtables (bb);
> +
> +  return ret;
> +}
> +
>  } // anon namespace
>
>  gimple_opt_pass *
> diff --git a/gcc/web.c b/gcc/web.c
> index 50fc9e6..46a6ff7 100644
> --- a/gcc/web.c
> +++ b/gcc/web.c
> @@ -325,10 +325,37 @@ replace_ref (df_ref ref, rtx reg)
>  }
>
>
> -/* Main entry point.  */
> +namespace {
> +
> +const pass_data pass_data_web =
> +{
> +  RTL_PASS, /* type */
> +  "web", /* name */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  true, /* has_execute */
> +  TV_WEB, /* tv_id */
> +  0, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  ( TODO_df_finish | TODO_verify_rtl_sharing ), /* todo_flags_finish */
> +};
> +
> +class pass_web : public rtl_opt_pass
> +{
> +public:
> +  pass_web (gcc::context *ctxt)
> +    : rtl_opt_pass (pass_data_web, ctxt)
> +  {}
> +
> +  /* opt_pass methods: */
> +  virtual bool gate (function *) { return (optimize > 0 && flag_web); }
> +  virtual unsigned int execute (function *);
>
> -static unsigned int
> -web_main (void)
> +}; // class pass_web
> +
> +unsigned int
> +pass_web::execute (function *fun)
>  {
>    struct web_entry *def_entry;
>    struct web_entry *use_entry;
> @@ -345,7 +372,7 @@ web_main (void)
>    df_set_flags (DF_DEFER_INSN_RESCAN);
>
>    /* Assign ids to the uses.  */
> -  FOR_ALL_BB_FN (bb, cfun)
> +  FOR_ALL_BB_FN (bb, fun)
>      FOR_BB_INSNS (bb, insn)
>      {
>        unsigned int uid = INSN_UID (insn);
> @@ -373,7 +400,7 @@ web_main (void)
>    use_entry = XCNEWVEC (struct web_entry, uses_num);
>
>    /* Produce the web.  */
> -  FOR_ALL_BB_FN (bb, cfun)
> +  FOR_ALL_BB_FN (bb, fun)
>      FOR_BB_INSNS (bb, insn)
>      {
>        unsigned int uid = INSN_UID (insn);
> @@ -398,7 +425,7 @@ web_main (void)
>
>    /* Update the instruction stream, allocating new registers for split pseudos
>       in progress.  */
> -  FOR_ALL_BB_FN (bb, cfun)
> +  FOR_ALL_BB_FN (bb, fun)
>      FOR_BB_INSNS (bb, insn)
>      {
>        unsigned int uid = INSN_UID (insn);
> @@ -443,35 +470,6 @@ web_main (void)
>    return 0;
>  }
>
> -namespace {
> -
> -const pass_data pass_data_web =
> -{
> -  RTL_PASS, /* type */
> -  "web", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  true, /* has_execute */
> -  TV_WEB, /* tv_id */
> -  0, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  ( TODO_df_finish | TODO_verify_rtl_sharing ), /* todo_flags_finish */
> -};
> -
> -class pass_web : public rtl_opt_pass
> -{
> -public:
> -  pass_web (gcc::context *ctxt)
> -    : rtl_opt_pass (pass_data_web, ctxt)
> -  {}
> -
> -  /* opt_pass methods: */
> -  virtual bool gate (function *) { return (optimize > 0 && flag_web); }
> -  unsigned int execute () { return web_main (); }
> -
> -}; // class pass_web
> -
>  } // anon namespace
>
>  rtl_opt_pass *
> --
> 1.9.2
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/6] remove properties stuff from register_dump_files_1
  2014-04-17  8:53 ` [PATCH 1/6] remove properties stuff from register_dump_files_1 Richard Biener
@ 2014-04-17 13:10   ` Trevor Saunders
  0 siblings, 0 replies; 13+ messages in thread
From: Trevor Saunders @ 2014-04-17 13:10 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 2884 bytes --]

On Thu, Apr 17, 2014 at 10:53:07AM +0200, Richard Biener wrote:
> On Thu, Apr 17, 2014 at 10:37 AM,  <tsaunders@mozilla.com> wrote:
> > From: Trevor Saunders <tsaunders@mozilla.com>
> >
> > Hi,
> >
> > just removing some dead code.
> >
> > bootstrapped + regtested against r209414 on x86_64-unknown-linux-gnu, ok?
> 
> Ok.

Thanks for the quick reviews! committed as r209477 - 209482

Trev

> 
> Thanks,
> Richard.
> 
> > Trev
> >
> > 2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>
> >
> >         * pass_manager.h (pass_manager::register_dump_files_1): Adjust.
> >         * passes.c (pass_manager::register_dump_files_1): Remove dead code
> >         dealing with properties.
> >         (pass_manager::register_dump_files): Adjust.
> >
> > diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
> > index e1d8143..8309567 100644
> > --- a/gcc/pass_manager.h
> > +++ b/gcc/pass_manager.h
> > @@ -91,7 +91,7 @@ public:
> >
> >  private:
> >    void set_pass_for_id (int id, opt_pass *pass);
> > -  int register_dump_files_1 (opt_pass *pass, int properties);
> > +  void register_dump_files_1 (opt_pass *pass);
> >    void register_dump_files (opt_pass *pass, int properties);
> >
> >  private:
> > diff --git a/gcc/passes.c b/gcc/passes.c
> > index 60fb135..3f9590a 100644
> > --- a/gcc/passes.c
> > +++ b/gcc/passes.c
> > @@ -708,33 +708,21 @@ pass_manager::register_one_dump_file (opt_pass *pass)
> >
> >  /* Recursive worker function for register_dump_files.  */
> >
> > -int
> > +void
> >  pass_manager::
> > -register_dump_files_1 (opt_pass *pass, int properties)
> > +register_dump_files_1 (opt_pass *pass)
> >  {
> >    do
> >      {
> > -      int new_properties = (properties | pass->properties_provided)
> > -                          & ~pass->properties_destroyed;
> > -
> >        if (pass->name && pass->name[0] != '*')
> >          register_one_dump_file (pass);
> >
> >        if (pass->sub)
> > -        new_properties = register_dump_files_1 (pass->sub, new_properties);
> > -
> > -      /* If we have a gate, combine the properties that we could have with
> > -         and without the pass being examined.  */
> > -      if (pass->has_gate)
> > -        properties &= new_properties;
> > -      else
> > -        properties = new_properties;
> > +        register_dump_files_1 (pass->sub);
> >
> >        pass = pass->next;
> >      }
> >    while (pass);
> > -
> > -  return properties;
> >  }
> >
> >  /* Register the dump files for the pass_manager starting at PASS.
> > @@ -746,7 +734,7 @@ pass_manager::
> >  register_dump_files (opt_pass *pass,int properties)
> >  {
> >    pass->properties_required |= properties;
> > -  register_dump_files_1 (pass, properties);
> > +  register_dump_files_1 (pass);
> >  }
> >
> >  struct pass_registry
> > --
> > 1.9.2
> >

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-04-17 12:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17  8:38 [PATCH 1/6] remove properties stuff from register_dump_files_1 tsaunders
2014-04-17  8:38 ` [PATCH 3/6] remove has_gate tsaunders
2014-04-17  8:56   ` Richard Biener
2014-04-17  8:38 ` [PATCH 4/6] enable -Woverloaded-virtual when available tsaunders
2014-04-17  9:00   ` Richard Biener
2014-04-17  8:38 ` [PATCH 5/6] pass current function to opt_pass::gate () tsaunders
2014-04-17  9:00   ` Richard Biener
2014-04-17  8:38 ` [PATCH 2/6] merge register_dump_files_1 into register_dump_files tsaunders
2014-04-17  8:54   ` Richard Biener
2014-04-17  8:53 ` [PATCH 1/6] remove properties stuff from register_dump_files_1 Richard Biener
2014-04-17 13:10   ` Trevor Saunders
2014-04-17  8:53 ` [PATCH 6/6] pass cfun to pass::execute tsaunders
2014-04-17  9:01   ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).