Patchwork [12/13] Eliminate FOR_EACH_BB_REVERSE macro.

login
register
mail settings
Submitter David Malcolm
Date Dec. 6, 2013, 2:51 p.m.
Message ID <1386341499-19603-13-git-send-email-dmalcolm@redhat.com>
Download mbox | patch
Permalink /patch/298048/
State New
Headers show

Comments

David Malcolm - Dec. 6, 2013, 2:51 p.m.
gcc/
	* basic-block.h (FOR_EACH_BB_REVERSE): Eliminate macro.

	* cfghooks.c (verify_flow_info): Replace uses of FOR_EACH_BB_REVERSE
	with FOR_EACH_BB_REVERSE_FN, making uses of cfun explicit.
	* cfgrtl.c (print_rtl_with_bb, rtl_verify_edges,
	rtl_verify_bb_insns, rtl_verify_bb_pointers,
	rtl_verify_bb_insn_chain, rtl_verify_fallthru): Likewise.
	* config/ia64/ia64.c (emit_predicate_relation_info): Likewise.
	* config/sh/sh.c (sh_md_init_global): Likewise.
	* dce.c (reset_unmarked_insns_debug_uses, delete_unmarked_insns):
	Likewise.
	* dominance.c (calc_dfs_tree): Likewise.
	* final.c (final): Likewise.
	* function.c (thread_prologue_and_epilogue_insns): Likewise.
	* gcse.c (compute_code_hoist_vbeinout): Likewise.
	* ira.c (update_equiv_regs, build_insn_chain): Likewise.
	* lcm.c (compute_antinout_edge): Likewise.
	* mode-switching.c (optimize_mode_switching): Likewise.
	* postreload.c (reload_combine): Likewise.
	* recog.c (split_all_insns, peephole2_optimize): Likewise.
	* tree-ssa-live.c (live_worklist): Likewise.
---
 gcc/basic-block.h      |  2 --
 gcc/cfghooks.c         |  2 +-
 gcc/cfgrtl.c           | 12 ++++++------
 gcc/config/ia64/ia64.c |  4 ++--
 gcc/config/sh/sh.c     |  2 +-
 gcc/dce.c              |  4 ++--
 gcc/dominance.c        |  4 ++--
 gcc/final.c            |  2 +-
 gcc/function.c         |  2 +-
 gcc/gcse.c             |  2 +-
 gcc/ira.c              |  4 ++--
 gcc/lcm.c              |  2 +-
 gcc/mode-switching.c   |  4 ++--
 gcc/postreload.c       |  2 +-
 gcc/recog.c            |  4 ++--
 gcc/tree-ssa-live.c    |  2 +-
 16 files changed, 26 insertions(+), 28 deletions(-)
Oleg Endo - Dec. 7, 2013, 7:14 a.m.
David,

Could you please also update the use of FOR_EACH_BB_REVERSE in
config/sh/sh_optimize_sett_clrt.cc ?

Thanks,
Oleg

On Fri, 2013-12-06 at 09:51 -0500, David Malcolm wrote:
> gcc/
> 	* basic-block.h (FOR_EACH_BB_REVERSE): Eliminate macro.
> 
> 	* cfghooks.c (verify_flow_info): Replace uses of FOR_EACH_BB_REVERSE
> 	with FOR_EACH_BB_REVERSE_FN, making uses of cfun explicit.
> 	* cfgrtl.c (print_rtl_with_bb, rtl_verify_edges,
> 	rtl_verify_bb_insns, rtl_verify_bb_pointers,
> 	rtl_verify_bb_insn_chain, rtl_verify_fallthru): Likewise.
> 	* config/ia64/ia64.c (emit_predicate_relation_info): Likewise.
> 	* config/sh/sh.c (sh_md_init_global): Likewise.
> 	* dce.c (reset_unmarked_insns_debug_uses, delete_unmarked_insns):
> 	Likewise.
> 	* dominance.c (calc_dfs_tree): Likewise.
> 	* final.c (final): Likewise.
> 	* function.c (thread_prologue_and_epilogue_insns): Likewise.
> 	* gcse.c (compute_code_hoist_vbeinout): Likewise.
> 	* ira.c (update_equiv_regs, build_insn_chain): Likewise.
> 	* lcm.c (compute_antinout_edge): Likewise.
> 	* mode-switching.c (optimize_mode_switching): Likewise.
> 	* postreload.c (reload_combine): Likewise.
> 	* recog.c (split_all_insns, peephole2_optimize): Likewise.
> 	* tree-ssa-live.c (live_worklist): Likewise.
> ---
>  gcc/basic-block.h      |  2 --
>  gcc/cfghooks.c         |  2 +-
>  gcc/cfgrtl.c           | 12 ++++++------
>  gcc/config/ia64/ia64.c |  4 ++--
>  gcc/config/sh/sh.c     |  2 +-
>  gcc/dce.c              |  4 ++--
>  gcc/dominance.c        |  4 ++--
>  gcc/final.c            |  2 +-
>  gcc/function.c         |  2 +-
>  gcc/gcse.c             |  2 +-
>  gcc/ira.c              |  4 ++--
>  gcc/lcm.c              |  2 +-
>  gcc/mode-switching.c   |  4 ++--
>  gcc/postreload.c       |  2 +-
>  gcc/recog.c            |  4 ++--
>  gcc/tree-ssa-live.c    |  2 +-
>  16 files changed, 26 insertions(+), 28 deletions(-)
> 
> diff --git a/gcc/basic-block.h b/gcc/basic-block.h
> index b378a5b..75f16ac 100644
> --- a/gcc/basic-block.h
> +++ b/gcc/basic-block.h
> @@ -336,8 +336,6 @@ struct GTY(()) control_flow_graph {
>  #define FOR_EACH_BB_REVERSE_FN(BB, FN) \
>    FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb)
>  
> -#define FOR_EACH_BB_REVERSE(BB) FOR_EACH_BB_REVERSE_FN (BB, cfun)
> -
>  /* For iterating over insns in basic block.  */
>  #define FOR_BB_INSNS(BB, INSN)			\
>    for ((INSN) = BB_HEAD (BB);			\
> diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
> index 2400965..78218b5 100644
> --- a/gcc/cfghooks.c
> +++ b/gcc/cfghooks.c
> @@ -123,7 +123,7 @@ verify_flow_info (void)
>      }
>  
>    /* Now check the basic blocks (boundaries etc.) */
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        int n_fallthru = 0;
>        edge e;
> diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
> index daadd9b..7734ac1 100644
> --- a/gcc/cfgrtl.c
> +++ b/gcc/cfgrtl.c
> @@ -2153,7 +2153,7 @@ print_rtl_with_bb (FILE *outf, const_rtx rtx_first, int flags)
>  
>        if (flags & TDF_BLOCKS)
>  	{
> -	  FOR_EACH_BB_REVERSE (bb)
> +	  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>  	    {
>  	      rtx x;
>  
> @@ -2408,7 +2408,7 @@ rtl_verify_edges (void)
>    int err = 0;
>    basic_block bb;
>  
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        int n_fallthru = 0, n_branch = 0, n_abnormal_call = 0, n_sibcall = 0;
>        int n_eh = 0, n_abnormal = 0;
> @@ -2586,7 +2586,7 @@ rtl_verify_bb_insns (void)
>    int err = 0;
>    basic_block bb;
>  
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        /* Now check the header of basic
>  	 block.  It ought to contain optional CODE_LABEL followed
> @@ -2649,7 +2649,7 @@ rtl_verify_bb_pointers (void)
>    basic_block bb;
>  
>    /* Check the general integrity of the basic blocks.  */
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        rtx insn;
>  
> @@ -2739,7 +2739,7 @@ rtl_verify_bb_insn_chain (void)
>  
>    bb_info = XCNEWVEC (basic_block, max_uid);
>  
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        rtx head = BB_HEAD (bb);
>        rtx end = BB_END (bb);
> @@ -2821,7 +2821,7 @@ rtl_verify_fallthru (void)
>    basic_block bb;
>    int err = 0;
>  
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        edge e;
>  
> diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
> index a837974..99bc094 100644
> --- a/gcc/config/ia64/ia64.c
> +++ b/gcc/config/ia64/ia64.c
> @@ -9613,7 +9613,7 @@ emit_predicate_relation_info (void)
>  {
>    basic_block bb;
>  
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        int r;
>        rtx head = BB_HEAD (bb);
> @@ -9641,7 +9641,7 @@ emit_predicate_relation_info (void)
>       relations around them.  Otherwise the assembler will assume the call
>       returns, and complain about uses of call-clobbered predicates after
>       the call.  */
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        rtx insn = BB_HEAD (bb);
>  
> diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
> index 3e907b2..26c8957 100644
> --- a/gcc/config/sh/sh.c
> +++ b/gcc/config/sh/sh.c
> @@ -11110,7 +11110,7 @@ sh_md_init_global (FILE *dump ATTRIBUTE_UNUSED,
>    regmode_weight[1] = (short *) xcalloc (old_max_uid, sizeof (short));
>    r0_life_regions = 0;
>  
> -  FOR_EACH_BB_REVERSE (b)
> +  FOR_EACH_BB_REVERSE_FN (b, cfun)
>    {
>      find_regmode_weight (b, SImode);
>      find_regmode_weight (b, SFmode);
> diff --git a/gcc/dce.c b/gcc/dce.c
> index 3101102..843dfc6 100644
> --- a/gcc/dce.c
> +++ b/gcc/dce.c
> @@ -511,7 +511,7 @@ reset_unmarked_insns_debug_uses (void)
>    basic_block bb;
>    rtx insn, next;
>  
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next)
>        if (DEBUG_INSN_P (insn))
>  	{
> @@ -550,7 +550,7 @@ delete_unmarked_insns (void)
>    rtx insn, next;
>    bool must_clean = false;
>  
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next)
>        if (NONDEBUG_INSN_P (insn))
>  	{
> diff --git a/gcc/dominance.c b/gcc/dominance.c
> index 521b224..69816c1 100644
> --- a/gcc/dominance.c
> +++ b/gcc/dominance.c
> @@ -357,7 +357,7 @@ calc_dfs_tree (struct dom_info *di, bool reverse)
>        basic_block b;
>        bool saw_unconnected = false;
>  
> -      FOR_EACH_BB_REVERSE (b)
> +      FOR_EACH_BB_REVERSE_FN (b, cfun)
>  	{
>  	  if (EDGE_COUNT (b->succs) > 0)
>  	    {
> @@ -376,7 +376,7 @@ calc_dfs_tree (struct dom_info *di, bool reverse)
>  
>        if (saw_unconnected)
>  	{
> -	  FOR_EACH_BB_REVERSE (b)
> +	  FOR_EACH_BB_REVERSE_FN (b, cfun)
>  	    {
>  	      basic_block b2;
>  	      if (di->dfs_order[b->index])
> diff --git a/gcc/final.c b/gcc/final.c
> index f475d27..5526974 100644
> --- a/gcc/final.c
> +++ b/gcc/final.c
> @@ -1996,7 +1996,7 @@ final (rtx first, FILE *file, int optimize_p)
>  
>        /* There is no cfg for a thunk.  */
>        if (!cfun->is_thunk)
> -	FOR_EACH_BB_REVERSE (bb)
> +	FOR_EACH_BB_REVERSE_FN (bb, cfun)
>  	  {
>  	    start_to_bb[INSN_UID (BB_HEAD (bb))] = bb;
>  	    end_to_bb[INSN_UID (BB_END (bb))] = bb;
> diff --git a/gcc/function.c b/gcc/function.c
> index e00f583..e2d0e23 100644
> --- a/gcc/function.c
> +++ b/gcc/function.c
> @@ -6236,7 +6236,7 @@ thread_prologue_and_epilogue_insns (void)
>  	    }
>  	  /* Now duplicate the tails.  */
>  	  if (!bitmap_empty_p (&bb_tail))
> -	    FOR_EACH_BB_REVERSE (bb)
> +	    FOR_EACH_BB_REVERSE_FN (bb, cfun)
>  	      {
>  		basic_block copy_bb, tbb;
>  		rtx insert_point;
> diff --git a/gcc/gcse.c b/gcc/gcse.c
> index a6874ab..fdf0a57 100644
> --- a/gcc/gcse.c
> +++ b/gcc/gcse.c
> @@ -2829,7 +2829,7 @@ compute_code_hoist_vbeinout (void)
>  
>        /* We scan the blocks in the reverse order to speed up
>  	 the convergence.  */
> -      FOR_EACH_BB_REVERSE (bb)
> +      FOR_EACH_BB_REVERSE_FN (bb, cfun)
>  	{
>  	  if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
>  	    {
> diff --git a/gcc/ira.c b/gcc/ira.c
> index b4ae0ca..7403870 100644
> --- a/gcc/ira.c
> +++ b/gcc/ira.c
> @@ -3772,7 +3772,7 @@ update_equiv_regs (void)
>       within the same loop (or in an inner loop), then move the register
>       initialization just before the use, so that they are in the same
>       basic block.  */
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        loop_depth = bb_loop_depth (bb);
>        for (insn = BB_END (bb);
> @@ -4127,7 +4127,7 @@ build_insn_chain (void)
>    for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
>      if (TEST_HARD_REG_BIT (eliminable_regset, i))
>        bitmap_set_bit (elim_regset, i);
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        bitmap_iterator bi;
>        rtx insn;
> diff --git a/gcc/lcm.c b/gcc/lcm.c
> index 0b528d9..b5d56e0 100644
> --- a/gcc/lcm.c
> +++ b/gcc/lcm.c
> @@ -109,7 +109,7 @@ compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin,
>  
>    /* Put every block on the worklist; this is necessary because of the
>       optimistic initialization of ANTIN above.  */
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        *qin++ = bb;
>        bb->aux = bb;
> diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
> index 4e31d68..4f68536 100644
> --- a/gcc/mode-switching.c
> +++ b/gcc/mode-switching.c
> @@ -692,7 +692,7 @@ optimize_mode_switching (void)
>  	      insert_insn_on_edge (mode_set, eg);
>  	    }
>  
> -	  FOR_EACH_BB_REVERSE (bb)
> +	  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>  	    if (bitmap_bit_p (del[bb->index], j))
>  	      {
>  		make_preds_opaque (bb, j);
> @@ -712,7 +712,7 @@ optimize_mode_switching (void)
>      {
>        int no_mode = num_modes[entity_map[j]];
>  
> -      FOR_EACH_BB_REVERSE (bb)
> +      FOR_EACH_BB_REVERSE_FN (bb, cfun)
>  	{
>  	  struct seginfo *ptr, *next;
>  	  for (ptr = bb_info[j][bb->index].seginfo; ptr; ptr = next)
> diff --git a/gcc/postreload.c b/gcc/postreload.c
> index bfa5a38..37bd9ff 100644
> --- a/gcc/postreload.c
> +++ b/gcc/postreload.c
> @@ -1281,7 +1281,7 @@ reload_combine (void)
>    label_live = XNEWVEC (HARD_REG_SET, n_labels);
>    CLEAR_HARD_REG_SET (ever_live_at_start);
>  
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        insn = BB_HEAD (bb);
>        if (LABEL_P (insn))
> diff --git a/gcc/recog.c b/gcc/recog.c
> index c59aa0e..dbd9a8a 100644
> --- a/gcc/recog.c
> +++ b/gcc/recog.c
> @@ -2902,7 +2902,7 @@ split_all_insns (void)
>    bitmap_clear (blocks);
>    changed = false;
>  
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        rtx insn, next;
>        bool finish = false;
> @@ -3556,7 +3556,7 @@ peephole2_optimize (void)
>    search_ofs = 0;
>    live = BITMAP_ALLOC (&reg_obstack);
>  
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      {
>        bool past_end = false;
>        int pos;
> diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
> index da7198b..a37ef85 100644
> --- a/gcc/tree-ssa-live.c
> +++ b/gcc/tree-ssa-live.c
> @@ -1050,7 +1050,7 @@ live_worklist (tree_live_info_p live)
>  
>    /* Visit all the blocks in reverse order and propagate live on entry values
>       into the predecessors blocks.  */
> -  FOR_EACH_BB_REVERSE (bb)
> +  FOR_EACH_BB_REVERSE_FN (bb, cfun)
>      loe_visit_block (live, bb, visited, tmp);
>  
>    /* Process any blocks which require further iteration.  */

Patch

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index b378a5b..75f16ac 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -336,8 +336,6 @@  struct GTY(()) control_flow_graph {
 #define FOR_EACH_BB_REVERSE_FN(BB, FN) \
   FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb)
 
-#define FOR_EACH_BB_REVERSE(BB) FOR_EACH_BB_REVERSE_FN (BB, cfun)
-
 /* For iterating over insns in basic block.  */
 #define FOR_BB_INSNS(BB, INSN)			\
   for ((INSN) = BB_HEAD (BB);			\
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 2400965..78218b5 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -123,7 +123,7 @@  verify_flow_info (void)
     }
 
   /* Now check the basic blocks (boundaries etc.) */
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       int n_fallthru = 0;
       edge e;
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index daadd9b..7734ac1 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2153,7 +2153,7 @@  print_rtl_with_bb (FILE *outf, const_rtx rtx_first, int flags)
 
       if (flags & TDF_BLOCKS)
 	{
-	  FOR_EACH_BB_REVERSE (bb)
+	  FOR_EACH_BB_REVERSE_FN (bb, cfun)
 	    {
 	      rtx x;
 
@@ -2408,7 +2408,7 @@  rtl_verify_edges (void)
   int err = 0;
   basic_block bb;
 
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       int n_fallthru = 0, n_branch = 0, n_abnormal_call = 0, n_sibcall = 0;
       int n_eh = 0, n_abnormal = 0;
@@ -2586,7 +2586,7 @@  rtl_verify_bb_insns (void)
   int err = 0;
   basic_block bb;
 
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       /* Now check the header of basic
 	 block.  It ought to contain optional CODE_LABEL followed
@@ -2649,7 +2649,7 @@  rtl_verify_bb_pointers (void)
   basic_block bb;
 
   /* Check the general integrity of the basic blocks.  */
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       rtx insn;
 
@@ -2739,7 +2739,7 @@  rtl_verify_bb_insn_chain (void)
 
   bb_info = XCNEWVEC (basic_block, max_uid);
 
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       rtx head = BB_HEAD (bb);
       rtx end = BB_END (bb);
@@ -2821,7 +2821,7 @@  rtl_verify_fallthru (void)
   basic_block bb;
   int err = 0;
 
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       edge e;
 
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index a837974..99bc094 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -9613,7 +9613,7 @@  emit_predicate_relation_info (void)
 {
   basic_block bb;
 
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       int r;
       rtx head = BB_HEAD (bb);
@@ -9641,7 +9641,7 @@  emit_predicate_relation_info (void)
      relations around them.  Otherwise the assembler will assume the call
      returns, and complain about uses of call-clobbered predicates after
      the call.  */
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       rtx insn = BB_HEAD (bb);
 
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 3e907b2..26c8957 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -11110,7 +11110,7 @@  sh_md_init_global (FILE *dump ATTRIBUTE_UNUSED,
   regmode_weight[1] = (short *) xcalloc (old_max_uid, sizeof (short));
   r0_life_regions = 0;
 
-  FOR_EACH_BB_REVERSE (b)
+  FOR_EACH_BB_REVERSE_FN (b, cfun)
   {
     find_regmode_weight (b, SImode);
     find_regmode_weight (b, SFmode);
diff --git a/gcc/dce.c b/gcc/dce.c
index 3101102..843dfc6 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -511,7 +511,7 @@  reset_unmarked_insns_debug_uses (void)
   basic_block bb;
   rtx insn, next;
 
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next)
       if (DEBUG_INSN_P (insn))
 	{
@@ -550,7 +550,7 @@  delete_unmarked_insns (void)
   rtx insn, next;
   bool must_clean = false;
 
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next)
       if (NONDEBUG_INSN_P (insn))
 	{
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 521b224..69816c1 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -357,7 +357,7 @@  calc_dfs_tree (struct dom_info *di, bool reverse)
       basic_block b;
       bool saw_unconnected = false;
 
-      FOR_EACH_BB_REVERSE (b)
+      FOR_EACH_BB_REVERSE_FN (b, cfun)
 	{
 	  if (EDGE_COUNT (b->succs) > 0)
 	    {
@@ -376,7 +376,7 @@  calc_dfs_tree (struct dom_info *di, bool reverse)
 
       if (saw_unconnected)
 	{
-	  FOR_EACH_BB_REVERSE (b)
+	  FOR_EACH_BB_REVERSE_FN (b, cfun)
 	    {
 	      basic_block b2;
 	      if (di->dfs_order[b->index])
diff --git a/gcc/final.c b/gcc/final.c
index f475d27..5526974 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1996,7 +1996,7 @@  final (rtx first, FILE *file, int optimize_p)
 
       /* There is no cfg for a thunk.  */
       if (!cfun->is_thunk)
-	FOR_EACH_BB_REVERSE (bb)
+	FOR_EACH_BB_REVERSE_FN (bb, cfun)
 	  {
 	    start_to_bb[INSN_UID (BB_HEAD (bb))] = bb;
 	    end_to_bb[INSN_UID (BB_END (bb))] = bb;
diff --git a/gcc/function.c b/gcc/function.c
index e00f583..e2d0e23 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6236,7 +6236,7 @@  thread_prologue_and_epilogue_insns (void)
 	    }
 	  /* Now duplicate the tails.  */
 	  if (!bitmap_empty_p (&bb_tail))
-	    FOR_EACH_BB_REVERSE (bb)
+	    FOR_EACH_BB_REVERSE_FN (bb, cfun)
 	      {
 		basic_block copy_bb, tbb;
 		rtx insert_point;
diff --git a/gcc/gcse.c b/gcc/gcse.c
index a6874ab..fdf0a57 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -2829,7 +2829,7 @@  compute_code_hoist_vbeinout (void)
 
       /* We scan the blocks in the reverse order to speed up
 	 the convergence.  */
-      FOR_EACH_BB_REVERSE (bb)
+      FOR_EACH_BB_REVERSE_FN (bb, cfun)
 	{
 	  if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
 	    {
diff --git a/gcc/ira.c b/gcc/ira.c
index b4ae0ca..7403870 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3772,7 +3772,7 @@  update_equiv_regs (void)
      within the same loop (or in an inner loop), then move the register
      initialization just before the use, so that they are in the same
      basic block.  */
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       loop_depth = bb_loop_depth (bb);
       for (insn = BB_END (bb);
@@ -4127,7 +4127,7 @@  build_insn_chain (void)
   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
     if (TEST_HARD_REG_BIT (eliminable_regset, i))
       bitmap_set_bit (elim_regset, i);
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       bitmap_iterator bi;
       rtx insn;
diff --git a/gcc/lcm.c b/gcc/lcm.c
index 0b528d9..b5d56e0 100644
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -109,7 +109,7 @@  compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin,
 
   /* Put every block on the worklist; this is necessary because of the
      optimistic initialization of ANTIN above.  */
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       *qin++ = bb;
       bb->aux = bb;
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index 4e31d68..4f68536 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -692,7 +692,7 @@  optimize_mode_switching (void)
 	      insert_insn_on_edge (mode_set, eg);
 	    }
 
-	  FOR_EACH_BB_REVERSE (bb)
+	  FOR_EACH_BB_REVERSE_FN (bb, cfun)
 	    if (bitmap_bit_p (del[bb->index], j))
 	      {
 		make_preds_opaque (bb, j);
@@ -712,7 +712,7 @@  optimize_mode_switching (void)
     {
       int no_mode = num_modes[entity_map[j]];
 
-      FOR_EACH_BB_REVERSE (bb)
+      FOR_EACH_BB_REVERSE_FN (bb, cfun)
 	{
 	  struct seginfo *ptr, *next;
 	  for (ptr = bb_info[j][bb->index].seginfo; ptr; ptr = next)
diff --git a/gcc/postreload.c b/gcc/postreload.c
index bfa5a38..37bd9ff 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1281,7 +1281,7 @@  reload_combine (void)
   label_live = XNEWVEC (HARD_REG_SET, n_labels);
   CLEAR_HARD_REG_SET (ever_live_at_start);
 
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       insn = BB_HEAD (bb);
       if (LABEL_P (insn))
diff --git a/gcc/recog.c b/gcc/recog.c
index c59aa0e..dbd9a8a 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -2902,7 +2902,7 @@  split_all_insns (void)
   bitmap_clear (blocks);
   changed = false;
 
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       rtx insn, next;
       bool finish = false;
@@ -3556,7 +3556,7 @@  peephole2_optimize (void)
   search_ofs = 0;
   live = BITMAP_ALLOC (&reg_obstack);
 
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     {
       bool past_end = false;
       int pos;
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index da7198b..a37ef85 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -1050,7 +1050,7 @@  live_worklist (tree_live_info_p live)
 
   /* Visit all the blocks in reverse order and propagate live on entry values
      into the predecessors blocks.  */
-  FOR_EACH_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE_FN (bb, cfun)
     loe_visit_block (live, bb, visited, tmp);
 
   /* Process any blocks which require further iteration.  */