]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
pass current function to opt_pass::gate ()
authorTrevor Saunders <tsaunders@mozilla.com>
Thu, 17 Apr 2014 12:37:16 +0000 (12:37 +0000)
committerTrevor Saunders <tbsaunde@gcc.gnu.org>
Thu, 17 Apr 2014 12:37:16 +0000 (12:37 +0000)
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.

From-SVN: r209481

110 files changed:
gcc/ChangeLog
gcc/asan.c
gcc/auto-inc-dec.c
gcc/bb-reorder.c
gcc/bt-load.c
gcc/combine-stack-adj.c
gcc/combine.c
gcc/compare-elim.c
gcc/config/epiphany/resolve-sw-modes.c
gcc/config/i386/i386.c
gcc/config/rl78/rl78.c
gcc/config/sh/sh_optimize_sett_clrt.cc
gcc/config/sh/sh_treg_combine.cc
gcc/config/sparc/sparc.c
gcc/cprop.c
gcc/cse.c
gcc/dce.c
gcc/df-core.c
gcc/dse.c
gcc/dwarf2cfi.c
gcc/except.c
gcc/fwprop.c
gcc/gcse.c
gcc/gimple-ssa-isolate-paths.c
gcc/gimple-ssa-strength-reduction.c
gcc/graphite.c
gcc/ifcvt.c
gcc/init-regs.c
gcc/ipa-cp.c
gcc/ipa-devirt.c
gcc/ipa-profile.c
gcc/ipa-pure-const.c
gcc/ipa-reference.c
gcc/ipa-split.c
gcc/ipa.c
gcc/loop-init.c
gcc/lower-subreg.c
gcc/mode-switching.c
gcc/modulo-sched.c
gcc/omp-low.c
gcc/passes.c
gcc/postreload-gcse.c
gcc/postreload.c
gcc/predict.c
gcc/recog.c
gcc/ree.c
gcc/reg-stack.c
gcc/regcprop.c
gcc/regrename.c
gcc/reorg.c
gcc/sched-rgn.c
gcc/store-motion.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/plugin/dumb_plugin.c
gcc/testsuite/g++.dg/plugin/selfassign.c
gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
gcc/testsuite/gcc.dg/plugin/selfassign.c
gcc/tracer.c
gcc/trans-mem.c
gcc/tree-call-cdce.c
gcc/tree-cfg.c
gcc/tree-cfgcleanup.c
gcc/tree-complex.c
gcc/tree-eh.c
gcc/tree-emutls.c
gcc/tree-if-conv.c
gcc/tree-into-ssa.c
gcc/tree-loop-distribution.c
gcc/tree-nrv.c
gcc/tree-parloops.c
gcc/tree-pass.h
gcc/tree-predcom.c
gcc/tree-profile.c
gcc/tree-sra.c
gcc/tree-ssa-ccp.c
gcc/tree-ssa-copy.c
gcc/tree-ssa-copyrename.c
gcc/tree-ssa-dce.c
gcc/tree-ssa-dom.c
gcc/tree-ssa-dse.c
gcc/tree-ssa-forwprop.c
gcc/tree-ssa-ifcombine.c
gcc/tree-ssa-loop-ch.c
gcc/tree-ssa-loop-im.c
gcc/tree-ssa-loop-ivcanon.c
gcc/tree-ssa-loop-prefetch.c
gcc/tree-ssa-loop-unswitch.c
gcc/tree-ssa-loop.c
gcc/tree-ssa-math-opts.c
gcc/tree-ssa-phiopt.c
gcc/tree-ssa-phiprop.c
gcc/tree-ssa-pre.c
gcc/tree-ssa-reassoc.c
gcc/tree-ssa-sink.c
gcc/tree-ssa-strlen.c
gcc/tree-ssa-structalias.c
gcc/tree-ssa-uncprop.c
gcc/tree-ssa-uninit.c
gcc/tree-ssa.c
gcc/tree-stdarg.c
gcc/tree-switch-conversion.c
gcc/tree-tailcall.c
gcc/tree-vect-generic.c
gcc/tree-vectorizer.c
gcc/tree-vrp.c
gcc/tsan.c
gcc/ubsan.c
gcc/var-tracking.c
gcc/vtable-verify.c
gcc/web.c

index 3fb035abcecff8464b19045b5639b0c943007eb2..e2ca3289f6f3d4da05946f1657a18cfea8e1b8b0 100644 (file)
@@ -1,3 +1,55 @@
+2014-04-17  Trevor Saunders  <tsaunders@mozilla.com>
+
+       * 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.
+
 2014-04-17  Trevor Saunders  <tsaunders@mozilla.com>
 
        * configure.ac: Check for -Woverloaded-virtual and enable it if found.
index e26ce419460b8543043813c59a7c9e1515a69f7e..3fe50ef2a09352c6a32185a1ecb8a2879e2c51bb 100644 (file)
@@ -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
index 4346e8579306545e8764165322963d614ab4690c..e1485a3cb2a9aaf01cadc1ae0124dcec37804242 100644 (file)
@@ -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
index 6ac0242f8258527b7b0204d9d107287f65027f87..57103bd323a38f5863c3853857f004fdf0fd5399 100644 (file)
@@ -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 *
index d44917f405618400e34f65011a26ddc588de73e3..fc2aea7fd727cd7d54d08a1b020f01d7e6e529b0 100644 (file)
@@ -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 ();
   }
index ec22ab34e35c16f782e4404f0c1db17225661738..37fc7a5d271dd7d03cd92de784afafedda07dcd9 100644 (file)
@@ -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 *
index 63933c07e99b25a75a0f44d8dee687b087822ddd..1b1e33c9d08221003c7224b5d42f1c06ae88f7be 100644 (file)
@@ -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
index e66b1c6854f1f8c002c172c3ad4f36c3ebc8c364..9cddb7a2d35778c36a32b0e515623b1780cfda25 100644 (file)
@@ -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
index 486330cf7cd3ff4e7a2c701515423246d9a011ca..31928fdb0ff8652374917051945dbc90cfd0b818 100644 (file)
@@ -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
index eb9c2bd0feb0212b2947c117de4b53018dac1c88..10d2fcbea2964c0004d2f3d723319c0937963332 100644 (file)
@@ -2494,12 +2494,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)
 {
@@ -2543,7 +2537,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
index 88b030fc97ed0a3f4750039d09aed07ff7a36445..988e1cd0ac00f2340c51d3adaf0a8aa1b72e311a 100644 (file)
@@ -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 (); }
 };
 
index 85cb6a1ec872718e9f88022521caafb33cb23929..5b1afcd961bf189e4978ed37dba47b04fd4ebd82 100644 (file)
@@ -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;
 }
index 1285ba2591a2cce41bdf97e37abf3927c6f71b0f..57eddd29406f34d6dc5fcc592efe36a4597bbc54 100644 (file)
@@ -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;
 }
index a63e813fd58bd5ad7d95d75464a067cf8e2776b5..5578cb8afcb3d16f3f79b93b3d603377cb5140d1 100644 (file)
@@ -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
index f22cde7cbc93d5ca525b97206ca633a4b0c19625..9802b8a42b5824ab5b3eb58b018cfb2b39109c86 100644 (file)
@@ -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
index 6edea01a96030a0407207ef738e046f64077bbb9..60ec9a99d7523b0b39b43961d58bb04314c3c247 100644 (file)
--- 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 ();
   }
index 33cdefdfceb0b04fe03fe666380670e2cddcd62a..1d290e37ee44ed982d16d8da44fd9f43e26d01e6 100644 (file)
--- 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
index 9909ac303733ba793fecaeace5d331d29de52d49..bd3cb31ebd92541065bc00725adb8e294b2e1a29 100644 (file)
@@ -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
index a3a66b1b62c50d7f0c74a04378a2c47051010daf..a80c0259b38a9808d2527a8d7c7fa99a36bea2d3 100644 (file)
--- 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
index d278a275c4c276299aa73a53445f2e0341e2d329..37492776ca068a1ba1dfd3aec76905fb8795121d 100644 (file)
@@ -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 *
index cf3cd5f5b9937f83961cc3674d218893086c3bb6..2015809f4db7542f93818159986627797f2779a5 100644 (file)
@@ -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 *
index 061d5338ae2314925ad57230a14f0fcf951c0ceb..c6fa4ee22d0c2bd2466138b32816528646875b30 100644 (file)
@@ -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
index 6797b080b7a34bcf9a523c03f7fe906e9cc7cf7c..942ea64325f85a1b9519c00766fa6af1c9890b48 100644 (file)
@@ -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 *
index e0ce2ec4a4899101bf5509a79a1983b016b83a2d..ab6185c276763246af51d88460fd1c95c01e1993 100644 (file)
@@ -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
index 8d19031afb5933a67af51cd5bac4fed414fd3e2a..a8596e0529baf6f6dab2c7c11ebf81b72510e9c4 100644 (file)
@@ -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
index 03a7161e507b16d6506554f200bc1d665444bfa6..68c93904fd90c5d27e0de1a8c3af69cd5f6681b6 100644 (file)
@@ -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
index 5c0843d2ea2429852eac24767e8e5dd8497aba72..657b585a07acfa0a59073dc409a6d9497580ac43 100644 (file)
@@ -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
index 265fed795c9a7d859a3bd002086edc270c96abf1..2025b777897bba70551dc8df598558d1c4ed94df 100644 (file)
@@ -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
index 1f28b698d083fa1243bd946edc9302902a0adfd5..ee48fc095ad53ea6462fe64421dd957b4680f1fb 100644 (file)
@@ -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
index 083c3453222ce82203d90116b658f9b40801a92e..ee8091c21464ad63886fca3b9a2b898c99867622 100644 (file)
@@ -2096,16 +2096,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 =
@@ -2139,7 +2129,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
index f2a72de19ba7b61e522f5a42f814850594601d04..7b58716c45b04cf55ae162862a44610f7eacc586 100644 (file)
@@ -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
index eac3636b7a5f8842cb28209855febfc4158083d0..eab7633b1de7911e8ae3d17ada8e5e1f84e0cf86 100644 (file)
@@ -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
index 126948ee79ef36814ca2eb8d300f09efa36e077a..51a57ac8d759759e602c987696dd27810548e801 100644 (file)
@@ -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
index ebb91973fcc64a187586ed79fbfab50a7721de71..187dc988489b7e44d54694484a0c16a08f1cbcc3 100644 (file)
@@ -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 *
index f28ea2a9877377e52309a9344639c50f09c68a25..e14f0c42eb2f003dd3d525391c30292c637753ff 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -1283,14 +1283,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
@@ -1335,9 +1327,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 ();
   }
@@ -1624,16 +1619,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 =
@@ -1667,11 +1652,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 *
index d0bd4ec55ed42dfb6a3ad44591e9eb46198bb9ee..6da29d3c0f15ef80fe5c8fd1bc79b4ec147e9366 100644 (file)
@@ -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 *
index 53ef1d90f56ddcf4f0c58e8ad3db71908546a3d9..89d976390a5639552d45ae390996df5e1ff1f422 100644 (file)
@@ -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
index d73135a7fdc8e1fa9c18a0624c013d535f25ea7b..e73d6ee3a9373992a3003fad7939ae61d38b03ab 100644 (file)
@@ -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
index a097df3fba68e115952dde1b1da0f4140fbcb100..20e2e623e684ea3fa7d6e04492dfd9f6aafe5872 100644 (file)
@@ -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
index cadec81ef84b598c1aa1b28764c18eb13ac3b674..0e96b881d77aa0e6681c0050888d4b948e4d1250 100644 (file)
@@ -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 *
index 5d5a94cd8c599d86cd88de3bc5b93d71c75f08d7..b71c11e3e3160ff81ca2f5f7f207dbc805e50e9d 100644 (file)
@@ -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;
 
index 264bd9ad8eb62ddd83970114f35fcd6a4efdeecd..8a804fb98eab5f1363e321b339157656f3238ef6 100644 (file)
@@ -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
index 0870183fe761dd9536fef29cb37866f4d4e388c7..0568c53f78acd2db80514a76979917a046e36fdd 100644 (file)
@@ -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
index dccde72cb52a723e1f955cd8a78c49974e5c9a62..068c1877a305f074b8a8078d9993e88528ea8ec7 100644 (file)
@@ -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
index b7113aad56ea92c1411fed4171daa9adc376f811..8afea7eca617b3e8b7d7643a20ad9cde9e8f6c42 100644 (file)
@@ -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
index 09dfa61656df66e6e05c17e1c646863bd4c431ee..435bb88747c58ff417c7b7879af7efcf9a154ec5 100644 (file)
--- 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
index 02e3e09b584bde267c4ab9a267f6a3d961c02381..f8f865887c7d64cb049ac7685f5a11d1e8cb981d 100644 (file)
@@ -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
 
index a7dbbc391838c4f109f0c4f84bb2d6f6ea5073ea..24992e4e2c5e47723febf48ada7d2717cc801aaf 100644 (file)
@@ -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
index 30f7abcccae5c61f293228a3d94251fbb2abb3c5..321d5bfbe5bee681538d37017f29f2e44e908fb7 100644 (file)
@@ -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
index fff342f2097422147c4dbcdbc1e0705c170f1aed..22f0b5a8287b0a5bfe284dbed8f5ef6874b68cc3 100644 (file)
@@ -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
index 18b50a4d066212010f2652271e6271196abed0a8..e0a80c229e945cef53a66f1dffeb3e89509b4fa3 100644 (file)
@@ -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 *
index 5aacaad2fd49e82080cd40944bb488d62a1d5270..7c57754d1c4bb969a259102988fc878e26d8904c 100644 (file)
@@ -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 *
index dcf9acddb44e565647a719d891db5634c65aeae8..a3cbef3abb5a915ae48cf40dcf677612d67cf4dd 100644 (file)
@@ -1,3 +1,8 @@
+2014-04-17  Trevor Saunders  <tsaunders@mozilla.com>
+
+       * g++.dg/plugin/dumb_plugin.c, g++.dg/plugin/selfasign.c,
+       gcc.dg/plugin/one_time_plugin.c, gcc.dg/plugin/selfasign.c: Adjust.
+
 2014-04-17  Trevor Saunders  <tsaunders@mozilla.com>
        
        * g++.dg/plugin/dumb_plugin.c, g++.dg/plugin/selfassign.c,
index d73bea8f15e5654665ff52796e04180421ac78fb..a3b04a24928ad0516d59abfe393cd254918a6a4c 100644 (file)
@@ -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
index 8df85796b9930148ff1fea88f1cfe7eefc550d15..033047b9894e86023af7e264c1a3fecad1f811df 100644 (file)
@@ -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
index 33106ada17b91c79971910831431dce93a8a3bcf..18e8b07a77f32bcf8f7139c0474abadcd7db5f4f 100644 (file)
@@ -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;
 }
index 8df85796b9930148ff1fea88f1cfe7eefc550d15..098df060c82109b964703140b1694012e1343656 100644 (file)
@@ -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
index 73e3209e05544c2acca1d26add936e2a11e1c61d..794d385988f1fbd9aec5490cd6a8f090fb982573 100644 (file)
@@ -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
index 5897cac9ddbe339e670f2ff081a96db0b6534f45..eb172a6079b9fe05918c0c74b54d59c99457d07d 100644 (file)
@@ -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
@@ -5595,7 +5581,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
index 329349385de2aa592ac209a5757a20895042bd01..c27149321621bdf52cf506588b28c551bc5b81d1 100644 (file)
@@ -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
index 16483073e0ddde7700d5bbec42e61d2f130d6934..8fcaae8c780214fb60c5f8268e8c6174ad8dc947 100644 (file)
@@ -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
index 914523d2e53d3abf500da7754dbfa1cc3ac7bed0..19433f9615664455af18485ee52bf8405f22bd41 100644 (file)
@@ -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
index 283c82759051776cbabff3eae77f111e2d4b3908..9ec83d9830f21b828165ab668f79c30d85bd7761 100644 (file)
@@ -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
index f51f18c34c6c6301199aabbecf5b5dec58d81347..41f96c461bde701ffedb75aed88c502783305655 100644 (file)
@@ -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
index 84aa00839910704ddc75d52637ab90393e88c0ac..280a606221d8952c6526cf12bd9f30364d5b54bf 100644 (file)
@@ -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
index b87c4768f1ee3587838102077d3e37bd40a0ba63..90b62a83a125a5392afd7d60f96aeee26a2d73c5 100644 (file)
@@ -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 *
index dec5a5b93453b16aacb65c58e4b05e1e4c4a59f4..332901d3f41538e89fca5785d7830cd353d6f7ba 100644 (file)
@@ -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
index dcc61c7fd3cd3b097b7221425cb55abeb349e956..0a154127f1771afeff8c88a4bcc8aa5aebe70a96 100644 (file)
@@ -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
index a39bc5ee200577092311a9409d807b2b77195877..71f8d68fc3d1255731c29e9f7d6b4c7fb1135f9c 100644 (file)
@@ -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
index e34607400777a7a0ecb0ce037ee2c9c076672311..a46fa51d05e81e7157c3789a9344969558275ead 100644 (file)
@@ -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
index 9bb6455ceb79c4ff5b324b1cb9da06156b3c8d91..9de2822cccec6a76430aad6f9ce0e117eb54a9e3 100644 (file)
@@ -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.
index 859a1120e329b972e1c9c0e44973f6cf6a30922c..7dd86e1669101d50eacdbf67cbaa638041e158e1 100644 (file)
@@ -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
index 0372c9298400b7a11a023793a032bf68c09b1257..b7d04661eeb15ce318fce2523e2680917c6c3404 100644 (file)
@@ -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 *
index acca2a7f2808b8c9abf8719ea9da0fcb07e28d37..27f71a37366f8280c987902a42c490ef51ff3bea 100644 (file)
@@ -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
index c7a7e8965c385881d15d3017e44322d4f3c65102..c4a5c71f530a9e93f546a73e03f9bdb1bfc28fef 100644 (file)
@@ -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
index fc26d036b3d86c4f392cb91df321c077698313cd..bd6ac04edbb88f4802a8baa1449c7a44dbf86766 100644 (file)
@@ -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
index 0da3d822da50abacf532b5d89d2a02ed7b54e8e1..65d80449c29b12611b3577dd2665c5340f66ef33 100644 (file)
@@ -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
index 8db149e0a6cc4dc4447b4f87f79b119f995628b5..e5799b96d14f510c58ceb82c658a7234b54b9550 100644 (file)
@@ -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
index 8101a5419b713281bbaa2cfd24ab83c3e1f5e972..b9cc5cc433dfd729f06a560dcc89a0970d30e6ad 100644 (file)
@@ -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
index 0096b4cd8b3e9f1aab6172ea60c80b71ec2439c2..b6fbdaf55059d12547591b2ff2553d62de1942ba 100644 (file)
@@ -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
index 66ae113d569a06ad877890b6f7a51c2f2570f845..8d5ca5f12527d76928066df0a4a8cdbcedfb1d0f 100644 (file)
@@ -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
index ef0c0c4515c25515c672391cb4c5cfe7b5f76813..b901f379c6b81d00cd7a31b6fb4ee14586470446 100644 (file)
@@ -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
index 99cc39cfa4d208e42aa704f02e7c9e00871fe857..34d1f7023ccadbcf41857bcb9c5b30e01dfeba71 100644 (file)
@@ -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
index aab521ec809e9ba11ca0db475708f336538ad16c..f38ee95933b5b492422e8e3e8e9fd019916e474b 100644 (file)
@@ -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
index 177666d0d568c0b670076f45426108218f3e2c9a..df82816024130b1d4efddf505863050611c15826 100644 (file)
@@ -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
index dd527033dd8281e5aa1eec1aed54d179771ba10b..17b13d11d71cb3d7b888a6beddba698be4ac48e8 100644 (file)
@@ -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
index e755b6252b4eda2442aff9c24a77cdf4ee0b3fb5..90bb205a5a6b2ed1861b9bea9a51d1c166bee5ca 100644 (file)
@@ -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
index 84e24a18b927fb2b3fd47215aad35a4745622a8f..38e7b13575c7a33b733a43d9b479f40131cdff97 100644 (file)
@@ -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
index f63c75dde1cdccadeedf5f7204064a7c94ad085a..fef1b1e659860a8c435bd6450a821c40f3eade20 100644 (file)
@@ -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
index 389231767d0195dcbf7448f09cf82fca754ba032..1ee39a5444203cea24fbbfece3d2d555b4284d3c 100644 (file)
@@ -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
index d67f488ec39ef67e67c9bcbfc3e7d0e5560a6948..cbdbc6ea4295173d0ae7814520bb8086514568b3 100644 (file)
@@ -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
index 1329fe24a76540a381aafc478c60cf58582a3a7e..cda315a63792df6e2022c6f60147a94f695a58fd 100644 (file)
@@ -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
index 012eeae7170f5b6b90743102c3682d60f33f4f02..57f260775d719293bb5d0b5a9c04023f33a3a55b 100644 (file)
@@ -4694,12 +4694,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 =
@@ -4727,7 +4721,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
index 4a7410d16f55b5c9fd770864b76672b54f0925e2..6803160ff7744aead6e859d521bfd50f54c18beb 100644 (file)
@@ -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
index aa6b6b9266396049a90b1ccd10b25f11b8bcc84b..fb83093cca5aed077c11a88e5274d814c191bcda 100644 (file)
@@ -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
index 9e1cdbcd8663b396684fb7f9f89291134e71dc6c..3548ac544b77f27adca85437a6a0047a1ad687be 100644 (file)
@@ -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
index 41f4bd88ed013becc2039497bd72d2bbb2d2343d..e39ce8898136ded85fc86f566c6f43f9b8100912 100644 (file)
@@ -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
index 70dc04c33f6ca62dec944a0e7a4ce0f60c822be7..89acd9b6b4b2debe892991501aeb0bbaa5e3bf99 100644 (file)
@@ -2382,7 +2382,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
@@ -2440,7 +2440,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
index ecc8da34e6a10f29be063d1ed2674da91cc7d1d9..52126ca07105e47b160b43a571f7e9c1e956a917 100644 (file)
@@ -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
index 7da36c469d1300bfff26e89618fecce1d342b068..710711bcda6a9abdd13a32e4b3646cd89a31f926 100644 (file)
@@ -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
index cf2e7634445e543e6485fdc7465a8e4a8bb1784e..a0f9d19c073700b60582229146023ed6f83a8390 100644 (file)
@@ -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
index b3a6256beb905893b3bc7f335449239306e9174a..84cdbde94118c1fda484a4e1c9fc95d8be19e7e6 100644 (file)
@@ -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
index 035c143731a9267b0caa373720e713999741977f..4274417bd6b2c4bb14998c134f2e0ca006ec9e16 100644 (file)
@@ -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
index 17be3aa9d604480682c0e93da3a096cb85e982f8..7b5691a3464adae77c18a215812f77275c21bd84 100644 (file)
@@ -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
index 4ccb90b09d7f5d24a27e36744270ab5ff5c4955b..80f3888c1065dbec548413001d2a6e526da2f237 100644 (file)
@@ -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
index f30cf57056d62fa1d903ec38791ad015b9ec5a2e..b413bb50edd28caae2eeb74e542673ff53f799d9 100644 (file)
@@ -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
index c205e6b337648aeb6047e64b9c9ece66a722fa5a..8e7dda54efeae8c72d29e46eec5a0e92ac293b56 100644 (file)
@@ -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
index e6ca3afa8fced3a9f0cf9cdf2aadaca1b3634d48..4586afc4b208d765b4449a3505750fe2de98834f 100644 (file)
@@ -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
index 99caa88f52c60bd0c40780b0d9f64ac01715b1d7..601b2ced8dd838b2cc86a00898845359251a9a2f 100644 (file)
@@ -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
index ba4172e2652e2dc54f7cfed55bb70f7ab65eb835..50fc9e6b920acb987cf508fcdc90e7a60a92d87c 100644 (file)
--- 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