This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Basic block renumbering removal, part 3


Hello.

This replaces iteration over basic block indices -- like

for (i = 0; i < n_basic_blocks; i++)
  {
    bb = BASIC_BLOCK (i);
    ...
  }

with traversing the basic block list:

FOR_EACH_BB (bb)
  {
    ...
  }

I have bootstrapped it on i686 and SUN Ultra 60 and regtested on i686.

Zdenek Dvorak

The patch is loooong :-( but this should be the worst one :-)

Changelog:
	* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
	Use FOR_EACH_BB macros to iterate over basic block chain.
	* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
	alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
	Likewise.
	* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
	find_unreachable_blocks, create_edge_list, verify_edge_list,
	remove_fake_edges, add_noreturn_fake_exit_edges,
	flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
	Likewise.
	* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
	find_sub_basic_blocks): Likewise.
	* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
	Likewise.
	* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
	Likewise.
	* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
	Likewise.
	* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
	commit_edge_insertions, commit_edge_insertions_watch_calls,
	print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
	* combine.c (combine_instructions, reg_dead_at_p): Likewise.
	* conflict.c (conflict_graph_compute): Likewise.
	* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
	df_modified_p, df_refs_unlink, df_dump): Likewise.
	* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
	* final.c (compute_alignments): Likewise.
	* flow.c (update_life_info, update_life_info_in_dirty_blocks,
	delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
	count_or_remove_death_notes): Likewise.
	* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
	compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
	classic_gcse, compute_transp, cprop, compute_pre_data,
	compute_transpout, invalidate_nonnull_info,
	delete_null_pointer_checks_1, delete_null_pointer_checks,
	compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
	compute_store_table, build_store_vectors, store_motion): Likewise.
	* global.c (global_conflicts, mark_elimination): Likewise.
	* graph.c (print_rtl_graph_with_bb): Likewise.
	* haifa-sched.c (sched_init): Likewise.
	* ifcvt.c (if_convert): Likewise.
	* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
	compute_available, compute_nearerout, compute_rev_insert_delete,
	optimize_mode_switching): Likewise.
	* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
	* predict.c (estimate_probability, note_prediction_to_br_prob,
	propagate_freq, counts_to_freqs, expensive_function_p,
	estimate_bb_frequencies): Likewise.
	* profile.c (instrument_edges, get_exec_counts,
	compute_branch_probabilities, compute_checksum, branch_prob,
	find_spanning_tree): Likewise.
	* recog.c (split_all_insns, peephole2_optimize): Likewise.
	* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
	Likewise.
	* regclass.c (scan_one_insn, regclass): Likewise.
	* regmove.c (mark_flags_life_zones, regmove_optimize,
	record_stack_memrefs): Likewise.
	* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
	* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
	* resource.c (find_basic_block): Likewise.
	* sched-ebb.c (schedule_ebbs): Likewise.
	* sched-rgn.c (is_cfg_nonregular, build_control_flow,
	find_single_block_region, find_rgns, schedule_insns)
	* sibcall.c (optimize_sibling_and_tail_recursive_call)
	* ssa-ccp.c (optimize_unexecutable_edges,
	ssa_ccp_df_delete_unreachable_insns): Likewise.
	* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
	* ssa.c (find_evaluations, compute_dominance_frontiers_1,
	rename_block, convert_to_ssa, compute_conservative_reg_partition,
	compute_coalesced_reg_partition, rename_equivalent_regs,
	convert_from_ssa): Likewise.
	* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
	process_for_unwind_directive): Likewise.

	* df.c (FOR_ALL_BBS): Removed.
	* gcse.c (struct null_pointer_info): Type of current_block field
	changed.
	(struct reg_avail_info): Type of last_bb field changed.
	* config/ia64/ia64.c (block_num): Removed.
	(need_copy_state): Type changed.
	(last_block): New.

Index: bb-reorder.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bb-reorder.c,v
retrieving revision 1.47
diff -c -3 -p -r1.47 bb-reorder.c
*** bb-reorder.c	21 May 2002 20:37:36 -0000	1.47
--- bb-reorder.c	22 May 2002 17:04:27 -0000
*************** static void
*** 102,115 ****
  make_reorder_chain ()
  {
    basic_block prev = NULL;
!   int nbb_m1 = n_basic_blocks - 1;
!   basic_block next;
  
    /* Loop until we've placed every block.  */
    do
      {
-       int i;
- 
        next = NULL;
  
        /* Find the next unplaced block.  */
--- 102,112 ----
  make_reorder_chain ()
  {
    basic_block prev = NULL;
!   basic_block next, bb;
  
    /* Loop until we've placed every block.  */
    do
      {
        next = NULL;
  
        /* Find the next unplaced block.  */
*************** make_reorder_chain ()
*** 119,130 ****
  	 remove from the list as we place.  The head of that list is
  	 what we're looking for here.  */
  
!       for (i = 0; i <= nbb_m1 && !next; ++i)
! 	{
! 	  basic_block bb = BASIC_BLOCK (i);
! 	  if (! RBI (bb)->visited)
  	    next = bb;
! 	}
        if (next)
          prev = make_reorder_chain_1 (next, prev);
      }
--- 116,128 ----
  	 remove from the list as we place.  The head of that list is
  	 what we're looking for here.  */
  
!       FOR_EACH_BB (bb)
! 	if (! RBI (bb)->visited)
! 	  {
  	    next = bb;
! 	    break;
! 	  }
!       
        if (next)
          prev = make_reorder_chain_1 (next, prev);
      }
*************** make_reorder_chain_1 (bb, prev)
*** 164,170 ****
      }
    else
      {
!       if (bb->index != 0)
  	abort ();
      }
    RBI (bb)->visited = 1;
--- 162,168 ----
      }
    else
      {
!       if (bb->prev_bb != ENTRY_BLOCK_PTR)
  	abort ();
      }
    RBI (bb)->visited = 1;
Index: cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfg.c,v
retrieving revision 1.28
diff -c -3 -p -r1.28 cfg.c
*** cfg.c	22 May 2002 01:27:33 -0000	1.28
--- cfg.c	22 May 2002 17:04:28 -0000
*************** free_edge (e)
*** 167,178 ****
  void
  clear_edges ()
  {
!   int i;
    edge e;
  
!   for (i = 0; i < n_basic_blocks; ++i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        edge e = bb->succ;
  
        while (e)
--- 167,177 ----
  void
  clear_edges ()
  {
!   basic_block bb;
    edge e;
  
!   FOR_EACH_BB (bb)
      {
        edge e = bb->succ;
  
        while (e)
*************** redirect_edge_pred (e, new_pred)
*** 480,490 ****
  void
  clear_bb_flags ()
  {
!   int i;
!   ENTRY_BLOCK_PTR->flags = 0;
!   EXIT_BLOCK_PTR->flags = 0;
!   for (i = 0; i < n_basic_blocks; i++)
!     BASIC_BLOCK (i)->flags = 0;
  }
  
  void
--- 479,488 ----
  void
  clear_bb_flags ()
  {
!   basic_block bb;
! 
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     bb->flags = 0;
  }
  
  void
*************** dump_flow_info (file)
*** 492,497 ****
--- 490,496 ----
       FILE *file;
  {
    int i;
+   basic_block bb;
    static const char * const reg_class_names[] = REG_CLASS_NAMES;
  
    fprintf (file, "%d registers.\n", max_regno);
*************** dump_flow_info (file)
*** 539,547 ****
        }
  
    fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        edge e;
        int sum;
        gcov_type lsum;
--- 538,545 ----
        }
  
    fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
!   FOR_EACH_BB (bb)
      {
        edge e;
        int sum;
        gcov_type lsum;
*************** alloc_aux_for_blocks (size)
*** 704,716 ****
    first_block_aux_obj = (char *) obstack_alloc (&block_aux_obstack, 0);
    if (size)
      {
!       int i;
! 
!       for (i = 0; i < n_basic_blocks; i++)
! 	alloc_aux_for_block (BASIC_BLOCK (i), size);
  
!       alloc_aux_for_block (ENTRY_BLOCK_PTR, size);
!       alloc_aux_for_block (EXIT_BLOCK_PTR, size);
      }
  }
  
--- 702,711 ----
    first_block_aux_obj = (char *) obstack_alloc (&block_aux_obstack, 0);
    if (size)
      {
!       basic_block bb;
  
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
! 	alloc_aux_for_block (bb, size);
      }
  }
  
*************** alloc_aux_for_blocks (size)
*** 719,731 ****
  void
  clear_aux_for_blocks ()
  {
!   int i;
! 
!   for (i = 0; i < n_basic_blocks; i++)
!     BASIC_BLOCK (i)->aux = NULL;
  
!   ENTRY_BLOCK_PTR->aux = NULL;
!   EXIT_BLOCK_PTR->aux = NULL;
  }
  
  /* Free data allocated in block_aux_obstack and clear AUX pointers
--- 714,723 ----
  void
  clear_aux_for_blocks ()
  {
!   basic_block bb;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     bb->aux = NULL;
  }
  
  /* Free data allocated in block_aux_obstack and clear AUX pointers
*************** alloc_aux_for_edges (size)
*** 779,795 ****
    first_edge_aux_obj = (char *) obstack_alloc (&edge_aux_obstack, 0);
    if (size)
      {
!       int i;
!       for (i = -1; i < n_basic_blocks; i++)
  	{
- 	  basic_block bb;
  	  edge e;
  
- 	  if (i >= 0)
- 	    bb = BASIC_BLOCK (i);
- 	  else
- 	    bb = ENTRY_BLOCK_PTR;
- 
  	  for (e = bb->succ; e; e = e->succ_next)
  	    alloc_aux_for_edge (e, size);
  	}
--- 771,782 ----
    first_edge_aux_obj = (char *) obstack_alloc (&edge_aux_obstack, 0);
    if (size)
      {
!       basic_block bb;
! 
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
  	{
  	  edge e;
  
  	  for (e = bb->succ; e; e = e->succ_next)
  	    alloc_aux_for_edge (e, size);
  	}
*************** alloc_aux_for_edges (size)
*** 801,818 ****
  void
  clear_aux_for_edges ()
  {
!   int i;
  
!   for (i = -1; i < n_basic_blocks; i++)
      {
-       basic_block bb;
-       edge e;
- 
-       if (i >= 0)
- 	bb = BASIC_BLOCK (i);
-       else
- 	bb = ENTRY_BLOCK_PTR;
- 
        for (e = bb->succ; e; e = e->succ_next)
  	e->aux = NULL;
      }
--- 788,798 ----
  void
  clear_aux_for_edges ()
  {
!   basic_block bb;
!   edge e;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
      {
        for (e = bb->succ; e; e = e->succ_next)
  	e->aux = NULL;
      }
Index: cfganal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfganal.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 cfganal.c
*** cfganal.c	21 May 2002 20:37:36 -0000	1.21
--- cfganal.c	22 May 2002 17:04:28 -0000
*************** mark_dfs_back_edges ()
*** 194,203 ****
  void
  set_edge_can_fallthru_flag ()
  {
!   int i;
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        edge e;
  
        /* The FALLTHRU edge is also CAN_FALLTHRU edge.  */
--- 194,203 ----
  void
  set_edge_can_fallthru_flag ()
  {
!   basic_block bb;
! 
!   FOR_EACH_BB (bb)
      {
        edge e;
  
        /* The FALLTHRU edge is also CAN_FALLTHRU edge.  */
*************** flow_call_edges_add (blocks)
*** 259,265 ****
    int i;
    int blocks_split = 0;
    int bb_num = 0;
!   basic_block *bbs;
    bool check_last_block = false;
  
    /* Map bb indices into basic block pointers since split_block
--- 259,265 ----
    int i;
    int blocks_split = 0;
    int bb_num = 0;
!   basic_block *bbs, bb;
    bool check_last_block = false;
  
    /* Map bb indices into basic block pointers since split_block
*************** flow_call_edges_add (blocks)
*** 269,276 ****
  
    if (! blocks)
      {
!       for (i = 0; i < n_basic_blocks; i++)
! 	bbs[bb_num++] = BASIC_BLOCK (i);
  
        check_last_block = true;
      }
--- 269,276 ----
  
    if (! blocks)
      {
!       FOR_EACH_BB (bb)
! 	bbs[bb_num++] = bb;
  
        check_last_block = true;
      }
*************** void
*** 386,401 ****
  find_unreachable_blocks ()
  {
    edge e;
!   int i, n;
!   basic_block *tos, *worklist;
  
!   n = n_basic_blocks;
!   tos = worklist = (basic_block *) xmalloc (sizeof (basic_block) * n);
  
    /* Clear all the reachability flags.  */
  
!   for (i = 0; i < n; ++i)
!     BASIC_BLOCK (i)->flags &= ~BB_REACHABLE;
  
    /* Add our starting points to the worklist.  Almost always there will
       be only one.  It isn't inconceivable that we might one day directly
--- 386,400 ----
  find_unreachable_blocks ()
  {
    edge e;
!   basic_block *tos, *worklist, bb;
  
!   tos = worklist =
! 	(basic_block *) xmalloc (sizeof (basic_block) * n_basic_blocks);
  
    /* Clear all the reachability flags.  */
  
!   FOR_EACH_BB (bb)
!     bb->flags &= ~BB_REACHABLE;
  
    /* Add our starting points to the worklist.  Almost always there will
       be only one.  It isn't inconceivable that we might one day directly
*************** create_edge_list ()
*** 445,452 ****
    struct edge_list *elist;
    edge e;
    int num_edges;
-   int x;
    int block_count;
  
    block_count = n_basic_blocks + 2;   /* Include the entry and exit blocks.  */
  
--- 444,451 ----
    struct edge_list *elist;
    edge e;
    int num_edges;
    int block_count;
+   basic_block bb;
  
    block_count = n_basic_blocks + 2;   /* Include the entry and exit blocks.  */
  
*************** create_edge_list ()
*** 454,471 ****
  
    /* Determine the number of edges in the flow graph by counting successor
       edges on each basic block.  */
!   for (x = 0; x < n_basic_blocks; x++)
      {
-       basic_block bb = BASIC_BLOCK (x);
- 
        for (e = bb->succ; e; e = e->succ_next)
  	num_edges++;
      }
  
-   /* Don't forget successors of the entry block.  */
-   for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
-     num_edges++;
- 
    elist = (struct edge_list *) xmalloc (sizeof (struct edge_list));
    elist->num_blocks = block_count;
    elist->num_edges = num_edges;
--- 453,464 ----
  
    /* Determine the number of edges in the flow graph by counting successor
       edges on each basic block.  */
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
      {
        for (e = bb->succ; e; e = e->succ_next)
  	num_edges++;
      }
  
    elist = (struct edge_list *) xmalloc (sizeof (struct edge_list));
    elist->num_blocks = block_count;
    elist->num_edges = num_edges;
*************** create_edge_list ()
*** 473,490 ****
  
    num_edges = 0;
  
!   /* Follow successors of the entry block, and register these edges.  */
!   for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
!     elist->index_to_edge[num_edges++] = e;
! 
!   for (x = 0; x < n_basic_blocks; x++)
!     {
!       basic_block bb = BASIC_BLOCK (x);
! 
!       /* Follow all successors of blocks, and register these edges.  */
!       for (e = bb->succ; e; e = e->succ_next)
! 	elist->index_to_edge[num_edges++] = e;
!     }
  
    return elist;
  }
--- 466,475 ----
  
    num_edges = 0;
  
!   /* Follow successors of blocks, and register these edges.  */
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
!     for (e = bb->succ; e; e = e->succ_next)
!       elist->index_to_edge[num_edges++] = e;
  
    return elist;
  }
*************** verify_edge_list (f, elist)
*** 538,550 ****
       FILE *f;
       struct edge_list *elist;
  {
!   int x, pred, succ, index;
    edge e;
  
!   for (x = 0; x < n_basic_blocks; x++)
      {
-       basic_block bb = BASIC_BLOCK (x);
- 
        for (e = bb->succ; e; e = e->succ_next)
  	{
  	  pred = e->src->index;
--- 523,534 ----
       FILE *f;
       struct edge_list *elist;
  {
!   int pred, succ, index;
    edge e;
+   basic_block bb, p, s;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
      {
        for (e = bb->succ; e; e = e->succ_next)
  	{
  	  pred = e->src->index;
*************** verify_edge_list (f, elist)
*** 565,597 ****
  	}
      }
  
!   for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
!     {
!       pred = e->src->index;
!       succ = e->dest->index;
!       index = EDGE_INDEX (elist, e->src, e->dest);
!       if (index == EDGE_INDEX_NO_EDGE)
! 	{
! 	  fprintf (f, "*p* No index for edge from %d to %d\n", pred, succ);
! 	  continue;
! 	}
! 
!       if (INDEX_EDGE_PRED_BB (elist, index)->index != pred)
! 	fprintf (f, "*p* Pred for index %d should be %d not %d\n",
! 		 index, pred, INDEX_EDGE_PRED_BB (elist, index)->index);
!       if (INDEX_EDGE_SUCC_BB (elist, index)->index != succ)
! 	fprintf (f, "*p* Succ for index %d should be %d not %d\n",
! 		 index, succ, INDEX_EDGE_SUCC_BB (elist, index)->index);
!     }
! 
!   /* We've verified that all the edges are in the list, no lets make sure
       there are no spurious edges in the list.  */
  
!   for (pred = 0; pred < n_basic_blocks; pred++)
!     for (succ = 0; succ < n_basic_blocks; succ++)
        {
- 	basic_block p = BASIC_BLOCK (pred);
- 	basic_block s = BASIC_BLOCK (succ);
  	int found_edge = 0;
  
  	for (e = p->succ; e; e = e->succ_next)
--- 549,560 ----
  	}
      }
  
!   /* We've verified that all the edges are in the list, now lets make sure
       there are no spurious edges in the list.  */
  
!   FOR_BB_BETWEEN (p, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
!     FOR_BB_BETWEEN (s, ENTRY_BLOCK_PTR->next_bb, NULL, next_bb)
        {
  	int found_edge = 0;
  
  	for (e = p->succ; e; e = e->succ_next)
*************** verify_edge_list (f, elist)
*** 608,685 ****
  	      break;
  	    }
  
! 	if (EDGE_INDEX (elist, BASIC_BLOCK (pred), BASIC_BLOCK (succ))
  	    == EDGE_INDEX_NO_EDGE && found_edge != 0)
  	  fprintf (f, "*** Edge (%d, %d) appears to not have an index\n",
! 		   pred, succ);
! 	if (EDGE_INDEX (elist, BASIC_BLOCK (pred), BASIC_BLOCK (succ))
  	    != EDGE_INDEX_NO_EDGE && found_edge == 0)
  	  fprintf (f, "*** Edge (%d, %d) has index %d, but there is no edge\n",
! 		   pred, succ, EDGE_INDEX (elist, BASIC_BLOCK (pred),
! 					   BASIC_BLOCK (succ)));
        }
- 
-   for (succ = 0; succ < n_basic_blocks; succ++)
-     {
-       basic_block p = ENTRY_BLOCK_PTR;
-       basic_block s = BASIC_BLOCK (succ);
-       int found_edge = 0;
- 
-       for (e = p->succ; e; e = e->succ_next)
- 	if (e->dest == s)
- 	  {
- 	    found_edge = 1;
- 	    break;
- 	  }
- 
-       for (e = s->pred; e; e = e->pred_next)
- 	if (e->src == p)
- 	  {
- 	    found_edge = 1;
- 	    break;
- 	  }
- 
-       if (EDGE_INDEX (elist, ENTRY_BLOCK_PTR, BASIC_BLOCK (succ))
- 	  == EDGE_INDEX_NO_EDGE && found_edge != 0)
- 	fprintf (f, "*** Edge (entry, %d) appears to not have an index\n",
- 		 succ);
-       if (EDGE_INDEX (elist, ENTRY_BLOCK_PTR, BASIC_BLOCK (succ))
- 	  != EDGE_INDEX_NO_EDGE && found_edge == 0)
- 	fprintf (f, "*** Edge (entry, %d) has index %d, but no edge exists\n",
- 		 succ, EDGE_INDEX (elist, ENTRY_BLOCK_PTR,
- 				   BASIC_BLOCK (succ)));
-     }
- 
-   for (pred = 0; pred < n_basic_blocks; pred++)
-     {
-       basic_block p = BASIC_BLOCK (pred);
-       basic_block s = EXIT_BLOCK_PTR;
-       int found_edge = 0;
- 
-       for (e = p->succ; e; e = e->succ_next)
- 	if (e->dest == s)
- 	  {
- 	    found_edge = 1;
- 	    break;
- 	  }
- 
-       for (e = s->pred; e; e = e->pred_next)
- 	if (e->src == p)
- 	  {
- 	    found_edge = 1;
- 	    break;
- 	  }
- 
-       if (EDGE_INDEX (elist, BASIC_BLOCK (pred), EXIT_BLOCK_PTR)
- 	  == EDGE_INDEX_NO_EDGE && found_edge != 0)
- 	fprintf (f, "*** Edge (%d, exit) appears to not have an index\n",
- 		 pred);
-       if (EDGE_INDEX (elist, BASIC_BLOCK (pred), EXIT_BLOCK_PTR)
- 	  != EDGE_INDEX_NO_EDGE && found_edge == 0)
- 	fprintf (f, "*** Edge (%d, exit) has index %d, but no edge exists\n",
- 		 pred, EDGE_INDEX (elist, BASIC_BLOCK (pred),
- 				   EXIT_BLOCK_PTR));
-     }
  }
  
  /* This routine will determine what, if any, edge there is between
--- 571,585 ----
  	      break;
  	    }
  
! 	if (EDGE_INDEX (elist, p, s)
  	    == EDGE_INDEX_NO_EDGE && found_edge != 0)
  	  fprintf (f, "*** Edge (%d, %d) appears to not have an index\n",
! 		   p->index, s->index);
! 	if (EDGE_INDEX (elist, p, s)
  	    != EDGE_INDEX_NO_EDGE && found_edge == 0)
  	  fprintf (f, "*** Edge (%d, %d) has index %d, but there is no edge\n",
! 		   p->index, s->index, EDGE_INDEX (elist, p, s));
        }
  }
  
  /* This routine will determine what, if any, edge there is between
*************** remove_fake_successors (bb)
*** 768,780 ****
  void
  remove_fake_edges ()
  {
!   int x;
! 
!   for (x = 0; x < n_basic_blocks; x++)
!     remove_fake_successors (BASIC_BLOCK (x));
  
!   /* We've handled all successors except the entry block's.  */
!   remove_fake_successors (ENTRY_BLOCK_PTR);
  }
  
  /* This function will add a fake edge between any block which has no
--- 668,677 ----
  void
  remove_fake_edges ()
  {
!   basic_block bb;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
!     remove_fake_successors (bb);
  }
  
  /* This function will add a fake edge between any block which has no
*************** remove_fake_edges ()
*** 784,794 ****
  void
  add_noreturn_fake_exit_edges ()
  {
!   int x;
  
!   for (x = 0; x < n_basic_blocks; x++)
!     if (BASIC_BLOCK (x)->succ == NULL)
!       make_single_succ_edge (BASIC_BLOCK (x), EXIT_BLOCK_PTR, EDGE_FAKE);
  }
  
  /* This function adds a fake edge between any infinite loops to the
--- 681,691 ----
  void
  add_noreturn_fake_exit_edges ()
  {
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     if (bb->succ == NULL)
!       make_single_succ_edge (bb, EXIT_BLOCK_PTR, EDGE_FAKE);
  }
  
  /* This function adds a fake edge between any infinite loops to the
*************** flow_preorder_transversal_compute (pot_o
*** 1014,1019 ****
--- 911,917 ----
    sbitmap visited;
    struct dfst_node *node;
    struct dfst_node *dfst;
+   basic_block bb;
  
    /* Allocate stack for back-tracking up CFG.  */
    stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge));
*************** flow_preorder_transversal_compute (pot_o
*** 1023,1032 ****
    dfst = (struct dfst_node *) xcalloc (n_basic_blocks,
  				       sizeof (struct dfst_node));
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
        max_successors = 0;
!       for (e = BASIC_BLOCK (i)->succ; e; e = e->succ_next)
  	max_successors++;
  
        dfst[i].node
--- 921,930 ----
    dfst = (struct dfst_node *) xcalloc (n_basic_blocks,
  				       sizeof (struct dfst_node));
  
!   FOR_EACH_BB (bb)
      {
        max_successors = 0;
!       for (e = bb->succ; e; e = e->succ_next)
  	max_successors++;
  
        dfst[i].node
*************** flow_dfs_compute_reverse_execute (data)
*** 1183,1189 ****
  {
    basic_block bb;
    edge e;
-   int i;
  
    while (data->sp > 0)
      {
--- 1081,1086 ----
*************** flow_dfs_compute_reverse_execute (data)
*** 1197,1205 ****
      }
  
    /* Determine if there are unvisited basic blocks.  */
!   for (i = n_basic_blocks - (INVALID_BLOCK + 1); --i >= 0; )
!     if (!TEST_BIT (data->visited_blocks, i))
!       return BASIC_BLOCK (i + (INVALID_BLOCK + 1));
  
    return NULL;
  }
--- 1094,1102 ----
      }
  
    /* Determine if there are unvisited basic blocks.  */
!   FOR_BB_BETWEEN (bb, EXIT_BLOCK_PTR, NULL, prev_bb)
!     if (!TEST_BIT (data->visited_blocks, bb->index - (INVALID_BLOCK + 1)))
!       return bb;
  
    return NULL;
  }
Index: cfgbuild.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgbuild.c,v
retrieving revision 1.18
diff -c -3 -p -r1.18 cfgbuild.c
*** cfgbuild.c	22 May 2002 01:27:33 -0000	1.18
--- cfgbuild.c	22 May 2002 17:04:28 -0000
*************** make_edges (label_value_list, min, max, 
*** 284,290 ****
       basic_block min, max;
       int update_p;
  {
!   int i;
    sbitmap *edge_cache = NULL;
  
    /* Assume no computed jump; revise as we create edges.  */
--- 284,290 ----
       basic_block min, max;
       int update_p;
  {
!   basic_block bb;
    sbitmap *edge_cache = NULL;
  
    /* Assume no computed jump; revise as we create edges.  */
*************** make_edges (label_value_list, min, max, 
*** 299,322 ****
        sbitmap_vector_zero (edge_cache, n_basic_blocks);
  
        if (update_p)
! 	for (i = min->index; i <= max->index; ++i)
  	  {
  	    edge e;
  
! 	    for (e = BASIC_BLOCK (i)->succ; e ; e = e->succ_next)
  	      if (e->dest != EXIT_BLOCK_PTR)
! 		SET_BIT (edge_cache[i], e->dest->index);
  	  }
      }
  
!   /* By nature of the way these get numbered, block 0 is always the entry.  */
    if (min == ENTRY_BLOCK_PTR->next_bb)
      cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, min,
  		      EDGE_FALLTHRU);
  
!   for (i = min->index; i <= max->index; ++i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn, x;
        enum rtx_code code;
        int force_fallthru = 0;
--- 299,322 ----
        sbitmap_vector_zero (edge_cache, n_basic_blocks);
  
        if (update_p)
!         FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
  	  {
  	    edge e;
  
! 	    for (e = bb->succ; e ; e = e->succ_next)
  	      if (e->dest != EXIT_BLOCK_PTR)
! 		SET_BIT (edge_cache[bb->index], e->dest->index);
  	  }
      }
  
!   /* By nature of the way these get numbered, ENTRY_BLOCK_PTR->next_bb block
!      is always the entry.  */
    if (min == ENTRY_BLOCK_PTR->next_bb)
      cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, min,
  		      EDGE_FALLTHRU);
  
!   FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
      {
        rtx insn, x;
        enum rtx_code code;
        int force_fallthru = 0;
*************** find_basic_blocks (f, nregs, file)
*** 614,619 ****
--- 614,621 ----
       FILE *file ATTRIBUTE_UNUSED;
  {
    int max_uid;
+   basic_block bb;
+ 
    timevar_push (TV_CFG);
  
    basic_block_for_insn = 0;
*************** find_basic_blocks (f, nregs, file)
*** 621,635 ****
    /* Flush out existing data.  */
    if (basic_block_info != NULL)
      {
-       int i;
- 
        clear_edges ();
  
        /* Clear bb->aux on all extant basic blocks.  We'll use this as a
  	 tag for reuse during create_basic_block, just in case some pass
  	 copies around basic block notes improperly.  */
!       for (i = 0; i < n_basic_blocks; ++i)
! 	BASIC_BLOCK (i)->aux = NULL;
  
        VARRAY_FREE (basic_block_info);
      }
--- 623,635 ----
    /* Flush out existing data.  */
    if (basic_block_info != NULL)
      {
        clear_edges ();
  
        /* Clear bb->aux on all extant basic blocks.  We'll use this as a
  	 tag for reuse during create_basic_block, just in case some pass
  	 copies around basic block notes improperly.  */
!       FOR_EACH_BB (bb)
!  	bb->aux = NULL;
  
        VARRAY_FREE (basic_block_info);
      }
*************** void
*** 794,848 ****
  find_many_sub_basic_blocks (blocks)
       sbitmap blocks;
  {
!   int i;
!   int min, max;
  
!   for (i = 0; i < n_basic_blocks; i++)
!     SET_STATE (BASIC_BLOCK (i),
! 	       TEST_BIT (blocks, i) ? BLOCK_TO_SPLIT : BLOCK_ORIGINAL);
! 
!   for (i = 0; i < n_basic_blocks; i++)
!     if (STATE (BASIC_BLOCK (i)) == BLOCK_TO_SPLIT)
!       find_bb_boundaries (BASIC_BLOCK (i));
  
!   for (i = 0; i < n_basic_blocks; i++)
!     if (STATE (BASIC_BLOCK (i)) != BLOCK_ORIGINAL)
        break;
  
!   min = max = i;
!   for (; i < n_basic_blocks; i++)
!     if (STATE (BASIC_BLOCK (i)) != BLOCK_ORIGINAL)
!       max = i;
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, BASIC_BLOCK (min), BASIC_BLOCK (max), 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
!   for (i = min; i <= max; i++)
      {
        edge e;
-       basic_block b = BASIC_BLOCK (i);
  
!       if (STATE (b) == BLOCK_ORIGINAL)
  	continue;
!       if (STATE (b) == BLOCK_NEW)
  	{
! 	  b->count = 0;
! 	  b->frequency = 0;
! 	  for (e = b->pred; e; e=e->pred_next)
  	    {
! 	      b->count += e->count;
! 	      b->frequency += EDGE_FREQUENCY (e);
  	    }
  	}
  
!       compute_outgoing_frequencies (b);
      }
  
!   for (i = 0; i < n_basic_blocks; i++)
!     SET_STATE (BASIC_BLOCK (i), 0);
  }
  
  /* Like above but for single basic block only.  */
--- 794,846 ----
  find_many_sub_basic_blocks (blocks)
       sbitmap blocks;
  {
!   basic_block bb, min, max;
  
!   FOR_EACH_BB (bb)
!     SET_STATE (bb,
! 	       TEST_BIT (blocks, bb->index) ? BLOCK_TO_SPLIT : BLOCK_ORIGINAL);
! 
!   FOR_EACH_BB (bb)
!     if (STATE (bb) == BLOCK_TO_SPLIT)
!       find_bb_boundaries (bb);
  
!   FOR_EACH_BB (bb)
!     if (STATE (bb) != BLOCK_ORIGINAL)
        break;
  
!   min = max = bb;
!   for (; bb != EXIT_BLOCK_PTR; bb = bb->next_bb)
!     if (STATE (bb) != BLOCK_ORIGINAL)
!       max = bb;
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, min, max, 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
!   FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
      {
        edge e;
  
!       if (STATE (bb) == BLOCK_ORIGINAL)
  	continue;
!       if (STATE (bb) == BLOCK_NEW)
  	{
! 	  bb->count = 0;
! 	  bb->frequency = 0;
! 	  for (e = bb->pred; e; e=e->pred_next)
  	    {
! 	      bb->count += e->count;
! 	      bb->frequency += EDGE_FREQUENCY (e);
  	    }
  	}
  
!       compute_outgoing_frequencies (bb);
      }
  
!   FOR_EACH_BB (bb)
!     SET_STATE (bb, 0);
  }
  
  /* Like above but for single basic block only.  */
*************** void
*** 851,876 ****
  find_sub_basic_blocks (bb)
       basic_block bb;
  {
!   int i;
!   int min, max;
    basic_block next = bb->next_bb;
  
!   min = bb->index;
    find_bb_boundaries (bb);
!   max = next->prev_bb->index;
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, BASIC_BLOCK (min), BASIC_BLOCK (max), 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
!   for (i = min; i <= max; i++)
      {
        edge e;
-       basic_block b = BASIC_BLOCK (i);
  
!       if (i != min)
  	{
  	  b->count = 0;
  	  b->frequency = 0;
--- 849,872 ----
  find_sub_basic_blocks (bb)
       basic_block bb;
  {
!   basic_block min, max, b;
    basic_block next = bb->next_bb;
  
!   min = bb;
    find_bb_boundaries (bb);
!   max = next->prev_bb;
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, min, max, 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
!   FOR_BB_BETWEEN (b, min, max->next_bb, next_bb)
      {
        edge e;
  
!       if (b != min)
  	{
  	  b->count = 0;
  	  b->frequency = 0;
Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.58
diff -c -3 -p -r1.58 cfgcleanup.c
*** cfgcleanup.c	22 May 2002 01:27:33 -0000	1.58
--- cfgcleanup.c	22 May 2002 17:04:28 -0000
*************** static bool
*** 1577,1592 ****
  try_optimize_cfg (mode)
       int mode;
  {
-   int i;
    bool changed_overall = false;
    bool changed;
    int iterations = 0;
  
    if (mode & CLEANUP_CROSSJUMP)
      add_noreturn_fake_exit_edges ();
  
!   for (i = 0; i < n_basic_blocks; i++)
!     update_forwarder_flag (BASIC_BLOCK (i));
  
    if (mode & CLEANUP_UPDATE_LIFE)
      clear_bb_flags ();
--- 1577,1592 ----
  try_optimize_cfg (mode)
       int mode;
  {
    bool changed_overall = false;
    bool changed;
    int iterations = 0;
+   basic_block bb, b;
  
    if (mode & CLEANUP_CROSSJUMP)
      add_noreturn_fake_exit_edges ();
  
!   FOR_EACH_BB (bb)
!     update_forwarder_flag (bb);
  
    if (mode & CLEANUP_UPDATE_LIFE)
      clear_bb_flags ();
*************** try_optimize_cfg (mode)
*** 1606,1614 ****
  		     "\n\ntry_optimize_cfg iteration %i\n\n",
  		     iterations);
  
! 	  for (i = 0; i < n_basic_blocks;)
  	    {
! 	      basic_block c, b = BASIC_BLOCK (i);
  	      edge s;
  	      bool changed_here = false;
  
--- 1606,1614 ----
  		     "\n\ntry_optimize_cfg iteration %i\n\n",
  		     iterations);
  
! 	  for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR;)
  	    {
! 	      basic_block c;
  	      edge s;
  	      bool changed_here = false;
  
*************** try_optimize_cfg (mode)
*** 1721,1727 ****
  	      /* Don't get confused by the index shift caused by
  		 deleting blocks.  */
  	      if (!changed_here)
! 		i = b->index + 1;
  	      else
  		changed = true;
  	    }
--- 1721,1727 ----
  	      /* Don't get confused by the index shift caused by
  		 deleting blocks.  */
  	      if (!changed_here)
! 		b = b->next_bb;
  	      else
  		changed = true;
  	    }
*************** try_optimize_cfg (mode)
*** 1753,1760 ****
  bool
  delete_unreachable_blocks ()
  {
-   int i, j;
    bool changed = false;
  
    find_unreachable_blocks ();
  
--- 1753,1761 ----
  bool
  delete_unreachable_blocks ()
  {
    bool changed = false;
+   basic_block b, next_bb;
+   int j = 0;
  
    find_unreachable_blocks ();
  
*************** delete_unreachable_blocks ()
*** 1762,1770 ****
       as otherwise we can wind up with O(N^2) behaviour here when we
       have oodles of dead code.  */
  
!   for (i = j = 0; i < n_basic_blocks; ++i)
      {
!       basic_block b = BASIC_BLOCK (i);
  
        if (!(b->flags & BB_REACHABLE))
  	{
--- 1763,1771 ----
       as otherwise we can wind up with O(N^2) behaviour here when we
       have oodles of dead code.  */
  
!   for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb)
      {
!       next_bb = b->next_bb;
  
        if (!(b->flags & BB_REACHABLE))
  	{
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 cfglayout.c
*** cfglayout.c	22 May 2002 01:27:33 -0000	1.16
--- cfglayout.c	22 May 2002 17:04:28 -0000
*************** static void
*** 191,201 ****
  record_effective_endpoints ()
  {
    rtx next_insn = get_insns ();
!   int i;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx end;
  
        if (PREV_INSN (bb->head) && next_insn != bb->head)
--- 191,200 ----
  record_effective_endpoints ()
  {
    rtx next_insn = get_insns ();
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
      {
        rtx end;
  
        if (PREV_INSN (bb->head) && next_insn != bb->head)
*************** verify_insn_chain ()
*** 597,607 ****
  static void
  cleanup_unconditional_jumps ()
  {
!   int i;
!   for (i = 0; i < n_basic_blocks; i++)
!     {
!       basic_block bb = BASIC_BLOCK (i);
  
        if (!bb->succ)
  	continue;
        if (bb->succ->flags & EDGE_FALLTHRU)
--- 596,605 ----
  static void
  cleanup_unconditional_jumps ()
  {
!   basic_block bb;
  
+   FOR_EACH_BB (bb)
+     {
        if (!bb->succ)
  	continue;
        if (bb->succ->flags & EDGE_FALLTHRU)
*************** cleanup_unconditional_jumps ()
*** 609,619 ****
        if (!bb->succ->succ_next)
  	{
  	  rtx insn;
! 	  if (GET_CODE (bb->head) != CODE_LABEL && forwarder_block_p (bb) && i)
  	    {
  	      basic_block prev = bb->prev_bb;
- 
- 	      i--;
  
  	      if (rtl_dump_file)
  		fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
--- 607,616 ----
        if (!bb->succ->succ_next)
  	{
  	  rtx insn;
! 	  if (GET_CODE (bb->head) != CODE_LABEL && forwarder_block_p (bb)
! 	      && bb->prev_bb != ENTRY_BLOCK_PTR)
  	    {
  	      basic_block prev = bb->prev_bb;
  
  	      if (rtl_dump_file)
  		fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
Index: cfgloop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloop.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 cfgloop.c
*** cfgloop.c	22 May 2002 01:27:34 -0000	1.9
--- cfgloop.c	22 May 2002 17:04:28 -0000
*************** flow_loops_cfg_dump (loops, file)
*** 50,65 ****
       FILE *file;
  {
    int i;
  
    if (! loops->num || ! file || ! loops->cfg.dom)
      return;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
        edge succ;
  
!       fprintf (file, ";; %d succs { ", i);
!       for (succ = BASIC_BLOCK (i)->succ; succ; succ = succ->succ_next)
  	fprintf (file, "%d ", succ->dest->index);
        flow_nodes_print ("} dom", loops->cfg.dom[i], file);
      }
--- 50,66 ----
       FILE *file;
  {
    int i;
+   basic_block bb;
  
    if (! loops->num || ! file || ! loops->cfg.dom)
      return;
  
!   FOR_EACH_BB (bb)
      {
        edge succ;
  
!       fprintf (file, ";; %d succs { ", bb->index);
!       for (succ = bb->succ; succ; succ = succ->succ_next)
  	fprintf (file, "%d ", succ->dest->index);
        flow_nodes_print ("} dom", loops->cfg.dom[i], file);
      }
*************** flow_loops_find (loops, flags)
*** 643,648 ****
--- 644,650 ----
    sbitmap *dom;
    int *dfs_order;
    int *rc_order;
+   basic_block header;
  
    /* This function cannot be repeatedly called with different
       flags to build up the loop information.  The loop tree
*************** flow_loops_find (loops, flags)
*** 667,677 ****
    /* Count the number of loop edges (back edges).  This should be the
       same as the number of natural loops.  */
    num_loops = 0;
!   for (b = 0; b < n_basic_blocks; b++)
      {
-       basic_block header;
- 
-       header = BASIC_BLOCK (b);
        header->loop_depth = 0;
  
        for (e = header->pred; e; e = e->pred_next)
--- 669,676 ----
    /* Count the number of loop edges (back edges).  This should be the
       same as the number of natural loops.  */
    num_loops = 0;
!   FOR_EACH_BB (header)
      {
        header->loop_depth = 0;
  
        for (e = header->pred; e; e = e->pred_next)
*************** flow_loops_find (loops, flags)
*** 684,693 ****
  	     loop.  It also has single back edge to the header
  	     from a latch node.  Note that multiple natural loops
  	     may share the same header.  */
! 	  if (b != header->index)
! 	    abort ();
! 
! 	  if (latch != ENTRY_BLOCK_PTR && TEST_BIT (dom[latch->index], b))
  	    num_loops++;
  	}
      }
--- 683,689 ----
  	     loop.  It also has single back edge to the header
  	     from a latch node.  Note that multiple natural loops
  	     may share the same header.  */
! 	  if (latch != ENTRY_BLOCK_PTR && TEST_BIT (dom[latch->index], header->index))
  	    num_loops++;
  	}
      }
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.50
diff -c -3 -p -r1.50 cfgrtl.c
*** cfgrtl.c	22 May 2002 01:27:34 -0000	1.50
--- cfgrtl.c	22 May 2002 17:04:28 -0000
*************** void
*** 448,463 ****
  compute_bb_for_insn (max)
       int max;
  {
!   int i;
  
    if (basic_block_for_insn)
      VARRAY_FREE (basic_block_for_insn);
  
    VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn");
  
!   for (i = 0; i < n_basic_blocks; ++i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx end = bb->end;
        rtx insn;
  
--- 448,462 ----
  compute_bb_for_insn (max)
       int max;
  {
!   basic_block bb;
  
    if (basic_block_for_insn)
      VARRAY_FREE (basic_block_for_insn);
  
    VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn");
  
!   FOR_EACH_BB (bb)
      {
        rtx end = bb->end;
        rtx insn;
  
*************** tidy_fallthru_edge (e, b, c)
*** 1168,1181 ****
  void
  tidy_fallthru_edges ()
  {
!   int i;
  
!   for (i = 1; i < n_basic_blocks; i++)
      {
-       basic_block c = BASIC_BLOCK (i);
-       basic_block b = c->prev_bb;
        edge s;
  
        /* We care about simple conditional or unconditional jumps with
  	 a single successor.
  
--- 1167,1183 ----
  void
  tidy_fallthru_edges ()
  {
!   basic_block b, c;
! 
!   if (ENTRY_BLOCK_PTR->next_bb == EXIT_BLOCK_PTR)
!     return;
  
!   FOR_BB_BETWEEN (b, ENTRY_BLOCK_PTR->next_bb, EXIT_BLOCK_PTR->prev_bb, next_bb)
      {
        edge s;
  
+       c = b->next_bb;
+ 
        /* We care about simple conditional or unconditional jumps with
  	 a single successor.
  
*************** commit_one_edge_insertion (e, watch_call
*** 1476,1491 ****
  void
  commit_edge_insertions ()
  {
-   int i;
    basic_block bb;
  
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
  #endif
  
!   i = -1;
!   bb = ENTRY_BLOCK_PTR;
!   while (1)
      {
        edge e, next;
  
--- 1478,1490 ----
  void
  commit_edge_insertions ()
  {
    basic_block bb;
  
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
  #endif
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
      {
        edge e, next;
  
*************** commit_edge_insertions ()
*** 1495,1504 ****
  	  if (e->insns)
  	    commit_one_edge_insertion (e, false);
  	}
- 
-       if (++i >= n_basic_blocks)
- 	break;
-       bb = BASIC_BLOCK (i);
      }
  }
  
--- 1494,1499 ----
*************** commit_edge_insertions ()
*** 1508,1523 ****
  void
  commit_edge_insertions_watch_calls ()
  {
-   int i;
    basic_block bb;
  
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
  #endif
  
!   i = -1;
!   bb = ENTRY_BLOCK_PTR;
!   while (1)
      {
        edge e, next;
  
--- 1503,1515 ----
  void
  commit_edge_insertions_watch_calls ()
  {
    basic_block bb;
  
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
  #endif
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
      {
        edge e, next;
  
*************** commit_edge_insertions_watch_calls ()
*** 1527,1536 ****
  	  if (e->insns)
  	    commit_one_edge_insertion (e, true);
  	}
- 
-       if (++i >= n_basic_blocks)
- 	break;
-       bb = BASIC_BLOCK (i);
      }
  }
  
--- 1519,1524 ----
*************** print_rtl_with_bb (outf, rtx_first)
*** 1601,1607 ****
      fprintf (outf, "(nil)\n");
    else
      {
-       int i;
        enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB };
        int max_uid = get_max_uid ();
        basic_block *start
--- 1589,1594 ----
*************** print_rtl_with_bb (outf, rtx_first)
*** 1611,1619 ****
        enum bb_state *in_bb_p
  	= (enum bb_state *) xcalloc (max_uid, sizeof (enum bb_state));
  
!       for (i = n_basic_blocks - 1; i >= 0; i--)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  rtx x;
  
  	  start[INSN_UID (bb->head)] = bb;
--- 1598,1607 ----
        enum bb_state *in_bb_p
  	= (enum bb_state *) xcalloc (max_uid, sizeof (enum bb_state));
  
!       basic_block bb;
! 
!       FOR_EACH_BB_REVERSE (bb)
  	{
  	  rtx x;
  
  	  start[INSN_UID (bb->head)] = bb;
*************** print_rtl_with_bb (outf, rtx_first)
*** 1634,1640 ****
        for (tmp_rtx = rtx_first; NULL != tmp_rtx; tmp_rtx = NEXT_INSN (tmp_rtx))
  	{
  	  int did_output;
- 	  basic_block bb;
  
  	  if ((bb = start[INSN_UID (tmp_rtx)]) != NULL)
  	    {
--- 1622,1627 ----
*************** verify_flow_info ()
*** 1721,1727 ****
    basic_block *bb_info, *last_visited;
    size_t *edge_checksum;
    rtx x;
!   int i, last_bb_num_seen, num_bb_notes, err = 0;
    basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
--- 1708,1714 ----
    basic_block *bb_info, *last_visited;
    size_t *edge_checksum;
    rtx x;
!   int i, num_bb_notes, err = 0;
    basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
*************** verify_flow_info ()
*** 1765,1773 ****
        last_bb_seen = bb;
      }
  
!   for (i = n_basic_blocks - 1; i >= 0; i--)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx head = bb->head;
        rtx end = bb->end;
  
--- 1752,1759 ----
        last_bb_seen = bb;
      }
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx head = bb->head;
        rtx end = bb->end;
  
*************** verify_flow_info ()
*** 1813,1821 ****
      }
  
    /* Now check the basic blocks (boundaries etc.) */
!   for (i = n_basic_blocks - 1; i >= 0; i--)
      {
-       basic_block bb = BASIC_BLOCK (i);
        int n_fallthru = 0, n_eh = 0, n_call = 0, n_abnormal = 0, n_branch = 0;
        edge e;
        rtx note;
--- 1799,1806 ----
      }
  
    /* Now check the basic blocks (boundaries etc.) */
!   FOR_EACH_BB_REVERSE (bb)
      {
        int n_fallthru = 0, n_eh = 0, n_call = 0, n_abnormal = 0, n_branch = 0;
        edge e;
        rtx note;
*************** verify_flow_info ()
*** 2087,2094 ****
  	err = 1;
        }
  
-   last_bb_num_seen = -1;
    num_bb_notes = 0;
    for (x = rtx_first; x; x = NEXT_INSN (x))
      {
        if (NOTE_INSN_BASIC_BLOCK_P (x))
--- 2072,2080 ----
  	err = 1;
        }
  
    num_bb_notes = 0;
+   last_bb_seen = ENTRY_BLOCK_PTR;
+ 
    for (x = rtx_first; x; x = NEXT_INSN (x))
      {
        if (NOTE_INSN_BASIC_BLOCK_P (x))
*************** verify_flow_info ()
*** 2096,2105 ****
  	  basic_block bb = NOTE_BASIC_BLOCK (x);
  
  	  num_bb_notes++;
! 	  if (bb->index != last_bb_num_seen + 1)
  	    internal_error ("basic blocks not numbered consecutively");
  
! 	  last_bb_num_seen = bb->index;
  	}
  
        if (!bb_info[INSN_UID (x)])
--- 2082,2091 ----
  	  basic_block bb = NOTE_BASIC_BLOCK (x);
  
  	  num_bb_notes++;
! 	  if (bb != last_bb_seen->next_bb)
  	    internal_error ("basic blocks not numbered consecutively");
  
! 	  last_bb_seen = bb;
  	}
  
        if (!bb_info[INSN_UID (x)])
*************** bool
*** 2325,2332 ****
  purge_all_dead_edges (update_life_p)
       int update_life_p;
  {
!   int i, purged = false;
    sbitmap blocks = 0;
  
    if (update_life_p)
      {
--- 2311,2319 ----
  purge_all_dead_edges (update_life_p)
       int update_life_p;
  {
!   int purged = false;
    sbitmap blocks = 0;
+   basic_block bb;
  
    if (update_life_p)
      {
*************** purge_all_dead_edges (update_life_p)
*** 2334,2346 ****
        sbitmap_zero (blocks);
      }
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
!       bool purged_here = purge_dead_edges (BASIC_BLOCK (i));
  
        purged |= purged_here;
        if (purged_here && update_life_p)
! 	SET_BIT (blocks, i);
      }
  
    if (update_life_p && purged)
--- 2321,2333 ----
        sbitmap_zero (blocks);
      }
  
!   FOR_EACH_BB (bb)
      {
!       bool purged_here = purge_dead_edges (bb);
  
        purged |= purged_here;
        if (purged_here && update_life_p)
! 	SET_BIT (blocks, bb->index);
      }
  
    if (update_life_p && purged)
Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.290
diff -c -3 -p -r1.290 combine.c
*** combine.c	21 May 2002 20:37:38 -0000	1.290
--- combine.c	22 May 2002 17:04:32 -0000
*************** combine_instructions (f, nregs)
*** 610,742 ****
  
    /* Now scan all the insns in forward order.  */
  
-   this_basic_block = ENTRY_BLOCK_PTR;
    label_tick = 1;
    last_call_cuid = 0;
    mem_last_set = 0;
    init_reg_last_arrays ();
    setup_incoming_promotions ();
  
!   for (insn = f; insn; insn = next ? next : NEXT_INSN (insn))
      {
!       next = 0;
! 
!       /* If INSN starts a new basic block, update our basic block number.  */
!       if (this_basic_block->next_bb != EXIT_BLOCK_PTR
! 	  && this_basic_block->next_bb->head == insn)
! 	this_basic_block = this_basic_block->next_bb;
  
!       if (GET_CODE (insn) == CODE_LABEL)
! 	label_tick++;
  
!       else if (INSN_P (insn))
! 	{
! 	  /* See if we know about function return values before this
! 	     insn based upon SUBREG flags.  */
! 	  check_promoted_subreg (insn, PATTERN (insn));
  
! 	  /* Try this insn with each insn it links back to.  */
  
! 	  for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 	    if ((next = try_combine (insn, XEXP (links, 0),
! 				     NULL_RTX, &new_direct_jump_p)) != 0)
! 	      goto retry;
  
! 	  /* Try each sequence of three linked insns ending with this one.  */
  
! 	  for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 	    {
! 	      rtx link = XEXP (links, 0);
  
! 	      /* If the linked insn has been replaced by a note, then there
! 		 is no point in pursuing this chain any further.  */
! 	      if (GET_CODE (link) == NOTE)
! 		continue;
  
! 	      for (nextlinks = LOG_LINKS (link);
! 		   nextlinks;
! 		   nextlinks = XEXP (nextlinks, 1))
! 		if ((next = try_combine (insn, link,
! 					 XEXP (nextlinks, 0),
! 					 &new_direct_jump_p)) != 0)
! 		  goto retry;
! 	    }
  
! #ifdef HAVE_cc0
! 	  /* Try to combine a jump insn that uses CC0
! 	     with a preceding insn that sets CC0, and maybe with its
! 	     logical predecessor as well.
! 	     This is how we make decrement-and-branch insns.
! 	     We need this special code because data flow connections
! 	     via CC0 do not get entered in LOG_LINKS.  */
! 
! 	  if (GET_CODE (insn) == JUMP_INSN
! 	      && (prev = prev_nonnote_insn (insn)) != 0
! 	      && GET_CODE (prev) == INSN
! 	      && sets_cc0_p (PATTERN (prev)))
! 	    {
! 	      if ((next = try_combine (insn, prev,
! 				       NULL_RTX, &new_direct_jump_p)) != 0)
! 		goto retry;
! 
! 	      for (nextlinks = LOG_LINKS (prev); nextlinks;
! 		   nextlinks = XEXP (nextlinks, 1))
! 		if ((next = try_combine (insn, prev,
! 					 XEXP (nextlinks, 0),
! 					 &new_direct_jump_p)) != 0)
! 		  goto retry;
! 	    }
  
! 	  /* Do the same for an insn that explicitly references CC0.  */
! 	  if (GET_CODE (insn) == INSN
! 	      && (prev = prev_nonnote_insn (insn)) != 0
! 	      && GET_CODE (prev) == INSN
! 	      && sets_cc0_p (PATTERN (prev))
! 	      && GET_CODE (PATTERN (insn)) == SET
! 	      && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (insn))))
! 	    {
! 	      if ((next = try_combine (insn, prev,
! 				       NULL_RTX, &new_direct_jump_p)) != 0)
! 		goto retry;
! 
! 	      for (nextlinks = LOG_LINKS (prev); nextlinks;
! 		   nextlinks = XEXP (nextlinks, 1))
! 		if ((next = try_combine (insn, prev,
! 					 XEXP (nextlinks, 0),
! 					 &new_direct_jump_p)) != 0)
  		  goto retry;
! 	    }
  
! 	  /* Finally, see if any of the insns that this insn links to
! 	     explicitly references CC0.  If so, try this insn, that insn,
! 	     and its predecessor if it sets CC0.  */
! 	  for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 	    if (GET_CODE (XEXP (links, 0)) == INSN
! 		&& GET_CODE (PATTERN (XEXP (links, 0))) == SET
! 		&& reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (XEXP (links, 0))))
! 		&& (prev = prev_nonnote_insn (XEXP (links, 0))) != 0
! 		&& GET_CODE (prev) == INSN
! 		&& sets_cc0_p (PATTERN (prev))
! 		&& (next = try_combine (insn, XEXP (links, 0),
! 					prev, &new_direct_jump_p)) != 0)
! 	      goto retry;
! #endif
! 
! 	  /* Try combining an insn with two different insns whose results it
! 	     uses.  */
! 	  for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 	    for (nextlinks = XEXP (links, 1); nextlinks;
! 		 nextlinks = XEXP (nextlinks, 1))
! 	      if ((next = try_combine (insn, XEXP (links, 0),
! 				       XEXP (nextlinks, 0),
! 				       &new_direct_jump_p)) != 0)
! 		goto retry;
  
! 	  if (GET_CODE (insn) != NOTE)
! 	    record_dead_and_set_regs (insn);
  
! 	retry:
! 	  ;
  	}
      }
    clear_bb_flags ();
--- 610,741 ----
  
    /* Now scan all the insns in forward order.  */
  
    label_tick = 1;
    last_call_cuid = 0;
    mem_last_set = 0;
    init_reg_last_arrays ();
    setup_incoming_promotions ();
  
!   FOR_EACH_BB (this_basic_block)
      {
!       for (insn = this_basic_block->head;
!            insn != NEXT_INSN (this_basic_block->end);
! 	   insn = next ? next : NEXT_INSN (insn))
! 	{
! 	  next = 0;
  
! 	  if (GET_CODE (insn) == CODE_LABEL)
! 	    label_tick++;
  
! 	  else if (INSN_P (insn))
! 	    {
! 	      /* See if we know about function return values before this
! 		 insn based upon SUBREG flags.  */
! 	      check_promoted_subreg (insn, PATTERN (insn));
  
! 	      /* Try this insn with each insn it links back to.  */
  
! 	      for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 		if ((next = try_combine (insn, XEXP (links, 0),
! 					 NULL_RTX, &new_direct_jump_p)) != 0)
! 		  goto retry;
  
! 	      /* Try each sequence of three linked insns ending with this one.  */
  
! 	      for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 		{
! 		  rtx link = XEXP (links, 0);
  
! 		  /* If the linked insn has been replaced by a note, then there
! 		     is no point in pursuing this chain any further.  */
! 		  if (GET_CODE (link) == NOTE)
! 		    continue;
! 
! 		  for (nextlinks = LOG_LINKS (link);
! 		       nextlinks;
! 		       nextlinks = XEXP (nextlinks, 1))
! 		    if ((next = try_combine (insn, link,
! 					     XEXP (nextlinks, 0),
! 					     &new_direct_jump_p)) != 0)
! 		      goto retry;
! 		}
  
!     #ifdef HAVE_cc0
! 	      /* Try to combine a jump insn that uses CC0
! 		 with a preceding insn that sets CC0, and maybe with its
! 		 logical predecessor as well.
! 		 This is how we make decrement-and-branch insns.
! 		 We need this special code because data flow connections
! 		 via CC0 do not get entered in LOG_LINKS.  */
! 
! 	      if (GET_CODE (insn) == JUMP_INSN
! 		  && (prev = prev_nonnote_insn (insn)) != 0
! 		  && GET_CODE (prev) == INSN
! 		  && sets_cc0_p (PATTERN (prev)))
! 		{
! 		  if ((next = try_combine (insn, prev,
! 					   NULL_RTX, &new_direct_jump_p)) != 0)
! 		    goto retry;
! 
! 		  for (nextlinks = LOG_LINKS (prev); nextlinks;
! 		       nextlinks = XEXP (nextlinks, 1))
! 		    if ((next = try_combine (insn, prev,
! 					     XEXP (nextlinks, 0),
! 					     &new_direct_jump_p)) != 0)
! 		      goto retry;
! 		}
  
! 	      /* Do the same for an insn that explicitly references CC0.  */
! 	      if (GET_CODE (insn) == INSN
! 		  && (prev = prev_nonnote_insn (insn)) != 0
! 		  && GET_CODE (prev) == INSN
! 		  && sets_cc0_p (PATTERN (prev))
! 		  && GET_CODE (PATTERN (insn)) == SET
! 		  && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (insn))))
! 		{
! 		  if ((next = try_combine (insn, prev,
! 					   NULL_RTX, &new_direct_jump_p)) != 0)
! 		    goto retry;
! 
! 		  for (nextlinks = LOG_LINKS (prev); nextlinks;
! 		       nextlinks = XEXP (nextlinks, 1))
! 		    if ((next = try_combine (insn, prev,
! 					     XEXP (nextlinks, 0),
! 					     &new_direct_jump_p)) != 0)
! 		      goto retry;
! 		}
  
! 	      /* Finally, see if any of the insns that this insn links to
! 		 explicitly references CC0.  If so, try this insn, that insn,
! 		 and its predecessor if it sets CC0.  */
! 	      for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 		if (GET_CODE (XEXP (links, 0)) == INSN
! 		    && GET_CODE (PATTERN (XEXP (links, 0))) == SET
! 		    && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (XEXP (links, 0))))
! 		    && (prev = prev_nonnote_insn (XEXP (links, 0))) != 0
! 		    && GET_CODE (prev) == INSN
! 		    && sets_cc0_p (PATTERN (prev))
! 		    && (next = try_combine (insn, XEXP (links, 0),
! 					    prev, &new_direct_jump_p)) != 0)
  		  goto retry;
!     #endif
  
! 	      /* Try combining an insn with two different insns whose results it
! 		 uses.  */
! 	      for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 		for (nextlinks = XEXP (links, 1); nextlinks;
! 		     nextlinks = XEXP (nextlinks, 1))
! 		  if ((next = try_combine (insn, XEXP (links, 0),
! 					   XEXP (nextlinks, 0),
! 					   &new_direct_jump_p)) != 0)
! 		    goto retry;
  
! 	      if (GET_CODE (insn) != NOTE)
! 		record_dead_and_set_regs (insn);
  
! 	    retry:
! 	      ;
! 	    }
  	}
      }
    clear_bb_flags ();
*************** reg_dead_at_p (reg, insn)
*** 11685,11691 ****
       rtx reg;
       rtx insn;
  {
!   int block;
    unsigned int i;
  
    /* Set variables for reg_dead_at_p_1.  */
--- 11684,11690 ----
       rtx reg;
       rtx insn;
  {
!   basic_block block;
    unsigned int i;
  
    /* Set variables for reg_dead_at_p_1.  */
*************** reg_dead_at_p (reg, insn)
*** 11718,11738 ****
  	return 1;
      }
  
!   /* Get the basic block number that we were in.  */
    if (insn == 0)
!     block = 0;
    else
      {
!       for (block = 0; block < n_basic_blocks; block++)
! 	if (insn == BLOCK_HEAD (block))
  	  break;
  
!       if (block == n_basic_blocks)
  	return 0;
      }
  
    for (i = reg_dead_regno; i < reg_dead_endregno; i++)
!     if (REGNO_REG_SET_P (BASIC_BLOCK (block)->global_live_at_start, i))
        return 0;
  
    return 1;
--- 11717,11737 ----
  	return 1;
      }
  
!   /* Get the basic block that we were in.  */
    if (insn == 0)
!     block = ENTRY_BLOCK_PTR->next_bb;
    else
      {
!       FOR_EACH_BB (block)
! 	if (insn == block->head)
  	  break;
  
!       if (block == EXIT_BLOCK_PTR)
  	return 0;
      }
  
    for (i = reg_dead_regno; i < reg_dead_endregno; i++)
!     if (REGNO_REG_SET_P (block->global_live_at_start, i))
        return 0;
  
    return 1;
Index: conflict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/conflict.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 conflict.c
*** conflict.c	17 May 2002 02:31:30 -0000	1.13
--- conflict.c	22 May 2002 17:04:32 -0000
*************** conflict_graph_compute (regs, p)
*** 447,465 ****
       regset regs;
       partition p;
  {
-   int b;
    conflict_graph graph = conflict_graph_new (max_reg_num ());
    regset_head live_head;
    regset live = &live_head;
    regset_head born_head;
    regset born = &born_head;
  
    INIT_REG_SET (live);
    INIT_REG_SET (born);
  
!   for (b = n_basic_blocks; --b >= 0; )
      {
-       basic_block bb = BASIC_BLOCK (b);
        rtx insn;
        rtx head;
  
--- 447,464 ----
       regset regs;
       partition p;
  {
    conflict_graph graph = conflict_graph_new (max_reg_num ());
    regset_head live_head;
    regset live = &live_head;
    regset_head born_head;
    regset born = &born_head;
+   basic_block bb;
  
    INIT_REG_SET (live);
    INIT_REG_SET (born);
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx insn;
        rtx head;
  
Index: df.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/df.c,v
retrieving revision 1.29
diff -c -3 -p -r1.29 df.c
*** df.c	17 May 2002 02:31:30 -0000	1.29
--- df.c	22 May 2002 17:04:32 -0000
*************** Perhaps there should be a bitmap argumen
*** 171,182 ****
  #include "df.h"
  #include "fibheap.h"
  
- #define FOR_ALL_BBS(BB, CODE)					\
- do {								\
-   int node_;							\
-   for (node_ = 0; node_ < n_basic_blocks; node_++)		\
-     {(BB) = BASIC_BLOCK (node_); CODE;};} while (0)
- 
  #define FOR_EACH_BB_IN_BITMAP(BITMAP, MIN, BB, CODE)		\
  do {								\
    unsigned int node_;						\
--- 171,176 ----
*************** df_bitmaps_alloc (df, flags)
*** 406,413 ****
       struct df *df;
       int flags;
  {
-   unsigned int i;
    int dflags = 0;
  
    /* Free the bitmaps if they need resizing.  */
    if ((flags & DF_LR) && df->n_regs < (unsigned int)max_reg_num ())
--- 400,407 ----
       struct df *df;
       int flags;
  {
    int dflags = 0;
+   basic_block bb;
  
    /* Free the bitmaps if they need resizing.  */
    if ((flags & DF_LR) && df->n_regs < (unsigned int)max_reg_num ())
*************** df_bitmaps_alloc (df, flags)
*** 423,431 ****
    df->n_defs = df->def_id;
    df->n_uses = df->use_id;
  
!   for (i = 0; i < df->n_bbs; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
        if (flags & DF_RD && ! bb_info->rd_in)
--- 417,424 ----
    df->n_defs = df->def_id;
    df->n_uses = df->use_id;
  
!   FOR_EACH_BB (bb)
      {
        struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
        if (flags & DF_RD && ! bb_info->rd_in)
*************** df_bitmaps_free (df, flags)
*** 474,484 ****
       struct df *df ATTRIBUTE_UNUSED;
       int flags;
  {
!   unsigned int i;
  
!   for (i = 0; i < df->n_bbs; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
        if (!bb_info)
--- 467,476 ----
       struct df *df ATTRIBUTE_UNUSED;
       int flags;
  {
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
      {
        struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
        if (!bb_info)
*************** df_alloc (df, n_regs)
*** 534,540 ****
       int n_regs;
  {
    int n_insns;
!   int i;
  
    gcc_obstack_init (&df_ref_obstack);
  
--- 526,532 ----
       int n_regs;
  {
    int n_insns;
!   basic_block bb;
  
    gcc_obstack_init (&df_ref_obstack);
  
*************** df_alloc (df, n_regs)
*** 572,579 ****
    df->bbs = xcalloc (df->n_bbs, sizeof (struct bb_info));
  
    df->all_blocks = BITMAP_XMALLOC ();
!   for (i = 0; i < n_basic_blocks; i++)
!     bitmap_set_bit (df->all_blocks, i);
  }
  
  
--- 564,571 ----
    df->bbs = xcalloc (df->n_bbs, sizeof (struct bb_info));
  
    df->all_blocks = BITMAP_XMALLOC ();
!   FOR_EACH_BB (bb)
!     bitmap_set_bit (df->all_blocks, bb->index);
  }
  
  
*************** df_analyse_1 (df, blocks, flags, update)
*** 1946,1951 ****
--- 1938,1945 ----
    int aflags;
    int dflags;
    int i;
+   basic_block bb;
+ 
    dflags = 0;
    aflags = flags;
    if (flags & DF_UD_CHAIN)
*************** df_analyse_1 (df, blocks, flags, update)
*** 2029,2045 ****
        /* Compute the sets of gens and kills for the defs of each bb.  */
        df_rd_local_compute (df, df->flags & DF_RD ? blocks : df->all_blocks);
        {
- 	int i;
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	for (i = 0; i < n_basic_blocks; i ++)
  	  {
! 	    in[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_in;
! 	    out[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_out;
! 	    gen[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_gen;
! 	    kill[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_kill;
  	  }
  	iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
  				   FORWARD, UNION, df_rd_transfer_function,
--- 2023,2038 ----
        /* Compute the sets of gens and kills for the defs of each bb.  */
        df_rd_local_compute (df, df->flags & DF_RD ? blocks : df->all_blocks);
        {
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	FOR_EACH_BB (bb)
  	  {
! 	    in[bb->index] = DF_BB_INFO (df, bb)->rd_in;
! 	    out[bb->index] = DF_BB_INFO (df, bb)->rd_out;
! 	    gen[bb->index] = DF_BB_INFO (df, bb)->rd_gen;
! 	    kill[bb->index] = DF_BB_INFO (df, bb)->rd_kill;
  	  }
  	iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
  				   FORWARD, UNION, df_rd_transfer_function,
*************** df_analyse_1 (df, blocks, flags, update)
*** 2066,2082 ****
  	 uses in each bb.  */
        df_ru_local_compute (df, df->flags & DF_RU ? blocks : df->all_blocks);
        {
- 	int i;
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	for (i = 0; i < n_basic_blocks; i ++)
  	  {
! 	    in[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_in;
! 	    out[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_out;
! 	    gen[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_gen;
! 	    kill[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_kill;
  	  }
  	iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
  				   BACKWARD, UNION, df_ru_transfer_function,
--- 2059,2074 ----
  	 uses in each bb.  */
        df_ru_local_compute (df, df->flags & DF_RU ? blocks : df->all_blocks);
        {
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	FOR_EACH_BB (bb)
  	  {
! 	    in[bb->index] = DF_BB_INFO (df, bb)->ru_in;
! 	    out[bb->index] = DF_BB_INFO (df, bb)->ru_out;
! 	    gen[bb->index] = DF_BB_INFO (df, bb)->ru_gen;
! 	    kill[bb->index] = DF_BB_INFO (df, bb)->ru_kill;
  	  }
  	iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
  				   BACKWARD, UNION, df_ru_transfer_function,
*************** df_analyse_1 (df, blocks, flags, update)
*** 2106,2122 ****
        /* Compute the sets of defs and uses of live variables.  */
        df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks);
        {
- 	int i;
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *use = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *def = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	for (i = 0; i < n_basic_blocks; i ++)
  	  {
! 	    in[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_in;
! 	    out[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_out;
! 	    use[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_use;
! 	    def[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_def;
  	  }
  	iterative_dataflow_bitmap (in, out, use, def, df->all_blocks,
  				   BACKWARD, UNION, df_lr_transfer_function,
--- 2098,2113 ----
        /* Compute the sets of defs and uses of live variables.  */
        df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks);
        {
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *use = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *def = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	FOR_EACH_BB (bb)
  	  {
! 	    in[bb->index] = DF_BB_INFO (df, bb)->lr_in;
! 	    out[bb->index] = DF_BB_INFO (df, bb)->lr_out;
! 	    use[bb->index] = DF_BB_INFO (df, bb)->lr_use;
! 	    def[bb->index] = DF_BB_INFO (df, bb)->lr_def;
  	  }
  	iterative_dataflow_bitmap (in, out, use, def, df->all_blocks,
  				   BACKWARD, UNION, df_lr_transfer_function,
*************** df_modified_p (df, blocks)
*** 2270,2281 ****
       struct df *df;
       bitmap blocks;
  {
-   unsigned int j;
    int update = 0;
  
!   for (j = 0; j < df->n_bbs; j++)
!     if (bitmap_bit_p (df->bbs_modified, j)
! 	&& (! blocks || (blocks == (bitmap) -1) || bitmap_bit_p (blocks, j)))
      {
        update = 1;
        break;
--- 2261,2275 ----
       struct df *df;
       bitmap blocks;
  {
    int update = 0;
+   basic_block bb;
+ 
+   if (!df->n_bbs)
+     return 0;
  
!   FOR_EACH_BB (bb)
!     if (bitmap_bit_p (df->bbs_modified, bb->index)
! 	&& (! blocks || (blocks == (bitmap) -1) || bitmap_bit_p (blocks, bb->index)))
      {
        update = 1;
        break;
*************** df_refs_unlink (df, blocks)
*** 2408,2414 ****
      }
    else
      {
!       FOR_ALL_BBS (bb,
        {
  	df_bb_refs_unlink (df, bb);
        });
--- 2402,2408 ----
      }
    else
      {
!       FOR_EACH_BB (bb,
        {
  	df_bb_refs_unlink (df, bb);
        });
*************** df_dump (df, flags, file)
*** 3274,3281 ****
       int flags;
       FILE *file;
  {
-   unsigned int i;
    unsigned int j;
  
    if (! df || ! file)
      return;
--- 3268,3275 ----
       int flags;
       FILE *file;
  {
    unsigned int j;
+   basic_block bb;
  
    if (! df || ! file)
      return;
*************** df_dump (df, flags, file)
*** 3286,3307 ****
  
    if (flags & DF_RD)
      {
        fprintf (file, "Reaching defs:\n");
!       for (i = 0; i < df->n_bbs; i++)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->rd_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", i);
  	  dump_bitmap (file, bb_info->rd_in);
! 	  fprintf (file, "bb %d gen \t", i);
  	  dump_bitmap (file, bb_info->rd_gen);
! 	  fprintf (file, "bb %d kill\t", i);
  	  dump_bitmap (file, bb_info->rd_kill);
! 	  fprintf (file, "bb %d out \t", i);
  	  dump_bitmap (file, bb_info->rd_out);
  	}
      }
--- 3280,3302 ----
  
    if (flags & DF_RD)
      {
+       basic_block bb;
+ 
        fprintf (file, "Reaching defs:\n");
!       FOR_EACH_BB (bb)
  	{
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->rd_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", bb->index);
  	  dump_bitmap (file, bb_info->rd_in);
! 	  fprintf (file, "bb %d gen \t", bb->index);
  	  dump_bitmap (file, bb_info->rd_gen);
! 	  fprintf (file, "bb %d kill\t", bb->index);
  	  dump_bitmap (file, bb_info->rd_kill);
! 	  fprintf (file, "bb %d out \t", bb->index);
  	  dump_bitmap (file, bb_info->rd_out);
  	}
      }
*************** df_dump (df, flags, file)
*** 3329,3349 ****
    if (flags & DF_RU)
      {
        fprintf (file, "Reaching uses:\n");
!       for (i = 0; i < df->n_bbs; i++)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->ru_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", i);
  	  dump_bitmap (file, bb_info->ru_in);
! 	  fprintf (file, "bb %d gen \t", i);
  	  dump_bitmap (file, bb_info->ru_gen);
! 	  fprintf (file, "bb %d kill\t", i);
  	  dump_bitmap (file, bb_info->ru_kill);
! 	  fprintf (file, "bb %d out \t", i);
  	  dump_bitmap (file, bb_info->ru_out);
  	}
      }
--- 3324,3343 ----
    if (flags & DF_RU)
      {
        fprintf (file, "Reaching uses:\n");
!       FOR_EACH_BB (bb)
  	{
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->ru_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", bb->index);
  	  dump_bitmap (file, bb_info->ru_in);
! 	  fprintf (file, "bb %d gen \t", bb->index);
  	  dump_bitmap (file, bb_info->ru_gen);
! 	  fprintf (file, "bb %d kill\t", bb->index);
  	  dump_bitmap (file, bb_info->ru_kill);
! 	  fprintf (file, "bb %d out \t", bb->index);
  	  dump_bitmap (file, bb_info->ru_out);
  	}
      }
*************** df_dump (df, flags, file)
*** 3371,3391 ****
    if (flags & DF_LR)
      {
        fprintf (file, "Live regs:\n");
!       for (i = 0; i < df->n_bbs; i++)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->lr_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", i);
  	  dump_bitmap (file, bb_info->lr_in);
! 	  fprintf (file, "bb %d use \t", i);
  	  dump_bitmap (file, bb_info->lr_use);
! 	  fprintf (file, "bb %d def \t", i);
  	  dump_bitmap (file, bb_info->lr_def);
! 	  fprintf (file, "bb %d out \t", i);
  	  dump_bitmap (file, bb_info->lr_out);
  	}
      }
--- 3365,3384 ----
    if (flags & DF_LR)
      {
        fprintf (file, "Live regs:\n");
!       FOR_EACH_BB (bb)
  	{
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->lr_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", bb->index);
  	  dump_bitmap (file, bb_info->lr_in);
! 	  fprintf (file, "bb %d use \t", bb->index);
  	  dump_bitmap (file, bb_info->lr_use);
! 	  fprintf (file, "bb %d def \t", bb->index);
  	  dump_bitmap (file, bb_info->lr_def);
! 	  fprintf (file, "bb %d out \t", bb->index);
  	  dump_bitmap (file, bb_info->lr_out);
  	}
      }
Index: dominance.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dominance.c,v
retrieving revision 1.8
diff -c -3 -p -r1.8 dominance.c
*** dominance.c	17 May 2002 02:31:31 -0000	1.8
--- dominance.c	22 May 2002 17:04:32 -0000
*************** calc_dfs_tree (di, reverse)
*** 326,335 ****
           They are reverse-unreachable.  In the dom-case we disallow such
           nodes, but in post-dom we have to deal with them, so we simply
           include them in the DFS tree which actually becomes a forest.  */
!       int i;
!       for (i = n_basic_blocks - 1; i >= 0; i--)
  	{
- 	  basic_block b = BASIC_BLOCK (i);
  	  if (di->dfs_order[b->index])
  	    continue;
  	  di->dfs_order[b->index] = di->dfsnum;
--- 326,334 ----
           They are reverse-unreachable.  In the dom-case we disallow such
           nodes, but in post-dom we have to deal with them, so we simply
           include them in the DFS tree which actually becomes a forest.  */
!       basic_block b;
!       FOR_EACH_BB_REVERSE (b)
  	{
  	  if (di->dfs_order[b->index])
  	    continue;
  	  di->dfs_order[b->index] = di->dfsnum;
*************** calculate_dominance_info (idom, doms, re
*** 604,620 ****
  
    if (idom)
      {
!       int i;
!       for (i = 0; i < n_basic_blocks; i++)
  	{
- 	  basic_block b = BASIC_BLOCK (i);
  	  TBB d = di.dom[di.dfs_order[b->index]];
  
  	  /* The old code didn't modify array elements of nodes having only
  	     itself as dominator (d==0) or only ENTRY_BLOCK (resp. EXIT_BLOCK)
  	     (d==1).  */
  	  if (d > 1)
! 	    idom[i] = di.dfs_to_bb[d]->index;
  	}
      }
    if (doms)
--- 603,619 ----
  
    if (idom)
      {
!       basic_block b;
! 
!       FOR_EACH_BB (b)
  	{
  	  TBB d = di.dom[di.dfs_order[b->index]];
  
  	  /* The old code didn't modify array elements of nodes having only
  	     itself as dominator (d==0) or only ENTRY_BLOCK (resp. EXIT_BLOCK)
  	     (d==1).  */
  	  if (d > 1)
! 	    idom[b->index] = di.dfs_to_bb[d]->index;
  	}
      }
    if (doms)
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.255
diff -c -3 -p -r1.255 final.c
*** final.c	21 May 2002 20:37:40 -0000	1.255
--- final.c	22 May 2002 17:04:32 -0000
*************** insn_current_reference_address (branch)
*** 934,941 ****
  void
  compute_alignments ()
  {
-   int i;
    int log, max_skip, max_log;
  
    if (label_align)
      {
--- 934,941 ----
  void
  compute_alignments ()
  {
    int log, max_skip, max_log;
+   basic_block bb;
  
    if (label_align)
      {
*************** compute_alignments ()
*** 952,960 ****
    if (! optimize || optimize_size)
      return;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx label = bb->head;
        int fallthru_frequency = 0, branch_frequency = 0, has_fallthru = 0;
        edge e;
--- 952,959 ----
    if (! optimize || optimize_size)
      return;
  
!   FOR_EACH_BB (bb)
      {
        rtx label = bb->head;
        int fallthru_frequency = 0, branch_frequency = 0, has_fallthru = 0;
        edge e;
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.522
diff -c -3 -p -r1.522 flow.c
*** flow.c	21 May 2002 22:35:04 -0000	1.522
--- flow.c	22 May 2002 17:04:33 -0000
*************** update_life_info (blocks, extent, prop_f
*** 637,642 ****
--- 637,643 ----
    regset_head tmp_head;
    int i;
    int stabilized_prop_flags = prop_flags;
+   basic_block bb;
  
    tmp = INITIALIZE_REG_SET (tmp_head);
    ndead = 0;
*************** update_life_info (blocks, extent, prop_f
*** 667,676 ****
  
  	  /* Removing dead code may allow the CFG to be simplified which
  	     in turn may allow for further dead code detection / removal.  */
! 	  for (i = n_basic_blocks - 1; i >= 0; --i)
  	    {
- 	      basic_block bb = BASIC_BLOCK (i);
- 
  	      COPY_REG_SET (tmp, bb->global_live_at_end);
  	      changed |= propagate_block (bb, tmp, NULL, NULL,
  				prop_flags & (PROP_SCAN_DEAD_CODE
--- 668,675 ----
  
  	  /* Removing dead code may allow the CFG to be simplified which
  	     in turn may allow for further dead code detection / removal.  */
! 	  FOR_EACH_BB_REVERSE (bb)
  	    {
  	      COPY_REG_SET (tmp, bb->global_live_at_end);
  	      changed |= propagate_block (bb, tmp, NULL, NULL,
  				prop_flags & (PROP_SCAN_DEAD_CODE
*************** update_life_info (blocks, extent, prop_f
*** 707,713 ****
      {
        EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
  	{
! 	  basic_block bb = BASIC_BLOCK (i);
  
  	  COPY_REG_SET (tmp, bb->global_live_at_end);
  	  propagate_block (bb, tmp, NULL, NULL, stabilized_prop_flags);
--- 706,712 ----
      {
        EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
  	{
! 	  bb = BASIC_BLOCK (i);
  
  	  COPY_REG_SET (tmp, bb->global_live_at_end);
  	  propagate_block (bb, tmp, NULL, NULL, stabilized_prop_flags);
*************** update_life_info (blocks, extent, prop_f
*** 718,727 ****
      }
    else
      {
!       for (i = n_basic_blocks - 1; i >= 0; --i)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
- 
  	  COPY_REG_SET (tmp, bb->global_live_at_end);
  
  	  propagate_block (bb, tmp, NULL, NULL, stabilized_prop_flags);
--- 717,724 ----
      }
    else
      {
!       FOR_EACH_BB_REVERSE (bb)
  	{
  	  COPY_REG_SET (tmp, bb->global_live_at_end);
  
  	  propagate_block (bb, tmp, NULL, NULL, stabilized_prop_flags);
*************** update_life_info_in_dirty_blocks (extent
*** 776,790 ****
       int prop_flags;
  {
    sbitmap update_life_blocks = sbitmap_alloc (n_basic_blocks);
-   int block_num;
    int n = 0;
    int retval = 0;
  
    sbitmap_zero (update_life_blocks);
!   for (block_num = 0; block_num < n_basic_blocks; block_num++)
!     if (BASIC_BLOCK (block_num)->flags & BB_DIRTY)
        {
! 	SET_BIT (update_life_blocks, block_num);
  	n++;
        }
  
--- 773,787 ----
       int prop_flags;
  {
    sbitmap update_life_blocks = sbitmap_alloc (n_basic_blocks);
    int n = 0;
+   basic_block bb;
    int retval = 0;
  
    sbitmap_zero (update_life_blocks);
!   FOR_EACH_BB (bb)
!     if (bb->flags & BB_DIRTY)
        {
! 	SET_BIT (update_life_blocks, bb->index);
  	n++;
        }
  
*************** int
*** 825,838 ****
  delete_noop_moves (f)
       rtx f ATTRIBUTE_UNUSED;
  {
-   int i;
    rtx insn, next;
    basic_block bb;
    int nnoops = 0;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       bb = BASIC_BLOCK (i);
        for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = next)
  	{
  	  next = NEXT_INSN (insn);
--- 822,833 ----
  delete_noop_moves (f)
       rtx f ATTRIBUTE_UNUSED;
  {
    rtx insn, next;
    basic_block bb;
    int nnoops = 0;
  
!   FOR_EACH_BB (bb)
      {
        for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = next)
  	{
  	  next = NEXT_INSN (insn);
*************** calculate_global_regs_live (blocks_in, b
*** 1079,1085 ****
       sbitmap blocks_in, blocks_out;
       int flags;
  {
!   basic_block *queue, *qhead, *qtail, *qend;
    regset tmp, new_live_at_end, call_used;
    regset_head tmp_head, call_used_head;
    regset_head new_live_at_end_head;
--- 1074,1080 ----
       sbitmap blocks_in, blocks_out;
       int flags;
  {
!   basic_block *queue, *qhead, *qtail, *qend, bb;
    regset tmp, new_live_at_end, call_used;
    regset_head tmp_head, call_used_head;
    regset_head new_live_at_end_head;
*************** calculate_global_regs_live (blocks_in, b
*** 1088,1097 ****
    /* Some passes used to forget clear aux field of basic block causing
       sick behaviour here.  */
  #ifdef ENABLE_CHECKING
!   if (ENTRY_BLOCK_PTR->aux || EXIT_BLOCK_PTR->aux)
!     abort ();
!   for (i = 0; i < n_basic_blocks; i++)
!     if (BASIC_BLOCK (i)->aux)
        abort ();
  #endif
  
--- 1083,1090 ----
    /* Some passes used to forget clear aux field of basic block causing
       sick behaviour here.  */
  #ifdef ENABLE_CHECKING
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     if (bb->aux)
        abort ();
  #endif
  
*************** calculate_global_regs_live (blocks_in, b
*** 1116,1131 ****
       useful work.  We use AUX non-null to flag that the block is queued.  */
    if (blocks_in)
      {
!       /* Clear out the garbage that might be hanging out in bb->aux.  */
!       for (i = n_basic_blocks - 1; i >= 0; --i)
! 	BASIC_BLOCK (i)->aux = NULL;
! 
!       EXECUTE_IF_SET_IN_SBITMAP (blocks_in, 0, i,
! 	{
! 	  basic_block bb = BASIC_BLOCK (i);
! 	  *--qhead = bb;
! 	  bb->aux = bb;
! 	});
      }
    else
      {
--- 1109,1120 ----
       useful work.  We use AUX non-null to flag that the block is queued.  */
    if (blocks_in)
      {
!       FOR_EACH_BB (bb)
! 	if (TEST_BIT (blocks_in, bb->index))
! 	  {
! 	    *--qhead = bb;
! 	    bb->aux = bb;
! 	  }
      }
    else
      {
*************** calculate_global_regs_live (blocks_in, b
*** 1370,1378 ****
      }
    else
      {
!       for (i = n_basic_blocks - 1; i >= 0; --i)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  FREE_REG_SET (bb->local_set);
  	  FREE_REG_SET (bb->cond_local_set);
  	}
--- 1359,1366 ----
      }
    else
      {
!       FOR_EACH_BB (bb)
  	{
  	  FREE_REG_SET (bb->local_set);
  	  FREE_REG_SET (bb->cond_local_set);
  	}
*************** initialize_uninitialized_subregs ()
*** 1498,1518 ****
  void
  allocate_bb_life_data ()
  {
!   int i;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
- 
        bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack);
        bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack);
      }
  
-   ENTRY_BLOCK_PTR->global_live_at_end
-     = OBSTACK_ALLOC_REG_SET (&flow_obstack);
-   EXIT_BLOCK_PTR->global_live_at_start
-     = OBSTACK_ALLOC_REG_SET (&flow_obstack);
- 
    regs_live_at_setjmp = OBSTACK_ALLOC_REG_SET (&flow_obstack);
  }
  
--- 1486,1499 ----
  void
  allocate_bb_life_data ()
  {
!   basic_block bb;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack);
        bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack);
      }
  
    regs_live_at_setjmp = OBSTACK_ALLOC_REG_SET (&flow_obstack);
  }
  
*************** count_or_remove_death_notes (blocks, kil
*** 4246,4262 ****
       sbitmap blocks;
       int kill;
  {
!   int i, count = 0;
  
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block bb;
        rtx insn;
  
!       if (blocks && ! TEST_BIT (blocks, i))
  	continue;
- 
-       bb = BASIC_BLOCK (i);
  
        for (insn = bb->head;; insn = NEXT_INSN (insn))
  	{
--- 4227,4241 ----
       sbitmap blocks;
       int kill;
  {
!   int count = 0;
!   basic_block bb;
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx insn;
  
!       if (blocks && ! TEST_BIT (blocks, bb->index))
  	continue;
  
        for (insn = bb->head;; insn = NEXT_INSN (insn))
  	{
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.188
diff -c -3 -p -r1.188 gcse.c
*** gcse.c	21 May 2002 20:37:40 -0000	1.188
--- gcse.c	22 May 2002 17:04:33 -0000
*************** static sbitmap *ae_kill, *ae_gen, *ae_in
*** 541,547 ****
  struct null_pointer_info
  {
    /* The basic block being processed.  */
!   int current_block;
    /* The first register to be handled in this pass.  */
    unsigned int min_reg;
    /* One greater than the last register to be handled in this pass.  */
--- 541,547 ----
  struct null_pointer_info
  {
    /* The basic block being processed.  */
!   basic_block current_block;
    /* The first register to be handled in this pass.  */
    unsigned int min_reg;
    /* One greater than the last register to be handled in this pass.  */
*************** compute_sets (f)
*** 1292,1304 ****
  
  struct reg_avail_info
  {
!   int last_bb;
    int first_set;
    int last_set;
  };
  
  static struct reg_avail_info *reg_avail_info;
! static int current_bb;
  
  
  /* See whether X, the source of a set, is something we want to consider for
--- 1292,1304 ----
  
  struct reg_avail_info
  {
!   basic_block last_bb;
    int first_set;
    int last_set;
  };
  
  static struct reg_avail_info *reg_avail_info;
! static basic_block current_bb;
  
  
  /* See whether X, the source of a set, is something we want to consider for
*************** oprs_unchanged_p (x, insn, avail_p)
*** 1385,1391 ****
        }
  
      case MEM:
!       if (load_killed_in_block_p (BASIC_BLOCK (current_bb), INSN_CUID (insn),
  				  x, avail_p))
  	return 0;
        else
--- 1385,1391 ----
        }
  
      case MEM:
!       if (load_killed_in_block_p (current_bb, INSN_CUID (insn),
  				  x, avail_p))
  	return 0;
        else
*************** record_last_reg_set_info (insn, regno)
*** 2373,2379 ****
      {
        info->last_bb = current_bb;
        info->first_set = cuid;
!       SET_BIT (reg_set_in_block[current_bb], regno);
      }
  }
  
--- 2373,2379 ----
      {
        info->last_bb = current_bb;
        info->first_set = cuid;
!       SET_BIT (reg_set_in_block[current_bb->index], regno);
      }
  }
  
*************** compute_hash_table (set_p)
*** 2502,2510 ****
      gmalloc (max_gcse_regno * sizeof (struct reg_avail_info));
  
    for (i = 0; i < max_gcse_regno; ++i)
!     reg_avail_info[i].last_bb = NEVER_SET;
  
!   for (current_bb = 0; current_bb < n_basic_blocks; current_bb++)
      {
        rtx insn;
        unsigned int regno;
--- 2502,2510 ----
      gmalloc (max_gcse_regno * sizeof (struct reg_avail_info));
  
    for (i = 0; i < max_gcse_regno; ++i)
!     reg_avail_info[i].last_bb = NULL;
  
!   FOR_EACH_BB (current_bb)
      {
        rtx insn;
        unsigned int regno;
*************** compute_hash_table (set_p)
*** 2515,2522 ****
  	 ??? hard-reg reg_set_in_block computation
  	 could be moved to compute_sets since they currently don't change.  */
  
!       for (insn = BLOCK_HEAD (current_bb);
! 	   insn && insn != NEXT_INSN (BLOCK_END (current_bb));
  	   insn = NEXT_INSN (insn))
  	{
  	  if (! INSN_P (insn))
--- 2515,2522 ----
  	 ??? hard-reg reg_set_in_block computation
  	 could be moved to compute_sets since they currently don't change.  */
  
!       for (insn = current_bb->head;
! 	   insn && insn != NEXT_INSN (current_bb->end);
  	   insn = NEXT_INSN (insn))
  	{
  	  if (! INSN_P (insn))
*************** compute_hash_table (set_p)
*** 2544,2551 ****
  
        /* The next pass builds the hash table.  */
  
!       for (insn = BLOCK_HEAD (current_bb), in_libcall_block = 0;
! 	   insn && insn != NEXT_INSN (BLOCK_END (current_bb));
  	   insn = NEXT_INSN (insn))
  	if (INSN_P (insn))
  	  {
--- 2544,2551 ----
  
        /* The next pass builds the hash table.  */
  
!       for (insn = current_bb->head, in_libcall_block = 0;
! 	   insn && insn != NEXT_INSN (current_bb->end);
  	   insn = NEXT_INSN (insn))
  	if (INSN_P (insn))
  	  {
*************** handle_rd_kill_set (insn, regno, bb)
*** 2981,2989 ****
  static void
  compute_kill_rd ()
  {
!   int bb, cuid;
    unsigned int regno;
    int i;
  
    /* For each block
         For each set bit in `gen' of the block (i.e each insn which
--- 2981,2990 ----
  static void
  compute_kill_rd ()
  {
!   int cuid;
    unsigned int regno;
    int i;
+   basic_block bb;
  
    /* For each block
         For each set bit in `gen' of the block (i.e each insn which
*************** compute_kill_rd ()
*** 2993,3001 ****
  	 For each setting of regx in the linked list, which is not in
  	     this block
  	   Set the bit in `kill' corresponding to that insn.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      for (cuid = 0; cuid < max_cuid; cuid++)
!       if (TEST_BIT (rd_gen[bb], cuid))
  	{
  	  rtx insn = CUID_INSN (cuid);
  	  rtx pat = PATTERN (insn);
--- 2994,3002 ----
  	 For each setting of regx in the linked list, which is not in
  	     this block
  	   Set the bit in `kill' corresponding to that insn.  */
!   FOR_EACH_BB (bb)
      for (cuid = 0; cuid < max_cuid; cuid++)
!       if (TEST_BIT (rd_gen[bb->index], cuid))
  	{
  	  rtx insn = CUID_INSN (cuid);
  	  rtx pat = PATTERN (insn);
*************** compute_kill_rd ()
*** 3004,3010 ****
  	    {
  	      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  		if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
! 		  handle_rd_kill_set (insn, regno, BASIC_BLOCK (bb));
  	    }
  
  	  if (GET_CODE (pat) == PARALLEL)
--- 3005,3011 ----
  	    {
  	      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  		if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
! 		  handle_rd_kill_set (insn, regno, bb);
  	    }
  
  	  if (GET_CODE (pat) == PARALLEL)
*************** compute_kill_rd ()
*** 3017,3029 ****
  		      && GET_CODE (XEXP (XVECEXP (pat, 0, i), 0)) == REG)
  		    handle_rd_kill_set (insn,
  					REGNO (XEXP (XVECEXP (pat, 0, i), 0)),
! 					BASIC_BLOCK (bb));
  		}
  	    }
  	  else if (GET_CODE (pat) == SET && GET_CODE (SET_DEST (pat)) == REG)
  	    /* Each setting of this register outside of this block
  	       must be marked in the set of kills in this block.  */
! 	    handle_rd_kill_set (insn, REGNO (SET_DEST (pat)), BASIC_BLOCK (bb));
  	}
  }
  
--- 3018,3030 ----
  		      && GET_CODE (XEXP (XVECEXP (pat, 0, i), 0)) == REG)
  		    handle_rd_kill_set (insn,
  					REGNO (XEXP (XVECEXP (pat, 0, i), 0)),
! 					bb);
  		}
  	    }
  	  else if (GET_CODE (pat) == SET && GET_CODE (SET_DEST (pat)) == REG)
  	    /* Each setting of this register outside of this block
  	       must be marked in the set of kills in this block.  */
! 	    handle_rd_kill_set (insn, REGNO (SET_DEST (pat)), bb);
  	}
  }
  
*************** compute_kill_rd ()
*** 3035,3055 ****
  static void
  compute_rd ()
  {
!   int bb, changed, passes;
  
!   for (bb = 0; bb < n_basic_blocks; bb++)
!     sbitmap_copy (rd_out[bb] /*dst*/, rd_gen[bb] /*src*/);
  
    passes = 0;
    changed = 1;
    while (changed)
      {
        changed = 0;
!       for (bb = 0; bb < n_basic_blocks; bb++)
  	{
! 	  sbitmap_union_of_preds (reaching_defs[bb], rd_out, bb);
! 	  changed |= sbitmap_union_of_diff_cg (rd_out[bb], rd_gen[bb],
! 					       reaching_defs[bb], rd_kill[bb]);
  	}
        passes++;
      }
--- 3036,3057 ----
  static void
  compute_rd ()
  {
!   int changed, passes;
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     sbitmap_copy (rd_out[bb->index] /*dst*/, rd_gen[bb->index] /*src*/);
  
    passes = 0;
    changed = 1;
    while (changed)
      {
        changed = 0;
!       FOR_EACH_BB (bb)
  	{
! 	  sbitmap_union_of_preds (reaching_defs[bb->index], rd_out, bb->index);
! 	  changed |= sbitmap_union_of_diff_cg (rd_out[bb->index], rd_gen[bb->index],
! 					       reaching_defs[bb->index], rd_kill[bb->index]);
  	}
        passes++;
      }
*************** static void
*** 3176,3195 ****
  compute_ae_kill (ae_gen, ae_kill)
       sbitmap *ae_gen, *ae_kill;
  {
!   int bb;
    unsigned int i;
    struct expr *expr;
  
!   for (bb = 0; bb < n_basic_blocks; bb++)
      for (i = 0; i < expr_hash_table_size; i++)
        for (expr = expr_hash_table[i]; expr; expr = expr->next_same_hash)
  	{
  	  /* Skip EXPR if generated in this block.  */
! 	  if (TEST_BIT (ae_gen[bb], expr->bitmap_index))
  	    continue;
  
! 	  if (expr_killed_p (expr->expr, BASIC_BLOCK (bb)))
! 	    SET_BIT (ae_kill[bb], expr->bitmap_index);
  	}
  }
  
--- 3178,3197 ----
  compute_ae_kill (ae_gen, ae_kill)
       sbitmap *ae_gen, *ae_kill;
  {
!   basic_block bb;
    unsigned int i;
    struct expr *expr;
  
!   FOR_EACH_BB (bb)
      for (i = 0; i < expr_hash_table_size; i++)
        for (expr = expr_hash_table[i]; expr; expr = expr->next_same_hash)
  	{
  	  /* Skip EXPR if generated in this block.  */
! 	  if (TEST_BIT (ae_gen[bb->index], expr->bitmap_index))
  	    continue;
  
! 	  if (expr_killed_p (expr->expr, bb))
! 	    SET_BIT (ae_kill[bb->index], expr->bitmap_index);
  	}
  }
  
*************** handle_avail_expr (insn, expr)
*** 3605,3624 ****
  static int
  classic_gcse ()
  {
!   int bb, changed;
    rtx insn;
  
    /* Note we start at block 1.  */
  
    changed = 0;
!   for (bb = 1; bb < n_basic_blocks; bb++)
      {
        /* Reset tables used to keep track of what's still valid [since the
  	 start of the block].  */
        reset_opr_set_tables ();
  
!       for (insn = BLOCK_HEAD (bb);
! 	   insn != NULL && insn != NEXT_INSN (BLOCK_END (bb));
  	   insn = NEXT_INSN (insn))
  	{
  	  /* Is insn of form (set (pseudo-reg) ...)?  */
--- 3607,3630 ----
  static int
  classic_gcse ()
  {
!   int changed;
    rtx insn;
+   basic_block bb;
  
    /* Note we start at block 1.  */
  
+   if (ENTRY_BLOCK_PTR->next_bb == EXIT_BLOCK_PTR)
+     return 0;
+ 
    changed = 0;
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb, EXIT_BLOCK_PTR, next_bb)
      {
        /* Reset tables used to keep track of what's still valid [since the
  	 start of the block].  */
        reset_opr_set_tables ();
  
!       for (insn = bb->head;
! 	   insn != NULL && insn != NEXT_INSN (bb->end);
  	   insn = NEXT_INSN (insn))
  	{
  	  /* Is insn of form (set (pseudo-reg) ...)?  */
*************** classic_gcse ()
*** 3636,3642 ****
  		  && ((expr = lookup_expr (src)) != NULL)
  		  /* Is the expression available [at the start of the
  		     block]?  */
! 		  && TEST_BIT (ae_in[bb], expr->bitmap_index)
  		  /* Are the operands unchanged since the start of the
  		     block?  */
  		  && oprs_not_set_p (src, insn))
--- 3642,3648 ----
  		  && ((expr = lookup_expr (src)) != NULL)
  		  /* Is the expression available [at the start of the
  		     block]?  */
! 		  && TEST_BIT (ae_in[bb->index], expr->bitmap_index)
  		  /* Are the operands unchanged since the start of the
  		     block?  */
  		  && oprs_not_set_p (src, insn))
*************** compute_transp (x, indx, bmap, set_p)
*** 3747,3753 ****
       sbitmap *bmap;
       int set_p;
  {
!   int bb, i, j;
    enum rtx_code code;
    reg_set *r;
    const char *fmt;
--- 3753,3760 ----
       sbitmap *bmap;
       int set_p;
  {
!   int i, j;
!   basic_block bb;
    enum rtx_code code;
    reg_set *r;
    const char *fmt;
*************** compute_transp (x, indx, bmap, set_p)
*** 3767,3775 ****
  	{
  	  if (REGNO (x) < FIRST_PSEUDO_REGISTER)
  	    {
! 	      for (bb = 0; bb < n_basic_blocks; bb++)
! 		if (TEST_BIT (reg_set_in_block[bb], REGNO (x)))
! 		  SET_BIT (bmap[bb], indx);
  	    }
  	  else
  	    {
--- 3774,3782 ----
  	{
  	  if (REGNO (x) < FIRST_PSEUDO_REGISTER)
  	    {
! 	      FOR_EACH_BB (bb)
! 		if (TEST_BIT (reg_set_in_block[bb->index], REGNO (x)))
! 		  SET_BIT (bmap[bb->index], indx);
  	    }
  	  else
  	    {
*************** compute_transp (x, indx, bmap, set_p)
*** 3781,3789 ****
  	{
  	  if (REGNO (x) < FIRST_PSEUDO_REGISTER)
  	    {
! 	      for (bb = 0; bb < n_basic_blocks; bb++)
! 		if (TEST_BIT (reg_set_in_block[bb], REGNO (x)))
! 		  RESET_BIT (bmap[bb], indx);
  	    }
  	  else
  	    {
--- 3788,3796 ----
  	{
  	  if (REGNO (x) < FIRST_PSEUDO_REGISTER)
  	    {
! 	      FOR_EACH_BB (bb)
! 		if (TEST_BIT (reg_set_in_block[bb->index], REGNO (x)))
! 		  RESET_BIT (bmap[bb->index], indx);
  	    }
  	  else
  	    {
*************** compute_transp (x, indx, bmap, set_p)
*** 3795,3803 ****
        return;
  
      case MEM:
!       for (bb = 0; bb < n_basic_blocks; bb++)
  	{
! 	  rtx list_entry = canon_modify_mem_list[bb];
  
  	  while (list_entry)
  	    {
--- 3802,3810 ----
        return;
  
      case MEM:
!       FOR_EACH_BB (bb)
  	{
! 	  rtx list_entry = canon_modify_mem_list[bb->index];
  
  	  while (list_entry)
  	    {
*************** compute_transp (x, indx, bmap, set_p)
*** 3806,3814 ****
  	      if (GET_CODE (XEXP (list_entry, 0)) == CALL_INSN)
  		{
  		  if (set_p)
! 		    SET_BIT (bmap[bb], indx);
  		  else
! 		    RESET_BIT (bmap[bb], indx);
  		  break;
  		}
  	      /* LIST_ENTRY must be an INSN of some kind that sets memory.
--- 3813,3821 ----
  	      if (GET_CODE (XEXP (list_entry, 0)) == CALL_INSN)
  		{
  		  if (set_p)
! 		    SET_BIT (bmap[bb->index], indx);
  		  else
! 		    RESET_BIT (bmap[bb->index], indx);
  		  break;
  		}
  	      /* LIST_ENTRY must be an INSN of some kind that sets memory.
*************** compute_transp (x, indx, bmap, set_p)
*** 3822,3830 ****
  					 x, rtx_addr_varies_p))
  		{
  		  if (set_p)
! 		    SET_BIT (bmap[bb], indx);
  		  else
! 		    RESET_BIT (bmap[bb], indx);
  		  break;
  		}
  	      list_entry = XEXP (list_entry, 1);
--- 3829,3837 ----
  					 x, rtx_addr_varies_p))
  		{
  		  if (set_p)
! 		    SET_BIT (bmap[bb->index], indx);
  		  else
! 		    RESET_BIT (bmap[bb->index], indx);
  		  break;
  		}
  	      list_entry = XEXP (list_entry, 1);
*************** static int
*** 4288,4311 ****
  cprop (alter_jumps)
       int alter_jumps;
  {
!   int bb, changed;
    rtx insn;
  
    /* Note we start at block 1.  */
  
    changed = 0;
!   for (bb = 1; bb < n_basic_blocks; bb++)
      {
        /* Reset tables used to keep track of what's still valid [since the
  	 start of the block].  */
        reset_opr_set_tables ();
  
!       for (insn = BLOCK_HEAD (bb);
! 	   insn != NULL && insn != NEXT_INSN (BLOCK_END (bb));
  	   insn = NEXT_INSN (insn))
  	if (INSN_P (insn))
  	  {
! 	    changed |= cprop_insn (BASIC_BLOCK (bb), insn, alter_jumps);
  
  	    /* Keep track of everything modified by this insn.  */
  	    /* ??? Need to be careful w.r.t. mods done to INSN.  Don't
--- 4295,4325 ----
  cprop (alter_jumps)
       int alter_jumps;
  {
!   int changed;
!   basic_block bb;
    rtx insn;
  
    /* Note we start at block 1.  */
+   if (ENTRY_BLOCK_PTR->next_bb == EXIT_BLOCK_PTR)
+     {
+       if (gcse_file != NULL)
+ 	fprintf (gcse_file, "\n");
+       return 0;
+     }
  
    changed = 0;
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb, EXIT_BLOCK_PTR, next_bb)
      {
        /* Reset tables used to keep track of what's still valid [since the
  	 start of the block].  */
        reset_opr_set_tables ();
  
!       for (insn = bb->head;
! 	   insn != NULL && insn != NEXT_INSN (bb->end);
  	   insn = NEXT_INSN (insn))
  	if (INSN_P (insn))
  	  {
! 	    changed |= cprop_insn (bb, insn, alter_jumps);
  
  	    /* Keep track of everything modified by this insn.  */
  	    /* ??? Need to be careful w.r.t. mods done to INSN.  Don't
*************** static void
*** 4452,4458 ****
  compute_pre_data ()
  {
    sbitmap trapping_expr;
!   int i;
    unsigned int ui;
  
    compute_local_properties (transp, comp, antloc, 0);
--- 4466,4472 ----
  compute_pre_data ()
  {
    sbitmap trapping_expr;
!   basic_block bb;
    unsigned int ui;
  
    compute_local_properties (transp, comp, antloc, 0);
*************** compute_pre_data ()
*** 4475,4481 ****
  
       This is significantly faster than compute_ae_kill.  */
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
        edge e;
  
--- 4489,4495 ----
  
       This is significantly faster than compute_ae_kill.  */
  
!   FOR_EACH_BB (bb)
      {
        edge e;
  
*************** compute_pre_data ()
*** 4483,4498 ****
  	 kill all trapping expressions because we won't be able to properly
  	 place the instruction on the edge.  So make them neither
  	 anticipatable nor transparent.  This is fairly conservative.  */
!       for (e = BASIC_BLOCK (i)->pred; e ; e = e->pred_next)
  	if (e->flags & EDGE_ABNORMAL)
  	  {
! 	    sbitmap_difference (antloc[i], antloc[i], trapping_expr);
! 	    sbitmap_difference (transp[i], transp[i], trapping_expr);
  	    break;
  	  }
  
!       sbitmap_a_or_b (ae_kill[i], transp[i], comp[i]);
!       sbitmap_not (ae_kill[i], ae_kill[i]);
      }
  
    edge_list = pre_edge_lcm (gcse_file, n_exprs, transp, comp, antloc,
--- 4497,4512 ----
  	 kill all trapping expressions because we won't be able to properly
  	 place the instruction on the edge.  So make them neither
  	 anticipatable nor transparent.  This is fairly conservative.  */
!       for (e = bb->pred; e ; e = e->pred_next)
  	if (e->flags & EDGE_ABNORMAL)
  	  {
! 	    sbitmap_difference (antloc[bb->index], antloc[bb->index], trapping_expr);
! 	    sbitmap_difference (transp[bb->index], transp[bb->index], trapping_expr);
  	    break;
  	  }
  
!       sbitmap_a_or_b (ae_kill[bb->index], transp[bb->index], comp[bb->index]);
!       sbitmap_not (ae_kill[bb->index], ae_kill[bb->index]);
      }
  
    edge_list = pre_edge_lcm (gcse_file, n_exprs, transp, comp, antloc,
*************** add_label_notes (x, insn)
*** 5179,5196 ****
  static void
  compute_transpout ()
  {
!   int bb;
    unsigned int i;
    struct expr *expr;
  
    sbitmap_vector_ones (transpout, n_basic_blocks);
  
!   for (bb = 0; bb < n_basic_blocks; ++bb)
      {
        /* Note that flow inserted a nop a the end of basic blocks that
  	 end in call instructions for reasons other than abnormal
  	 control flow.  */
!       if (GET_CODE (BLOCK_END (bb)) != CALL_INSN)
  	continue;
  
        for (i = 0; i < expr_hash_table_size; i++)
--- 5193,5210 ----
  static void
  compute_transpout ()
  {
!   basic_block bb;
    unsigned int i;
    struct expr *expr;
  
    sbitmap_vector_ones (transpout, n_basic_blocks);
  
!   FOR_EACH_BB (bb)
      {
        /* Note that flow inserted a nop a the end of basic blocks that
  	 end in call instructions for reasons other than abnormal
  	 control flow.  */
!       if (GET_CODE (bb->end) != CALL_INSN)
  	continue;
  
        for (i = 0; i < expr_hash_table_size; i++)
*************** compute_transpout ()
*** 5204,5210 ****
  	      /* ??? Optimally, we would use interprocedural alias
  		 analysis to determine if this mem is actually killed
  		 by this call.  */
! 	      RESET_BIT (transpout[bb], expr->bitmap_index);
  	    }
      }
  }
--- 5218,5224 ----
  	      /* ??? Optimally, we would use interprocedural alias
  		 analysis to determine if this mem is actually killed
  		 by this call.  */
! 	      RESET_BIT (transpout[bb->index], expr->bitmap_index);
  	    }
      }
  }
*************** invalidate_nonnull_info (x, setter, data
*** 5237,5244 ****
  
    regno = REGNO (x) - npi->min_reg;
  
!   RESET_BIT (npi->nonnull_local[npi->current_block], regno);
!   SET_BIT (npi->nonnull_killed[npi->current_block], regno);
  }
  
  /* Do null-pointer check elimination for the registers indicated in
--- 5251,5258 ----
  
    regno = REGNO (x) - npi->min_reg;
  
!   RESET_BIT (npi->nonnull_local[npi->current_block->index], regno);
!   SET_BIT (npi->nonnull_killed[npi->current_block->index], regno);
  }
  
  /* Do null-pointer check elimination for the registers indicated in
*************** delete_null_pointer_checks_1 (block_reg,
*** 5253,5260 ****
       sbitmap *nonnull_avout;
       struct null_pointer_info *npi;
  {
!   int bb;
!   int current_block;
    sbitmap *nonnull_local = npi->nonnull_local;
    sbitmap *nonnull_killed = npi->nonnull_killed;
    
--- 5267,5273 ----
       sbitmap *nonnull_avout;
       struct null_pointer_info *npi;
  {
!   basic_block bb, current_block;
    sbitmap *nonnull_local = npi->nonnull_local;
    sbitmap *nonnull_killed = npi->nonnull_killed;
    
*************** delete_null_pointer_checks_1 (block_reg,
*** 5269,5275 ****
    sbitmap_vector_zero (nonnull_local, n_basic_blocks);
    sbitmap_vector_zero (nonnull_killed, n_basic_blocks);
  
!   for (current_block = 0; current_block < n_basic_blocks; current_block++)
      {
        rtx insn, stop_insn;
  
--- 5282,5288 ----
    sbitmap_vector_zero (nonnull_local, n_basic_blocks);
    sbitmap_vector_zero (nonnull_killed, n_basic_blocks);
  
!   FOR_EACH_BB (current_block)
      {
        rtx insn, stop_insn;
  
*************** delete_null_pointer_checks_1 (block_reg,
*** 5278,5285 ****
  
        /* Scan each insn in the basic block looking for memory references and
  	 register sets.  */
!       stop_insn = NEXT_INSN (BLOCK_END (current_block));
!       for (insn = BLOCK_HEAD (current_block);
  	   insn != stop_insn;
  	   insn = NEXT_INSN (insn))
  	{
--- 5291,5298 ----
  
        /* Scan each insn in the basic block looking for memory references and
  	 register sets.  */
!       stop_insn = NEXT_INSN (current_block->end);
!       for (insn = current_block->head;
  	   insn != stop_insn;
  	   insn = NEXT_INSN (insn))
  	{
*************** delete_null_pointer_checks_1 (block_reg,
*** 5307,5313 ****
  	      && GET_CODE ((reg = XEXP (SET_SRC (set), 0))) == REG
  	      && REGNO (reg) >= npi->min_reg
  	      && REGNO (reg) < npi->max_reg)
! 	    SET_BIT (nonnull_local[current_block],
  		     REGNO (reg) - npi->min_reg);
  
  	  /* Now invalidate stuff clobbered by this insn.  */
--- 5320,5326 ----
  	      && GET_CODE ((reg = XEXP (SET_SRC (set), 0))) == REG
  	      && REGNO (reg) >= npi->min_reg
  	      && REGNO (reg) < npi->max_reg)
! 	    SET_BIT (nonnull_local[current_block->index],
  		     REGNO (reg) - npi->min_reg);
  
  	  /* Now invalidate stuff clobbered by this insn.  */
*************** delete_null_pointer_checks_1 (block_reg,
*** 5320,5326 ****
  	      && GET_CODE ((reg = XEXP (SET_DEST (set), 0))) == REG
  	      && REGNO (reg) >= npi->min_reg
  	      && REGNO (reg) < npi->max_reg)
! 	    SET_BIT (nonnull_local[current_block],
  		     REGNO (reg) - npi->min_reg);
  	}
      }
--- 5333,5339 ----
  	      && GET_CODE ((reg = XEXP (SET_DEST (set), 0))) == REG
  	      && REGNO (reg) >= npi->min_reg
  	      && REGNO (reg) < npi->max_reg)
! 	    SET_BIT (nonnull_local[current_block->index],
  		     REGNO (reg) - npi->min_reg);
  	}
      }
*************** delete_null_pointer_checks_1 (block_reg,
*** 5332,5348 ****
  
    /* Now look at each bb and see if it ends with a compare of a value
       against zero.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       rtx last_insn = BLOCK_END (bb);
        rtx condition, earliest;
        int compare_and_branch;
  
        /* Since MIN_REG is always at least FIRST_PSEUDO_REGISTER, and
  	 since BLOCK_REG[BB] is zero if this block did not end with a
  	 comparison against zero, this condition works.  */
!       if (block_reg[bb] < npi->min_reg
! 	  || block_reg[bb] >= npi->max_reg)
  	continue;
  
        /* LAST_INSN is a conditional jump.  Get its condition.  */
--- 5345,5361 ----
  
    /* Now look at each bb and see if it ends with a compare of a value
       against zero.  */
!   FOR_EACH_BB (bb)
      {
!       rtx last_insn = bb->end;
        rtx condition, earliest;
        int compare_and_branch;
  
        /* Since MIN_REG is always at least FIRST_PSEUDO_REGISTER, and
  	 since BLOCK_REG[BB] is zero if this block did not end with a
  	 comparison against zero, this condition works.  */
!       if (block_reg[bb->index] < npi->min_reg
! 	  || block_reg[bb->index] >= npi->max_reg)
  	continue;
  
        /* LAST_INSN is a conditional jump.  Get its condition.  */
*************** delete_null_pointer_checks_1 (block_reg,
*** 5353,5359 ****
  	continue;
  
        /* Is the register known to have a nonzero value?  */
!       if (!TEST_BIT (nonnull_avout[bb], block_reg[bb] - npi->min_reg))
  	continue;
  
        /* Try to compute whether the compare/branch at the loop end is one or
--- 5366,5372 ----
  	continue;
  
        /* Is the register known to have a nonzero value?  */
!       if (!TEST_BIT (nonnull_avout[bb->index], block_reg[bb->index] - npi->min_reg))
  	continue;
  
        /* Try to compute whether the compare/branch at the loop end is one or
*************** delete_null_pointer_checks_1 (block_reg,
*** 5381,5392 ****
        delete_insn (last_insn);
        if (compare_and_branch == 2)
          delete_insn (earliest);
!       purge_dead_edges (BASIC_BLOCK (bb));
  
        /* Don't check this block again.  (Note that BLOCK_END is
  	 invalid here; we deleted the last instruction in the 
  	 block.)  */
!       block_reg[bb] = 0;
      }
  }
  
--- 5394,5405 ----
        delete_insn (last_insn);
        if (compare_and_branch == 2)
          delete_insn (earliest);
!       purge_dead_edges (bb);
  
        /* Don't check this block again.  (Note that BLOCK_END is
  	 invalid here; we deleted the last instruction in the 
  	 block.)  */
!       block_reg[bb->index] = 0;
      }
  }
  
*************** delete_null_pointer_checks (f)
*** 5420,5426 ****
  {
    sbitmap *nonnull_avin, *nonnull_avout;
    unsigned int *block_reg;
!   int bb;
    int reg;
    int regs_per_pass;
    int max_reg;
--- 5433,5439 ----
  {
    sbitmap *nonnull_avin, *nonnull_avout;
    unsigned int *block_reg;
!   basic_block bb;
    int reg;
    int regs_per_pass;
    int max_reg;
*************** delete_null_pointer_checks (f)
*** 5456,5464 ****
       ends with a conditional branch whose condition is a comparison
       against zero.  Record the register compared in BLOCK_REG.  */
    block_reg = (unsigned int *) xcalloc (n_basic_blocks, sizeof (int));
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       rtx last_insn = BLOCK_END (bb);
        rtx condition, earliest, reg;
  
        /* We only want conditional branches.  */
--- 5469,5477 ----
       ends with a conditional branch whose condition is a comparison
       against zero.  Record the register compared in BLOCK_REG.  */
    block_reg = (unsigned int *) xcalloc (n_basic_blocks, sizeof (int));
!   FOR_EACH_BB (bb)
      {
!       rtx last_insn = bb->end;
        rtx condition, earliest, reg;
  
        /* We only want conditional branches.  */
*************** delete_null_pointer_checks (f)
*** 5484,5490 ****
        if (GET_CODE (reg) != REG)
  	continue;
  
!       block_reg[bb] = REGNO (reg);
      }
  
    /* Go through the algorithm for each block of registers.  */
--- 5497,5503 ----
        if (GET_CODE (reg) != REG)
  	continue;
  
!       block_reg[bb->index] = REGNO (reg);
      }
  
    /* Go through the algorithm for each block of registers.  */
*************** free_code_hoist_mem ()
*** 5568,5574 ****
  static void
  compute_code_hoist_vbeinout ()
  {
!   int bb, changed, passes;
  
    sbitmap_vector_zero (hoist_vbeout, n_basic_blocks);
    sbitmap_vector_zero (hoist_vbein, n_basic_blocks);
--- 5581,5588 ----
  static void
  compute_code_hoist_vbeinout ()
  {
!   int changed, passes;
!   basic_block bb;
  
    sbitmap_vector_zero (hoist_vbeout, n_basic_blocks);
    sbitmap_vector_zero (hoist_vbein, n_basic_blocks);
*************** compute_code_hoist_vbeinout ()
*** 5582,5593 ****
  
        /* We scan the blocks in the reverse order to speed up
  	 the convergence.  */
!       for (bb = n_basic_blocks - 1; bb >= 0; bb--)
  	{
! 	  changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb], antloc[bb],
! 					      hoist_vbeout[bb], transp[bb]);
! 	  if (BASIC_BLOCK (bb)->next_bb != EXIT_BLOCK_PTR)
! 	    sbitmap_intersection_of_succs (hoist_vbeout[bb], hoist_vbein, bb);
  	}
  
        passes++;
--- 5596,5607 ----
  
        /* We scan the blocks in the reverse order to speed up
  	 the convergence.  */
!       FOR_EACH_BB_REVERSE (bb)
  	{
! 	  changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb->index], antloc[bb->index],
! 					      hoist_vbeout[bb->index], transp[bb->index]);
! 	  if (bb->next_bb != EXIT_BLOCK_PTR)
! 	    sbitmap_intersection_of_succs (hoist_vbeout[bb->index], hoist_vbein, bb->index);
  	}
  
        passes++;
*************** hoist_expr_reaches_here_p (expr_bb, expr
*** 5675,5681 ****
  static void
  hoist_code ()
  {
!   int bb, dominated;
    unsigned int i;
    struct expr **index_map;
    struct expr *expr;
--- 5689,5695 ----
  static void
  hoist_code ()
  {
!   basic_block bb, dominated;
    unsigned int i;
    struct expr **index_map;
    struct expr *expr;
*************** hoist_code ()
*** 5692,5724 ****
  
    /* Walk over each basic block looking for potentially hoistable
       expressions, nothing gets hoisted from the entry block.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
        int found = 0;
        int insn_inserted_p;
  
        /* Examine each expression that is very busy at the exit of this
  	 block.  These are the potentially hoistable expressions.  */
!       for (i = 0; i < hoist_vbeout[bb]->n_bits; i++)
  	{
  	  int hoistable = 0;
  
! 	  if (TEST_BIT (hoist_vbeout[bb], i) && TEST_BIT (transpout[bb], i))
  	    {
  	      /* We've found a potentially hoistable expression, now
  		 we look at every block BB dominates to see if it
  		 computes the expression.  */
! 	      for (dominated = 0; dominated < n_basic_blocks; dominated++)
  		{
  		  /* Ignore self dominance.  */
  		  if (bb == dominated
! 		      || ! TEST_BIT (dominators[dominated], bb))
  		    continue;
  
  		  /* We've found a dominated block, now see if it computes
  		     the busy expression and whether or not moving that
  		     expression to the "beginning" of that block is safe.  */
! 		  if (!TEST_BIT (antloc[dominated], i))
  		    continue;
  
  		  /* Note if the expression would reach the dominated block
--- 5706,5738 ----
  
    /* Walk over each basic block looking for potentially hoistable
       expressions, nothing gets hoisted from the entry block.  */
!   FOR_EACH_BB (bb)
      {
        int found = 0;
        int insn_inserted_p;
  
        /* Examine each expression that is very busy at the exit of this
  	 block.  These are the potentially hoistable expressions.  */
!       for (i = 0; i < hoist_vbeout[bb->index]->n_bits; i++)
  	{
  	  int hoistable = 0;
  
! 	  if (TEST_BIT (hoist_vbeout[bb->index], i) && TEST_BIT (transpout[bb->index], i))
  	    {
  	      /* We've found a potentially hoistable expression, now
  		 we look at every block BB dominates to see if it
  		 computes the expression.  */
! 	      FOR_EACH_BB (dominated)
  		{
  		  /* Ignore self dominance.  */
  		  if (bb == dominated
! 		      || ! TEST_BIT (dominators[dominated->index], bb->index))
  		    continue;
  
  		  /* We've found a dominated block, now see if it computes
  		     the busy expression and whether or not moving that
  		     expression to the "beginning" of that block is safe.  */
! 		  if (!TEST_BIT (antloc[dominated->index], i))
  		    continue;
  
  		  /* Note if the expression would reach the dominated block
*************** hoist_code ()
*** 5726,5733 ****
  
  		     Keep track of how many times this expression is hoistable
  		     from a dominated block into BB.  */
! 		  if (hoist_expr_reaches_here_p (BASIC_BLOCK (bb), i, 
! 						 BASIC_BLOCK (dominated), NULL))
  		    hoistable++;
  		}
  
--- 5740,5746 ----
  
  		     Keep track of how many times this expression is hoistable
  		     from a dominated block into BB.  */
! 		  if (hoist_expr_reaches_here_p (bb, i, dominated, NULL))
  		    hoistable++;
  		}
  
*************** hoist_code ()
*** 5743,5749 ****
  		 to nullify any benefit we get from code hoisting.  */
  	      if (hoistable > 1)
  		{
! 		  SET_BIT (hoist_exprs[bb], i);
  		  found = 1;
  		}
  	    }
--- 5756,5762 ----
  		 to nullify any benefit we get from code hoisting.  */
  	      if (hoistable > 1)
  		{
! 		  SET_BIT (hoist_exprs[bb->index], i);
  		  found = 1;
  		}
  	    }
*************** hoist_code ()
*** 5754,5782 ****
  	continue;
  
        /* Loop over all the hoistable expressions.  */
!       for (i = 0; i < hoist_exprs[bb]->n_bits; i++)
  	{
  	  /* We want to insert the expression into BB only once, so
  	     note when we've inserted it.  */
  	  insn_inserted_p = 0;
  
  	  /* These tests should be the same as the tests above.  */
! 	  if (TEST_BIT (hoist_vbeout[bb], i))
  	    {
  	      /* We've found a potentially hoistable expression, now
  		 we look at every block BB dominates to see if it
  		 computes the expression.  */
! 	      for (dominated = 0; dominated < n_basic_blocks; dominated++)
  		{
  		  /* Ignore self dominance.  */
  		  if (bb == dominated
! 		      || ! TEST_BIT (dominators[dominated], bb))
  		    continue;
  
  		  /* We've found a dominated block, now see if it computes
  		     the busy expression and whether or not moving that
  		     expression to the "beginning" of that block is safe.  */
! 		  if (!TEST_BIT (antloc[dominated], i))
  		    continue;
  
  		  /* The expression is computed in the dominated block and
--- 5767,5795 ----
  	continue;
  
        /* Loop over all the hoistable expressions.  */
!       for (i = 0; i < hoist_exprs[bb->index]->n_bits; i++)
  	{
  	  /* We want to insert the expression into BB only once, so
  	     note when we've inserted it.  */
  	  insn_inserted_p = 0;
  
  	  /* These tests should be the same as the tests above.  */
! 	  if (TEST_BIT (hoist_vbeout[bb->index], i))
  	    {
  	      /* We've found a potentially hoistable expression, now
  		 we look at every block BB dominates to see if it
  		 computes the expression.  */
! 	      FOR_EACH_BB (dominated)
  		{
  		  /* Ignore self dominance.  */
  		  if (bb == dominated
! 		      || ! TEST_BIT (dominators[dominated->index], bb->index))
  		    continue;
  
  		  /* We've found a dominated block, now see if it computes
  		     the busy expression and whether or not moving that
  		     expression to the "beginning" of that block is safe.  */
! 		  if (!TEST_BIT (antloc[dominated->index], i))
  		    continue;
  
  		  /* The expression is computed in the dominated block and
*************** hoist_code ()
*** 5784,5791 ****
  		     dominated block.  Now we have to determine if the
  		     expression would reach the dominated block if it was
  		     placed at the end of BB.  */
! 		  if (hoist_expr_reaches_here_p (BASIC_BLOCK (bb), i, 
! 						 BASIC_BLOCK (dominated), NULL))
  		    {
  		      struct expr *expr = index_map[i];
  		      struct occr *occr = expr->antic_occr;
--- 5797,5803 ----
  		     dominated block.  Now we have to determine if the
  		     expression would reach the dominated block if it was
  		     placed at the end of BB.  */
! 		  if (hoist_expr_reaches_here_p (bb, i, dominated, NULL))
  		    {
  		      struct expr *expr = index_map[i];
  		      struct occr *occr = expr->antic_occr;
*************** hoist_code ()
*** 5793,5799 ****
  		      rtx set;
  
  		      /* Find the right occurrence of this expression.  */
! 		      while (BLOCK_NUM (occr->insn) != dominated && occr)
  			occr = occr->next;
  
  		      /* Should never happen.  */
--- 5805,5811 ----
  		      rtx set;
  
  		      /* Find the right occurrence of this expression.  */
! 		      while (BLOCK_FOR_INSN (occr->insn) != dominated && occr)
  			occr = occr->next;
  
  		      /* Should never happen.  */
*************** hoist_code ()
*** 5827,5834 ****
  			  occr->deleted_p = 1;
  			  if (!insn_inserted_p)
  			    {
! 			      insert_insn_end_bb (index_map[i], 
! 						  BASIC_BLOCK (bb), 0);
  			      insn_inserted_p = 1;
  			    }
  			}
--- 5839,5845 ----
  			  occr->deleted_p = 1;
  			  if (!insn_inserted_p)
  			    {
! 			      insert_insn_end_bb (index_map[i], bb, 0);
  			      insn_inserted_p = 1;
  			    }
  			}
*************** static void 
*** 6108,6122 ****
  compute_ld_motion_mems ()
  {
    struct ls_expr * ptr;
!   int bb;
    rtx insn;
    
    pre_ldst_mems = NULL;
  
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       for (insn = BLOCK_HEAD (bb);
! 	   insn && insn != NEXT_INSN (BLOCK_END (bb));
  	   insn = NEXT_INSN (insn))
  	{
  	  if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
--- 6119,6133 ----
  compute_ld_motion_mems ()
  {
    struct ls_expr * ptr;
!   basic_block bb;
    rtx insn;
    
    pre_ldst_mems = NULL;
  
!   FOR_EACH_BB (bb)
      {
!       for (insn = bb->head;
! 	   insn && insn != NEXT_INSN (bb->end);
  	   insn = NEXT_INSN (insn))
  	{
  	  if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
*************** find_moveable_store (insn)
*** 6433,6439 ****
  static int
  compute_store_table ()
  {
!   int bb, ret;
    unsigned regno;
    rtx insn, pat;
  
--- 6444,6451 ----
  static int
  compute_store_table ()
  {
!   int ret;
!   basic_block bb;
    unsigned regno;
    rtx insn, pat;
  
*************** compute_store_table ()
*** 6445,6455 ****
    pre_ldst_mems = 0;
  
    /* Find all the stores we care about.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       regvec = & (reg_set_in_block[bb]);
!       for (insn = BLOCK_END (bb);
! 	   insn && insn != PREV_INSN (BLOCK_HEAD (bb));
  	   insn = PREV_INSN (insn))
  	{
  	  /* Ignore anything that is not a normal insn.  */
--- 6457,6467 ----
    pre_ldst_mems = 0;
  
    /* Find all the stores we care about.  */
!   FOR_EACH_BB (bb)
      {
!       regvec = & (reg_set_in_block[bb->index]);
!       for (insn = bb->end;
! 	   insn && insn != PREV_INSN (bb->end);
  	   insn = PREV_INSN (insn))
  	{
  	  /* Ignore anything that is not a normal insn.  */
*************** compute_store_table ()
*** 6468,6474 ****
  	      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  		if (clobbers_all
  		    || TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
! 		  SET_BIT (reg_set_in_block[bb], regno);
  	    }
  	  
  	  pat = PATTERN (insn);
--- 6480,6486 ----
  	      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  		if (clobbers_all
  		    || TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
! 		  SET_BIT (reg_set_in_block[bb->index], regno);
  	    }
  	  
  	  pat = PATTERN (insn);
*************** store_killed_before (x, insn, bb)
*** 6634,6641 ****
  static void
  build_store_vectors () 
  {
!   basic_block bb;
!   int b;
    rtx insn, st;
    struct ls_expr * ptr;
  
--- 6646,6652 ----
  static void
  build_store_vectors () 
  {
!   basic_block bb, b;
    rtx insn, st;
    struct ls_expr * ptr;
  
*************** build_store_vectors () 
*** 6707,6715 ****
    sbitmap_vector_zero (transp, n_basic_blocks);
  
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
!     for (b = 0; b < n_basic_blocks; b++)
        {
! 	if (store_killed_after (ptr->pattern, BLOCK_HEAD (b), BASIC_BLOCK (b)))
  	  {
  	    /* The anticipatable expression is not killed if it's gen'd.  */
  	    /*
--- 6718,6726 ----
    sbitmap_vector_zero (transp, n_basic_blocks);
  
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
!     FOR_EACH_BB (b)
        {
! 	if (store_killed_after (ptr->pattern, b->head, b))
  	  {
  	    /* The anticipatable expression is not killed if it's gen'd.  */
  	    /*
*************** build_store_vectors () 
*** 6727,6736 ****
  	      If we always kill it in this case, we'll sometimes do
  	      uneccessary work, but it shouldn't actually hurt anything.
  	    if (!TEST_BIT (ae_gen[b], ptr->index)).  */
! 	    SET_BIT (ae_kill[b], ptr->index);
  	  }
  	else
! 	  SET_BIT (transp[b], ptr->index);
        }
  
    /* Any block with no exits calls some non-returning function, so
--- 6738,6747 ----
  	      If we always kill it in this case, we'll sometimes do
  	      uneccessary work, but it shouldn't actually hurt anything.
  	    if (!TEST_BIT (ae_gen[b], ptr->index)).  */
! 	    SET_BIT (ae_kill[b->index], ptr->index);
  	  }
  	else
! 	  SET_BIT (transp[b->index], ptr->index);
        }
  
    /* Any block with no exits calls some non-returning function, so
*************** free_store_memory ()
*** 6939,6944 ****
--- 6950,6956 ----
  static void
  store_motion ()
  {
+   basic_block bb;
    int x;
    struct ls_expr * ptr;
    int update_flow = 0;
*************** store_motion ()
*** 6972,6980 ****
    /* Now we want to insert the new stores which are going to be needed.  */
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
      {
!       for (x = 0; x < n_basic_blocks; x++)
! 	if (TEST_BIT (pre_delete_map[x], ptr->index))
! 	  delete_store (ptr, BASIC_BLOCK (x));
  
        for (x = 0; x < NUM_EDGES (edge_list); x++)
  	if (TEST_BIT (pre_insert_map[x], ptr->index))
--- 6984,6992 ----
    /* Now we want to insert the new stores which are going to be needed.  */
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
      {
!       FOR_EACH_BB (bb)
! 	if (TEST_BIT (pre_delete_map[bb->index], ptr->index))
! 	  delete_store (ptr, bb);
  
        for (x = 0; x < NUM_EDGES (edge_list); x++)
  	if (TEST_BIT (pre_insert_map[x], ptr->index))
Index: global.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/global.c,v
retrieving revision 1.80
diff -c -3 -p -r1.80 global.c
*** global.c	21 May 2002 20:37:41 -0000	1.80
--- global.c	22 May 2002 17:04:33 -0000
*************** allocno_compare (v1p, v2p)
*** 636,642 ****
  static void
  global_conflicts ()
  {
!   int b, i;
    rtx insn;
    int *block_start_allocnos;
  
--- 636,643 ----
  static void
  global_conflicts ()
  {
!   int i;
!   basic_block b;
    rtx insn;
    int *block_start_allocnos;
  
*************** global_conflicts ()
*** 645,651 ****
  
    block_start_allocnos = (int *) xmalloc (max_allocno * sizeof (int));
  
!   for (b = 0; b < n_basic_blocks; b++)
      {
        memset ((char *) allocnos_live, 0, allocno_row_words * sizeof (INT_TYPE));
  
--- 646,652 ----
  
    block_start_allocnos = (int *) xmalloc (max_allocno * sizeof (int));
  
!   FOR_EACH_BB (b)
      {
        memset ((char *) allocnos_live, 0, allocno_row_words * sizeof (INT_TYPE));
  
*************** global_conflicts ()
*** 664,670 ****
  	 are explicitly marked in basic_block_live_at_start.  */
  
        {
! 	regset old = BASIC_BLOCK (b)->global_live_at_start;
  	int ax = 0;
  
  	REG_SET_TO_HARD_REG_SET (hard_regs_live, old);
--- 665,671 ----
  	 are explicitly marked in basic_block_live_at_start.  */
  
        {
! 	regset old = b->global_live_at_start;
  	int ax = 0;
  
  	REG_SET_TO_HARD_REG_SET (hard_regs_live, old);
*************** global_conflicts ()
*** 713,719 ****
  	     that is reached by an abnormal edge.  */
  
  	  edge e;
! 	  for (e = BASIC_BLOCK (b)->pred; e ; e = e->pred_next)
  	    if (e->flags & EDGE_ABNORMAL)
  	      break;
  	  if (e != NULL)
--- 714,720 ----
  	     that is reached by an abnormal edge.  */
  
  	  edge e;
! 	  for (e = b->pred; e ; e = e->pred_next)
  	    if (e->flags & EDGE_ABNORMAL)
  	      break;
  	  if (e != NULL)
*************** global_conflicts ()
*** 723,729 ****
  #endif
        }
  
!       insn = BLOCK_HEAD (b);
  
        /* Scan the code of this basic block, noting which allocnos
  	 and hard regs are born or die.  When one is born,
--- 724,730 ----
  #endif
        }
  
!       insn = b->head;
  
        /* Scan the code of this basic block, noting which allocnos
  	 and hard regs are born or die.  When one is born,
*************** global_conflicts ()
*** 823,829 ****
  		}
  	    }
  
! 	  if (insn == BLOCK_END (b))
  	    break;
  	  insn = NEXT_INSN (insn);
  	}
--- 824,830 ----
  		}
  	    }
  
! 	  if (insn == b->end)
  	    break;
  	  insn = NEXT_INSN (insn);
  	}
*************** void
*** 1708,1718 ****
  mark_elimination (from, to)
       int from, to;
  {
!   int i;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
!       regset r = BASIC_BLOCK (i)->global_live_at_start; 
        if (REGNO_REG_SET_P (r, from))
  	{
  	  CLEAR_REGNO_REG_SET (r, from);
--- 1709,1719 ----
  mark_elimination (from, to)
       int from, to;
  {
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
      {
!       regset r = bb->global_live_at_start; 
        if (REGNO_REG_SET_P (r, from))
  	{
  	  CLEAR_REGNO_REG_SET (r, from);
Index: graph.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/graph.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 graph.c
*** graph.c	17 May 2002 02:31:35 -0000	1.21
--- graph.c	22 May 2002 17:04:33 -0000
*************** print_rtl_graph_with_bb (base, suffix, r
*** 258,264 ****
      fprintf (fp, "(nil)\n");
    else
      {
-       int i;
        enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB };
        int max_uid = get_max_uid ();
        int *start = (int *) xmalloc (max_uid * sizeof (int));
--- 258,263 ----
*************** print_rtl_graph_with_bb (base, suffix, r
*** 266,271 ****
--- 265,271 ----
        enum bb_state *in_bb_p = (enum bb_state *)
  	xmalloc (max_uid * sizeof (enum bb_state));
        basic_block bb;
+       int i;
  
        for (i = 0; i < max_uid; ++i)
  	{
*************** print_rtl_graph_with_bb (base, suffix, r
*** 273,284 ****
  	  in_bb_p[i] = NOT_IN_BB;
  	}
  
!       for (i = n_basic_blocks - 1; i >= 0; --i)
  	{
  	  rtx x;
! 	  bb = BASIC_BLOCK (i);
! 	  start[INSN_UID (bb->head)] = i;
! 	  end[INSN_UID (bb->end)] = i;
  	  for (x = bb->head; x != NULL_RTX; x = NEXT_INSN (x))
  	    {
  	      in_bb_p[INSN_UID (x)]
--- 273,283 ----
  	  in_bb_p[i] = NOT_IN_BB;
  	}
  
!       FOR_EACH_BB_REVERSE (bb)
  	{
  	  rtx x;
! 	  start[INSN_UID (bb->head)] = bb->index;
! 	  end[INSN_UID (bb->end)] = bb->index;
  	  for (x = bb->head; x != NULL_RTX; x = NEXT_INSN (x))
  	    {
  	      in_bb_p[INSN_UID (x)]
Index: haifa-sched.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/haifa-sched.c,v
retrieving revision 1.201
diff -c -3 -p -r1.201 haifa-sched.c
*** haifa-sched.c	17 May 2002 02:31:35 -0000	1.201
--- haifa-sched.c	22 May 2002 17:04:34 -0000
*************** void
*** 2303,2309 ****
  sched_init (dump_file)
       FILE *dump_file;
  {
!   int luid, b;
    rtx insn;
    int i;
  
--- 2303,2310 ----
  sched_init (dump_file)
       FILE *dump_file;
  {
!   int luid;
!   basic_block b;
    rtx insn;
    int i;
  
*************** sched_init (dump_file)
*** 2356,2363 ****
  
    h_i_d[0].luid = 0;
    luid = 1;
!   for (b = 0; b < n_basic_blocks; b++)
!     for (insn = BLOCK_HEAD (b);; insn = NEXT_INSN (insn))
        {
  	INSN_LUID (insn) = luid;
  
--- 2357,2364 ----
  
    h_i_d[0].luid = 0;
    luid = 1;
!   FOR_EACH_BB (b)
!     for (insn = b->head;; insn = NEXT_INSN (insn))
        {
  	INSN_LUID (insn) = luid;
  
*************** sched_init (dump_file)
*** 2369,2375 ****
  	if (GET_CODE (insn) != NOTE)
  	  ++luid;
  
! 	if (insn == BLOCK_END (b))
  	  break;
        }
  
--- 2370,2376 ----
  	if (GET_CODE (insn) != NOTE)
  	  ++luid;
  
! 	if (insn == b->end)
  	  break;
        }
  
*************** sched_init (dump_file)
*** 2391,2412 ****
           predecessor has been scheduled, it is impossible to accurately
           determine the correct line number for the first insn of the block.  */
  
!       for (b = 0; b < n_basic_blocks; b++)
  	{
! 	  for (line = BLOCK_HEAD (b); line; line = PREV_INSN (line))
  	    if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
  	      {
! 		line_note_head[b] = line;
  		break;
  	      }
  	  /* Do a forward search as well, since we won't get to see the first
  	     notes in a basic block.  */
! 	  for (line = BLOCK_HEAD (b); line; line = NEXT_INSN (line))
  	    {
  	      if (INSN_P (line))
  		break;
  	      if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
! 		line_note_head[b] = line;
  	    }
  	}
      }
--- 2392,2413 ----
           predecessor has been scheduled, it is impossible to accurately
           determine the correct line number for the first insn of the block.  */
  
!       FOR_EACH_BB (b)
  	{
! 	  for (line = b->head; line; line = PREV_INSN (line))
  	    if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
  	      {
! 		line_note_head[b->index] = line;
  		break;
  	      }
  	  /* Do a forward search as well, since we won't get to see the first
  	     notes in a basic block.  */
! 	  for (line = b->head; line; line = NEXT_INSN (line))
  	    {
  	      if (INSN_P (line))
  		break;
  	      if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
! 		line_note_head[b->index] = line;
  	    }
  	}
      }
*************** sched_init (dump_file)
*** 2420,2441 ****
    /* ??? Add a NOTE after the last insn of the last basic block.  It is not
       known why this is done.  */
  
!   insn = BLOCK_END (n_basic_blocks - 1);
    if (NEXT_INSN (insn) == 0
        || (GET_CODE (insn) != NOTE
  	  && GET_CODE (insn) != CODE_LABEL
  	  /* Don't emit a NOTE if it would end up before a BARRIER.  */
  	  && GET_CODE (NEXT_INSN (insn)) != BARRIER))
      {
!       emit_note_after (NOTE_INSN_DELETED, BLOCK_END (n_basic_blocks - 1));
        /* Make insn to appear outside BB.  */
!       BLOCK_END (n_basic_blocks - 1) = PREV_INSN (BLOCK_END (n_basic_blocks - 1));
      }
  
    /* Compute INSN_REG_WEIGHT for all blocks.  We must do this before
       removing death notes.  */
!   for (b = n_basic_blocks - 1; b >= 0; b--)
!     find_insn_reg_weight (b);
  }
  
  /* Free global data used during insn scheduling.  */
--- 2421,2442 ----
    /* ??? Add a NOTE after the last insn of the last basic block.  It is not
       known why this is done.  */
  
!   insn = EXIT_BLOCK_PTR->prev_bb->end;
    if (NEXT_INSN (insn) == 0
        || (GET_CODE (insn) != NOTE
  	  && GET_CODE (insn) != CODE_LABEL
  	  /* Don't emit a NOTE if it would end up before a BARRIER.  */
  	  && GET_CODE (NEXT_INSN (insn)) != BARRIER))
      {
!       emit_note_after (NOTE_INSN_DELETED, EXIT_BLOCK_PTR->prev_bb->end);
        /* Make insn to appear outside BB.  */
!       EXIT_BLOCK_PTR->prev_bb->end = PREV_INSN (EXIT_BLOCK_PTR->prev_bb->end);
      }
  
    /* Compute INSN_REG_WEIGHT for all blocks.  We must do this before
       removing death notes.  */
!   FOR_EACH_BB_REVERSE (b)
!     find_insn_reg_weight (b->index);
  }
  
  /* Free global data used during insn scheduling.  */
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.90
diff -c -3 -p -r1.90 ifcvt.c
*** ifcvt.c	21 May 2002 20:37:41 -0000	1.90
--- ifcvt.c	22 May 2002 17:04:34 -0000
*************** void
*** 2685,2691 ****
  if_convert (x_life_data_ok)
       int x_life_data_ok;
  {
!   int block_num;
  
    num_possible_if_blocks = 0;
    num_updated_if_blocks = 0;
--- 2685,2691 ----
  if_convert (x_life_data_ok)
       int x_life_data_ok;
  {
!   basic_block bb;
  
    num_possible_if_blocks = 0;
    num_updated_if_blocks = 0;
*************** if_convert (x_life_data_ok)
*** 2707,2724 ****
      clear_bb_flags ();
  
    /* Record initial block numbers.  */
!   for (block_num = 0; block_num < n_basic_blocks; block_num++)
!     SET_ORIG_INDEX (BASIC_BLOCK (block_num), block_num);
  
    /* Go through each of the basic blocks looking for things to convert.  */
!   for (block_num = 0; block_num < n_basic_blocks; )
!     {
!       basic_block bb = BASIC_BLOCK (block_num);
!       if (find_if_header (bb))
! 	block_num = bb->index;
!       else 
! 	block_num++;
!     }
  
    if (post_dominators)
      sbitmap_vector_free (post_dominators);
--- 2707,2719 ----
      clear_bb_flags ();
  
    /* Record initial block numbers.  */
!   FOR_EACH_BB (bb)
!     SET_ORIG_INDEX (bb, bb->index);
  
    /* Go through each of the basic blocks looking for things to convert.  */
!   FOR_EACH_BB (bb)
!     while (find_if_header (bb))
!       continue;
  
    if (post_dominators)
      sbitmap_vector_free (post_dominators);
Index: lcm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/lcm.c,v
retrieving revision 1.42
diff -c -3 -p -r1.42 lcm.c
*** lcm.c	17 May 2002 02:31:36 -0000	1.42
--- lcm.c	22 May 2002 17:04:34 -0000
*************** compute_antinout_edge (antloc, transp, a
*** 106,112 ****
       sbitmap *antin;
       sbitmap *antout;
  {
!   int bb;
    edge e;
    basic_block *worklist, *qin, *qout, *qend;
    unsigned int qlen;
--- 106,112 ----
       sbitmap *antin;
       sbitmap *antout;
  {
!   basic_block bb;
    edge e;
    basic_block *worklist, *qin, *qout, *qend;
    unsigned int qlen;
*************** compute_antinout_edge (antloc, transp, a
*** 123,132 ****
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of ANTIN above.  */
!   for (bb = n_basic_blocks - 1; bb >= 0; bb--)
      {
!       *qin++ = BASIC_BLOCK (bb);
!       BASIC_BLOCK (bb)->aux = BASIC_BLOCK (bb);
      }
  
    qin = worklist;
--- 123,132 ----
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of ANTIN above.  */
!   FOR_EACH_BB_REVERSE (bb)
      {
!       *qin++ =bb;
!       bb->aux = bb;
      }
  
    qin = worklist;
*************** compute_antinout_edge (antloc, transp, a
*** 142,173 ****
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       basic_block b = *qout++;
!       bb = b->index;
        qlen--;
  
        if (qout >= qend)
          qout = worklist;
  
!       if (b->aux == EXIT_BLOCK_PTR)
  	/* Do not clear the aux field for blocks which are predecessors of
  	   the EXIT block.  That way we never add then to the worklist
  	   again.  */
! 	sbitmap_zero (antout[bb]);
        else
  	{
  	  /* Clear the aux field of this block so that it can be added to
  	     the worklist again if necessary.  */
! 	  b->aux = NULL;
! 	  sbitmap_intersection_of_succs (antout[bb], antin, bb);
  	}
  
!       if (sbitmap_a_or_b_and_c_cg (antin[bb], antloc[bb],
! 				   transp[bb], antout[bb]))
  	/* If the in state of this block changed, then we need
  	   to add the predecessors of this block to the worklist
  	   if they are not already on the worklist.  */
! 	for (e = b->pred; e; e = e->pred_next)
  	  if (!e->src->aux && e->src != ENTRY_BLOCK_PTR)
  	    {
  	      *qin++ = e->src;
--- 142,172 ----
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       bb = *qout++;
        qlen--;
  
        if (qout >= qend)
          qout = worklist;
  
!       if (bb->aux == EXIT_BLOCK_PTR)
  	/* Do not clear the aux field for blocks which are predecessors of
  	   the EXIT block.  That way we never add then to the worklist
  	   again.  */
! 	sbitmap_zero (antout[bb->index]);
        else
  	{
  	  /* Clear the aux field of this block so that it can be added to
  	     the worklist again if necessary.  */
! 	  bb->aux = NULL;
! 	  sbitmap_intersection_of_succs (antout[bb->index], antin, bb->index);
  	}
  
!       if (sbitmap_a_or_b_and_c_cg (antin[bb->index], antloc[bb->index],
! 				   transp[bb->index], antout[bb->index]))
  	/* If the in state of this block changed, then we need
  	   to add the predecessors of this block to the worklist
  	   if they are not already on the worklist.  */
! 	for (e = bb->pred; e; e = e->pred_next)
  	  if (!e->src->aux && e->src != ENTRY_BLOCK_PTR)
  	    {
  	      *qin++ = e->src;
*************** compute_laterin (edge_list, earliest, an
*** 263,271 ****
       struct edge_list *edge_list;
       sbitmap *earliest, *antloc, *later, *laterin;
  {
!   int bb, num_edges, i;
    edge e;
!   basic_block *worklist, *qin, *qout, *qend;
    unsigned int qlen;
  
    num_edges = NUM_EDGES (edge_list);
--- 262,270 ----
       struct edge_list *edge_list;
       sbitmap *earliest, *antloc, *later, *laterin;
  {
!   int num_edges, i;
    edge e;
!   basic_block *worklist, *qin, *qout, *qend, bb;
    unsigned int qlen;
  
    num_edges = NUM_EDGES (edge_list);
*************** compute_laterin (edge_list, earliest, an
*** 301,311 ****
  
    /* Add all the blocks to the worklist.  This prevents an early exit from
       the loop given our optimistic initialization of LATER above.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       basic_block b = BASIC_BLOCK (bb);
!       *qin++ = b;
!       b->aux = b;
      }
    qin = worklist;
    /* Note that we do not use the last allocated element for our queue,
--- 300,309 ----
  
    /* Add all the blocks to the worklist.  This prevents an early exit from
       the loop given our optimistic initialization of LATER above.  */
!   FOR_EACH_BB (bb)
      {
!       *qin++ = bb;
!       bb->aux = bb;
      }
    qin = worklist;
    /* Note that we do not use the last allocated element for our queue,
*************** compute_laterin (edge_list, earliest, an
*** 318,337 ****
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       basic_block b = *qout++;
!       b->aux = NULL;
        qlen--;
        if (qout >= qend)
          qout = worklist;
  
        /* Compute the intersection of LATERIN for each incoming edge to B.  */
!       bb = b->index;
!       sbitmap_ones (laterin[bb]);
!       for (e = b->pred; e != NULL; e = e->pred_next)
! 	sbitmap_a_and_b (laterin[bb], laterin[bb], later[(size_t)e->aux]);
  
        /* Calculate LATER for all outgoing edges.  */
!       for (e = b->succ; e != NULL; e = e->succ_next)
  	if (sbitmap_union_of_diff_cg (later[(size_t) e->aux],
  				      earliest[(size_t) e->aux],
  				      laterin[e->src->index],
--- 316,334 ----
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       bb = *qout++;
!       bb->aux = NULL;
        qlen--;
        if (qout >= qend)
          qout = worklist;
  
        /* Compute the intersection of LATERIN for each incoming edge to B.  */
!       sbitmap_ones (laterin[bb->index]);
!       for (e = bb->pred; e != NULL; e = e->pred_next)
! 	sbitmap_a_and_b (laterin[bb->index], laterin[bb->index], later[(size_t)e->aux]);
  
        /* Calculate LATER for all outgoing edges.  */
!       for (e = bb->succ; e != NULL; e = e->succ_next)
  	if (sbitmap_union_of_diff_cg (later[(size_t) e->aux],
  				      earliest[(size_t) e->aux],
  				      laterin[e->src->index],
*************** compute_insert_delete (edge_list, antloc
*** 370,378 ****
       sbitmap *antloc, *later, *laterin, *insert, *delete;
  {
    int x;
  
!   for (x = 0; x < n_basic_blocks; x++)
!     sbitmap_difference (delete[x], antloc[x], laterin[x]);
  
    for (x = 0; x < NUM_EDGES (edge_list); x++)
      {
--- 367,376 ----
       sbitmap *antloc, *later, *laterin, *insert, *delete;
  {
    int x;
+   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     sbitmap_difference (delete[bb->index], antloc[bb->index], laterin[bb->index]);
  
    for (x = 0; x < NUM_EDGES (edge_list); x++)
      {
*************** void
*** 496,504 ****
  compute_available (avloc, kill, avout, avin)
       sbitmap *avloc, *kill, *avout, *avin;
  {
-   int bb;
    edge e;
!   basic_block *worklist, *qin, *qout, *qend;
    unsigned int qlen;
  
    /* Allocate a worklist array/queue.  Entries are only added to the
--- 494,501 ----
  compute_available (avloc, kill, avout, avin)
       sbitmap *avloc, *kill, *avout, *avin;
  {
    edge e;
!   basic_block *worklist, *qin, *qout, *qend, bb;
    unsigned int qlen;
  
    /* Allocate a worklist array/queue.  Entries are only added to the
*************** compute_available (avloc, kill, avout, a
*** 512,521 ****
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of AVOUT above.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       *qin++ = BASIC_BLOCK (bb);
!       BASIC_BLOCK (bb)->aux = BASIC_BLOCK (bb);
      }
  
    qin = worklist;
--- 509,518 ----
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of AVOUT above.  */
!   FOR_EACH_BB (bb)
      {
!       *qin++ = bb;
!       bb->aux = bb;
      }
  
    qin = worklist;
*************** compute_available (avloc, kill, avout, a
*** 531,538 ****
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       basic_block b = *qout++;
!       bb = b->index;
        qlen--;
  
        if (qout >= qend)
--- 528,534 ----
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       bb = *qout++;
        qlen--;
  
        if (qout >= qend)
*************** compute_available (avloc, kill, avout, a
*** 541,563 ****
        /* If one of the predecessor blocks is the ENTRY block, then the
  	 intersection of avouts is the null set.  We can identify such blocks
  	 by the special value in the AUX field in the block structure.  */
!       if (b->aux == ENTRY_BLOCK_PTR)
  	/* Do not clear the aux field for blocks which are successors of the
  	   ENTRY block.  That way we never add then to the worklist again.  */
! 	sbitmap_zero (avin[bb]);
        else
  	{
  	  /* Clear the aux field of this block so that it can be added to
  	     the worklist again if necessary.  */
! 	  b->aux = NULL;
! 	  sbitmap_intersection_of_preds (avin[bb], avout, bb);
  	}
  
!       if (sbitmap_union_of_diff_cg (avout[bb], avloc[bb], avin[bb], kill[bb]))
  	/* If the out state of this block changed, then we need
  	   to add the successors of this block to the worklist
  	   if they are not already on the worklist.  */
! 	for (e = b->succ; e; e = e->succ_next)
  	  if (!e->dest->aux && e->dest != EXIT_BLOCK_PTR)
  	    {
  	      *qin++ = e->dest;
--- 537,559 ----
        /* If one of the predecessor blocks is the ENTRY block, then the
  	 intersection of avouts is the null set.  We can identify such blocks
  	 by the special value in the AUX field in the block structure.  */
!       if (bb->aux == ENTRY_BLOCK_PTR)
  	/* Do not clear the aux field for blocks which are successors of the
  	   ENTRY block.  That way we never add then to the worklist again.  */
! 	sbitmap_zero (avin[bb->index]);
        else
  	{
  	  /* Clear the aux field of this block so that it can be added to
  	     the worklist again if necessary.  */
! 	  bb->aux = NULL;
! 	  sbitmap_intersection_of_preds (avin[bb->index], avout, bb->index);
  	}
  
!       if (sbitmap_union_of_diff_cg (avout[bb->index], avloc[bb->index], avin[bb->index], kill[bb->index]))
  	/* If the out state of this block changed, then we need
  	   to add the successors of this block to the worklist
  	   if they are not already on the worklist.  */
! 	for (e = bb->succ; e; e = e->succ_next)
  	  if (!e->dest->aux && e->dest != EXIT_BLOCK_PTR)
  	    {
  	      *qin++ = e->dest;
*************** compute_nearerout (edge_list, farthest, 
*** 627,635 ****
       struct edge_list *edge_list;
       sbitmap *farthest, *st_avloc, *nearer, *nearerout;
  {
!   int bb, num_edges, i;
    edge e;
!   basic_block *worklist, *tos;
  
    num_edges = NUM_EDGES (edge_list);
  
--- 623,631 ----
       struct edge_list *edge_list;
       sbitmap *farthest, *st_avloc, *nearer, *nearerout;
  {
!   int num_edges, i;
    edge e;
!   basic_block *worklist, *tos, bb;
  
    num_edges = NUM_EDGES (edge_list);
  
*************** compute_nearerout (edge_list, farthest, 
*** 656,684 ****
  
    /* Add all the blocks to the worklist.  This prevents an early exit
       from the loop given our optimistic initialization of NEARER.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       basic_block b = BASIC_BLOCK (bb);
!       *tos++ = b;
!       b->aux = b;
      }
  
    /* Iterate until the worklist is empty.  */
    while (tos != worklist)
      {
        /* Take the first entry off the worklist.  */
!       basic_block b = *--tos;
!       b->aux = NULL;
  
        /* Compute the intersection of NEARER for each outgoing edge from B.  */
!       bb = b->index;
!       sbitmap_ones (nearerout[bb]);
!       for (e = b->succ; e != NULL; e = e->succ_next)
! 	sbitmap_a_and_b (nearerout[bb], nearerout[bb],
  			 nearer[(size_t) e->aux]);
  
        /* Calculate NEARER for all incoming edges.  */
!       for (e = b->pred; e != NULL; e = e->pred_next)
  	if (sbitmap_union_of_diff_cg (nearer[(size_t) e->aux],
  				      farthest[(size_t) e->aux],
  				      nearerout[e->dest->index],
--- 652,678 ----
  
    /* Add all the blocks to the worklist.  This prevents an early exit
       from the loop given our optimistic initialization of NEARER.  */
!   FOR_EACH_BB (bb)
      {
!       *tos++ = bb;
!       bb->aux = bb;
      }
  
    /* Iterate until the worklist is empty.  */
    while (tos != worklist)
      {
        /* Take the first entry off the worklist.  */
!       bb = *--tos;
!       bb->aux = NULL;
  
        /* Compute the intersection of NEARER for each outgoing edge from B.  */
!       sbitmap_ones (nearerout[bb->index]);
!       for (e = bb->succ; e != NULL; e = e->succ_next)
! 	sbitmap_a_and_b (nearerout[bb->index], nearerout[bb->index],
  			 nearer[(size_t) e->aux]);
  
        /* Calculate NEARER for all incoming edges.  */
!       for (e = bb->pred; e != NULL; e = e->pred_next)
  	if (sbitmap_union_of_diff_cg (nearer[(size_t) e->aux],
  				      farthest[(size_t) e->aux],
  				      nearerout[e->dest->index],
*************** compute_rev_insert_delete (edge_list, st
*** 714,722 ****
       sbitmap *st_avloc, *nearer, *nearerout, *insert, *delete;
  {
    int x;
  
!   for (x = 0; x < n_basic_blocks; x++)
!     sbitmap_difference (delete[x], st_avloc[x], nearerout[x]);
  
    for (x = 0; x < NUM_EDGES (edge_list); x++)
      {
--- 708,717 ----
       sbitmap *st_avloc, *nearer, *nearerout, *insert, *delete;
  {
    int x;
+   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     sbitmap_difference (delete[bb->index], st_avloc[bb->index], nearerout[bb->index]);
  
    for (x = 0; x < NUM_EDGES (edge_list); x++)
      {
*************** optimize_mode_switching (file)
*** 1019,1025 ****
       FILE *file;
  {
    rtx insn;
!   int bb, e;
    int need_commit = 0;
    sbitmap *kill;
    struct edge_list *edge_list;
--- 1014,1021 ----
       FILE *file;
  {
    rtx insn;
!   int e;
!   basic_block bb;
    int need_commit = 0;
    sbitmap *kill;
    struct edge_list *edge_list;
*************** optimize_mode_switching (file)
*** 1087,1102 ****
        /* Determine what the first use (if any) need for a mode of entity E is.
  	 This will be the mode that is anticipatable for this block.
  	 Also compute the initial transparency settings.  */
!       for (bb = 0 ; bb < n_basic_blocks; bb++)
  	{
  	  struct seginfo *ptr;
  	  int last_mode = no_mode;
  	  HARD_REG_SET live_now;
  
  	  REG_SET_TO_HARD_REG_SET (live_now,
! 				   BASIC_BLOCK (bb)->global_live_at_start);
! 	  for (insn = BLOCK_HEAD (bb);
! 	       insn != NULL && insn != NEXT_INSN (BLOCK_END (bb));
  	       insn = NEXT_INSN (insn))
  	    {
  	      if (INSN_P (insn))
--- 1083,1098 ----
        /* Determine what the first use (if any) need for a mode of entity E is.
  	 This will be the mode that is anticipatable for this block.
  	 Also compute the initial transparency settings.  */
!       FOR_EACH_BB (bb)
  	{
  	  struct seginfo *ptr;
  	  int last_mode = no_mode;
  	  HARD_REG_SET live_now;
  
  	  REG_SET_TO_HARD_REG_SET (live_now,
! 				   bb->global_live_at_start);
! 	  for (insn = bb->head;
! 	       insn != NULL && insn != NEXT_INSN (bb->end);
  	       insn = NEXT_INSN (insn))
  	    {
  	      if (INSN_P (insn))
*************** optimize_mode_switching (file)
*** 1107,1115 ****
  		  if (mode != no_mode && mode != last_mode)
  		    {
  		      last_mode = mode;
! 		      ptr = new_seginfo (mode, insn, bb, live_now);
! 		      add_seginfo (info + bb, ptr);
! 		      RESET_BIT (transp[bb], j);
  		    }
  
  		  /* Update LIVE_NOW.  */
--- 1103,1111 ----
  		  if (mode != no_mode && mode != last_mode)
  		    {
  		      last_mode = mode;
! 		      ptr = new_seginfo (mode, insn, bb->index, live_now);
! 		      add_seginfo (info + bb->index, ptr);
! 		      RESET_BIT (transp[bb->index], j);
  		    }
  
  		  /* Update LIVE_NOW.  */
*************** optimize_mode_switching (file)
*** 1124,1135 ****
  		}
  	    }
  
! 	  info[bb].computing = last_mode;
  	  /* Check for blocks without ANY mode requirements.  */
  	  if (last_mode == no_mode)
  	    {
! 	      ptr = new_seginfo (no_mode, insn, bb, live_now);
! 	      add_seginfo (info + bb, ptr);
  	    }
  	}
  #ifdef NORMAL_MODE
--- 1120,1131 ----
  		}
  	    }
  
! 	  info[bb->index].computing = last_mode;
  	  /* Check for blocks without ANY mode requirements.  */
  	  if (last_mode == no_mode)
  	    {
! 	      ptr = new_seginfo (no_mode, insn, bb->index, live_now);
! 	      add_seginfo (info + bb->index, ptr);
  	    }
  	}
  #ifdef NORMAL_MODE
*************** optimize_mode_switching (file)
*** 1142,1154 ****
  
  	    for (eg = ENTRY_BLOCK_PTR->succ; eg; eg = eg->succ_next)
  	      {
! 		bb = eg->dest->index;
  
  	        /* By always making this nontransparent, we save
  		   an extra check in make_preds_opaque.  We also
  		   need this to avoid confusing pre_edge_lcm when
  		   antic is cleared but transp and comp are set.  */
! 		RESET_BIT (transp[bb], j);
  
  		/* If the block already has MODE, pretend it
  		   has none (because we don't need to set it),
--- 1138,1150 ----
  
  	    for (eg = ENTRY_BLOCK_PTR->succ; eg; eg = eg->succ_next)
  	      {
! 		bb = eg->dest;
  
  	        /* By always making this nontransparent, we save
  		   an extra check in make_preds_opaque.  We also
  		   need this to avoid confusing pre_edge_lcm when
  		   antic is cleared but transp and comp are set.  */
! 		RESET_BIT (transp[bb->index], j);
  
  		/* If the block already has MODE, pretend it
  		   has none (because we don't need to set it),
*************** optimize_mode_switching (file)
*** 1166,1172 ****
  		  }
  	      }
  
! 	    bb = n_basic_blocks - 1;
  	    info[bb].seginfo->mode = mode;
  	  }
        }
--- 1162,1168 ----
  		  }
  	      }
  
! 	    bb = EXIT_BLOCK_PTR;
  	    info[bb].seginfo->mode = mode;
  	  }
        }
*************** optimize_mode_switching (file)
*** 1186,1206 ****
  	  int m = current_mode[j] = MODE_PRIORITY_TO_MODE (entity_map[j], i);
  	  struct bb_info *info = bb_info[j];
  
! 	  for (bb = 0 ; bb < n_basic_blocks; bb++)
  	    {
! 	      if (info[bb].seginfo->mode == m)
! 		SET_BIT (antic[bb], j);
  
! 	      if (info[bb].computing == m)
! 		SET_BIT (comp[bb], j);
  	    }
  	}
  
        /* Calculate the optimal locations for the
  	 placement mode switches to modes with priority I.  */
  
!       for (bb = n_basic_blocks - 1; bb >= 0; bb--)
! 	sbitmap_not (kill[bb], transp[bb]);
        edge_list = pre_edge_lcm (file, 1, transp, comp, antic,
  				kill, &insert, &delete);
  
--- 1182,1202 ----
  	  int m = current_mode[j] = MODE_PRIORITY_TO_MODE (entity_map[j], i);
  	  struct bb_info *info = bb_info[j];
  
! 	  FOR_EACH_BB (bb)
  	    {
! 	      if (info[bb->index].seginfo->mode == m)
! 		SET_BIT (antic[bb->index], j);
  
! 	      if (info[bb->index].computing == m)
! 		SET_BIT (comp[bb->index], j);
  	    }
  	}
  
        /* Calculate the optimal locations for the
  	 placement mode switches to modes with priority I.  */
  
!       FOR_EACH_BB (bb)
! 	sbitmap_not (kill[bb->index], transp[bb->index]);
        edge_list = pre_edge_lcm (file, 1, transp, comp, antic,
  				kill, &insert, &delete);
  
*************** optimize_mode_switching (file)
*** 1279,1290 ****
  		}
  	    }
  
! 	  for (bb = n_basic_blocks - 1; bb >= 0; bb--)
! 	    if (TEST_BIT (delete[bb], j))
  	      {
! 		make_preds_opaque (BASIC_BLOCK (bb), j);
  		/* Cancel the 'deleted' mode set.  */
! 		bb_info[j][bb].seginfo->mode = no_mode;
  	      }
  	}
  
--- 1275,1286 ----
  		}
  	    }
  
! 	  FOR_EACH_BB_REVERSE (bb)
! 	    if (TEST_BIT (delete[bb->index], j))
  	      {
! 		make_preds_opaque (bb, j);
  		/* Cancel the 'deleted' mode set.  */
! 		bb_info[j][bb->index].seginfo->mode = no_mode;
  	      }
  	}
  
*************** optimize_mode_switching (file)
*** 1349,1358 ****
  	}
  #endif
  
!       for (bb = n_basic_blocks - 1; bb >= 0; bb--)
  	{
  	  struct seginfo *ptr, *next;
! 	  for (ptr = bb_info[j][bb].seginfo; ptr; ptr = next)
  	    {
  	      next = ptr->next;
  	      if (ptr->mode != no_mode)
--- 1345,1354 ----
  	}
  #endif
  
!       FOR_EACH_BB_REVERSE (bb)
  	{
  	  struct seginfo *ptr, *next;
! 	  for (ptr = bb_info[j][bb->index].seginfo; ptr; ptr = next)
  	    {
  	      next = ptr->next;
  	      if (ptr->mode != no_mode)
Index: local-alloc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/local-alloc.c,v
retrieving revision 1.107
diff -c -3 -p -r1.107 local-alloc.c
*** local-alloc.c	17 May 2002 17:01:06 -0000	1.107
--- local-alloc.c	22 May 2002 17:04:34 -0000
*************** alloc_qty (regno, mode, size, birth)
*** 336,343 ****
  int
  local_alloc ()
  {
!   int b, i;
    int max_qty;
  
    /* We need to keep track of whether or not we recorded a LABEL_REF so
       that we know if the jump optimizer needs to be rerun.  */
--- 336,344 ----
  int
  local_alloc ()
  {
!   int i;
    int max_qty;
+   basic_block b;
  
    /* We need to keep track of whether or not we recorded a LABEL_REF so
       that we know if the jump optimizer needs to be rerun.  */
*************** local_alloc ()
*** 394,400 ****
  
    /* Allocate each block's local registers, block by block.  */
  
!   for (b = 0; b < n_basic_blocks; b++)
      {
        /* NEXT_QTY indicates which elements of the `qty_...'
  	 vectors might need to be initialized because they were used
--- 395,401 ----
  
    /* Allocate each block's local registers, block by block.  */
  
!   FOR_EACH_BB (b)
      {
        /* NEXT_QTY indicates which elements of the `qty_...'
  	 vectors might need to be initialized because they were used
*************** local_alloc ()
*** 426,432 ****
  
        next_qty = 0;
  
!       block_alloc (b);
      }
  
    free (qty);
--- 427,433 ----
  
        next_qty = 0;
  
!       block_alloc (b->index);
      }
  
    free (qty);
*************** static void
*** 815,821 ****
  update_equiv_regs ()
  {
    rtx insn;
!   int block;
    int loop_depth;
    regset_head cleared_regs;
    int clear_regnos = 0;
--- 816,822 ----
  update_equiv_regs ()
  {
    rtx insn;
!   basic_block bb;
    int loop_depth;
    regset_head cleared_regs;
    int clear_regnos = 0;
*************** update_equiv_regs ()
*** 828,836 ****
    /* Scan the insns and find which registers have equivalences.  Do this
       in a separate scan of the insns because (due to -fcse-follow-jumps)
       a register can be set below its use.  */
!   for (block = 0; block < n_basic_blocks; block++)
      {
-       basic_block bb = BASIC_BLOCK (block);
        loop_depth = bb->loop_depth;
  
        for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = NEXT_INSN (insn))
--- 829,836 ----
    /* Scan the insns and find which registers have equivalences.  Do this
       in a separate scan of the insns because (due to -fcse-follow-jumps)
       a register can be set below its use.  */
!   FOR_EACH_BB (bb)
      {
        loop_depth = bb->loop_depth;
  
        for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = NEXT_INSN (insn))
*************** update_equiv_regs ()
*** 1044,1053 ****
       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 (block = n_basic_blocks - 1; block >= 0; block--)
      {
-       basic_block bb = BASIC_BLOCK (block);
- 
        loop_depth = bb->loop_depth;
        for (insn = bb->end; insn != PREV_INSN (bb->head); insn = PREV_INSN (insn))
  	{
--- 1044,1051 ----
       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)
      {
        loop_depth = bb->loop_depth;
        for (insn = bb->end; insn != PREV_INSN (bb->head); insn = PREV_INSN (insn))
  	{
*************** update_equiv_regs ()
*** 1139,1150 ****
  
  		      XEXP (reg_equiv[regno].init_insns, 0) = new_insn;
  
! 		      REG_BASIC_BLOCK (regno) = block >= 0 ? block : 0;
  		      REG_N_CALLS_CROSSED (regno) = 0;
  		      REG_LIVE_LENGTH (regno) = 2;
  
! 		      if (block >= 0 && insn == BLOCK_HEAD (block))
! 			BLOCK_HEAD (block) = PREV_INSN (insn);
  
  		      /* Remember to clear REGNO from all basic block's live
  			 info.  */
--- 1137,1148 ----
  
  		      XEXP (reg_equiv[regno].init_insns, 0) = new_insn;
  
! 		      REG_BASIC_BLOCK (regno) = bb->index;
  		      REG_N_CALLS_CROSSED (regno) = 0;
  		      REG_LIVE_LENGTH (regno) = 2;
  
! 		      if (insn == bb->head)
! 			bb->head = PREV_INSN (insn);
  
  		      /* Remember to clear REGNO from all basic block's live
  			 info.  */
*************** update_equiv_regs ()
*** 1159,1182 ****
    /* Clear all dead REGNOs from all basic block's live info.  */
    if (clear_regnos)
      {
!       int j, l;
        if (clear_regnos > 8)
          {
! 	  for (l = 0; l < n_basic_blocks; l++)
  	    {
! 	      AND_COMPL_REG_SET (BASIC_BLOCK (l)->global_live_at_start,
! 	                         &cleared_regs);
! 	      AND_COMPL_REG_SET (BASIC_BLOCK (l)->global_live_at_end,
! 	                         &cleared_regs);
  	    }
  	}
        else
          EXECUTE_IF_SET_IN_REG_SET (&cleared_regs, 0, j,
            {
! 	    for (l = 0; l < n_basic_blocks; l++)
  	      {
! 	        CLEAR_REGNO_REG_SET (BASIC_BLOCK (l)->global_live_at_start, j);
! 	        CLEAR_REGNO_REG_SET (BASIC_BLOCK (l)->global_live_at_end, j);
  	      }
  	  });
      }
--- 1157,1178 ----
    /* Clear all dead REGNOs from all basic block's live info.  */
    if (clear_regnos)
      {
!       int j;
        if (clear_regnos > 8)
          {
! 	  FOR_EACH_BB (bb)
  	    {
! 	      AND_COMPL_REG_SET (bb->global_live_at_start, &cleared_regs);
! 	      AND_COMPL_REG_SET (bb->global_live_at_end, &cleared_regs);
  	    }
  	}
        else
          EXECUTE_IF_SET_IN_REG_SET (&cleared_regs, 0, j,
            {
! 	    FOR_EACH_BB (bb)
  	      {
! 	        CLEAR_REGNO_REG_SET (bb->global_live_at_start, j);
! 	        CLEAR_REGNO_REG_SET (bb->global_live_at_end, j);
  	      }
  	  });
      }
Index: predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.67
diff -c -3 -p -r1.67 predict.c
*** predict.c	21 May 2002 20:37:41 -0000	1.67
--- predict.c	22 May 2002 17:04:34 -0000
*************** estimate_probability (loops_info)
*** 409,414 ****
--- 409,415 ----
       struct loops *loops_info;
  {
    sbitmap *dominators, *post_dominators;
+   basic_block bb;
    int i;
  
    dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
*************** estimate_probability (loops_info)
*** 420,434 ****
       natural loop.  */
    for (i = 0; i < loops_info->num; i++)
      {
-       int j;
        int exits;
        struct loop *loop = &loops_info->array[i];
  
        flow_loop_scan (loops_info, loop, LOOP_EXIT_EDGES);
        exits = loop->num_exits;
  
!       for (j = loop->first->index; j <= loop->last->index; ++j)
! 	if (TEST_BIT (loop->nodes, j))
  	  {
  	    int header_found = 0;
  	    edge e;
--- 421,434 ----
       natural loop.  */
    for (i = 0; i < loops_info->num; i++)
      {
        int exits;
        struct loop *loop = &loops_info->array[i];
  
        flow_loop_scan (loops_info, loop, LOOP_EXIT_EDGES);
        exits = loop->num_exits;
  
!       FOR_BB_BETWEEN (bb, loop->first, loop->last->next_bb, next_bb)
! 	if (TEST_BIT (loop->nodes, bb->index))
  	  {
  	    int header_found = 0;
  	    edge e;
*************** estimate_probability (loops_info)
*** 437,448 ****
  	     statements construct loops via "non-loop" constructs
  	     in the source language and are better to be handled
  	     separately.  */
! 	  if (predicted_by_p (BASIC_BLOCK (j), PRED_CONTINUE))
  	    continue;
  
  	    /* Loop branch heuristics - predict an edge back to a
  	       loop's head as taken.  */
! 	    for (e = BASIC_BLOCK(j)->succ; e; e = e->succ_next)
  	      if (e->dest == loop->header
  		  && e->src == loop->latch)
  		{
--- 437,448 ----
  	     statements construct loops via "non-loop" constructs
  	     in the source language and are better to be handled
  	     separately.  */
! 	  if (predicted_by_p (bb, PRED_CONTINUE))
  	    continue;
  
  	    /* Loop branch heuristics - predict an edge back to a
  	       loop's head as taken.  */
! 	    for (e = bb->succ; e; e = e->succ_next)
  	      if (e->dest == loop->header
  		  && e->src == loop->latch)
  		{
*************** estimate_probability (loops_info)
*** 453,459 ****
  	    /* Loop exit heuristics - predict an edge exiting the loop if the
  	       conditinal has no loop header successors as not taken.  */
  	    if (!header_found)
! 	      for (e = BASIC_BLOCK(j)->succ; e; e = e->succ_next)
  		if (e->dest->index < 0
  		    || !TEST_BIT (loop->nodes, e->dest->index))
  		  predict_edge
--- 453,459 ----
  	    /* Loop exit heuristics - predict an edge exiting the loop if the
  	       conditinal has no loop header successors as not taken.  */
  	    if (!header_found)
! 	      for (e = bb->succ; e; e = e->succ_next)
  		if (e->dest->index < 0
  		    || !TEST_BIT (loop->nodes, e->dest->index))
  		  predict_edge
*************** estimate_probability (loops_info)
*** 465,473 ****
      }
  
    /* Attempt to predict conditional jumps using a number of heuristics.  */
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx last_insn = bb->end;
        rtx cond, earliest;
        edge e;
--- 465,472 ----
      }
  
    /* Attempt to predict conditional jumps using a number of heuristics.  */
!   FOR_EACH_BB (bb)
      {
        rtx last_insn = bb->end;
        rtx cond, earliest;
        edge e;
*************** estimate_probability (loops_info)
*** 604,614 ****
      }
  
    /* Attach the combined probability to each conditional jump.  */
!   for (i = 0; i < n_basic_blocks; i++)
!     if (GET_CODE (BLOCK_END (i)) == JUMP_INSN
! 	&& any_condjump_p (BLOCK_END (i))
! 	&& BASIC_BLOCK (i)->succ->succ_next != NULL)
!       combine_predictions_for_insn (BLOCK_END (i), BASIC_BLOCK (i));
  
    sbitmap_vector_free (post_dominators);
    sbitmap_vector_free (dominators);
--- 603,613 ----
      }
  
    /* Attach the combined probability to each conditional jump.  */
!   FOR_EACH_BB (bb)
!     if (GET_CODE (bb->end) == JUMP_INSN
! 	&& any_condjump_p (bb->end)
! 	&& bb->succ->succ_next != NULL)
!       combine_predictions_for_insn (bb->end, bb);
  
    sbitmap_vector_free (post_dominators);
    sbitmap_vector_free (dominators);
*************** process_note_predictions (bb, heads, dom
*** 834,840 ****
  void
  note_prediction_to_br_prob ()
  {
!   int i;
    sbitmap *post_dominators;
    int *dominators, *heads;
  
--- 833,839 ----
  void
  note_prediction_to_br_prob ()
  {
!   basic_block bb;
    sbitmap *post_dominators;
    int *dominators, *heads;
  
*************** note_prediction_to_br_prob ()
*** 854,864 ****
  
    /* Process all prediction notes.  */
  
!   for (i = 0; i < n_basic_blocks; ++i)
!     {
!       basic_block bb = BASIC_BLOCK (i);
!       process_note_predictions (bb, heads, dominators, post_dominators);
!     }
  
    sbitmap_vector_free (post_dominators);
    free (dominators);
--- 853,860 ----
  
    /* Process all prediction notes.  */
  
!   FOR_EACH_BB (bb)
!     process_note_predictions (bb, heads, dominators, post_dominators);
  
    sbitmap_vector_free (post_dominators);
    free (dominators);
*************** static void
*** 906,922 ****
  propagate_freq (head)
       basic_block head;
  {
!   basic_block bb = head;
!   basic_block last = bb;
    edge e;
    basic_block nextbb;
-   int n;
  
    /* For each basic block we need to visit count number of his predecessors
       we need to visit first.  */
!   for (n = 0; n < n_basic_blocks; n++)
      {
-       basic_block bb = BASIC_BLOCK (n);
        if (BLOCK_INFO (bb)->tovisit)
  	{
  	  int count = 0;
--- 902,916 ----
  propagate_freq (head)
       basic_block head;
  {
!   basic_block bb;
!   basic_block last;
    edge e;
    basic_block nextbb;
  
    /* For each basic block we need to visit count number of his predecessors
       we need to visit first.  */
!   FOR_EACH_BB (bb)
      {
        if (BLOCK_INFO (bb)->tovisit)
  	{
  	  int count = 0;
*************** propagate_freq (head)
*** 934,940 ****
      }
  
    memcpy (&BLOCK_INFO (head)->frequency, &real_one, sizeof (real_one));
!   for (; bb; bb = nextbb)
      {
        REAL_VALUE_TYPE cyclic_probability, frequency;
  
--- 928,935 ----
      }
  
    memcpy (&BLOCK_INFO (head)->frequency, &real_one, sizeof (real_one));
!   last = head;
!   for (bb = head; bb; bb = nextbb)
      {
        REAL_VALUE_TYPE cyclic_probability, frequency;
  
*************** static void
*** 1077,1100 ****
  counts_to_freqs ()
  {
    HOST_WIDEST_INT count_max = 1;
!   int i;
  
!   for (i = 0; i < n_basic_blocks; i++)
!     count_max = MAX (BASIC_BLOCK (i)->count, count_max);
  
!   for (i = -2; i < n_basic_blocks; i++)
!     {
!       basic_block bb;
! 
!       if (i == -2)
! 	bb = ENTRY_BLOCK_PTR;
!       else if (i == -1)
! 	bb = EXIT_BLOCK_PTR;
!       else
! 	bb = BASIC_BLOCK (i);
! 
!       bb->frequency = (bb->count * BB_FREQ_MAX + count_max / 2) / count_max;
!     }
  }
  
  /* Return true if function is likely to be expensive, so there is no point to
--- 1072,1084 ----
  counts_to_freqs ()
  {
    HOST_WIDEST_INT count_max = 1;
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     count_max = MAX (bb->count, count_max);
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     bb->frequency = (bb->count * BB_FREQ_MAX + count_max / 2) / count_max;
  }
  
  /* Return true if function is likely to be expensive, so there is no point to
*************** expensive_function_p (threshold)
*** 1107,1113 ****
  	int threshold;
  {
    unsigned int sum = 0;
!   int i;
    unsigned int limit;
  
    /* We can not compute accurately for large thresholds due to scaled
--- 1091,1097 ----
  	int threshold;
  {
    unsigned int sum = 0;
!   basic_block bb;
    unsigned int limit;
  
    /* We can not compute accurately for large thresholds due to scaled
*************** expensive_function_p (threshold)
*** 1123,1131 ****
  
    /* Maximally BB_FREQ_MAX^2 so overflow won't happen.  */
    limit = ENTRY_BLOCK_PTR->frequency * threshold;
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn;
  
        for (insn = bb->head; insn != NEXT_INSN (bb->end);
--- 1107,1114 ----
  
    /* Maximally BB_FREQ_MAX^2 so overflow won't happen.  */
    limit = ENTRY_BLOCK_PTR->frequency * threshold;
!   FOR_EACH_BB (bb)
      {
        rtx insn;
  
        for (insn = bb->head; insn != NEXT_INSN (bb->end);
*************** static void
*** 1147,1153 ****
  estimate_bb_frequencies (loops)
       struct loops *loops;
  {
!   int i;
    REAL_VALUE_TYPE freq_max;
    enum machine_mode double_mode = TYPE_MODE (double_type_node);
  
--- 1130,1136 ----
  estimate_bb_frequencies (loops)
       struct loops *loops;
  {
!   basic_block bb;
    REAL_VALUE_TYPE freq_max;
    enum machine_mode double_mode = TYPE_MODE (double_type_node);
  
*************** estimate_bb_frequencies (loops)
*** 1169,1181 ****
        mark_dfs_back_edges ();
        /* Fill in the probability values in flowgraph based on the REG_BR_PROB
           notes.  */
!       for (i = 0; i < n_basic_blocks; i++)
  	{
! 	  rtx last_insn = BLOCK_END (i);
  
  	  if (GET_CODE (last_insn) != JUMP_INSN || !any_condjump_p (last_insn)
  	      /* Avoid handling of conditional jumps jumping to fallthru edge.  */
! 	      || BASIC_BLOCK (i)->succ->succ_next == NULL)
  	    {
  	      /* We can predict only conditional jumps at the moment.
  	         Expect each edge to be equally probable.
--- 1152,1164 ----
        mark_dfs_back_edges ();
        /* Fill in the probability values in flowgraph based on the REG_BR_PROB
           notes.  */
!       FOR_EACH_BB (bb)
  	{
! 	  rtx last_insn = bb->end;
  
  	  if (GET_CODE (last_insn) != JUMP_INSN || !any_condjump_p (last_insn)
  	      /* Avoid handling of conditional jumps jumping to fallthru edge.  */
! 	      || bb->succ->succ_next == NULL)
  	    {
  	      /* We can predict only conditional jumps at the moment.
  	         Expect each edge to be equally probable.
*************** estimate_bb_frequencies (loops)
*** 1183,1196 ****
  	      int nedges = 0;
  	      edge e;
  
! 	      for (e = BASIC_BLOCK (i)->succ; e; e = e->succ_next)
  		{
  		  nedges++;
  		  if (e->probability != 0)
  		    break;
  		}
  	      if (!e)
! 		for (e = BASIC_BLOCK (i)->succ; e; e = e->succ_next)
  		  e->probability = (REG_BR_PROB_BASE + nedges / 2) / nedges;
  	    }
  	}
--- 1166,1179 ----
  	      int nedges = 0;
  	      edge e;
  
! 	      for (e = bb->succ; e; e = e->succ_next)
  		{
  		  nedges++;
  		  if (e->probability != 0)
  		    break;
  		}
  	      if (!e)
! 		for (e = bb->succ; e; e = e->succ_next)
  		  e->probability = (REG_BR_PROB_BASE + nedges / 2) / nedges;
  	    }
  	}
*************** estimate_bb_frequencies (loops)
*** 1200,1221 ****
        /* Set up block info for each basic block.  */
        alloc_aux_for_blocks (sizeof (struct block_info_def));
        alloc_aux_for_edges (sizeof (struct edge_info_def));
!       for (i = -2; i < n_basic_blocks; i++)
  	{
  	  edge e;
- 	  basic_block bb;
- 
- 	  if (i == -2)
- 	    bb = ENTRY_BLOCK_PTR;
- 	  else if (i == -1)
- 	    bb = EXIT_BLOCK_PTR;
- 	  else
- 	    bb = BASIC_BLOCK (i);
  
  	  BLOCK_INFO (bb)->tovisit = 0;
  	  for (e = bb->succ; e; e = e->succ_next)
  	    {
- 
  	      REAL_VALUE_FROM_INT (EDGE_INFO (e)->back_edge_prob,
  				   e->probability, 0, double_mode);
  	      REAL_ARITHMETIC (EDGE_INFO (e)->back_edge_prob,
--- 1183,1195 ----
        /* Set up block info for each basic block.  */
        alloc_aux_for_blocks (sizeof (struct block_info_def));
        alloc_aux_for_edges (sizeof (struct edge_info_def));
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
  	{
  	  edge e;
  
  	  BLOCK_INFO (bb)->tovisit = 0;
  	  for (e = bb->succ; e; e = e->succ_next)
  	    {
  	      REAL_VALUE_FROM_INT (EDGE_INFO (e)->back_edge_prob,
  				   e->probability, 0, double_mode);
  	      REAL_ARITHMETIC (EDGE_INFO (e)->back_edge_prob,
*************** estimate_bb_frequencies (loops)
*** 1229,1260 ****
        estimate_loops_at_level (loops->tree_root);
  
        /* Now fake loop around whole function to finalize probabilities.  */
!       for (i = 0; i < n_basic_blocks; i++)
! 	BLOCK_INFO (BASIC_BLOCK (i))->tovisit = 1;
  
        BLOCK_INFO (ENTRY_BLOCK_PTR)->tovisit = 1;
        BLOCK_INFO (EXIT_BLOCK_PTR)->tovisit = 1;
        propagate_freq (ENTRY_BLOCK_PTR);
  
        memcpy (&freq_max, &real_zero, sizeof (real_zero));
!       for (i = 0; i < n_basic_blocks; i++)
  	if (REAL_VALUES_LESS
! 	    (freq_max, BLOCK_INFO (BASIC_BLOCK (i))->frequency))
! 	  memcpy (&freq_max, &BLOCK_INFO (BASIC_BLOCK (i))->frequency,
  		  sizeof (freq_max));
  
!       for (i = -2; i < n_basic_blocks; i++)
  	{
- 	  basic_block bb;
  	  REAL_VALUE_TYPE tmp;
  
- 	  if (i == -2)
- 	    bb = ENTRY_BLOCK_PTR;
- 	  else if (i == -1)
- 	    bb = EXIT_BLOCK_PTR;
- 	  else
- 	    bb = BASIC_BLOCK (i);
- 
  	  REAL_ARITHMETIC (tmp, MULT_EXPR, BLOCK_INFO (bb)->frequency,
  			   real_bb_freq_max);
  	  REAL_ARITHMETIC (tmp, RDIV_EXPR, tmp, freq_max);
--- 1203,1226 ----
        estimate_loops_at_level (loops->tree_root);
  
        /* Now fake loop around whole function to finalize probabilities.  */
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
! 	BLOCK_INFO (bb)->tovisit = 1;
  
        BLOCK_INFO (ENTRY_BLOCK_PTR)->tovisit = 1;
        BLOCK_INFO (EXIT_BLOCK_PTR)->tovisit = 1;
        propagate_freq (ENTRY_BLOCK_PTR);
  
        memcpy (&freq_max, &real_zero, sizeof (real_zero));
!       FOR_EACH_BB (bb)
  	if (REAL_VALUES_LESS
! 	    (freq_max, BLOCK_INFO (bb)->frequency))
! 	  memcpy (&freq_max, &BLOCK_INFO (bb)->frequency,
  		  sizeof (freq_max));
  
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
  	{
  	  REAL_VALUE_TYPE tmp;
  
  	  REAL_ARITHMETIC (tmp, MULT_EXPR, BLOCK_INFO (bb)->frequency,
  			   real_bb_freq_max);
  	  REAL_ARITHMETIC (tmp, RDIV_EXPR, tmp, freq_max);
*************** estimate_bb_frequencies (loops)
*** 1274,1287 ****
  static void
  compute_function_frequency ()
  {
!   int i;
    if (!profile_info.count_profiles_merged
        || !flag_branch_probabilities)
      return;
    cfun->function_frequency = FUNCTION_FREQUENCY_UNLIKELY_EXECUTED;
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        if (maybe_hot_bb_p (bb))
  	{
  	  cfun->function_frequency = FUNCTION_FREQUENCY_HOT;
--- 1240,1253 ----
  static void
  compute_function_frequency ()
  {
!   basic_block bb;
! 
    if (!profile_info.count_profiles_merged
        || !flag_branch_probabilities)
      return;
    cfun->function_frequency = FUNCTION_FREQUENCY_UNLIKELY_EXECUTED;
!   FOR_EACH_BB (bb)
      {
        if (maybe_hot_bb_p (bb))
  	{
  	  cfun->function_frequency = FUNCTION_FREQUENCY_HOT;
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.88
diff -c -3 -p -r1.88 profile.c
*** profile.c	21 May 2002 08:54:21 -0000	1.88
--- profile.c	22 May 2002 17:04:34 -0000
*************** static void
*** 137,150 ****
  instrument_edges (el)
       struct edge_list *el;
  {
-   int i;
    int num_instr_edges = 0;
    int num_edges = NUM_EDGES (el);
    remove_fake_edges ();
  
!   for (i = 0; i < n_basic_blocks + 2; i++)
      {
-       basic_block bb = GCOV_INDEX_TO_BB (i);
        edge e = bb->succ;
        while (e)
  	{
--- 137,149 ----
  instrument_edges (el)
       struct edge_list *el;
  {
    int num_instr_edges = 0;
    int num_edges = NUM_EDGES (el);
+   basic_block bb;
    remove_fake_edges ();
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        edge e = bb->succ;
        while (e)
  	{
*************** static gcov_type *
*** 216,223 ****
  get_exec_counts ()
  {
    int num_edges = 0;
!   int i;
!   int okay = 1;
    int mismatch = 0;
    gcov_type *profile;
    char *function_name_buffer;
--- 215,222 ----
  get_exec_counts ()
  {
    int num_edges = 0;
!   basic_block bb;
!   int okay = 1, i;
    int mismatch = 0;
    gcov_type *profile;
    char *function_name_buffer;
*************** get_exec_counts ()
*** 233,247 ****
  
    /* Count the edges to be (possibly) instrumented.  */
  
!   for (i = 0; i < n_basic_blocks + 2; i++)
      {
-       basic_block bb = GCOV_INDEX_TO_BB (i);
        edge e;
        for (e = bb->succ; e; e = e->succ_next)
  	if (!EDGE_INFO (e)->ignore && !EDGE_INFO (e)->on_tree)
! 	  {
! 	    num_edges++;
! 	  }
      }
  
    /* now read and combine all matching profiles.  */
--- 232,243 ----
  
    /* Count the edges to be (possibly) instrumented.  */
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        edge e;
        for (e = bb->succ; e; e = e->succ_next)
  	if (!EDGE_INFO (e)->ignore && !EDGE_INFO (e)->on_tree)
! 	  num_edges++;
      }
  
    /* now read and combine all matching profiles.  */
*************** get_exec_counts ()
*** 382,387 ****
--- 378,384 ----
  static void
  compute_branch_probabilities ()
  {
+   basic_block bb;
    int i;
    int num_edges = 0;
    int changes;
*************** compute_branch_probabilities ()
*** 395,403 ****
    /* Attach extra info block to each bb.  */
  
    alloc_aux_for_blocks (sizeof (struct bb_info));
!   for (i = 0; i < n_basic_blocks + 2; i++)
      {
-       basic_block bb = GCOV_INDEX_TO_BB (i);
        edge e;
  
        for (e = bb->succ; e; e = e->succ_next)
--- 392,399 ----
    /* Attach extra info block to each bb.  */
  
    alloc_aux_for_blocks (sizeof (struct bb_info));
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        edge e;
  
        for (e = bb->succ; e; e = e->succ_next)
*************** compute_branch_probabilities ()
*** 418,426 ****
    /* The first count in the .da file is the number of times that the function
       was entered.  This is the exec_count for block zero.  */
  
!   for (i = 0; i < n_basic_blocks + 2; i++)
      {
-       basic_block bb = GCOV_INDEX_TO_BB (i);
        edge e;
        for (e = bb->succ; e; e = e->succ_next)
  	if (!EDGE_INFO (e)->ignore && !EDGE_INFO (e)->on_tree)
--- 414,421 ----
    /* The first count in the .da file is the number of times that the function
       was entered.  This is the exec_count for block zero.  */
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        edge e;
        for (e = bb->succ; e; e = e->succ_next)
  	if (!EDGE_INFO (e)->ignore && !EDGE_INFO (e)->on_tree)
*************** compute_branch_probabilities ()
*** 472,480 ****
      {
        passes++;
        changes = 0;
!       for (i = n_basic_blocks + 1; i >= 0; i--)
  	{
- 	  basic_block bb = GCOV_INDEX_TO_BB (i);
  	  struct bb_info *bi = BB_INFO (bb);
  	  if (! bi->count_valid)
  	    {
--- 467,474 ----
      {
        passes++;
        changes = 0;
!       FOR_BB_BETWEEN (bb, EXIT_BLOCK_PTR, NULL, prev_bb)
  	{
  	  struct bb_info *bi = BB_INFO (bb);
  	  if (! bi->count_valid)
  	    {
*************** compute_branch_probabilities ()
*** 569,577 ****
  
    /* If the graph has been correctly solved, every block will have a
       succ and pred count of zero.  */
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        if (BB_INFO (bb)->succ_count || BB_INFO (bb)->pred_count)
  	abort ();
      }
--- 563,570 ----
  
    /* If the graph has been correctly solved, every block will have a
       succ and pred count of zero.  */
!   FOR_EACH_BB (bb)
      {
        if (BB_INFO (bb)->succ_count || BB_INFO (bb)->pred_count)
  	abort ();
      }
*************** compute_branch_probabilities ()
*** 584,592 ****
    num_never_executed = 0;
    num_branches = 0;
  
!   for (i = 0; i <= n_basic_blocks + 1; i++)
      {
-       basic_block bb = GCOV_INDEX_TO_BB (i);
        edge e;
        gcov_type total;
        rtx note;
--- 577,584 ----
    num_never_executed = 0;
    num_branches = 0;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        edge e;
        gcov_type total;
        rtx note;
*************** static long
*** 702,713 ****
  compute_checksum ()
  {
    long chsum = 0;
!   int i;
! 
  
!   for (i = 0; i < n_basic_blocks ; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        edge e;
  
        for (e = bb->succ; e; e = e->succ_next)
--- 694,703 ----
  compute_checksum ()
  {
    long chsum = 0;
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
      {
        edge e;
  
        for (e = bb->succ; e; e = e->succ_next)
*************** compute_checksum ()
*** 740,745 ****
--- 730,736 ----
  void
  branch_prob ()
  {
+   basic_block bb;
    int i;
    int num_edges, ignored_edges;
    struct edge_list *el;
*************** branch_prob ()
*** 768,778 ****
       We also add fake exit edges for each call and asm statement in the
       basic, since it may not return.  */
  
!   for (i = 0; i < n_basic_blocks ; i++)
      {
        int need_exit_edge = 0, need_entry_edge = 0;
        int have_exit_edge = 0, have_entry_edge = 0;
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn;
        edge e;
  
--- 759,768 ----
       We also add fake exit edges for each call and asm statement in the
       basic, since it may not return.  */
  
!   FOR_EACH_BB (bb)
      {
        int need_exit_edge = 0, need_entry_edge = 0;
        int have_exit_edge = 0, have_entry_edge = 0;
        rtx insn;
        edge e;
  
*************** branch_prob ()
*** 797,803 ****
  		{
  		  /* We should not get abort here, as call to setjmp should not
  		     be the very first instruction of function.  */
! 		  if (!i)
  		    abort ();
  		  make_edge (ENTRY_BLOCK_PTR, bb, EDGE_FAKE);
  		}
--- 787,793 ----
  		{
  		  /* We should not get abort here, as call to setjmp should not
  		     be the very first instruction of function.  */
! 		  if (bb == ENTRY_BLOCK_PTR)
  		    abort ();
  		  make_edge (ENTRY_BLOCK_PTR, bb, EDGE_FAKE);
  		}
*************** branch_prob ()
*** 864,873 ****
       GCOV utility.  */
    if (flag_test_coverage)
      {
!       int i = 0;
!       for (i = 0 ; i < n_basic_blocks; i++)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  rtx insn = bb->head;
  	  static int ignore_next_note = 0;
  
--- 854,861 ----
       GCOV utility.  */
    if (flag_test_coverage)
      {
!       FOR_EACH_BB (bb)
  	{
  	  rtx insn = bb->head;
  	  static int ignore_next_note = 0;
  
*************** branch_prob ()
*** 976,984 ****
        __write_long (n_basic_blocks + 2, bbg_file, 4);
        __write_long (num_edges - ignored_edges + 1, bbg_file, 4);
  
!       for (i = 0; i < n_basic_blocks + 1; i++)
  	{
- 	  basic_block bb = GCOV_INDEX_TO_BB (i);
  	  edge e;
  	  long count = 0;
  
--- 964,971 ----
        __write_long (n_basic_blocks + 2, bbg_file, 4);
        __write_long (num_edges - ignored_edges + 1, bbg_file, 4);
  
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
  	{
  	  edge e;
  	  long count = 0;
  
*************** find_spanning_tree (el)
*** 1088,1099 ****
  {
    int i;
    int num_edges = NUM_EDGES (el);
  
    /* We use aux field for standard union-find algorithm.  */
!   EXIT_BLOCK_PTR->aux = EXIT_BLOCK_PTR;
!   ENTRY_BLOCK_PTR->aux = ENTRY_BLOCK_PTR;
!   for (i = 0; i < n_basic_blocks; i++)
!     BASIC_BLOCK (i)->aux = BASIC_BLOCK (i);
  
    /* Add fake edge exit to entry we can't instrument.  */
    union_groups (EXIT_BLOCK_PTR, ENTRY_BLOCK_PTR);
--- 1075,1085 ----
  {
    int i;
    int num_edges = NUM_EDGES (el);
+   basic_block bb;
  
    /* We use aux field for standard union-find algorithm.  */
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     bb->aux = bb;
  
    /* Add fake edge exit to entry we can't instrument.  */
    union_groups (EXIT_BLOCK_PTR, ENTRY_BLOCK_PTR);
*************** find_spanning_tree (el)
*** 1149,1158 ****
  	}
      }
  
!   EXIT_BLOCK_PTR->aux = NULL;
!   ENTRY_BLOCK_PTR->aux = NULL;
!   for (i = 0; i < n_basic_blocks; i++)
!     BASIC_BLOCK (i)->aux = NULL;
  }
  
  /* Perform file-level initialization for branch-prob processing.  */
--- 1135,1142 ----
  	}
      }
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     bb->aux = NULL;
  }
  
  /* Perform file-level initialization for branch-prob processing.  */
Index: recog.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/recog.c,v
retrieving revision 1.154
diff -c -3 -p -r1.154 recog.c
*** recog.c	17 May 2002 02:31:48 -0000	1.154
--- recog.c	22 May 2002 17:04:34 -0000
*************** split_all_insns (upd_life)
*** 2727,2741 ****
  {
    sbitmap blocks;
    int changed;
!   int i;
  
    blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
    changed = 0;
  
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn, next;
        bool finish = false;
  
--- 2727,2740 ----
  {
    sbitmap blocks;
    int changed;
!   basic_block bb;
  
    blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
    changed = 0;
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx insn, next;
        bool finish = false;
  
*************** split_all_insns (upd_life)
*** 2756,2762 ****
  
  	      while (GET_CODE (last) == BARRIER)
  		last = PREV_INSN (last);
! 	      SET_BIT (blocks, i);
  	      changed = 1;
  	      insn = last;
  	    }
--- 2755,2761 ----
  
  	      while (GET_CODE (last) == BARRIER)
  		last = PREV_INSN (last);
! 	      SET_BIT (blocks, bb->index);
  	      changed = 1;
  	      insn = last;
  	    }
*************** peephole2_optimize (dump_file)
*** 2999,3005 ****
    regset_head rs_heads[MAX_INSNS_PER_PEEP2 + 2];
    rtx insn, prev;
    regset live;
!   int i, b;
  #ifdef HAVE_conditional_execution
    sbitmap blocks;
    bool changed;
--- 2998,3005 ----
    regset_head rs_heads[MAX_INSNS_PER_PEEP2 + 2];
    rtx insn, prev;
    regset live;
!   int i;
!   basic_block bb;
  #ifdef HAVE_conditional_execution
    sbitmap blocks;
    bool changed;
*************** peephole2_optimize (dump_file)
*** 3020,3028 ****
    count_or_remove_death_notes (NULL, 1);
  #endif
  
!   for (b = n_basic_blocks - 1; b >= 0; --b)
      {
-       basic_block bb = BASIC_BLOCK (b);
        struct propagate_block_info *pbi;
  
        /* Indicate that all slots except the last holds invalid data.  */
--- 3020,3027 ----
    count_or_remove_death_notes (NULL, 1);
  #endif
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        struct propagate_block_info *pbi;
  
        /* Indicate that all slots except the last holds invalid data.  */
*************** peephole2_optimize (dump_file)
*** 3201,3207 ****
  		     death data structures are not so self-contained.
  		     So record that we've made a modification to this
  		     block and update life information at the end.  */
! 		  SET_BIT (blocks, b);
  		  changed = true;
  
  		  for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i)
--- 3200,3206 ----
  		     death data structures are not so self-contained.
  		     So record that we've made a modification to this
  		     block and update life information at the end.  */
! 		  SET_BIT (blocks, bb->index);
  		  changed = true;
  
  		  for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i)
Index: reg-stack.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reg-stack.c,v
retrieving revision 1.107
diff -c -3 -p -r1.107 reg-stack.c
*** reg-stack.c	21 May 2002 19:57:39 -0000	1.107
--- reg-stack.c	22 May 2002 17:04:35 -0000
*************** reg_to_stack (first, file)
*** 418,423 ****
--- 418,424 ----
       rtx first;
       FILE *file;
  {
+   basic_block bb;
    int i;
    int max_uid;
  
*************** reg_to_stack (first, file)
*** 451,460 ****
  
    /* Set up block info for each basic block.  */
    alloc_aux_for_blocks (sizeof (struct block_info_def));
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
        edge e;
-       basic_block bb = BASIC_BLOCK (i);
        for (e = bb->pred; e; e=e->pred_next)
  	if (!(e->flags & EDGE_DFS_BACK)
  	    && e->src != ENTRY_BLOCK_PTR)
--- 452,460 ----
  
    /* Set up block info for each basic block.  */
    alloc_aux_for_blocks (sizeof (struct block_info_def));
!   FOR_EACH_BB_REVERSE (bb)
      {
        edge e;
        for (e = bb->pred; e; e=e->pred_next)
  	if (!(e->flags & EDGE_DFS_BACK)
  	    && e->src != ENTRY_BLOCK_PTR)
*************** print_stack (file, s)
*** 2380,2391 ****
  static int
  convert_regs_entry ()
  {
!   int inserted = 0, i;
    edge e;
  
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block block = BASIC_BLOCK (i);
        block_info bi = BLOCK_INFO (block);
        int reg;
  
--- 2380,2391 ----
  static int
  convert_regs_entry ()
  {
!   int inserted = 0;
    edge e;
+   basic_block block;
  
!   FOR_EACH_BB_REVERSE (block)
      {
        block_info bi = BLOCK_INFO (block);
        int reg;
  
*************** static int
*** 2813,2819 ****
  convert_regs (file)
       FILE *file;
  {
!   int inserted, i;
    edge e;
  
    /* Initialize uninitialized registers on function entry.  */
--- 2813,2820 ----
  convert_regs (file)
       FILE *file;
  {
!   int inserted;
!   basic_block b;
    edge e;
  
    /* Initialize uninitialized registers on function entry.  */
*************** convert_regs (file)
*** 2833,2841 ****
  
    /* ??? Process all unreachable blocks.  Though there's no excuse
       for keeping these even when not optimizing.  */
!   for (i = 0; i < n_basic_blocks; ++i)
      {
-       basic_block b = BASIC_BLOCK (i);
        block_info bi = BLOCK_INFO (b);
  
        if (! bi->done)
--- 2834,2841 ----
  
    /* ??? Process all unreachable blocks.  Though there's no excuse
       for keeping these even when not optimizing.  */
!   FOR_EACH_BB (b)
      {
        block_info bi = BLOCK_INFO (b);
  
        if (! bi->done)
Index: regclass.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regclass.c,v
retrieving revision 1.148
diff -c -3 -p -r1.148 regclass.c
*** regclass.c	17 May 2002 02:31:50 -0000	1.148
--- regclass.c	22 May 2002 17:04:35 -0000
*************** scan_one_insn (insn, pass)
*** 1127,1136 ****
  	 INSN could not be at the beginning of that block.  */
        if (previnsn == 0 || GET_CODE (previnsn) == JUMP_INSN)
  	{
! 	  int b;
! 	  for (b = 0; b < n_basic_blocks; b++)
! 	    if (insn == BLOCK_HEAD (b))
! 	      BLOCK_HEAD (b) = newinsn;
  	}
  
        /* This makes one more setting of new insns's dest.  */
--- 1127,1136 ----
  	 INSN could not be at the beginning of that block.  */
        if (previnsn == 0 || GET_CODE (previnsn) == JUMP_INSN)
  	{
! 	  basic_block b;
! 	  FOR_EACH_BB (b)
! 	    if (insn == b->head)
! 	      b->head = newinsn;
  	}
  
        /* This makes one more setting of new insns's dest.  */
*************** regclass (f, nregs, dump)
*** 1255,1261 ****
  
    for (pass = 0; pass <= flag_expensive_optimizations; pass++)
      {
!       int index;
  
        if (dump)
  	fprintf (dump, "\n\nPass %i\n\n",pass);
--- 1255,1261 ----
  
    for (pass = 0; pass <= flag_expensive_optimizations; pass++)
      {
!       basic_block bb;
  
        if (dump)
  	fprintf (dump, "\n\nPass %i\n\n",pass);
*************** regclass (f, nregs, dump)
*** 1277,1286 ****
  	    insn = scan_one_insn (insn, pass);
  	}
        else
! 	for (index = 0; index < n_basic_blocks; index++)
  	  {
- 	    basic_block bb = BASIC_BLOCK (index);
- 
  	    /* Show that an insn inside a loop is likely to be executed three
  	       times more than insns outside a loop.  This is much more
  	       aggressive than the assumptions made elsewhere and is being
--- 1277,1284 ----
  	    insn = scan_one_insn (insn, pass);
  	}
        else
! 	FOR_EACH_BB (bb)
  	  {
  	    /* Show that an insn inside a loop is likely to be executed three
  	       times more than insns outside a loop.  This is much more
  	       aggressive than the assumptions made elsewhere and is being
Index: regmove.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regmove.c,v
retrieving revision 1.129
diff -c -3 -p -r1.129 regmove.c
*** regmove.c	21 May 2002 20:37:42 -0000	1.129
--- regmove.c	22 May 2002 17:04:35 -0000
*************** mark_flags_life_zones (flags)
*** 223,229 ****
  {
    int flags_regno;
    int flags_nregs;
!   int block;
  
  #ifdef HAVE_cc0
    /* If we found a flags register on a cc0 host, bail.  */
--- 223,229 ----
  {
    int flags_regno;
    int flags_nregs;
!   basic_block block;
  
  #ifdef HAVE_cc0
    /* If we found a flags register on a cc0 host, bail.  */
*************** mark_flags_life_zones (flags)
*** 254,266 ****
    flags_set_1_rtx = flags;
  
    /* Process each basic block.  */
!   for (block = n_basic_blocks - 1; block >= 0; block--)
      {
        rtx insn, end;
        int live;
  
!       insn = BLOCK_HEAD (block);
!       end = BLOCK_END (block);
  
        /* Look out for the (unlikely) case of flags being live across
  	 basic block boundaries.  */
--- 254,266 ----
    flags_set_1_rtx = flags;
  
    /* Process each basic block.  */
!   FOR_EACH_BB_REVERSE (block)
      {
        rtx insn, end;
        int live;
  
!       insn = block->head;
!       end = block->end;
  
        /* Look out for the (unlikely) case of flags being live across
  	 basic block boundaries.  */
*************** mark_flags_life_zones (flags)
*** 269,275 ****
        {
  	int i;
  	for (i = 0; i < flags_nregs; ++i)
! 	  live |= REGNO_REG_SET_P (BASIC_BLOCK (block)->global_live_at_start,
  				   flags_regno + i);
        }
  #endif
--- 269,275 ----
        {
  	int i;
  	for (i = 0; i < flags_nregs; ++i)
! 	  live |= REGNO_REG_SET_P (block->global_live_at_start,
  				   flags_regno + i);
        }
  #endif
*************** regmove_optimize (f, nregs, regmove_dump
*** 1061,1066 ****
--- 1061,1067 ----
    int pass;
    int i;
    rtx copy_src, copy_dst;
+   basic_block bb;
  
    /* ??? Hack.  Regmove doesn't examine the CFG, and gets mightily
       confused by non-call exceptions ending blocks.  */
*************** regmove_optimize (f, nregs, regmove_dump
*** 1076,1083 ****
  
    regmove_bb_head = (int *) xmalloc (sizeof (int) * (old_max_uid + 1));
    for (i = old_max_uid; i >= 0; i--) regmove_bb_head[i] = -1;
!   for (i = 0; i < n_basic_blocks; i++)
!     regmove_bb_head[INSN_UID (BLOCK_HEAD (i))] = i;
  
    /* A forward/backward pass.  Replace output operands with input operands.  */
  
--- 1077,1084 ----
  
    regmove_bb_head = (int *) xmalloc (sizeof (int) * (old_max_uid + 1));
    for (i = old_max_uid; i >= 0; i--) regmove_bb_head[i] = -1;
!   FOR_EACH_BB (bb)
!     regmove_bb_head[INSN_UID (bb->head)] = bb->index;
  
    /* A forward/backward pass.  Replace output operands with input operands.  */
  
*************** regmove_optimize (f, nregs, regmove_dump
*** 1504,1512 ****
  
    /* In fixup_match_1, some insns may have been inserted after basic block
       ends.  Fix that here.  */
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx end = bb->end;
        rtx new = end;
        rtx next = NEXT_INSN (new);
--- 1505,1512 ----
  
    /* In fixup_match_1, some insns may have been inserted after basic block
       ends.  Fix that here.  */
!   FOR_EACH_BB (bb)
      {
        rtx end = bb->end;
        rtx new = end;
        rtx next = NEXT_INSN (new);
*************** static int record_stack_memrefs	PARAMS (
*** 2139,2148 ****
  void
  combine_stack_adjustments ()
  {
!   int i;
  
!   for (i = 0; i < n_basic_blocks; ++i)
!     combine_stack_adjustments_for_block (BASIC_BLOCK (i));
  }
  
  /* Recognize a MEM of the form (sp) or (plus sp const).  */
--- 2139,2148 ----
  void
  combine_stack_adjustments ()
  {
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     combine_stack_adjustments_for_block (bb);
  }
  
  /* Recognize a MEM of the form (sp) or (plus sp const).  */
Index: regrename.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regrename.c,v
retrieving revision 1.51
diff -c -3 -p -r1.51 regrename.c
*** regrename.c	17 May 2002 02:31:53 -0000	1.51
--- regrename.c	22 May 2002 17:04:35 -0000
*************** regrename_optimize ()
*** 201,207 ****
  {
    int tick[FIRST_PSEUDO_REGISTER];
    int this_tick = 0;
!   int b;
    char *first_obj;
  
    memset (tick, 0, sizeof tick);
--- 201,207 ----
  {
    int tick[FIRST_PSEUDO_REGISTER];
    int this_tick = 0;
!   basic_block bb;
    char *first_obj;
  
    memset (tick, 0, sizeof tick);
*************** regrename_optimize ()
*** 209,217 ****
    gcc_obstack_init (&rename_obstack);
    first_obj = (char *) obstack_alloc (&rename_obstack, 0);
  
!   for (b = 0; b < n_basic_blocks; b++)
      {
-       basic_block bb = BASIC_BLOCK (b);
        struct du_chain *all_chains = 0;
        HARD_REG_SET unavailable;
        HARD_REG_SET regs_seen;
--- 209,216 ----
    gcc_obstack_init (&rename_obstack);
    first_obj = (char *) obstack_alloc (&rename_obstack, 0);
  
!   FOR_EACH_BB (bb)
      {
        struct du_chain *all_chains = 0;
        HARD_REG_SET unavailable;
        HARD_REG_SET regs_seen;
*************** regrename_optimize ()
*** 219,225 ****
        CLEAR_HARD_REG_SET (unavailable);
  
        if (rtl_dump_file)
! 	fprintf (rtl_dump_file, "\nBasic block %d:\n", b);
  
        all_chains = build_def_use (bb);
  
--- 218,224 ----
        CLEAR_HARD_REG_SET (unavailable);
  
        if (rtl_dump_file)
! 	fprintf (rtl_dump_file, "\nBasic block %d:\n", bb->index);
  
        all_chains = build_def_use (bb);
  
*************** copyprop_hardreg_forward ()
*** 1726,1755 ****
  {
    struct value_data *all_vd;
    bool need_refresh;
!   int b;
  
    need_refresh = false;
  
    all_vd = xmalloc (sizeof (struct value_data) * n_basic_blocks);
  
!   for (b = 0; b < n_basic_blocks; b++)
      {
-       basic_block bb = BASIC_BLOCK (b);
- 
        /* If a block has a single predecessor, that we've already
  	 processed, begin with the value data that was live at
  	 the end of the predecessor block.  */
        /* ??? Ought to use more intelligent queueing of blocks.  */
        if (bb->pred
  	  && ! bb->pred->pred_next
  	  && ! (bb->pred->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
! 	  && bb->pred->src->index != ENTRY_BLOCK
! 	  && bb->pred->src->index < b)
! 	all_vd[b] = all_vd[bb->pred->src->index];
        else
! 	init_value_data (all_vd + b);
  
!       if (copyprop_hardreg_forward_1 (bb, all_vd + b))
  	need_refresh = true;
      }
  
--- 1725,1754 ----
  {
    struct value_data *all_vd;
    bool need_refresh;
!   basic_block bb, bbp;
  
    need_refresh = false;
  
    all_vd = xmalloc (sizeof (struct value_data) * n_basic_blocks);
  
!   FOR_EACH_BB (bb)
      {
        /* If a block has a single predecessor, that we've already
  	 processed, begin with the value data that was live at
  	 the end of the predecessor block.  */
        /* ??? Ought to use more intelligent queueing of blocks.  */
+       if (bb->pred)
+ 	for (bbp = bb; bbp && bbp != bb->pred->src; bbp = bbp->prev_bb);
        if (bb->pred
  	  && ! bb->pred->pred_next
  	  && ! (bb->pred->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
! 	  && bb->pred->src != ENTRY_BLOCK_PTR
! 	  && bbp)
! 	all_vd[bb->index] = all_vd[bb->pred->src->index];
        else
! 	init_value_data (all_vd + bb->index);
  
!       if (copyprop_hardreg_forward_1 (bb, all_vd + bb->index))
  	need_refresh = true;
      }
  
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.340
diff -c -3 -p -r1.340 reload1.c
*** reload1.c	21 May 2002 22:40:53 -0000	1.340
--- reload1.c	22 May 2002 17:04:37 -0000
*************** reload (first, global)
*** 676,681 ****
--- 676,682 ----
    int i;
    rtx insn;
    struct elim_table *ep;
+   basic_block bb;
  
    /* The two pointers used to track the true location of the memory used
       for label offsets.  */
*************** reload (first, global)
*** 1123,1130 ****
       pseudo.  */
  
    if (! frame_pointer_needed)
!     for (i = 0; i < n_basic_blocks; i++)
!       CLEAR_REGNO_REG_SET (BASIC_BLOCK (i)->global_live_at_start,
  			   HARD_FRAME_POINTER_REGNUM);
  
    /* Come here (with failure set nonzero) if we can't get enough spill regs
--- 1124,1131 ----
       pseudo.  */
  
    if (! frame_pointer_needed)
!     FOR_EACH_BB (bb)
!       CLEAR_REGNO_REG_SET (bb->global_live_at_start,
  			   HARD_FRAME_POINTER_REGNUM);
  
    /* Come here (with failure set nonzero) if we can't get enough spill regs
*************** reload_combine ()
*** 8613,8618 ****
--- 8614,8620 ----
    int first_index_reg = -1;
    int last_index_reg = 0;
    int i;
+   basic_block bb;
    unsigned int r;
    int last_label_ruid;
    int min_labelno, n_labels;
*************** reload_combine ()
*** 8648,8664 ****
    label_live = (HARD_REG_SET *) xmalloc (n_labels * sizeof (HARD_REG_SET));
    CLEAR_HARD_REG_SET (ever_live_at_start);
  
!   for (i = n_basic_blocks - 1; i >= 0; i--)
      {
!       insn = BLOCK_HEAD (i);
        if (GET_CODE (insn) == CODE_LABEL)
  	{
  	  HARD_REG_SET live;
  
  	  REG_SET_TO_HARD_REG_SET (live,
! 				   BASIC_BLOCK (i)->global_live_at_start);
  	  compute_use_by_pseudos (&live,
! 				  BASIC_BLOCK (i)->global_live_at_start);
  	  COPY_HARD_REG_SET (LABEL_LIVE (insn), live);
  	  IOR_HARD_REG_SET (ever_live_at_start, live);
  	}
--- 8650,8666 ----
    label_live = (HARD_REG_SET *) xmalloc (n_labels * sizeof (HARD_REG_SET));
    CLEAR_HARD_REG_SET (ever_live_at_start);
  
!   FOR_EACH_BB_REVERSE (bb)
      {
!       insn = bb->head;
        if (GET_CODE (insn) == CODE_LABEL)
  	{
  	  HARD_REG_SET live;
  
  	  REG_SET_TO_HARD_REG_SET (live,
! 				   bb->global_live_at_start);
  	  compute_use_by_pseudos (&live,
! 				  bb->global_live_at_start);
  	  COPY_HARD_REG_SET (LABEL_LIVE (insn), live);
  	  IOR_HARD_REG_SET (ever_live_at_start, live);
  	}
*************** copy_eh_notes (insn, x)
*** 9489,9500 ****
  void
  fixup_abnormal_edges ()
  {
-   int i;
    bool inserted = false;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        edge e;
  
        /* Look for cases we are interested in - an calls or instructions causing
--- 9491,9501 ----
  void
  fixup_abnormal_edges ()
  {
    bool inserted = false;
+   basic_block bb;
  
!   FOR_EACH_BB (bb)
      {
        edge e;
  
        /* Look for cases we are interested in - an calls or instructions causing
Index: resource.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/resource.c,v
retrieving revision 1.56
diff -c -3 -p -r1.56 resource.c
*** resource.c	21 May 2002 20:37:43 -0000	1.56
--- resource.c	22 May 2002 17:04:37 -0000
*************** find_basic_block (insn, search_limit)
*** 133,139 ****
       rtx insn;
       int search_limit;
  {
!   int i;
  
    /* Scan backwards to the previous BARRIER.  Then see if we can find a
       label that starts a basic block.  Return the basic block number.  */
--- 133,139 ----
       rtx insn;
       int search_limit;
  {
!   basic_block bb;
  
    /* Scan backwards to the previous BARRIER.  Then see if we can find a
       label that starts a basic block.  Return the basic block number.  */
*************** find_basic_block (insn, search_limit)
*** 156,164 ****
         insn && GET_CODE (insn) == CODE_LABEL;
         insn = next_nonnote_insn (insn))
      {
!       for (i = 0; i < n_basic_blocks; i++)
! 	if (insn == BLOCK_HEAD (i))
! 	  return i;
      }
  
    return -1;
--- 156,164 ----
         insn && GET_CODE (insn) == CODE_LABEL;
         insn = next_nonnote_insn (insn))
      {
!       FOR_EACH_BB (bb)
! 	if (insn == bb->head)
! 	  return bb->index;
      }
  
    return -1;
Index: sched-ebb.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-ebb.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 sched-ebb.c
*** sched-ebb.c	21 May 2002 20:37:43 -0000	1.13
--- sched-ebb.c	22 May 2002 17:04:37 -0000
*************** void
*** 279,285 ****
  schedule_ebbs (dump_file)
       FILE *dump_file;
  {
!   int i;
  
    /* Taking care of this degenerate case makes the rest of
       this code simpler.  */
--- 279,285 ----
  schedule_ebbs (dump_file)
       FILE *dump_file;
  {
!   basic_block bb;
  
    /* Taking care of this degenerate case makes the rest of
       this code simpler.  */
*************** schedule_ebbs (dump_file)
*** 296,315 ****
    compute_bb_for_insn (get_max_uid ());
  
    /* Schedule every region in the subroutine.  */
!   for (i = 0; i < n_basic_blocks; i++)
      {
!       rtx head = BASIC_BLOCK (i)->head;
        rtx tail;
  
        for (;;)
  	{
- 	  basic_block b = BASIC_BLOCK (i);
  	  edge e;
! 	  tail = b->end;
! 	  if (b->next_bb == EXIT_BLOCK_PTR
! 	      || GET_CODE (b->next_bb->head) == CODE_LABEL)
  	    break;
! 	  for (e = b->succ; e; e = e->succ_next)
  	    if ((e->flags & EDGE_FALLTHRU) != 0)
  	      break;
  	  if (! e)
--- 296,314 ----
    compute_bb_for_insn (get_max_uid ());
  
    /* Schedule every region in the subroutine.  */
!   FOR_EACH_BB (bb)
      {
!       rtx head = bb->head;
        rtx tail;
  
        for (;;)
  	{
  	  edge e;
! 	  tail = bb->end;
! 	  if (bb->next_bb == EXIT_BLOCK_PTR
! 	      || GET_CODE (bb->next_bb->head) == CODE_LABEL)
  	    break;
! 	  for (e = bb->succ; e; e = e->succ_next)
  	    if ((e->flags & EDGE_FALLTHRU) != 0)
  	      break;
  	  if (! e)
*************** schedule_ebbs (dump_file)
*** 325,331 ****
  		}
  	    }
  
! 	  i++;
  	}
  
        /* Blah.  We should fix the rest of the code not to get confused by
--- 324,330 ----
  		}
  	    }
  
! 	  bb = bb->next_bb;
  	}
  
        /* Blah.  We should fix the rest of the code not to get confused by
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 sched-rgn.c
*** sched-rgn.c	17 May 2002 02:31:55 -0000	1.40
--- sched-rgn.c	22 May 2002 17:04:38 -0000
*************** static void free_pending_lists PARAMS ((
*** 319,325 ****
  static int
  is_cfg_nonregular ()
  {
!   int b;
    rtx insn;
    RTX_CODE code;
  
--- 319,325 ----
  static int
  is_cfg_nonregular ()
  {
!   basic_block b;
    rtx insn;
    RTX_CODE code;
  
*************** is_cfg_nonregular ()
*** 346,353 ****
    /* If we have non-jumping insns which refer to labels, then we consider
       the cfg not well structured.  */
    /* Check for labels referred to other thn by jumps.  */
!   for (b = 0; b < n_basic_blocks; b++)
!     for (insn = BLOCK_HEAD (b);; insn = NEXT_INSN (insn))
        {
  	code = GET_CODE (insn);
  	if (GET_RTX_CLASS (code) == 'i' && code != JUMP_INSN)
--- 346,353 ----
    /* If we have non-jumping insns which refer to labels, then we consider
       the cfg not well structured.  */
    /* Check for labels referred to other thn by jumps.  */
!   FOR_EACH_BB (b)
!     for (insn = b->head;; insn = NEXT_INSN (insn))
        {
  	code = GET_CODE (insn);
  	if (GET_RTX_CLASS (code) == 'i' && code != JUMP_INSN)
*************** is_cfg_nonregular ()
*** 361,367 ****
  	      return 1;
  	  }
  
! 	if (insn == BLOCK_END (b))
  	  break;
        }
  
--- 361,367 ----
  	      return 1;
  	  }
  
! 	if (insn == b->end)
  	  break;
        }
  
*************** build_control_flow (edge_list)
*** 382,387 ****
--- 382,388 ----
       struct edge_list *edge_list;
  {
    int i, unreachable, num_edges;
+   basic_block b;
  
    /* This already accounts for entry/exit edges.  */
    num_edges = NUM_EDGES (edge_list);
*************** build_control_flow (edge_list)
*** 393,402 ****
       test is redundant with the one in find_rgns, but it's much
      cheaper to go ahead and catch the trivial case here.  */
    unreachable = 0;
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block b = BASIC_BLOCK (i);
- 
        if (b->pred == NULL
  	  || (b->pred->src == b
  	      && b->pred->pred_next == NULL))
--- 394,401 ----
       test is redundant with the one in find_rgns, but it's much
      cheaper to go ahead and catch the trivial case here.  */
    unreachable = 0;
!   FOR_EACH_BB (b)
      {
        if (b->pred == NULL
  	  || (b->pred->src == b
  	      && b->pred->pred_next == NULL))
*************** debug_regions ()
*** 544,560 ****
  static void
  find_single_block_region ()
  {
!   int i;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
!       rgn_bb_table[i] = i;
!       RGN_NR_BLOCKS (i) = 1;
!       RGN_BLOCKS (i) = i;
!       CONTAINING_RGN (i) = i;
!       BLOCK_TO_BB (i) = 0;
      }
-   nr_regions = n_basic_blocks;
  }
  
  /* Update number of blocks and the estimate for number of insns
--- 543,561 ----
  static void
  find_single_block_region ()
  {
!   basic_block bb;
  
!   nr_regions = 0;
! 
!   FOR_EACH_BB (bb)
      {
!       rgn_bb_table[nr_regions] = bb->index;
!       RGN_NR_BLOCKS (nr_regions) = 1;
!       RGN_BLOCKS (nr_regions) = nr_regions;
!       CONTAINING_RGN (bb->index) = nr_regions;
!       BLOCK_TO_BB (bb->index) = 0;
!       nr_regions++;
      }
  }
  
  /* Update number of blocks and the estimate for number of insns
*************** find_rgns (edge_list, dom)
*** 631,636 ****
--- 632,638 ----
    int count = 0, sp, idx = 0, current_edge = out_edges[0];
    int num_bbs, num_insns, unreachable;
    int too_large_failure;
+   basic_block bb;
  
    /* Note if an edge has been passed.  */
    sbitmap passed;
*************** find_rgns (edge_list, dom)
*** 772,779 ****
       the entry node by placing a nonzero value in dfs_nr.  Thus if
       dfs_nr is zero for any block, then it must be unreachable.  */
    unreachable = 0;
!   for (i = 0; i < n_basic_blocks; i++)
!     if (dfs_nr[i] == 0)
        {
  	unreachable = 1;
  	break;
--- 774,781 ----
       the entry node by placing a nonzero value in dfs_nr.  Thus if
       dfs_nr is zero for any block, then it must be unreachable.  */
    unreachable = 0;
!   FOR_EACH_BB (bb)
!     if (dfs_nr[bb->index] == 0)
        {
  	unreachable = 1;
  	break;
*************** find_rgns (edge_list, dom)
*** 783,790 ****
       to hold degree counts.  */
    degree = dfs_nr;
  
!   for (i = 0; i < n_basic_blocks; i++)
!     degree[i] = 0;
    for (i = 0; i < num_edges; i++)
      {
        edge e = INDEX_EDGE (edge_list, i);
--- 785,792 ----
       to hold degree counts.  */
    degree = dfs_nr;
  
!   FOR_EACH_BB (bb)
!     degree[bb->index] = 0;
    for (i = 0; i < num_edges; i++)
      {
        edge e = INDEX_EDGE (edge_list, i);
*************** find_rgns (edge_list, dom)
*** 809,820 ****
  
        /* Find blocks which are inner loop headers.  We still have non-reducible
  	 loops to consider at this point.  */
!       for (i = 0; i < n_basic_blocks; i++)
  	{
! 	  if (TEST_BIT (header, i) && TEST_BIT (inner, i))
  	    {
  	      edge e;
! 	      int j;
  
  	      /* Now check that the loop is reducible.  We do this separate
  		 from finding inner loops so that we do not find a reducible
--- 811,822 ----
  
        /* Find blocks which are inner loop headers.  We still have non-reducible
  	 loops to consider at this point.  */
!       FOR_EACH_BB (bb)
  	{
! 	  if (TEST_BIT (header, bb->index) && TEST_BIT (inner, bb->index))
  	    {
  	      edge e;
! 	      basic_block jbb;
  
  	      /* Now check that the loop is reducible.  We do this separate
  		 from finding inner loops so that we do not find a reducible
*************** find_rgns (edge_list, dom)
*** 827,841 ****
  		 If there exists a block that is not dominated by the loop
  		 header, then the block is reachable from outside the loop
  		 and thus the loop is not a natural loop.  */
! 	      for (j = 0; j < n_basic_blocks; j++)
  		{
  		  /* First identify blocks in the loop, except for the loop
  		     entry block.  */
! 		  if (i == max_hdr[j] && i != j)
  		    {
  		      /* Now verify that the block is dominated by the loop
  			 header.  */
! 		      if (!TEST_BIT (dom[j], i))
  			break;
  		    }
  		}
--- 829,843 ----
  		 If there exists a block that is not dominated by the loop
  		 header, then the block is reachable from outside the loop
  		 and thus the loop is not a natural loop.  */
! 	      FOR_EACH_BB (jbb)
  		{
  		  /* First identify blocks in the loop, except for the loop
  		     entry block.  */
! 		  if (bb->index == max_hdr[jbb->index] && bb != jbb)
  		    {
  		      /* Now verify that the block is dominated by the loop
  			 header.  */
! 		      if (!TEST_BIT (dom[jbb->index], bb->index))
  			break;
  		    }
  		}
*************** find_rgns (edge_list, dom)
*** 843,867 ****
  	      /* If we exited the loop early, then I is the header of
  		 a non-reducible loop and we should quit processing it
  		 now.  */
! 	      if (j != n_basic_blocks)
  		continue;
  
  	      /* I is a header of an inner loop, or block 0 in a subroutine
  		 with no loops at all.  */
  	      head = tail = -1;
  	      too_large_failure = 0;
! 	      loop_head = max_hdr[i];
  
  	      /* Decrease degree of all I's successors for topological
  		 ordering.  */
! 	      for (e = BASIC_BLOCK (i)->succ; e; e = e->succ_next)
  		if (e->dest != EXIT_BLOCK_PTR)
  		  --degree[e->dest->index];
  
  	      /* Estimate # insns, and count # blocks in the region.  */
  	      num_bbs = 1;
! 	      num_insns = (INSN_LUID (BLOCK_END (i))
! 			   - INSN_LUID (BLOCK_HEAD (i)));
  
  	      /* Find all loop latches (blocks with back edges to the loop
  		 header) or all the leaf blocks in the cfg has no loops.
--- 845,869 ----
  	      /* If we exited the loop early, then I is the header of
  		 a non-reducible loop and we should quit processing it
  		 now.  */
! 	      if (jbb != EXIT_BLOCK_PTR)
  		continue;
  
  	      /* I is a header of an inner loop, or block 0 in a subroutine
  		 with no loops at all.  */
  	      head = tail = -1;
  	      too_large_failure = 0;
! 	      loop_head = max_hdr[bb->index];
  
  	      /* Decrease degree of all I's successors for topological
  		 ordering.  */
! 	      for (e = bb->succ; e; e = e->succ_next)
  		if (e->dest != EXIT_BLOCK_PTR)
  		  --degree[e->dest->index];
  
  	      /* Estimate # insns, and count # blocks in the region.  */
  	      num_bbs = 1;
! 	      num_insns = (INSN_LUID (bb->end)
! 			   - INSN_LUID (bb->head));
  
  	      /* Find all loop latches (blocks with back edges to the loop
  		 header) or all the leaf blocks in the cfg has no loops.
*************** find_rgns (edge_list, dom)
*** 869,885 ****
  		 Place those blocks into the queue.  */
  	      if (no_loops)
  		{
! 		  for (j = 0; j < n_basic_blocks; j++)
  		    /* Leaf nodes have only a single successor which must
  		       be EXIT_BLOCK.  */
! 		    if (BASIC_BLOCK (j)->succ
! 			&& BASIC_BLOCK (j)->succ->dest == EXIT_BLOCK_PTR
! 			&& BASIC_BLOCK (j)->succ->succ_next == NULL)
  		      {
! 			queue[++tail] = j;
! 			SET_BIT (in_queue, j);
  
! 			if (too_large (j, &num_bbs, &num_insns))
  			  {
  			    too_large_failure = 1;
  			    break;
--- 871,887 ----
  		 Place those blocks into the queue.  */
  	      if (no_loops)
  		{
! 		  FOR_EACH_BB (jbb)
  		    /* Leaf nodes have only a single successor which must
  		       be EXIT_BLOCK.  */
! 		    if (jbb->succ
! 			&& jbb->succ->dest == EXIT_BLOCK_PTR
! 			&& jbb->succ->succ_next == NULL)
  		      {
! 			queue[++tail] = jbb->index;
! 			SET_BIT (in_queue, jbb->index);
  
! 			if (too_large (jbb->index, &num_bbs, &num_insns))
  			  {
  			    too_large_failure = 1;
  			    break;
*************** find_rgns (edge_list, dom)
*** 890,903 ****
  		{
  		  edge e;
  
! 		  for (e = BASIC_BLOCK (i)->pred; e; e = e->pred_next)
  		    {
  		      if (e->src == ENTRY_BLOCK_PTR)
  			continue;
  
  		      node = e->src->index;
  
! 		      if (max_hdr[node] == loop_head && node != i)
  			{
  			  /* This is a loop latch.  */
  			  queue[++tail] = node;
--- 892,905 ----
  		{
  		  edge e;
  
! 		  for (e = bb->pred; e; e = e->pred_next)
  		    {
  		      if (e->src == ENTRY_BLOCK_PTR)
  			continue;
  
  		      node = e->src->index;
  
! 		      if (max_hdr[node] == loop_head && node != bb->index)
  			{
  			  /* This is a loop latch.  */
  			  queue[++tail] = node;
*************** find_rgns (edge_list, dom)
*** 959,965 ****
  			  tail = -1;
  			  break;
  			}
! 		      else if (!TEST_BIT (in_queue, node) && node != i)
  			{
  			  queue[++tail] = node;
  			  SET_BIT (in_queue, node);
--- 961,967 ----
  			  tail = -1;
  			  break;
  			}
! 		      else if (!TEST_BIT (in_queue, node) && node != bb->index)
  			{
  			  queue[++tail] = node;
  			  SET_BIT (in_queue, node);
*************** find_rgns (edge_list, dom)
*** 976,987 ****
  	      if (tail >= 0 && !too_large_failure)
  		{
  		  /* Place the loop header into list of region blocks.  */
! 		  degree[i] = -1;
! 		  rgn_bb_table[idx] = i;
  		  RGN_NR_BLOCKS (nr_regions) = num_bbs;
  		  RGN_BLOCKS (nr_regions) = idx++;
! 		  CONTAINING_RGN (i) = nr_regions;
! 		  BLOCK_TO_BB (i) = count = 0;
  
  		  /* Remove blocks from queue[] when their in degree
  		     becomes zero.  Repeat until no blocks are left on the
--- 978,989 ----
  	      if (tail >= 0 && !too_large_failure)
  		{
  		  /* Place the loop header into list of region blocks.  */
! 		  degree[bb->index] = -1;
! 		  rgn_bb_table[idx] = bb->index;
  		  RGN_NR_BLOCKS (nr_regions) = num_bbs;
  		  RGN_BLOCKS (nr_regions) = idx++;
! 		  CONTAINING_RGN (bb->index) = nr_regions;
! 		  BLOCK_TO_BB (bb->index) = count = 0;
  
  		  /* Remove blocks from queue[] when their in degree
  		     becomes zero.  Repeat until no blocks are left on the
*************** find_rgns (edge_list, dom)
*** 1020,1033 ****
  
    /* Any block that did not end up in a region is placed into a region
       by itself.  */
!   for (i = 0; i < n_basic_blocks; i++)
!     if (degree[i] >= 0)
        {
! 	rgn_bb_table[idx] = i;
  	RGN_NR_BLOCKS (nr_regions) = 1;
  	RGN_BLOCKS (nr_regions) = idx++;
! 	CONTAINING_RGN (i) = nr_regions++;
! 	BLOCK_TO_BB (i) = 0;
        }
  
    free (max_hdr);
--- 1022,1035 ----
  
    /* Any block that did not end up in a region is placed into a region
       by itself.  */
!   FOR_EACH_BB (bb)
!     if (degree[bb->index] >= 0)
        {
! 	rgn_bb_table[idx] = bb->index;
  	RGN_NR_BLOCKS (nr_regions) = 1;
  	RGN_BLOCKS (nr_regions) = idx++;
! 	CONTAINING_RGN (bb->index) = nr_regions++;
! 	BLOCK_TO_BB (bb->index) = 0;
        }
  
    free (max_hdr);
*************** schedule_insns (dump_file)
*** 2980,2985 ****
--- 2982,2988 ----
    sbitmap large_region_blocks, blocks;
    int rgn;
    int any_large_regions;
+   basic_block bb;
  
    /* Taking care of this degenerate case makes the rest of
       this code simpler.  */
*************** schedule_insns (dump_file)
*** 3019,3025 ****
  
    any_large_regions = 0;
    large_region_blocks = sbitmap_alloc (n_basic_blocks);
!   sbitmap_ones (large_region_blocks);
  
    blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
--- 3022,3030 ----
  
    any_large_regions = 0;
    large_region_blocks = sbitmap_alloc (n_basic_blocks);
!   sbitmap_zero (large_region_blocks);
!   FOR_EACH_BB (bb)
!     SET_BIT (large_region_blocks, bb->index);
  
    blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
Index: sibcall.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sibcall.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 sibcall.c
*** sibcall.c	17 May 2002 02:31:55 -0000	1.36
--- sibcall.c	22 May 2002 17:04:38 -0000
*************** optimize_sibling_and_tail_recursive_call
*** 610,616 ****
  
        /* Walk forwards through the last normal block and see if it
  	 does nothing except fall into the exit block.  */
!       for (insn = BLOCK_HEAD (n_basic_blocks - 1);
  	   insn;
  	   insn = NEXT_INSN (insn))
  	{
--- 610,616 ----
  
        /* Walk forwards through the last normal block and see if it
  	 does nothing except fall into the exit block.  */
!       for (insn = EXIT_BLOCK_PTR->prev_bb->head;
  	   insn;
  	   insn = NEXT_INSN (insn))
  	{
Index: ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa-ccp.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 ssa-ccp.c
*** ssa-ccp.c	17 May 2002 02:31:55 -0000	1.21
--- ssa-ccp.c	22 May 2002 17:04:38 -0000
*************** optimize_unexecutable_edges (edges, exec
*** 740,745 ****
--- 740,746 ----
       sbitmap executable_edges;
  {
    int i;
+   basic_block bb;
  
    for (i = 0; i < NUM_EDGES (edges); i++)
      {
*************** optimize_unexecutable_edges (edges, exec
*** 797,805 ****
       In cases B & C we are removing uses of registers, so make sure
       to note those changes for the DF analyzer.  */
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn = bb->end;
        edge edge = bb->succ;
  
--- 798,805 ----
       In cases B & C we are removing uses of registers, so make sure
       to note those changes for the DF analyzer.  */
  
!   FOR_EACH_BB (bb)
      {
        rtx insn = bb->end;
        edge edge = bb->succ;
  
*************** ssa_ccp_substitute_constants ()
*** 929,935 ****
  static void
  ssa_ccp_df_delete_unreachable_insns ()
  {
!   int i;
  
    /* Use the CFG to find all the reachable blocks.  */
    find_unreachable_blocks ();
--- 929,935 ----
  static void
  ssa_ccp_df_delete_unreachable_insns ()
  {
!   basic_block b;
  
    /* Use the CFG to find all the reachable blocks.  */
    find_unreachable_blocks ();
*************** ssa_ccp_df_delete_unreachable_insns ()
*** 937,946 ****
    /* Now we know what blocks are not reachable.  Mark all the insns
       in those blocks as deleted for the DF analyzer.   We'll let the
       normal flow code actually remove the unreachable blocks.  */
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block b = BASIC_BLOCK (i);
- 
        if (!(b->flags & BB_REACHABLE))
  	{
  	  rtx start = b->head;
--- 937,944 ----
    /* Now we know what blocks are not reachable.  Mark all the insns
       in those blocks as deleted for the DF analyzer.   We'll let the
       normal flow code actually remove the unreachable blocks.  */
!   FOR_EACH_BB_REVERSE (b)
      {
        if (!(b->flags & BB_REACHABLE))
  	{
  	  rtx start = b->head;
Index: ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa-dce.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 ssa-dce.c
*** ssa-dce.c	21 May 2002 20:37:43 -0000	1.16
--- ssa-dce.c	22 May 2002 17:04:38 -0000
*************** ssa_eliminate_dead_code ()
*** 490,495 ****
--- 490,496 ----
  {
    int i;
    rtx insn;
+   basic_block bb;
    /* Necessary instructions with operands to explore.  */
    varray_type unprocessed_instructions;
    /* Map element (b,e) is nonzero if the block is control dependent on
*************** ssa_eliminate_dead_code ()
*** 718,727 ****
    /* Find any blocks with no successors and ensure they are followed
       by a BARRIER.  delete_insn has the nasty habit of deleting barriers
       when deleting insns.  */
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
- 
        if (bb->succ == NULL)
  	{
  	  rtx next = NEXT_INSN (bb->end);
--- 719,726 ----
    /* Find any blocks with no successors and ensure they are followed
       by a BARRIER.  delete_insn has the nasty habit of deleting barriers
       when deleting insns.  */
!   FOR_EACH_BB (bb)
      {
        if (bb->succ == NULL)
  	{
  	  rtx next = NEXT_INSN (bb->end);
Index: ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa.c,v
retrieving revision 1.47
diff -c -3 -p -r1.47 ssa.c
*** ssa.c	17 May 2002 02:31:56 -0000	1.47
--- ssa.c	22 May 2002 17:04:38 -0000
*************** find_evaluations (evals, nregs)
*** 470,487 ****
       sbitmap *evals;
       int nregs;
  {
!   int bb;
  
    sbitmap_vector_zero (evals, nregs);
    fe_evals = evals;
  
!   for (bb = n_basic_blocks; --bb >= 0; )
      {
        rtx p, last;
  
!       fe_current_bb = bb;
!       p = BLOCK_HEAD (bb);
!       last = BLOCK_END (bb);
        while (1)
  	{
  	  if (INSN_P (p))
--- 470,487 ----
       sbitmap *evals;
       int nregs;
  {
!   basic_block bb;
  
    sbitmap_vector_zero (evals, nregs);
    fe_evals = evals;
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx p, last;
  
!       fe_current_bb = bb->index;
!       p = bb->head;
!       last = bb->end;
        while (1)
  	{
  	  if (INSN_P (p))
*************** compute_dominance_frontiers_1 (frontiers
*** 520,526 ****
  {
    basic_block b = BASIC_BLOCK (bb);
    edge e;
!   int c;
  
    SET_BIT (done, bb);
    sbitmap_zero (frontiers[bb]);
--- 520,526 ----
  {
    basic_block b = BASIC_BLOCK (bb);
    edge e;
!   basic_block c;
  
    SET_BIT (done, bb);
    sbitmap_zero (frontiers[bb]);
*************** compute_dominance_frontiers_1 (frontiers
*** 528,536 ****
    /* Do the frontier of the children first.  Not all children in the
       dominator tree (blocks dominated by this one) are children in the
       CFG, so check all blocks.  */
!   for (c = 0; c < n_basic_blocks; ++c)
!     if (idom[c] == bb && ! TEST_BIT (done, c))
!       compute_dominance_frontiers_1 (frontiers, idom, c, done);
  
    /* Find blocks conforming to rule (1) above.  */
    for (e = b->succ; e; e = e->succ_next)
--- 528,536 ----
    /* Do the frontier of the children first.  Not all children in the
       dominator tree (blocks dominated by this one) are children in the
       CFG, so check all blocks.  */
!   FOR_EACH_BB (c)
!     if (idom[c->index] == bb && ! TEST_BIT (done, c->index))
!       compute_dominance_frontiers_1 (frontiers, idom, c->index, done);
  
    /* Find blocks conforming to rule (1) above.  */
    for (e = b->succ; e; e = e->succ_next)
*************** compute_dominance_frontiers_1 (frontiers
*** 542,552 ****
      }
  
    /* Find blocks conforming to rule (2).  */
!   for (c = 0; c < n_basic_blocks; ++c)
!     if (idom[c] == bb)
        {
  	int x;
! 	EXECUTE_IF_SET_IN_SBITMAP (frontiers[c], 0, x,
  	  {
  	    if (idom[x] != bb)
  	      SET_BIT (frontiers[bb], x);
--- 542,552 ----
      }
  
    /* Find blocks conforming to rule (2).  */
!   FOR_EACH_BB (c)
!     if (idom[c->index] == bb)
        {
  	int x;
! 	EXECUTE_IF_SET_IN_SBITMAP (frontiers[c->index], 0, x,
  	  {
  	    if (idom[x] != bb)
  	      SET_BIT (frontiers[bb], x);
*************** rename_block (bb, idom)
*** 975,981 ****
    edge e;
    rtx insn, next, last;
    struct rename_set_data *set_data = NULL;
!   int c;
  
    /* Step One: Walk the basic block, adding new names for sets and
       replacing uses.  */
--- 975,981 ----
    edge e;
    rtx insn, next, last;
    struct rename_set_data *set_data = NULL;
!   basic_block c;
  
    /* Step One: Walk the basic block, adding new names for sets and
       replacing uses.  */
*************** rename_block (bb, idom)
*** 1078,1086 ****
    /* Step Three: Do the same to the children of this block in
       dominator order.  */
  
!   for (c = 0; c < n_basic_blocks; ++c)
!     if (idom[c] == bb)
!       rename_block (c, idom);
  
    /* Step Four: Update the sets to refer to their new register,
       and restore ssa_rename_to to its previous state.  */
--- 1078,1086 ----
    /* Step Three: Do the same to the children of this block in
       dominator order.  */
  
!   FOR_EACH_BB (c)
!     if (idom[c->index] == bb)
!       rename_block (c->index, idom);
  
    /* Step Four: Update the sets to refer to their new register,
       and restore ssa_rename_to to its previous state.  */
*************** convert_to_ssa ()
*** 1140,1145 ****
--- 1140,1147 ----
  
    int nregs;
  
+   basic_block bb;
+ 
    /* Don't do it twice.  */
    if (in_ssa_form)
      abort ();
*************** convert_to_ssa ()
*** 1154,1163 ****
  
    if (rtl_dump_file)
      {
-       int i;
        fputs (";; Immediate Dominators:\n", rtl_dump_file);
!       for (i = 0; i < n_basic_blocks; ++i)
! 	fprintf (rtl_dump_file, ";\t%3d = %3d\n", i, idom[i]);
        fflush (rtl_dump_file);
      }
  
--- 1156,1164 ----
  
    if (rtl_dump_file)
      {
        fputs (";; Immediate Dominators:\n", rtl_dump_file);
!       FOR_EACH_BB (bb)
! 	fprintf (rtl_dump_file, ";\t%3d = %3d\n", bb->index, idom[bb->index]);
        fflush (rtl_dump_file);
      }
  
*************** make_equivalent_phi_alternatives_equival
*** 1629,1635 ****
  static partition
  compute_conservative_reg_partition ()
  {
!   int bb;
    int changed = 0;
  
    /* We don't actually work with hard registers, but it's easier to
--- 1630,1636 ----
  static partition
  compute_conservative_reg_partition ()
  {
!   basic_block bb;
    int changed = 0;
  
    /* We don't actually work with hard registers, but it's easier to
*************** compute_conservative_reg_partition ()
*** 1642,1649 ****
       be copied on abnormal critical edges are placed in the same
       partition.  This saves us from having to split abnormal critical
       edges.  */
!   for (bb = n_basic_blocks; --bb >= 0; )
!     changed += make_regs_equivalent_over_bad_edges (bb, p);
  
    /* Now we have to insure that corresponding arguments of phi nodes
       assigning to corresponding regs are equivalent.  Iterate until
--- 1643,1650 ----
       be copied on abnormal critical edges are placed in the same
       partition.  This saves us from having to split abnormal critical
       edges.  */
!   FOR_EACH_BB_REVERSE (bb)
!     changed += make_regs_equivalent_over_bad_edges (bb->index, p);
  
    /* Now we have to insure that corresponding arguments of phi nodes
       assigning to corresponding regs are equivalent.  Iterate until
*************** compute_conservative_reg_partition ()
*** 1651,1658 ****
    while (changed > 0)
      {
        changed = 0;
!       for (bb = n_basic_blocks; --bb >= 0; )
! 	changed += make_equivalent_phi_alternatives_equivalent (bb, p);
      }
  
    return p;
--- 1652,1659 ----
    while (changed > 0)
      {
        changed = 0;
!       FOR_EACH_BB_REVERSE (bb)
! 	changed += make_equivalent_phi_alternatives_equivalent (bb->index, p);
      }
  
    return p;
*************** coalesce_regs_in_successor_phi_nodes (bb
*** 1848,1854 ****
  static partition
  compute_coalesced_reg_partition ()
  {
!   int bb;
    int changed = 0;
    regset_head phi_set_head;
    regset phi_set = &phi_set_head;
--- 1849,1855 ----
  static partition
  compute_coalesced_reg_partition ()
  {
!   basic_block bb;
    int changed = 0;
    regset_head phi_set_head;
    regset phi_set = &phi_set_head;
*************** compute_coalesced_reg_partition ()
*** 1860,1867 ****
       be copied on abnormal critical edges are placed in the same
       partition.  This saves us from having to split abnormal critical
       edges (which can't be done).  */
!   for (bb = n_basic_blocks; --bb >= 0; )
!     make_regs_equivalent_over_bad_edges (bb, p);
  
    INIT_REG_SET (phi_set);
  
--- 1861,1868 ----
       be copied on abnormal critical edges are placed in the same
       partition.  This saves us from having to split abnormal critical
       edges (which can't be done).  */
!   FOR_EACH_BB_REVERSE (bb)
!     make_regs_equivalent_over_bad_edges (bb->index, p);
  
    INIT_REG_SET (phi_set);
  
*************** compute_coalesced_reg_partition ()
*** 1883,1894 ****
  	 blocks first, so that most frequently executed copies would
  	 be more likely to be removed by register coalescing.  But any
  	 order will generate correct, if non-optimal, results.  */
!       for (bb = n_basic_blocks; --bb >= 0; )
  	{
! 	  basic_block block = BASIC_BLOCK (bb);
! 	  changed += coalesce_regs_in_copies (block, p, conflicts);
  	  changed +=
! 	    coalesce_regs_in_successor_phi_nodes (block, p, conflicts);
  	}
  
        conflict_graph_delete (conflicts);
--- 1884,1894 ----
  	 blocks first, so that most frequently executed copies would
  	 be more likely to be removed by register coalescing.  But any
  	 order will generate correct, if non-optimal, results.  */
!       FOR_EACH_BB_REVERSE (bb)
  	{
! 	  changed += coalesce_regs_in_copies (bb, p, conflicts);
  	  changed +=
! 	    coalesce_regs_in_successor_phi_nodes (bb, p, conflicts);
  	}
  
        conflict_graph_delete (conflicts);
*************** static void
*** 2094,2104 ****
  rename_equivalent_regs (reg_partition)
       partition reg_partition;
  {
!   int bb;
  
!   for (bb = n_basic_blocks; --bb >= 0; )
      {
-       basic_block b = BASIC_BLOCK (bb);
        rtx next = b->head;
        rtx last = b->end;
        rtx insn;
--- 2094,2103 ----
  rename_equivalent_regs (reg_partition)
       partition reg_partition;
  {
!   basic_block b;
  
!   FOR_EACH_BB_REVERSE (b)
      {
        rtx next = b->head;
        rtx last = b->end;
        rtx insn;
*************** rename_equivalent_regs (reg_partition)
*** 2141,2147 ****
  void
  convert_from_ssa ()
  {
!   int bb;
    partition reg_partition;
    rtx insns = get_insns ();
  
--- 2140,2146 ----
  void
  convert_from_ssa ()
  {
!   basic_block b, bb;
    partition reg_partition;
    rtx insns = get_insns ();
  
*************** convert_from_ssa ()
*** 2167,2175 ****
    rename_equivalent_regs (reg_partition);
  
    /* Eliminate the PHI nodes.  */
!   for (bb = n_basic_blocks; --bb >= 0; )
      {
-       basic_block b = BASIC_BLOCK (bb);
        edge e;
  
        for (e = b->pred; e; e = e->pred_next)
--- 2166,2173 ----
    rename_equivalent_regs (reg_partition);
  
    /* Eliminate the PHI nodes.  */
!   FOR_EACH_BB_REVERSE (b)
      {
        edge e;
  
        for (e = b->pred; e; e = e->pred_next)
*************** convert_from_ssa ()
*** 2180,2196 ****
    partition_delete (reg_partition);
  
    /* Actually delete the PHI nodes.  */
!   for (bb = n_basic_blocks; --bb >= 0; )
      {
!       rtx insn = BLOCK_HEAD (bb);
  
        while (1)
  	{
  	  /* If this is a PHI node delete it.  */
  	  if (PHI_NODE_P (insn))
  	    {
! 	      if (insn == BLOCK_END (bb))
! 		BLOCK_END (bb) = PREV_INSN (insn);
  	      insn = delete_insn (insn);
  	    }
  	  /* Since all the phi nodes come at the beginning of the
--- 2178,2194 ----
    partition_delete (reg_partition);
  
    /* Actually delete the PHI nodes.  */
!   FOR_EACH_BB_REVERSE (bb)
      {
!       rtx insn = bb->head;
  
        while (1)
  	{
  	  /* If this is a PHI node delete it.  */
  	  if (PHI_NODE_P (insn))
  	    {
! 	      if (insn == bb->end)
! 		bb->end = PREV_INSN (insn);
  	      insn = delete_insn (insn);
  	    }
  	  /* Since all the phi nodes come at the beginning of the
*************** convert_from_ssa ()
*** 2199,2205 ****
  	  else if (INSN_P (insn))
  	    break;
  	  /* If we've reached the end of the block, stop.  */
! 	  else if (insn == BLOCK_END (bb))
  	    break;
  	  else
  	    insn = NEXT_INSN (insn);
--- 2197,2203 ----
  	  else if (INSN_P (insn))
  	    break;
  	  /* If we've reached the end of the block, stop.  */
! 	  else if (insn == bb->end)
  	    break;
  	  else
  	    insn = NEXT_INSN (insn);
Index: ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.169
diff -c -3 -p -r1.169 ia64.c
*** ia64.c	19 May 2002 09:50:21 -0000	1.169
--- ia64.c	22 May 2002 17:08:04 -0000
*************** ia64_sched_finish (dump, sched_verbose)
*** 6566,6576 ****
  static void
  emit_predicate_relation_info ()
  {
!   int i;
  
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        int r;
        rtx head = bb->head;
  
--- 6566,6575 ----
  static void
  emit_predicate_relation_info ()
  {
!   basic_block bb;
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        int r;
        rtx head = bb->head;
  
*************** emit_predicate_relation_info ()
*** 6596,6604 ****
       relations around them.  Otherwise the assembler will assume the call
       returns, and complain about uses of call-clobbered predicates after
       the call.  */
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn = bb->head;
        
        while (1)
--- 6595,6602 ----
       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)
      {
        rtx insn = bb->head;
        
        while (1)
*************** ia64_strip_name_encoding (str)
*** 6974,6984 ****
  
  /* The current basic block number.  */
  
! static int block_num;
  
  /* True if we need a copy_state command at the start of the next block.  */
  
! static int need_copy_state;
  
  /* The function emits unwind directives for the start of an epilogue.  */
  
--- 6972,6982 ----
  
  /* The current basic block number.  */
  
! static bool last_block;
  
  /* True if we need a copy_state command at the start of the next block.  */
  
! static bool need_copy_state;
  
  /* The function emits unwind directives for the start of an epilogue.  */
  
*************** process_epilogue ()
*** 6988,6997 ****
    /* If this isn't the last block of the function, then we need to label the
       current state, and copy it back in at the start of the next block.  */
  
!   if (block_num != n_basic_blocks - 1)
      {
        fprintf (asm_out_file, "\t.label_state 1\n");
!       need_copy_state = 1;
      }
  
    fprintf (asm_out_file, "\t.restore sp\n");
--- 6986,6995 ----
    /* If this isn't the last block of the function, then we need to label the
       current state, and copy it back in at the start of the next block.  */
  
!   if (!last_block)
      {
        fprintf (asm_out_file, "\t.label_state 1\n");
!       need_copy_state = true;
      }
  
    fprintf (asm_out_file, "\t.restore sp\n");
*************** process_for_unwind_directive (asm_out_fi
*** 7229,7242 ****
        if (GET_CODE (insn) == NOTE
  	  && NOTE_LINE_NUMBER (insn) == NOTE_INSN_BASIC_BLOCK)
  	{
! 	  block_num = NOTE_BASIC_BLOCK (insn)->index;
  
  	  /* Restore unwind state from immediately before the epilogue.  */
  	  if (need_copy_state)
  	    {
  	      fprintf (asm_out_file, "\t.body\n");
  	      fprintf (asm_out_file, "\t.copy_state 1\n");
! 	      need_copy_state = 0;
  	    }
  	}
  
--- 7227,7240 ----
        if (GET_CODE (insn) == NOTE
  	  && NOTE_LINE_NUMBER (insn) == NOTE_INSN_BASIC_BLOCK)
  	{
! 	  last_block = NOTE_BASIC_BLOCK (insn)->next_bb == EXIT_BLOCK_PTR;
  
  	  /* Restore unwind state from immediately before the epilogue.  */
  	  if (need_copy_state)
  	    {
  	      fprintf (asm_out_file, "\t.body\n");
  	      fprintf (asm_out_file, "\t.copy_state 1\n");
! 	      need_copy_state = false;
  	    }
  	}
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]