]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
bb-reorder.c (make_reorder_chain_1): Modified.
authorZdenek Dvorak <rakdver@gcc.gnu.org>
Tue, 21 May 2002 20:37:43 +0000 (20:37 +0000)
committerZdenek Dvorak <rakdver@gcc.gnu.org>
Tue, 21 May 2002 20:37:43 +0000 (20:37 +0000)
* bb-reorder.c (make_reorder_chain_1): Modified.
* cfganal.c (can_fallthru, flow_call_edges_add,
flow_preorder_transversal_compute): Modified.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Modified.
* cfgcleanup.c (try_simplify_condjump, try_optimize_cfg): Modified.
* cfglayout.c (skip_insns_after_block, fixup_reorder_chain,
fixup_fallthru_exit_predecessor, cfg_layout_redirect_edge): Modified.
* cfgrtl.c (tidy_fallthru_edges, verify_flow_info): Modified.
* combine.c (this_basic_block): Type changed to basic_block.
(combine_instructions, set_nonzero_bits_and_sign_copies, try_combine,
nonzero_bits, num_sign_bit_copies, get_last_value_validate,
get_last_value, distribute_notes, distribute_links): Modified.
* final.c (compute_alignments): Modified.
* flow.c (regno_uninitialized, regno_clobbered_at_setjmp): Modified.
* function.c (thread_prologue_and_epilogue_insns): Modified.
* gcse.c (compute_code_hoist_vbeinout): Modified.
* global.c (build_insn_chain): Modified.
* ifcvt.c (find_if_block, find_cond_trap): Modified.
* predict.c (last_basic_block_p, note_prediction_to_br_prob): Modified.
* regmove.c (regmove_optimize): Modified.
* resource.c (find_basic_block): Modified.
* sched-ebb.c (schedule_ebbs): Modified.
* ssa-dce.c (find_control_dependence, find_pdom): Modified.

From-SVN: r53695

18 files changed:
gcc/bb-reorder.c
gcc/cfganal.c
gcc/cfgbuild.c
gcc/cfgcleanup.c
gcc/cfglayout.c
gcc/cfgrtl.c
gcc/combine.c
gcc/final.c
gcc/flow.c
gcc/function.c
gcc/gcse.c
gcc/global.c
gcc/ifcvt.c
gcc/predict.c
gcc/regmove.c
gcc/resource.c
gcc/sched-ebb.c
gcc/ssa-dce.c

index 3647ad6ec4b45dfcecdf47ab0bf56b2395a3cf6d..5434e676813bd4b06402c5f255e42fbdc63c0b2e 100644 (file)
@@ -158,7 +158,7 @@ make_reorder_chain_1 (bb, prev)
  restart:
       RBI (prev)->next = bb;
 
-      if (rtl_dump_file && prev->index + 1 != bb->index)
+      if (rtl_dump_file && prev->next_bb != bb)
        fprintf (rtl_dump_file, "Reordering block %d after %d\n",
                 bb->index, prev->index);
     }
@@ -214,7 +214,7 @@ make_reorder_chain_1 (bb, prev)
   if (! next)
     {
       for (e = bb->succ; e ; e = e->succ_next)
-       if (e->dest->index == bb->index + 1)
+       if (e->dest == bb->next_bb)
          {
            if ((e->flags & EDGE_FALLTHRU)
                || (e->dest->succ
index a64124cfb79e0cf16832e73ff1107238e8e64bc2..570f6b3d5cd4956b591e008e6e3c4ad62ed48d6e 100644 (file)
@@ -87,7 +87,7 @@ can_fallthru (src, target)
   rtx insn = src->end;
   rtx insn2 = target->head;
 
-  if (src->index + 1 != target->index)
+  if (src->next_bb != target)
     return 0;
 
   if (!active_insn_p (insn2))
@@ -296,7 +296,7 @@ flow_call_edges_add (blocks)
      Handle this by adding a dummy instruction in a new last basic block.  */
   if (check_last_block)
     {
-      basic_block bb = BASIC_BLOCK (n_basic_blocks - 1);
+      basic_block bb = EXIT_BLOCK_PTR->prev_bb;
       rtx insn = bb->end;
 
       /* Back up past insns that must be kept in the same block as a call.  */
@@ -1088,7 +1088,7 @@ flow_preorder_transversal_compute (pot_order)
      walking the tree from right to left.  */
 
   i = 0;
-  node = &dfst[0];
+  node = &dfst[ENTRY_BLOCK_PTR->next_bb->index];
   pot_order[i++] = 0;
 
   while (node)
index 767b0dee0bc634b9a35f5c070dd430e8bbf1fa54..ce7c307e391cebb57a3bdc01f6bb80028372e154 100644 (file)
@@ -50,7 +50,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 static int count_basic_blocks          PARAMS ((rtx));
 static void find_basic_blocks_1                PARAMS ((rtx));
 static rtx find_label_refs             PARAMS ((rtx, rtx));
-static void make_edges                 PARAMS ((rtx, int, int, int));
+static void make_edges                 PARAMS ((rtx, basic_block,
+                                                basic_block, int));
 static void make_label_edge            PARAMS ((sbitmap *, basic_block,
                                                 rtx, int));
 static void make_eh_edge               PARAMS ((sbitmap *, basic_block, rtx));
@@ -280,7 +281,8 @@ make_eh_edge (edge_cache, src, insn)
 static void
 make_edges (label_value_list, min, max, update_p)
      rtx label_value_list;
-     int min, max, update_p;
+     basic_block min, max;
+     int update_p;
 {
   int i;
   sbitmap *edge_cache = NULL;
@@ -297,7 +299,7 @@ make_edges (label_value_list, min, max, update_p)
       sbitmap_vector_zero (edge_cache, n_basic_blocks);
 
       if (update_p)
-       for (i = min; i <= max; ++i)
+       for (i = min->index; i <= max->index; ++i)
          {
            edge e;
 
@@ -308,11 +310,11 @@ make_edges (label_value_list, min, max, update_p)
     }
 
   /* By nature of the way these get numbered, block 0 is always the entry.  */
-  if (min == 0)
-    cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, BASIC_BLOCK (0),
+  if (min == ENTRY_BLOCK_PTR->next_bb)
+    cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, min,
                      EDGE_FALLTHRU);
 
-  for (i = min; i <= max; ++i)
+  for (i = min->index; i <= max->index; ++i)
     {
       basic_block bb = BASIC_BLOCK (i);
       rtx insn, x;
@@ -443,16 +445,15 @@ make_edges (label_value_list, min, max, update_p)
 
       /* Find out if we can drop through to the next block.  */
       insn = next_nonnote_insn (insn);
-      if (!insn || (i + 1 == n_basic_blocks && force_fallthru))
+      if (!insn || (bb->next_bb == EXIT_BLOCK_PTR && force_fallthru))
        cached_make_edge (edge_cache, bb, EXIT_BLOCK_PTR, EDGE_FALLTHRU);
-      else if (i + 1 < n_basic_blocks)
+      else if (bb->next_bb != EXIT_BLOCK_PTR)
        {
-         rtx tmp = BLOCK_HEAD (i + 1);
+         rtx tmp = bb->next_bb->head;
          if (GET_CODE (tmp) == NOTE)
            tmp = next_nonnote_insn (tmp);
          if (force_fallthru || insn == tmp)
-           cached_make_edge (edge_cache, bb, BASIC_BLOCK (i + 1),
-                             EDGE_FALLTHRU);
+           cached_make_edge (edge_cache, bb, bb->next_bb, EDGE_FALLTHRU);
        }
     }
 
@@ -664,7 +665,7 @@ find_basic_blocks (f, nregs, file)
   compute_bb_for_insn (max_uid);
 
   /* Discover the edges of our cfg.  */
-  make_edges (label_value_list, 0, n_basic_blocks - 1, 0);
+  make_edges (label_value_list, ENTRY_BLOCK_PTR->next_bb, EXIT_BLOCK_PTR->prev_bb, 0);
 
   /* Do very simple cleanup now, for the benefit of code that runs between
      here and cleanup_cfg, e.g. thread_prologue_and_epilogue_insns.  */
@@ -815,7 +816,7 @@ find_many_sub_basic_blocks (blocks)
 
   /* 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);
+  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.  */
@@ -852,16 +853,15 @@ find_sub_basic_blocks (bb)
 {
   int i;
   int min, max;
-  basic_block next = (bb->index == n_basic_blocks - 1
-                     ? NULL : BASIC_BLOCK (bb->index + 1));
+  basic_block next = bb->next_bb;
 
   min = bb->index;
   find_bb_boundaries (bb);
-  max = (next ? next->index : n_basic_blocks) - 1;
+  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, min, max, 1);
+  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.  */
index 15dbec1f28b7b18f6bc292edd1f339d0f36b9df2..070c1c7e30b258654c41d96fd74b5214f41b0001 100644 (file)
@@ -147,7 +147,7 @@ try_simplify_condjump (cbranch_block)
      unconditional jump.  */
   jump_block = cbranch_fallthru_edge->dest;
   if (jump_block->pred->pred_next
-      || jump_block->index == n_basic_blocks - 1
+      || jump_block->next_bb == EXIT_BLOCK_PTR
       || !FORWARDER_BLOCK_P (jump_block))
     return false;
   jump_dest_block = jump_block->succ->dest;
@@ -1615,7 +1615,7 @@ try_optimize_cfg (mode)
              /* Delete trivially dead basic blocks.  */
              while (b->pred == NULL)
                {
-                 c = BASIC_BLOCK (b->index - 1);
+                 c = b->prev_bb;
                  if (rtl_dump_file)
                    fprintf (rtl_dump_file, "Deleting block %i.\n",
                             b->index);
@@ -1669,7 +1669,7 @@ try_optimize_cfg (mode)
                             "Deleting fallthru block %i.\n",
                             b->index);
 
-                 c = BASIC_BLOCK (b->index ? b->index - 1 : 1);
+                 c = b->prev_bb == ENTRY_BLOCK_PTR ? b->next_bb : b->prev_bb;
                  redirect_edge_succ_nodup (b->pred, b->succ->dest);
                  flow_delete_block (b);
                  changed = true;
index b3cdf84b66a6ecd858ea749fd04a3015026e2046..05eb97e9a3935f296c240b422be849e7be60c885 100644 (file)
@@ -86,8 +86,8 @@ skip_insns_after_block (bb)
   rtx insn, last_insn, next_head, prev;
 
   next_head = NULL_RTX;
-  if (bb->index + 1 != n_basic_blocks)
-    next_head = BASIC_BLOCK (bb->index + 1)->head;
+  if (bb->next_bb != EXIT_BLOCK_PTR)
+    next_head = bb->next_bb->head;
 
   for (last_insn = insn = bb->end; (insn = NEXT_INSN (insn)) != 0; )
     {
@@ -364,7 +364,7 @@ fixup_reorder_chain ()
   /* First do the bulk reordering -- rechain the blocks without regard to
      the needed changes to jumps and labels.  */
 
-  for (bb = BASIC_BLOCK (0), index = 0;
+  for (bb = ENTRY_BLOCK_PTR->next_bb, index = 0;
        bb != 0;
        bb = RBI (bb)->next, index++)
     {
@@ -412,7 +412,7 @@ fixup_reorder_chain ()
   /* Now add jumps and labels as needed to match the blocks new
      outgoing edges.  */
 
-  for (bb = BASIC_BLOCK (0); bb ; bb = RBI (bb)->next)
+  for (bb = ENTRY_BLOCK_PTR->next_bb; bb ; bb = RBI (bb)->next)
     {
       edge e_fall, e_taken, e;
       rtx bb_end_insn;
@@ -527,7 +527,7 @@ fixup_reorder_chain ()
   if (rtl_dump_file)
     {
       fprintf (rtl_dump_file, "Reordered sequence:\n");
-      for (bb = BASIC_BLOCK (0), index = 0; bb; bb = RBI (bb)->next, index ++)
+      for (bb = ENTRY_BLOCK_PTR->next_bb, index = 0; bb; bb = RBI (bb)->next, index ++)
        {
          fprintf (rtl_dump_file, " %i ", index);
          if (RBI (bb)->original)
@@ -542,7 +542,7 @@ fixup_reorder_chain ()
     }
 
   prev_bb = ENTRY_BLOCK_PTR;
-  bb = BASIC_BLOCK (0);
+  bb = ENTRY_BLOCK_PTR->next_bb;
   index = 0;
 
   for (; bb; prev_bb = bb, bb = RBI (bb)->next, index ++)
@@ -611,7 +611,9 @@ cleanup_unconditional_jumps ()
          rtx insn;
          if (GET_CODE (bb->head) != CODE_LABEL && forwarder_block_p (bb) && i)
            {
-             basic_block prev = BASIC_BLOCK (--i);
+             basic_block prev = bb->prev_bb;
+
+             i--;
 
              if (rtl_dump_file)
                fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
@@ -672,7 +674,7 @@ fixup_fallthru_exit_predecessor ()
 
   if (bb && RBI (bb)->next)
     {
-      basic_block c = BASIC_BLOCK (0);
+      basic_block c = ENTRY_BLOCK_PTR->next_bb;
 
       while (RBI (c)->next != bb)
        c = RBI (c)->next;
@@ -822,14 +824,14 @@ cfg_layout_redirect_edge (e, dest)
      edge e;
      basic_block dest;
 {
-  int old_index = dest->index;
   basic_block src = e->src;
+  basic_block old_next_bb = src->next_bb;
 
   /* Redirect_edge_and_branch may decide to turn branch into fallthru edge
      in the case the basic block appears to be in sequence.  Avoid this
      transformation.  */
 
-  dest->index = n_basic_blocks + 1;
+  src->next_bb = NULL;
   if (e->flags & EDGE_FALLTHRU)
     {
       /* In case we are redirecting fallthru edge to the branch edge
@@ -855,7 +857,7 @@ cfg_layout_redirect_edge (e, dest)
       delete_barrier (NEXT_INSN (src->end));
       src->succ->flags |= EDGE_FALLTHRU;
     }
-  dest->index = old_index;
+  src->next_bb = old_next_bb;
 }
 
 /* Create an duplicate of the basic block BB and redirect edge E into it.  */
index 1ce15ba8c6832cf7280d322dae8a09f8dee7c728..d2025b8226a906cdcfff3187efcdc48d4d9878c4 100644 (file)
@@ -1172,8 +1172,8 @@ tidy_fallthru_edges ()
 
   for (i = 1; i < n_basic_blocks; i++)
     {
-      basic_block b = BASIC_BLOCK (i - 1);
       basic_block c = BASIC_BLOCK (i);
+      basic_block b = c->prev_bb;
       edge s;
 
       /* We care about simple conditional or unconditional jumps with
@@ -1887,7 +1887,7 @@ verify_flow_info ()
            {
              rtx insn;
 
-             if (e->src->index + 1 != e->dest->index)
+             if (e->src->next_bb != e->dest)
                {
                  error
                    ("verify_flow_info: Incorrect blocks for fallthru %i->%i",
@@ -1952,7 +1952,7 @@ verify_flow_info ()
          err = 1;
        }
       if (n_branch != 1 && any_condjump_p (bb->end)
-         && JUMP_LABEL (bb->end) != BASIC_BLOCK (bb->index + 1)->head)
+         && JUMP_LABEL (bb->end) != bb->next_bb->head)
        {
          error ("Wrong amount of branch edges after conditional jump %i", bb->index);
          err = 1;
index 9415728d6307771834a90248c1e0c4b98507fe22..bdb130ca05575da61b8a6b09a92b1e1f31d8a621 100644 (file)
@@ -192,8 +192,8 @@ static HARD_REG_SET newpat_used_regs;
 
 static rtx added_links_insn;
 
-/* Basic block number of the block in which we are performing combines.  */
-static int this_basic_block;
+/* Basic block in which we are performing combines.  */
+static basic_block this_basic_block;
 
 /* A bitmap indicating which blocks had registers go dead at entry.
    After combine, we'll need to re-do global life analysis with
@@ -610,7 +610,7 @@ combine_instructions (f, nregs)
 
   /* Now scan all the insns in forward order.  */
 
-  this_basic_block = -1;
+  this_basic_block = ENTRY_BLOCK_PTR;
   label_tick = 1;
   last_call_cuid = 0;
   mem_last_set = 0;
@@ -622,9 +622,9 @@ combine_instructions (f, nregs)
       next = 0;
 
       /* If INSN starts a new basic block, update our basic block number.  */
-      if (this_basic_block + 1 < n_basic_blocks
-         && BLOCK_HEAD (this_basic_block + 1) == insn)
-       this_basic_block++;
+      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++;
@@ -741,8 +741,8 @@ combine_instructions (f, nregs)
     }
   clear_bb_flags ();
 
-  EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, this_basic_block,
-                            BASIC_BLOCK (this_basic_block)->flags |= BB_DIRTY);
+  EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, i,
+                            BASIC_BLOCK (i)->flags |= BB_DIRTY);
   new_direct_jump_p |= purge_all_dead_edges (0);
   delete_noop_moves (f);
 
@@ -860,7 +860,7 @@ set_nonzero_bits_and_sign_copies (x, set, data)
       && REGNO (x) >= FIRST_PSEUDO_REGISTER
       /* If this register is undefined at the start of the file, we can't
         say what its contents were.  */
-      && ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, REGNO (x))
+      && ! REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, REGNO (x))
       && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT)
     {
       if (set == 0 || GET_CODE (set) == CLOBBER)
@@ -2388,8 +2388,8 @@ try_combine (i3, i2, i1, new_direct_jump_p)
             which we know will be a NOTE.  */
 
          for (insn = NEXT_INSN (i3);
-              insn && (this_basic_block == n_basic_blocks - 1
-                       || insn != BLOCK_HEAD (this_basic_block + 1));
+              insn && (this_basic_block->next_bb == EXIT_BLOCK_PTR
+                       || insn != this_basic_block->next_bb->head);
               insn = NEXT_INSN (insn))
            {
              if (INSN_P (insn) && reg_referenced_p (ni2dest, PATTERN (insn)))
@@ -2606,8 +2606,8 @@ try_combine (i3, i2, i1, new_direct_jump_p)
              && ! find_reg_note (i2, REG_UNUSED,
                                  SET_DEST (XVECEXP (PATTERN (i2), 0, i))))
            for (temp = NEXT_INSN (i2);
-                temp && (this_basic_block == n_basic_blocks - 1
-                         || BLOCK_HEAD (this_basic_block) != temp);
+                temp && (this_basic_block->next_bb == EXIT_BLOCK_PTR
+                         || this_basic_block->head != temp);
                 temp = NEXT_INSN (temp))
              if (temp != i3 && INSN_P (temp))
                for (link = LOG_LINKS (temp); link; link = XEXP (link, 1))
@@ -8068,7 +8068,7 @@ nonzero_bits (x, mode)
          && (reg_last_set_label[REGNO (x)] == label_tick
              || (REGNO (x) >= FIRST_PSEUDO_REGISTER
                  && REG_N_SETS (REGNO (x)) == 1
-                 && ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start,
+                 && ! REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start,
                                        REGNO (x))))
          && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
        return reg_last_set_nonzero_bits[REGNO (x)] & nonzero;
@@ -8483,7 +8483,7 @@ num_sign_bit_copies (x, mode)
          && (reg_last_set_label[REGNO (x)] == label_tick
              || (REGNO (x) >= FIRST_PSEUDO_REGISTER
                  && REG_N_SETS (REGNO (x)) == 1
-                 && ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start,
+                 && ! REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start,
                                        REGNO (x))))
          && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
        return reg_last_set_sign_bit_copies[REGNO (x)];
@@ -11492,7 +11492,7 @@ get_last_value_validate (loc, insn, tick, replace)
            || (! (regno >= FIRST_PSEUDO_REGISTER
                   && REG_N_SETS (regno) == 1
                   && (! REGNO_REG_SET_P
-                      (BASIC_BLOCK (0)->global_live_at_start, regno)))
+                      (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno)))
                && reg_last_set_label[j] > tick))
          {
            if (replace)
@@ -11566,7 +11566,7 @@ get_last_value (x)
          && (regno < FIRST_PSEUDO_REGISTER
              || REG_N_SETS (regno) != 1
              || (REGNO_REG_SET_P
-                 (BASIC_BLOCK (0)->global_live_at_start, regno)))))
+                 (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno)))))
     return 0;
 
   /* If the value was set in a later insn than the ones we are processing,
@@ -12375,7 +12375,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
 
          if (place == 0)
            {
-             basic_block bb = BASIC_BLOCK (this_basic_block);
+             basic_block bb = this_basic_block;
 
              for (tem = PREV_INSN (i3); place == 0; tem = PREV_INSN (tem))
                {
@@ -12519,7 +12519,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
                  && REGNO_REG_SET_P (bb->global_live_at_start,
                                      REGNO (XEXP (note, 0))))
                {
-                 SET_BIT (refresh_blocks, this_basic_block);
+                 SET_BIT (refresh_blocks, this_basic_block->index);
                  need_refresh = 1;
                }
            }
@@ -12539,7 +12539,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
                 after we remove them in delete_noop_moves.  */
              if (noop_move_p (place))
                {
-                 SET_BIT (refresh_blocks, this_basic_block);
+                 SET_BIT (refresh_blocks, this_basic_block->index);
                  need_refresh = 1;
                }
 
@@ -12589,7 +12589,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
                           i += HARD_REGNO_NREGS (i, reg_raw_mode[i]))
                        {
                          rtx piece = gen_rtx_REG (reg_raw_mode[i], i);
-                         basic_block bb = BASIC_BLOCK (this_basic_block);
+                         basic_block bb = this_basic_block;
 
                          if (! dead_or_set_p (place, piece)
                              && ! reg_bitfield_target_p (piece,
@@ -12612,7 +12612,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
                                    if (tem == bb->head)
                                      {
                                        SET_BIT (refresh_blocks,
-                                                this_basic_block);
+                                                this_basic_block->index);
                                        need_refresh = 1;
                                        break;
                                      }
@@ -12717,8 +12717,8 @@ distribute_links (links)
         since most links don't point very far away.  */
 
       for (insn = NEXT_INSN (XEXP (link, 0));
-          (insn && (this_basic_block == n_basic_blocks - 1
-                    || BLOCK_HEAD (this_basic_block + 1) != insn));
+          (insn && (this_basic_block->next_bb == EXIT_BLOCK_PTR
+                    || this_basic_block->next_bb->head != insn));
           insn = NEXT_INSN (insn))
        if (INSN_P (insn) && reg_overlap_mentioned_p (reg, PATTERN (insn)))
          {
index eeed1a1e89281457e0f658e4d4bc878a2c214898..ad522aef2ce98547ae600e55b9ab327b2450bfe4 100644 (file)
@@ -984,8 +984,8 @@ compute_alignments ()
 
       if (!has_fallthru
          && (branch_frequency > BB_FREQ_MAX / 10
-             || (bb->frequency > BASIC_BLOCK (i - 1)->frequency * 10
-                 && (BASIC_BLOCK (i - 1)->frequency
+             || (bb->frequency > bb->prev_bb->frequency * 10
+                 && (bb->prev_bb->frequency
                      <= ENTRY_BLOCK_PTR->frequency / 2))))
        {
          log = JUMP_ALIGN (label);
index 31017fb28eb68a16675d49ab668abc42c56c904a..64d68dffca7fb7d731b3d029f4b02362aa4921ae 100644 (file)
@@ -2349,7 +2349,7 @@ regno_uninitialized (regno)
              || FUNCTION_ARG_REGNO_P (regno))))
     return 0;
 
-  return REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno);
+  return REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno);
 }
 
 /* 1 if register REGNO was alive at a place where `setjmp' was called
@@ -2364,7 +2364,7 @@ regno_clobbered_at_setjmp (regno)
     return 0;
 
   return ((REG_N_SETS (regno) > 1
-          || REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno))
+          || REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno))
          && REGNO_REG_SET_P (regs_live_at_setjmp, regno));
 }
 \f
index 9a944139ab5d77a862d0daff0e85eb91c1cccf9e..669dd2ecf851f8ae8b4026d82f3f639b5701b721 100644 (file)
@@ -7817,7 +7817,7 @@ epilogue_done:
        }
 
       /* Find the last line number note in the first block.  */
-      for (insn = BASIC_BLOCK (0)->end;
+      for (insn = ENTRY_BLOCK_PTR->next_bb->end;
           insn != prologue_end && insn;
           insn = PREV_INSN (insn))
        if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
index 93200536ec738ecc56a07c7d7dd5e57905935629..b2aad0515393b553b4d94aeb05ce5877338bfad3 100644 (file)
@@ -5586,7 +5586,7 @@ compute_code_hoist_vbeinout ()
        {
          changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb], antloc[bb],
                                              hoist_vbeout[bb], transp[bb]);
-         if (bb != n_basic_blocks - 1)
+         if (BASIC_BLOCK (bb)->next_bb != EXIT_BLOCK_PTR)
            sbitmap_intersection_of_succs (hoist_vbeout[bb], hoist_vbein, bb);
        }
 
index 0d9618c27b72c73337ce91ace05b7ea407012896..b75ef21652871bb970365c361b42cfba01b0ec7e 100644 (file)
@@ -1794,7 +1794,7 @@ build_insn_chain (first)
 {
   struct insn_chain **p = &reload_insn_chain;
   struct insn_chain *prev = 0;
-  int b = 0;
+  basic_block b = ENTRY_BLOCK_PTR->next_bb;
   regset_head live_relevant_regs_head;
 
   live_relevant_regs = INITIALIZE_REG_SET (live_relevant_regs_head);
@@ -1803,14 +1803,14 @@ build_insn_chain (first)
     {
       struct insn_chain *c;
 
-      if (first == BLOCK_HEAD (b))
+      if (first == b->head)
        {
          int i;
 
          CLEAR_REG_SET (live_relevant_regs);
 
          EXECUTE_IF_SET_IN_BITMAP
-           (BASIC_BLOCK (b)->global_live_at_start, 0, i,
+           (b->global_live_at_start, 0, i,
             {
               if (i < FIRST_PSEUDO_REGISTER
                   ? ! TEST_HARD_REG_BIT (eliminable_regset, i)
@@ -1827,7 +1827,7 @@ build_insn_chain (first)
          *p = c;
          p = &c->next;
          c->insn = first;
-         c->block = b;
+         c->block = b->index;
 
          if (INSN_P (first))
            {
@@ -1865,8 +1865,8 @@ build_insn_chain (first)
            }
        }
 
-      if (first == BLOCK_END (b))
-       b++;
+      if (first == b->end)
+       b = b->next_bb;
 
       /* Stop after we pass the end of the last basic block.  Verify that
         no real insns are after the end of the last basic block.
@@ -1874,7 +1874,7 @@ build_insn_chain (first)
         We may want to reorganize the loop somewhat since this test should
         always be the right exit test.  Allow an ADDR_VEC or ADDR_DIF_VEC if
         the previous real insn is a JUMP_INSN.  */
-      if (b == n_basic_blocks)
+      if (b == EXIT_BLOCK_PTR)
        {
          for (first = NEXT_INSN (first) ; first; first = NEXT_INSN (first))
            if (INSN_P (first)
index e8c2b5f89b94a7eb46b224f6419c884c364ffed0..408f7aff4fe31bd48c6fc58c61beaad7b532a178 100644 (file)
@@ -1973,7 +1973,7 @@ find_if_block (test_bb, then_edge, else_edge)
   basic_block join_bb = NULL_BLOCK;
   edge then_succ = then_bb->succ;
   edge else_succ = else_bb->succ;
-  int next_index;
+  basic_block next;
 
   /* The THEN block of an IF-THEN combo must have exactly one predecessor.  */
   if (then_bb->pred->pred_next != NULL_EDGE)
@@ -2057,10 +2057,10 @@ find_if_block (test_bb, then_edge, else_edge)
   /* ??? As an enhancement, move the ELSE block.  Have to deal with
      BLOCK notes, if by no other means than aborting the merge if they
      exist.  Sticky enough I don't want to think about it now.  */
-  next_index = then_bb->index;
-  if (else_bb && ++next_index != else_bb->index)
+  next = then_bb;
+  if (else_bb && (next = next->next_bb) != else_bb)
     return FALSE;
-  if (++next_index != join_bb->index && join_bb->index != EXIT_BLOCK)
+  if ((next = next->next_bb) != join_bb && join_bb != EXIT_BLOCK_PTR)
     {
       if (else_bb)
        join_bb = NULL;
@@ -2146,7 +2146,7 @@ find_cond_trap (test_bb, then_edge, else_edge)
 
   /* If the non-trap block and the test are now adjacent, merge them.
      Otherwise we must insert a direct branch.  */
-  if (test_bb->index + 1 == other_bb->index)
+  if (test_bb->next_bb == other_bb)
     {
       delete_insn (jump);
       merge_if_block (test_bb, NULL, NULL, other_bb);
index b0be982761d950f6bc0ac867175f0ab6858793b5..ce8ed2d04496c4a0813f871448fc03b97e12da97 100644 (file)
@@ -695,10 +695,13 @@ static bool
 last_basic_block_p (bb)
      basic_block bb;
 {
-  return (bb->index == n_basic_blocks - 1
-         || (bb->index == n_basic_blocks - 2
+  if (bb == EXIT_BLOCK_PTR)
+    return false;
+
+  return (bb->next_bb == EXIT_BLOCK_PTR
+         || (bb->next_bb->next_bb == EXIT_BLOCK_PTR
              && bb->succ && !bb->succ->succ_next
-             && bb->succ->dest->index == n_basic_blocks - 1));
+             && bb->succ->dest->next_bb == EXIT_BLOCK_PTR));
 }
 
 /* Sets branch probabilities according to PREDiction and FLAGS. HEADS[bb->index]
@@ -847,7 +850,7 @@ note_prediction_to_br_prob ()
 
   heads = xmalloc (sizeof (int) * n_basic_blocks);
   memset (heads, -1, sizeof (int) * n_basic_blocks);
-  heads[0] = n_basic_blocks;
+  heads[ENTRY_BLOCK_PTR->next_bb->index] = n_basic_blocks;
 
   /* Process all prediction notes.  */
 
index 7b073f29e7330b8a4abc869997bbe86cd8b645f6..7dc808cc3641fe937078f647ecaa6ff6187728b2 100644 (file)
@@ -1506,13 +1506,14 @@ regmove_optimize (f, nregs, regmove_dump_file)
      ends.  Fix that here.  */
   for (i = 0; i < n_basic_blocks; i++)
     {
-      rtx end = BLOCK_END (i);
+      basic_block bb = BASIC_BLOCK (i);
+      rtx end = bb->end;
       rtx new = end;
       rtx next = NEXT_INSN (new);
       while (next != 0 && INSN_UID (next) >= old_max_uid
-            && (i == n_basic_blocks - 1 || BLOCK_HEAD (i + 1) != next))
+            && (bb->next_bb == EXIT_BLOCK_PTR || bb->next_bb->head != next))
        new = next, next = NEXT_INSN (new);
-      BLOCK_END (i) = new;
+      bb->end = new;
     }
 
  done:
index 6c20517a5f09ad10733f4d01c36d63e1a1c731e0..ea915831547f2026b22eed4bc2d22115901dfaec 100644 (file)
@@ -146,9 +146,9 @@ find_basic_block (insn, search_limit)
   if (search_limit == 0)
     return -1;
 
-  /* The start of the function is basic block zero.  */
+  /* The start of the function.  */
   else if (insn == 0)
-    return 0;
+    return ENTRY_BLOCK_PTR->next_bb->index;
 
   /* See if any of the upcoming CODE_LABELs start a basic block.  If we reach
      anything other than a CODE_LABEL or note, we can't find this code.  */
index 5f1464b9c147b510dbe3f48661be6e2462dd2e3c..4a08b3e96c2dcc0454d8795213f70903307ff219 100644 (file)
@@ -306,8 +306,8 @@ schedule_ebbs (dump_file)
          basic_block b = BASIC_BLOCK (i);
          edge e;
          tail = b->end;
-         if (i + 1 == n_basic_blocks
-             || GET_CODE (BLOCK_HEAD (i + 1)) == CODE_LABEL)
+         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)
index 45dcd659f00ccaa0f4499bccf41dca5c51f08a9a..46ae1c142ec53d42a288b641cf3b30912df82007 100644 (file)
@@ -247,7 +247,7 @@ find_control_dependence (el, edge_index, pdom, cdbte)
     abort ();
   ending_block =
     (INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR)
-    ? BASIC_BLOCK (0)
+    ? ENTRY_BLOCK_PTR->next_bb
     : find_pdom (pdom, INDEX_EDGE_PRED_BB (el, edge_index));
 
   for (current_block = INDEX_EDGE_SUCC_BB (el, edge_index);
@@ -275,7 +275,7 @@ find_pdom (pdom, block)
     abort ();
 
   if (block == ENTRY_BLOCK_PTR)
-    return BASIC_BLOCK (0);
+    return ENTRY_BLOCK_PTR->next_bb;
   else if (block == EXIT_BLOCK_PTR || pdom[block->index] == EXIT_BLOCK)
     return EXIT_BLOCK_PTR;
   else