Patchwork [13/13] Eliminate FOR_ALL_BB macro.

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

Comments

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

	* cfg.c (alloc_aux_for_blocks, clear_aux_for_blocks): Replace
	uses of FOR_ALL_BB with FOR_ALL_BB_FN, making uses of cfun explicit.

	* cfganal.c (inverted_post_order_compute): Likewise.
	* cfgcleanup.c (try_optimize_cfg): Likewise.
	* cfgexpand.c (add_scope_conflicts): Likewise.
	* cfghooks.c (dump_flow_info, account_profile_record): Likewise.
	* cfgrtl.c (relink_block_chain): Likewise.
	* dce.c (mark_artificial_uses): Likewise.
	* df-core.c (df_set_blocks, df_compute_cfg_image, df_dump): Likewise.
	* df-problems.c (df_lr_verify_solution_start,
	df_lr_verify_solution_end, df_lr_verify_transfer_functions,
	df_live_verify_solution_start, df_live_verify_solution_end,
	df_live_set_all_dirty, df_live_verify_transfer_functions,
	df_md_local_comput): Likewise.
	* df-scan.c (df_scan_free_internal, df_scan_alloc)
	df_reorganize_refs_by_insn, df_scan_verify): Likewise.
	* dominance.c (compute_dom_fast_query, calculate_dominance_info,
	free_dominance_info): Likewise.
	* dse.c (dse_step1, dse_step3, dse_step4, dse_step6): Likewise.
	* graph.c (draw_cfg_edges): Likewise.
	* graphite-scop-detection.c (print_graphite_scop_statistics,
	dot_all_scops_1): Likewise.
	* graphite.c (print_global_statistics,
	print_graphite_scop_statistics): Likewise.
	* ira.c (do_reload): Likewise.
	* loop-init.c (loop_optimizer_finalize): Likewise.
	* lto-streamer-in.c (input_function): Likewise.
	* lto-streamer-out.c (output_function): Likewise.
	* mcf.c (adjust_cfg_counts): Likewise.
	* predict.c (estimate_loops): Likewise.
	* sched-rgn.c (haifa_find_rgns): Likewise.
	* tree-cfg.c (split_critical_edges): Likewise.
 	* tree-dfa.c (renumber_gimple_stmt_uids): Likewise.
	* tree-loop-distribution.c (tree_loop_distribution): Likewise.
	* tree-ssa-pre.c (compute_antic, insert, init_pre): Likewise.
	* tree-ssa-propagate.c (ssa_prop_init): Likewise.
	* var-tracking.c (vt_initialize, vt_finalize): Likewise.
	* vtable-verify.c (vtable_verify_main): Likewise.
	* web.c (web_main): Likewise.
---
 gcc/basic-block.h             |  3 ---
 gcc/cfg.c                     |  4 ++--
 gcc/cfganal.c                 |  2 +-
 gcc/cfgcleanup.c              |  2 +-
 gcc/cfgexpand.c               |  4 ++--
 gcc/cfghooks.c                |  4 ++--
 gcc/cfgrtl.c                  |  2 +-
 gcc/dce.c                     |  2 +-
 gcc/df-core.c                 |  8 ++++----
 gcc/df-problems.c             | 22 +++++++++++-----------
 gcc/df-scan.c                 |  8 ++++----
 gcc/df.h                      |  2 +-
 gcc/dominance.c               |  6 +++---
 gcc/dse.c                     |  8 ++++----
 gcc/graph.c                   |  2 +-
 gcc/graphite-scop-detection.c |  6 +++---
 gcc/graphite.c                |  4 ++--
 gcc/ira.c                     |  4 ++--
 gcc/loop-init.c               |  2 +-
 gcc/lto-streamer-in.c         |  4 ++--
 gcc/lto-streamer-out.c        |  4 ++--
 gcc/mcf.c                     |  2 +-
 gcc/predict.c                 |  2 +-
 gcc/sched-rgn.c               |  2 +-
 gcc/tree-cfg.c                |  2 +-
 gcc/tree-dfa.c                |  2 +-
 gcc/tree-loop-distribution.c  |  2 +-
 gcc/tree-ssa-pre.c            |  8 ++++----
 gcc/tree-ssa-propagate.c      |  2 +-
 gcc/var-tracking.c            |  4 ++--
 gcc/vtable-verify.c           |  2 +-
 gcc/web.c                     |  6 +++---
 32 files changed, 67 insertions(+), 70 deletions(-)

Patch

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 75f16ac..b323a1f 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -362,9 +362,6 @@  struct GTY(()) control_flow_graph {
 /* Cycles through _all_ basic blocks, even the fake ones (entry and
    exit block).  */
 
-#define FOR_ALL_BB(BB) \
-  for (BB = ENTRY_BLOCK_PTR_FOR_FN (cfun); BB; BB = BB->next_bb)
-
 #define FOR_ALL_BB_FN(BB, FN) \
   for (BB = ENTRY_BLOCK_PTR_FOR_FN (FN); BB; BB = BB->next_bb)
 
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 4f9d769..d4d00a4 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -576,7 +576,7 @@  alloc_aux_for_blocks (int size)
     {
       basic_block bb;
 
-      FOR_ALL_BB (bb)
+      FOR_ALL_BB_FN (bb, cfun)
 	alloc_aux_for_block (bb, size);
     }
 }
@@ -588,7 +588,7 @@  clear_aux_for_blocks (void)
 {
   basic_block bb;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     bb->aux = NULL;
 }
 
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 3371b4a..d7e0382 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -784,7 +784,7 @@  inverted_post_order_compute (int *post_order)
   bitmap_clear (visited);
 
   /* Put all blocks that have no successor into the initial work list.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     if (EDGE_COUNT (bb->succs) == 0)
       {
         /* Push the initial edge on to the stack.  */
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index cf72c03..684ab0f 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -2864,7 +2864,7 @@  try_optimize_cfg (int mode)
       while (changed);
     }
 
-  FOR_ALL_BB (b)
+  FOR_ALL_BB_FN (b, cfun)
     b->flags &= ~(BB_FORWARDER_BLOCK | BB_NONTHREADABLE_BLOCK);
 
   return changed_overall;
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 56bcd80..a73bd41 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -498,7 +498,7 @@  add_scope_conflicts (void)
 
      We then do a mostly classical bitmap liveness algorithm.  */
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     bb->aux = BITMAP_ALLOC (&stack_var_bitmap_obstack);
 
   rpo = XNEWVEC (int, last_basic_block_for_fn (cfun));
@@ -525,7 +525,7 @@  add_scope_conflicts (void)
 
   free (rpo);
   BITMAP_FREE (work);
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     BITMAP_FREE (bb->aux);
 }
 
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 78218b5..7a16887 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -325,7 +325,7 @@  dump_flow_info (FILE *file, int flags)
 
   fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks_for_fn (cfun),
 	   n_edges_for_fn (cfun));
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     dump_bb (file, bb, 0, flags);
 
   putc ('\n', file);
@@ -1408,7 +1408,7 @@  account_profile_record (struct profile_record *record, int after_pass)
   int sum;
   gcov_type lsum;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
    {
       if (bb != EXIT_BLOCK_PTR_FOR_FN (cfun)
 	  && profile_status_for_fn (cfun) != PROFILE_ABSENT)
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 7734ac1..1a63249 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -3619,7 +3619,7 @@  relink_block_chain (bool stay_in_cfglayout_mode)
   EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb = prev_bb;
 
   /* Then, clean up the aux fields.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       bb->aux = NULL;
       if (!stay_in_cfglayout_mode)
diff --git a/gcc/dce.c b/gcc/dce.c
index 843dfc6..7e8278f 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -663,7 +663,7 @@  mark_artificial_uses (void)
   struct df_link *defs;
   df_ref *use_rec;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       for (use_rec = df_get_artificial_uses (bb->index);
 	   *use_rec; use_rec++)
diff --git a/gcc/df-core.c b/gcc/df-core.c
index ba57d39..045b54f 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -549,7 +549,7 @@  df_set_blocks (bitmap blocks)
 		    {
 		      basic_block bb;
 		      bitmap_initialize (&blocks_to_reset, &df_bitmap_obstack);
-		      FOR_ALL_BB (bb)
+		      FOR_ALL_BB_FN (bb, cfun)
 			{
 			  bitmap_set_bit (&blocks_to_reset, bb->index);
 			}
@@ -1720,7 +1720,7 @@  df_compute_cfg_image (void)
   int i;
   int * map;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       size += EDGE_COUNT (bb->succs);
     }
@@ -1728,7 +1728,7 @@  df_compute_cfg_image (void)
   map = XNEWVEC (int, size);
   map[0] = size;
   i = 1;
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       edge_iterator ei;
       edge e;
@@ -2021,7 +2021,7 @@  df_dump (FILE *file)
   basic_block bb;
   df_dump_start (file);
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       df_print_bb_index (bb, file);
       df_dump_top (bb, file);
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 70f7254..4b926b6 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -1176,7 +1176,7 @@  df_lr_verify_solution_start (void)
   problem_data->in = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
   problem_data->out = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       bitmap_initialize (&problem_data->in[bb->index], &problem_data->lr_bitmaps);
       bitmap_initialize (&problem_data->out[bb->index], &problem_data->lr_bitmaps);
@@ -1205,7 +1205,7 @@  df_lr_verify_solution_end (void)
        in df_lr_finalize for details.  */
     df_lr->solutions_dirty = false;
   else
-    FOR_ALL_BB (bb)
+    FOR_ALL_BB_FN (bb, cfun)
       {
 	if ((!bitmap_equal_p (&problem_data->in[bb->index], DF_LR_IN (bb)))
 	    || (!bitmap_equal_p (&problem_data->out[bb->index], DF_LR_OUT (bb))))
@@ -1217,7 +1217,7 @@  df_lr_verify_solution_end (void)
 
   /* Cannot delete them immediately because you may want to dump them
      if the comparison fails.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       bitmap_clear (&problem_data->in[bb->index]);
       bitmap_clear (&problem_data->out[bb->index]);
@@ -1294,7 +1294,7 @@  df_lr_verify_transfer_functions (void)
   bitmap_initialize (&saved_use, &bitmap_default_obstack);
   bitmap_initialize (&all_blocks, &bitmap_default_obstack);
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index);
       bitmap_set_bit (&all_blocks, bb->index);
@@ -1713,7 +1713,7 @@  df_live_verify_solution_start (void)
   problem_data->in = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
   problem_data->out = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       bitmap_initialize (&problem_data->in[bb->index], &problem_data->live_bitmaps);
       bitmap_initialize (&problem_data->out[bb->index], &problem_data->live_bitmaps);
@@ -1736,7 +1736,7 @@  df_live_verify_solution_end (void)
   if (!problem_data->out)
     return;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       if ((!bitmap_equal_p (&problem_data->in[bb->index], DF_LIVE_IN (bb)))
 	  || (!bitmap_equal_p (&problem_data->out[bb->index], DF_LIVE_OUT (bb))))
@@ -1748,7 +1748,7 @@  df_live_verify_solution_end (void)
 
   /* Cannot delete them immediately because you may want to dump them
      if the comparison fails.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       bitmap_clear (&problem_data->in[bb->index]);
       bitmap_clear (&problem_data->out[bb->index]);
@@ -1814,7 +1814,7 @@  void
 df_live_set_all_dirty (void)
 {
   basic_block bb;
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     bitmap_set_bit (df_live->out_of_date_transfer_functions,
 		    bb->index);
 }
@@ -1840,7 +1840,7 @@  df_live_verify_transfer_functions (void)
 
   df_grow_insn_info ();
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       struct df_live_bb_info *bb_info = df_live_get_bb_info (bb->index);
       bitmap_set_bit (&all_blocks, bb->index);
@@ -4316,7 +4316,7 @@  df_md_local_compute (bitmap all_blocks)
   bitmap_clear (&seen_in_insn);
 
   frontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     bitmap_initialize (&frontiers[bb->index], &bitmap_default_obstack);
 
   compute_dominance_frontiers (frontiers);
@@ -4334,7 +4334,7 @@  df_md_local_compute (bitmap all_blocks)
 	}
     }
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     bitmap_clear (&frontiers[bb->index]);
   free (frontiers);
 }
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 9f6f67a..a35b12f 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -213,7 +213,7 @@  df_scan_free_internal (void)
 	}
     }
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       unsigned int bb_index = bb->index;
       struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index);
@@ -355,7 +355,7 @@  df_scan_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
   df_grow_insn_info ();
   df_grow_bb_info (df_scan);
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       unsigned int bb_index = bb->index;
       struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index);
@@ -1887,7 +1887,7 @@  df_reorganize_refs_by_insn (struct df_ref_info *ref_info,
     }
   else
     {
-      FOR_ALL_BB (bb)
+      FOR_ALL_BB_FN (bb, cfun)
 	offset = df_reorganize_refs_by_insn_bb (bb, offset, ref_info,
 						include_defs, include_uses,
 						include_eq_uses);
@@ -4569,7 +4569,7 @@  df_scan_verify (void)
      clear a mark that has not been set as this means that the ref in
      the block or insn was not in the reg chain.  */
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     df_bb_verify (bb);
 
   /* (4) See if all reg chains are traversed a second time.  This time
diff --git a/gcc/df.h b/gcc/df.h
index e3ca67b..579712c 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -176,7 +176,7 @@  enum df_ref_order
     DF_REF_ORDER_BY_REG_WITH_NOTES,
 
     /* Organize the refs in insn order.  The insns are ordered within a
-       block, and the blocks are ordered by FOR_ALL_BB.  */
+       block, and the blocks are ordered by FOR_ALL_BB_FN.  */
     DF_REF_ORDER_BY_INSN,
 
     /* For uses, the refs within eq notes may be added for
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 69816c1..77f9471 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -624,7 +624,7 @@  compute_dom_fast_query (enum cdi_direction dir)
   if (dom_computed[dir_index] == DOM_OK)
     return;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       if (!bb->dom[dir_index]->father)
 	assign_dfs_numbers (bb->dom[dir_index], &num);
@@ -652,7 +652,7 @@  calculate_dominance_info (enum cdi_direction dir)
     {
       gcc_assert (!n_bbs_in_dom_tree[dir_index]);
 
-      FOR_ALL_BB (b)
+      FOR_ALL_BB_FN (b, cfun)
 	{
 	  b->dom[dir_index] = et_new_tree (b);
 	}
@@ -689,7 +689,7 @@  free_dominance_info (enum cdi_direction dir)
   if (!dom_info_available_p (dir))
     return;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       et_free_tree_force (bb->dom[dir_index]);
       bb->dom[dir_index] = NULL;
diff --git a/gcc/dse.c b/gcc/dse.c
index e5b0850..958097d 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -2708,7 +2708,7 @@  dse_step1 (void)
   bitmap_set_bit (all_blocks, ENTRY_BLOCK);
   bitmap_set_bit (all_blocks, EXIT_BLOCK);
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       insn_info_t ptr;
       bb_info_t bb_info = (bb_info_t) pool_alloc (bb_info_pool);
@@ -3290,7 +3290,7 @@  dse_step3 (bool for_spills)
 
   bitmap_ones (unreachable_blocks);
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       bb_info_t bb_info = bb_table[bb->index];
       if (bb_info->gen)
@@ -3469,7 +3469,7 @@  dse_step4 (void)
       basic_block bb;
 
       fprintf (dump_file, "\n\n*** Global dataflow info after analysis.\n");
-      FOR_ALL_BB (bb)
+      FOR_ALL_BB_FN (bb, cfun)
 	{
 	  bb_info_t bb_info = bb_table[bb->index];
 
@@ -3617,7 +3617,7 @@  dse_step6 (void)
 {
   basic_block bb;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       bb_info_t bb_info = bb_table[bb->index];
       insn_info_t insn_info = bb_info->last_insn;
diff --git a/gcc/graph.c b/gcc/graph.c
index 6c405d8..545de44 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -255,7 +255,7 @@  draw_cfg_edges (pretty_printer *pp, struct function *fun)
 {
   basic_block bb;
   mark_dfs_back_edges ();
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     draw_cfg_node_succ_edges (pp, fun->funcdef_no, bb);
 
   /* Add an invisible edge from ENTRY to EXIT, to improve the graph layout.  */
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index a8db98d..fea15e5 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1114,7 +1114,7 @@  print_graphite_scop_statistics (FILE* file, scop_p scop)
 
   basic_block bb;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       gimple_stmt_iterator psi;
       loop_p loop = bb->loop_father;
@@ -1450,7 +1450,7 @@  dot_all_scops_1 (FILE *file, vec<scop_p> scops)
 
   fprintf (file, "digraph all {\n");
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       int part_of_scop = false;
 
@@ -1557,7 +1557,7 @@  dot_all_scops_1 (FILE *file, vec<scop_p> scops)
       fprintf (file, "  </TABLE>>, shape=box, style=\"setlinewidth(0)\"]\n");
     }
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       FOR_EACH_EDGE (e, ei, bb->succs)
 	      fprintf (file, "%d -> %d;\n", bb->index, e->dest->index);
diff --git a/gcc/graphite.c b/gcc/graphite.c
index a573ea7..8af0402 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -94,7 +94,7 @@  print_global_statistics (FILE* file)
 
   basic_block bb;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       gimple_stmt_iterator psi;
 
@@ -150,7 +150,7 @@  print_graphite_scop_statistics (FILE* file, scop_p scop)
 
   basic_block bb;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       gimple_stmt_iterator psi;
       loop_p loop = bb->loop_father;
diff --git a/gcc/ira.c b/gcc/ira.c
index 7403870..d6462ca 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5443,7 +5443,7 @@  do_reload (void)
 	  loop_optimizer_finalize ();
 	  free_dominance_info (CDI_DOMINATORS);
 	}
-      FOR_ALL_BB (bb)
+      FOR_ALL_BB_FN (bb, cfun)
 	bb->loop_father = NULL;
       current_loops = NULL;
       
@@ -5492,7 +5492,7 @@  do_reload (void)
 	  loop_optimizer_finalize ();
 	  free_dominance_info (CDI_DOMINATORS);
 	}
-      FOR_ALL_BB (bb)
+      FOR_ALL_BB_FN (bb, cfun)
 	bb->loop_father = NULL;
       current_loops = NULL;
       
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 3dc6953..8c5553b 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -169,7 +169,7 @@  loop_optimizer_finalize (void)
   ggc_free (current_loops);
   current_loops = NULL;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       bb->loop_father = NULL;
     }
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 8dc94bd..9d4466b 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -976,7 +976,7 @@  input_function (tree fn_decl, struct data_in *data_in,
   /* Fix up the call statements that are mentioned in the callgraph
      edges.  */
   set_gimple_stmt_max_uid (cfun, 0);
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       gimple_stmt_iterator gsi;
       for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -991,7 +991,7 @@  input_function (tree fn_decl, struct data_in *data_in,
 	}
     }
   stmts = (gimple *) xcalloc (gimple_stmt_max_uid (fn), sizeof (gimple));
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       gimple_stmt_iterator bsi = gsi_start_phis (bb);
       while (!gsi_end_p (bsi))
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 615cc84..205518f 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1868,7 +1868,7 @@  output_function (struct cgraph_node *node)
 	 virtual PHIs get re-computed on-the-fly which would make numbers
 	 inconsistent.  */
       set_gimple_stmt_max_uid (cfun, 0);
-      FOR_ALL_BB (bb)
+      FOR_ALL_BB_FN (bb, cfun)
 	{
 	  gimple_stmt_iterator gsi;
 	  for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -1887,7 +1887,7 @@  output_function (struct cgraph_node *node)
 	}
       /* To avoid keeping duplicate gimple IDs in the statements, renumber
 	 virtual phis now.  */
-      FOR_ALL_BB (bb)
+      FOR_ALL_BB_FN (bb, cfun)
 	{
 	  gimple_stmt_iterator gsi;
 	  for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/mcf.c b/gcc/mcf.c
index f9b5505..146b43c 100644
--- a/gcc/mcf.c
+++ b/gcc/mcf.c
@@ -1245,7 +1245,7 @@  adjust_cfg_counts (fixup_graph_type *fixup_graph)
 		     sum_edge_counts (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds);
 
   /* Compute edge probabilities.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       if (bb->count)
         {
diff --git a/gcc/predict.c b/gcc/predict.c
index 78efb72..a5ad34f 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2757,7 +2757,7 @@  estimate_loops (void)
     estimate_loops_at_level (current_loops->tree_root->inner);
 
   /* Now propagate the frequencies through all the blocks.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       bitmap_set_bit (tovisit, bb->index);
     }
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 7fa9759..863cd1d 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -745,7 +745,7 @@  haifa_find_rgns (void)
     }
 
   /* Reset ->aux field used by EDGE_PASSED.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       edge_iterator ei;
       edge e;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 98434ac..03e177a 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7940,7 +7940,7 @@  split_critical_edges (void)
      expensive.  So we want to enable recording of edge to CASE_LABEL_EXPR
      mappings around the calls to split_edge.  */
   start_recording_case_labels ();
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       FOR_EACH_EDGE (e, ei, bb->succs)
         {
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 2d964d5..302822c 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -80,7 +80,7 @@  renumber_gimple_stmt_uids (void)
   basic_block bb;
 
   set_gimple_stmt_max_uid (cfun, 0);
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       gimple_stmt_iterator bsi;
       for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index abf69f4..7d86b08 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -1677,7 +1677,7 @@  tree_loop_distribution (void)
   basic_block bb;
   control_dependences *cd = NULL;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       gimple_stmt_iterator gsi;
       for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index c1c5b4f..bceea77 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2445,7 +2445,7 @@  compute_antic (void)
   has_abnormal_preds = sbitmap_alloc (last_basic_block_for_fn (cfun));
   bitmap_clear (has_abnormal_preds);
 
-  FOR_ALL_BB (block)
+  FOR_ALL_BB_FN (block, cfun)
     {
       edge_iterator ei;
       edge e;
@@ -3660,7 +3660,7 @@  insert (void)
   basic_block bb;
   int num_iterations = 0;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     NEW_SETS (bb) = bitmap_set_new ();
 
   while (new_stuff)
@@ -3673,7 +3673,7 @@  insert (void)
       /* Clear the NEW sets before the next iteration.  We have already
          fully propagated its contents.  */
       if (new_stuff)
-	FOR_ALL_BB (bb)
+	FOR_ALL_BB_FN (bb, cfun)
 	  bitmap_set_free (NEW_SETS (bb));
     }
   statistics_histogram_event (cfun, "insert iterations", num_iterations);
@@ -4672,7 +4672,7 @@  init_pre (void)
 				       sizeof (struct bitmap_set), 30);
   pre_expr_pool = create_alloc_pool ("pre_expr nodes",
 				     sizeof (struct pre_expr_d), 30);
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       EXP_GEN (bb) = bitmap_set_new ();
       PHI_GEN (bb) = bitmap_set_new ();
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index f9f084b..fc8041f 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -509,7 +509,7 @@  ssa_prop_init (void)
 
   /* Initially assume that every edge in the CFG is not executable.
      (including the edges coming out of the entry block).  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       gimple_stmt_iterator si;
 
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 175ec01..f38cbe1 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -9847,7 +9847,7 @@  vt_initialize (void)
   changed_variables.create (10);
 
   /* Init the IN and OUT sets.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       VTI (bb)->visited = false;
       VTI (bb)->flooded = false;
@@ -10186,7 +10186,7 @@  vt_finalize (void)
       VTI (bb)->mos.release ();
     }
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     {
       dataflow_set_destroy (&VTI (bb)->in);
       dataflow_set_destroy (&VTI (bb)->out);
diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
index 46c5621..401f40b 100644
--- a/gcc/vtable-verify.c
+++ b/gcc/vtable-verify.c
@@ -746,7 +746,7 @@  vtable_verify_main (void)
   unsigned int ret = 1;
   basic_block bb;
 
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
       verify_bb_vtables (bb);
 
   return ret;
diff --git a/gcc/web.c b/gcc/web.c
index 8e8c465..d281f45 100644
--- a/gcc/web.c
+++ b/gcc/web.c
@@ -351,7 +351,7 @@  web_main (void)
   df_set_flags (DF_DEFER_INSN_RESCAN);
 
   /* Assign ids to the uses.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     FOR_BB_INSNS (bb, insn)
     {
       unsigned int uid = INSN_UID (insn);
@@ -379,7 +379,7 @@  web_main (void)
   use_entry = XCNEWVEC (struct web_entry, uses_num);
 
   /* Produce the web.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     FOR_BB_INSNS (bb, insn)
     {
       unsigned int uid = INSN_UID (insn);
@@ -404,7 +404,7 @@  web_main (void)
 
   /* Update the instruction stream, allocating new registers for split pseudos
      in progress.  */
-  FOR_ALL_BB (bb)
+  FOR_ALL_BB_FN (bb, cfun)
     FOR_BB_INSNS (bb, insn)
     {
       unsigned int uid = INSN_UID (insn);