OSDN Git Service

* pt.c (can_complete_type_without_circularity): Add static to
[pf3gnuchains/gcc-fork.git] / gcc / df.c
index 1051c0f..d713168 100644 (file)
--- a/gcc/df.c
+++ b/gcc/df.c
@@ -153,7 +153,7 @@ when optimising a loop, only certain registers are of interest.
 Perhaps there should be a bitmap argument to df_analyse to specify
  which registers should be analysed?   */
 
-#define HANDLE_SUBREG 
+#define HANDLE_SUBREG
 
 #include "config.h"
 #include "system.h"
@@ -171,12 +171,6 @@ Perhaps there should be a bitmap argument to df_analyse to specify
 #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_;                                          \
@@ -226,13 +220,13 @@ static void df_refs_unlink PARAMS ((struct df *, bitmap));
 #endif
 
 static struct ref *df_ref_create PARAMS((struct df *,
-                                        rtx, rtx *, basic_block, rtx,
+                                        rtx, rtx *, rtx,
                                         enum df_ref_type, enum df_ref_flags));
 static void df_ref_record_1 PARAMS((struct df *, rtx, rtx *,
-                                   basic_block, rtx, enum df_ref_type,
+                                   rtx, enum df_ref_type,
                                    enum df_ref_flags));
 static void df_ref_record PARAMS((struct df *, rtx, rtx *,
-                                 basic_block bb, rtx, enum df_ref_type,
+                                 rtx, enum df_ref_type,
                                  enum df_ref_flags));
 static void df_def_record_1 PARAMS((struct df *, rtx, basic_block, rtx));
 static void df_defs_record PARAMS((struct df *, rtx, basic_block, rtx));
@@ -295,16 +289,16 @@ static void df_chain_dump PARAMS((struct df_link *, FILE *file));
 static void df_chain_dump_regno PARAMS((struct df_link *, FILE *file));
 static void df_regno_debug PARAMS ((struct df *, unsigned int, FILE *));
 static void df_ref_debug PARAMS ((struct df *, struct ref *, FILE *));
-static void df_rd_transfer_function PARAMS ((int, int *, bitmap, bitmap, 
+static void df_rd_transfer_function PARAMS ((int, int *, bitmap, bitmap,
                                             bitmap, bitmap, void *));
-static void df_ru_transfer_function PARAMS ((int, int *, bitmap, bitmap, 
+static void df_ru_transfer_function PARAMS ((int, int *, bitmap, bitmap,
                                             bitmap, bitmap, void *));
-static void df_lr_transfer_function PARAMS ((int, int *, bitmap, bitmap, 
+static void df_lr_transfer_function PARAMS ((int, int *, bitmap, bitmap,
                                             bitmap, bitmap, void *));
-static void hybrid_search_bitmap PARAMS ((basic_block, bitmap *, bitmap *, 
-                                         bitmap *, bitmap *, enum df_flow_dir, 
-                                         enum df_confluence_op, 
-                                         transfer_function_bitmap, 
+static void hybrid_search_bitmap PARAMS ((basic_block, bitmap *, bitmap *,
+                                         bitmap *, bitmap *, enum df_flow_dir,
+                                         enum df_confluence_op,
+                                         transfer_function_bitmap,
                                          sbitmap, sbitmap, void *));
 static void hybrid_search_sbitmap PARAMS ((basic_block, sbitmap *, sbitmap *,
                                           sbitmap *, sbitmap *, enum df_flow_dir,
@@ -406,8 +400,8 @@ df_bitmaps_alloc (df, flags)
      struct df *df;
      int flags;
 {
-  unsigned int i;
   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 ())
@@ -423,9 +417,8 @@ df_bitmaps_alloc (df, flags)
   df->n_defs = df->def_id;
   df->n_uses = df->use_id;
 
-  for (i = 0; i < df->n_bbs; i++)
+  FOR_EACH_BB (bb)
     {
-      basic_block bb = BASIC_BLOCK (i);
       struct bb_info *bb_info = DF_BB_INFO (df, bb);
 
       if (flags & DF_RD && ! bb_info->rd_in)
@@ -474,11 +467,10 @@ df_bitmaps_free (df, flags)
      struct df *df ATTRIBUTE_UNUSED;
      int flags;
 {
-  unsigned int i;
+  basic_block bb;
 
-  for (i = 0; i < df->n_bbs; i++)
+  FOR_EACH_BB (bb)
     {
-      basic_block bb = BASIC_BLOCK (i);
       struct bb_info *bb_info = DF_BB_INFO (df, bb);
 
       if (!bb_info)
@@ -534,7 +526,7 @@ df_alloc (df, n_regs)
      int n_regs;
 {
   int n_insns;
-  int i;
+  basic_block bb;
 
   gcc_obstack_init (&df_ref_obstack);
 
@@ -555,7 +547,7 @@ df_alloc (df, n_regs)
   df->uses = xmalloc (df->use_size * sizeof (*df->uses));
 
   df->n_regs = n_regs;
-  df->n_bbs = n_basic_blocks;
+  df->n_bbs = last_basic_block;
 
   /* Allocate temporary working array used during local dataflow analysis.  */
   df->reg_def_last = xmalloc (df->n_regs * sizeof (struct ref *));
@@ -569,11 +561,11 @@ df_alloc (df, n_regs)
 
   df->flags = 0;
 
-  df->bbs = xcalloc (df->n_bbs, sizeof (struct bb_info));
+  df->bbs = xcalloc (last_basic_block, sizeof (struct bb_info));
 
   df->all_blocks = BITMAP_XMALLOC ();
-  for (i = 0; i < n_basic_blocks; i++)
-    bitmap_set_bit (df->all_blocks, i);
+  FOR_EACH_BB (bb)
+    bitmap_set_bit (df->all_blocks, bb->index);
 }
 
 
@@ -633,8 +625,7 @@ static rtx df_reg_use_gen (regno)
   rtx reg;
   rtx use;
 
-  reg = regno >= FIRST_PSEUDO_REGISTER
-    ? regno_reg_rtx[regno] : gen_rtx_REG (reg_raw_mode[regno], regno);
+  reg = regno_reg_rtx[regno];
 
   use = gen_rtx_USE (GET_MODE (reg), reg);
   return use;
@@ -648,8 +639,7 @@ static rtx df_reg_clobber_gen (regno)
   rtx reg;
   rtx use;
 
-  reg = regno >= FIRST_PSEUDO_REGISTER
-    ? regno_reg_rtx[regno] : gen_rtx_REG (reg_raw_mode[regno], regno);
+  reg = regno_reg_rtx[regno];
 
   use = gen_rtx_CLOBBER (GET_MODE (reg), reg);
   return use;
@@ -794,11 +784,10 @@ df_use_unlink (df, use)
 /* Create a new ref of type DF_REF_TYPE for register REG at address
    LOC within INSN of BB.  */
 static struct ref *
-df_ref_create (df, reg, loc, bb, insn, ref_type, ref_flags)
+df_ref_create (df, reg, loc, insn, ref_type, ref_flags)
      struct df *df;
      rtx reg;
      rtx *loc;
-     basic_block bb;
      rtx insn;
      enum df_ref_type ref_type;
      enum df_ref_flags ref_flags;
@@ -810,7 +799,6 @@ df_ref_create (df, reg, loc, bb, insn, ref_type, ref_flags)
                                           sizeof (*this_ref));
   DF_REF_REG (this_ref) = reg;
   DF_REF_LOC (this_ref) = loc;
-  DF_REF_BB (this_ref) = bb;
   DF_REF_INSN (this_ref) = insn;
   DF_REF_CHAIN (this_ref) = 0;
   DF_REF_TYPE (this_ref) = ref_type;
@@ -848,27 +836,25 @@ df_ref_create (df, reg, loc, bb, insn, ref_type, ref_flags)
 /* Create a new reference of type DF_REF_TYPE for a single register REG,
    used inside the LOC rtx of INSN.  */
 static void
-df_ref_record_1 (df, reg, loc, bb, insn, ref_type, ref_flags)
+df_ref_record_1 (df, reg, loc, insn, ref_type, ref_flags)
      struct df *df;
      rtx reg;
      rtx *loc;
-     basic_block bb;
      rtx insn;
      enum df_ref_type ref_type;
      enum df_ref_flags ref_flags;
 {
-  df_ref_create (df, reg, loc, bb, insn, ref_type, ref_flags);
+  df_ref_create (df, reg, loc, insn, ref_type, ref_flags);
 }
 
 
 /* Create new references of type DF_REF_TYPE for each part of register REG
    at address LOC within INSN of BB.  */
 static void
-df_ref_record (df, reg, loc, bb, insn, ref_type, ref_flags)
+df_ref_record (df, reg, loc, insn, ref_type, ref_flags)
      struct df *df;
      rtx reg;
      rtx *loc;
-     basic_block bb;
      rtx insn;
      enum df_ref_type ref_type;
      enum df_ref_flags ref_flags;
@@ -885,7 +871,7 @@ df_ref_record (df, reg, loc, bb, insn, ref_type, ref_flags)
      XXX Is that true?  We could also use the global word_mode variable.  */
   if (GET_CODE (reg) == SUBREG
       && (GET_MODE_SIZE (GET_MODE (reg)) < GET_MODE_SIZE (word_mode)
-          || GET_MODE_SIZE (GET_MODE (reg))
+         || GET_MODE_SIZE (GET_MODE (reg))
               >= GET_MODE_SIZE (GET_MODE (SUBREG_REG (reg)))))
     {
       loc = &SUBREG_REG (reg);
@@ -909,12 +895,12 @@ df_ref_record (df, reg, loc, bb, insn, ref_type, ref_flags)
       endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (reg));
 
       for (i = regno; i < endregno; i++)
-       df_ref_record_1 (df, gen_rtx_REG (reg_raw_mode[i], i),
-                        loc, bb, insn, ref_type, ref_flags);
+       df_ref_record_1 (df, regno_reg_rtx[i],
+                        loc, insn, ref_type, ref_flags);
     }
   else
     {
-      df_ref_record_1 (df, reg, loc, bb, insn, ref_type, ref_flags);
+      df_ref_record_1 (df, reg, loc, insn, ref_type, ref_flags);
     }
 }
 
@@ -960,7 +946,7 @@ df_def_record_1 (df, x, bb, insn)
   /* May be, we should flag the use of strict_low_part somehow.  Might be
      handy for the reg allocator.  */
   while (GET_CODE (dst) == STRICT_LOW_PART
-         || GET_CODE (dst) == ZERO_EXTRACT
+        || GET_CODE (dst) == ZERO_EXTRACT
         || GET_CODE (dst) == SIGN_EXTRACT
         || read_modify_subreg_p (dst))
     {
@@ -975,10 +961,10 @@ df_def_record_1 (df, x, bb, insn)
       dst = *loc;
       flags |= DF_REF_READ_WRITE;
     }
-  
+
     if (GET_CODE (dst) == REG
-        || (GET_CODE (dst) == SUBREG && GET_CODE (SUBREG_REG (dst)) == REG))
-      df_ref_record (df, dst, loc, bb, insn, DF_REF_REG_DEF, flags);
+       || (GET_CODE (dst) == SUBREG && GET_CODE (SUBREG_REG (dst)) == REG))
+      df_ref_record (df, dst, loc, insn, DF_REF_REG_DEF, flags);
 }
 
 
@@ -1036,6 +1022,7 @@ df_uses_record (df, loc, ref_type, bb, insn, flags)
     case CONST_INT:
     case CONST:
     case CONST_DOUBLE:
+    case CONST_VECTOR:
     case PC:
     case ADDR_VEC:
     case ADDR_DIFF_VEC:
@@ -1070,7 +1057,7 @@ df_uses_record (df, loc, ref_type, bb, insn, flags)
 
     case REG:
       /* See a register (or subreg) other than being set.  */
-      df_ref_record (df, x, loc, bb, insn, ref_type, flags);
+      df_ref_record (df, x, loc, insn, ref_type, flags);
       return;
 
     case SET:
@@ -1093,7 +1080,7 @@ df_uses_record (df, loc, ref_type, bb, insn, flags)
            case PC:
              break;
            case MEM:
-             df_uses_record (df, &XEXP (dst, 0), 
+             df_uses_record (df, &XEXP (dst, 0),
                              DF_REF_REG_MEM_STORE,
                              bb, insn, 0);
              break;
@@ -1138,7 +1125,7 @@ df_uses_record (df, loc, ref_type, bb, insn, flags)
           For now, just mark any regs we can find in ASM_OPERANDS as
           used.  */
 
-        /* For all ASM_OPERANDS, we must traverse the vector of input operands.
+       /* For all ASM_OPERANDS, we must traverse the vector of input operands.
           We can not just fall through here since then we would be confused
           by the ASM_INPUT rtx inside ASM_OPERANDS, which do not indicate
           traditional asms unlike their normal usage.  */
@@ -1161,7 +1148,7 @@ df_uses_record (df, loc, ref_type, bb, insn, flags)
     case PRE_MODIFY:
     case POST_MODIFY:
       /* Catch the def of the register being modified.  */
-      df_ref_record (df, XEXP (x, 0), &XEXP (x, 0), bb, insn, DF_REF_REG_DEF, DF_REF_READ_WRITE);
+      df_ref_record (df, XEXP (x, 0), &XEXP (x, 0), insn, DF_REF_REG_DEF, DF_REF_READ_WRITE);
 
       /* ... Fall through to handle uses ...  */
 
@@ -1239,13 +1226,13 @@ df_insn_refs_record (df, bb, insn)
               note = XEXP (note, 1))
            {
              if (GET_CODE (XEXP (note, 0)) == USE)
-               df_uses_record (df, &SET_DEST (XEXP (note, 0)), DF_REF_REG_USE,
+               df_uses_record (df, &XEXP (XEXP (note, 0), 0), DF_REF_REG_USE,
                                bb, insn, 0);
            }
 
          /* The stack ptr is used (honorarily) by a CALL insn.  */
          x = df_reg_use_gen (STACK_POINTER_REGNUM);
-         df_uses_record (df, &SET_DEST (x), DF_REF_REG_USE, bb, insn, 0);
+         df_uses_record (df, &XEXP (x, 0), DF_REF_REG_USE, bb, insn, 0);
 
          if (df->flags & DF_HARD_REGS)
            {
@@ -1256,7 +1243,7 @@ df_insn_refs_record (df, bb, insn)
                  {
                    x = df_reg_use_gen (i);
                    df_uses_record (df, &SET_DEST (x),
-                                   DF_REF_REG_USE, bb, insn, 0);
+                                   DF_REF_REG_USE, bb, insn, 0);
                  }
            }
        }
@@ -1676,7 +1663,7 @@ df_bb_rd_local_compute (df, bb)
          bitmap_set_bit (bb_info->rd_gen, DF_REF_ID (def));
        }
     }
-  
+
   bb_info->rd_valid = 1;
 }
 
@@ -1706,7 +1693,7 @@ df_bb_ru_local_compute (df, bb)
   /* This is much more tricky than computing reaching defs.  With
      reaching defs, defs get killed by other defs.  With upwards
      exposed uses, these get killed by defs with the same regno.  */
-  
+
   struct bb_info *bb_info = DF_BB_INFO (df, bb);
   rtx insn;
 
@@ -1949,6 +1936,8 @@ df_analyse_1 (df, blocks, flags, update)
   int aflags;
   int dflags;
   int i;
+  basic_block bb;
+
   dflags = 0;
   aflags = flags;
   if (flags & DF_UD_CHAIN)
@@ -2015,10 +2004,10 @@ df_analyse_1 (df, blocks, flags, update)
   df->dfs_order = xmalloc (sizeof(int) * n_basic_blocks);
   df->rc_order = xmalloc (sizeof(int) * n_basic_blocks);
   df->rts_order = xmalloc (sizeof(int) * n_basic_blocks);
-  df->inverse_dfs_map = xmalloc (sizeof(int) * n_basic_blocks);
-  df->inverse_rc_map = xmalloc (sizeof(int) * n_basic_blocks);
-  df->inverse_rts_map = xmalloc (sizeof(int) * n_basic_blocks);
-  
+  df->inverse_dfs_map = xmalloc (sizeof(int) * last_basic_block);
+  df->inverse_rc_map = xmalloc (sizeof(int) * last_basic_block);
+  df->inverse_rts_map = xmalloc (sizeof(int) * last_basic_block);
+
   flow_depth_first_order_compute (df->dfs_order, df->rc_order);
   flow_reverse_top_sort_order_compute (df->rts_order);
   for (i = 0; i < n_basic_blocks; i ++)
@@ -2032,19 +2021,18 @@ df_analyse_1 (df, blocks, flags, update)
       /* 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 ++)
+       bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
+       bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
+       bitmap *gen = xmalloc (sizeof (bitmap) * last_basic_block);
+       bitmap *kill = xmalloc (sizeof (bitmap) * last_basic_block);
+       FOR_EACH_BB (bb)
          {
-           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;
+           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, 
+       iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
                                   FORWARD, UNION, df_rd_transfer_function,
                                   df->inverse_rc_map, NULL);
        free (in);
@@ -2069,19 +2057,18 @@ df_analyse_1 (df, blocks, flags, update)
         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 ++)
+       bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
+       bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
+       bitmap *gen = xmalloc (sizeof (bitmap) * last_basic_block);
+       bitmap *kill = xmalloc (sizeof (bitmap) * last_basic_block);
+       FOR_EACH_BB (bb)
          {
-           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;
+           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, 
+       iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
                                   BACKWARD, UNION, df_ru_transfer_function,
                                   df->inverse_rts_map, NULL);
        free (in);
@@ -2107,21 +2094,20 @@ df_analyse_1 (df, blocks, flags, update)
   if (aflags & DF_LR)
     {
       /* Compute the sets of defs and uses of live variables.  */
-      df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks);      
+      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 ++)
+       bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
+       bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
+       bitmap *use = xmalloc (sizeof (bitmap) * last_basic_block);
+       bitmap *def = xmalloc (sizeof (bitmap) * last_basic_block);
+       FOR_EACH_BB (bb)
          {
-           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;
+           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, 
+       iterative_dataflow_bitmap (in, out, use, def, df->all_blocks,
                                   BACKWARD, UNION, df_lr_transfer_function,
                                   df->inverse_rts_map, NULL);
        free (in);
@@ -2273,12 +2259,15 @@ df_modified_p (df, blocks)
      struct df *df;
      bitmap blocks;
 {
-  unsigned int j;
   int update = 0;
+  basic_block bb;
+
+  if (!df->n_bbs)
+    return 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)))
+  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;
@@ -2301,7 +2290,7 @@ df_analyse (df, blocks, flags)
 
   /* We could deal with additional basic blocks being created by
      rescanning everything again.  */
-  if (df->n_bbs && df->n_bbs != (unsigned int)n_basic_blocks)
+  if (df->n_bbs && df->n_bbs != (unsigned int) last_basic_block)
     abort ();
 
   update = df_modified_p (df, blocks);
@@ -2411,10 +2400,8 @@ df_refs_unlink (df, blocks)
     }
   else
     {
-      FOR_ALL_BBS (bb,
-      {
+      FOR_EACH_BB (bb)
        df_bb_refs_unlink (df, bb);
-      });
     }
 }
 #endif
@@ -3263,9 +3250,9 @@ df_chain_dump_regno (link, file)
   for (; link; link = link->next)
     {
       fprintf (file, "%c%d(%d) ",
-               DF_REF_REG_DEF_P (link->ref) ? 'd' : 'u',
-               DF_REF_ID (link->ref),
-               DF_REF_REGNO (link->ref));
+              DF_REF_REG_DEF_P (link->ref) ? 'd' : 'u',
+              DF_REF_ID (link->ref),
+              DF_REF_REGNO (link->ref));
     }
   fprintf (file, "}");
 }
@@ -3277,8 +3264,8 @@ df_dump (df, flags, file)
      int flags;
      FILE *file;
 {
-  unsigned int i;
   unsigned int j;
+  basic_block bb;
 
   if (! df || ! file)
     return;
@@ -3289,22 +3276,23 @@ df_dump (df, flags, file)
 
   if (flags & DF_RD)
     {
+      basic_block bb;
+
       fprintf (file, "Reaching defs:\n");
-      for (i = 0; i < df->n_bbs; i++)
+      FOR_EACH_BB (bb)
        {
-         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);
+         fprintf (file, "bb %d in  \t", bb->index);
          dump_bitmap (file, bb_info->rd_in);
-         fprintf (file, "bb %d gen \t", i);
+         fprintf (file, "bb %d gen \t", bb->index);
          dump_bitmap (file, bb_info->rd_gen);
-         fprintf (file, "bb %d kill\t", i);
+         fprintf (file, "bb %d kill\t", bb->index);
          dump_bitmap (file, bb_info->rd_kill);
-         fprintf (file, "bb %d out \t", i);
+         fprintf (file, "bb %d out \t", bb->index);
          dump_bitmap (file, bb_info->rd_out);
        }
     }
@@ -3332,21 +3320,20 @@ df_dump (df, flags, file)
   if (flags & DF_RU)
     {
       fprintf (file, "Reaching uses:\n");
-      for (i = 0; i < df->n_bbs; i++)
+      FOR_EACH_BB (bb)
        {
-         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);
+         fprintf (file, "bb %d in  \t", bb->index);
          dump_bitmap (file, bb_info->ru_in);
-         fprintf (file, "bb %d gen \t", i);
+         fprintf (file, "bb %d gen \t", bb->index);
          dump_bitmap (file, bb_info->ru_gen);
-         fprintf (file, "bb %d kill\t", i);
+         fprintf (file, "bb %d kill\t", bb->index);
          dump_bitmap (file, bb_info->ru_kill);
-         fprintf (file, "bb %d out \t", i);
+         fprintf (file, "bb %d out \t", bb->index);
          dump_bitmap (file, bb_info->ru_out);
        }
     }
@@ -3374,21 +3361,20 @@ df_dump (df, flags, file)
   if (flags & DF_LR)
     {
       fprintf (file, "Live regs:\n");
-      for (i = 0; i < df->n_bbs; i++)
+      FOR_EACH_BB (bb)
        {
-         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);
+         fprintf (file, "bb %d in  \t", bb->index);
          dump_bitmap (file, bb_info->lr_in);
-         fprintf (file, "bb %d use \t", i);
+         fprintf (file, "bb %d use \t", bb->index);
          dump_bitmap (file, bb_info->lr_use);
-         fprintf (file, "bb %d def \t", i);
+         fprintf (file, "bb %d def \t", bb->index);
          dump_bitmap (file, bb_info->lr_def);
-         fprintf (file, "bb %d out \t", i);
+         fprintf (file, "bb %d out \t", bb->index);
          dump_bitmap (file, bb_info->lr_out);
        }
     }
@@ -3495,7 +3481,7 @@ df_insn_debug_regno (df, insn, file)
     bbi = -1;
 
   fprintf (file, "insn %d bb %d luid %d defs ",
-           uid, bbi, DF_INSN_LUID (df, insn));
+          uid, bbi, DF_INSN_LUID (df, insn));
   df_chain_dump_regno (df->insns[uid].defs, file);
   fprintf (file, " uses ");
   df_chain_dump_regno (df->insns[uid].uses, file);
@@ -3598,9 +3584,9 @@ debug_df_chain (link)
 
 /* Hybrid search algorithm from "Implementation Techniques for
    Efficient Data-Flow Analysis of Large Programs".  */
-static void 
-hybrid_search_bitmap (block, in, out, gen, kill, dir, 
-                     conf_op, transfun, visited, pending, 
+static void
+hybrid_search_bitmap (block, in, out, gen, kill, dir,
+                     conf_op, transfun, visited, pending,
                      data)
      basic_block block;
      bitmap *in, *out, *gen, *kill;
@@ -3637,7 +3623,7 @@ hybrid_search_bitmap (block, in, out, gen, kill, dir,
                }
            }
        }
-      else 
+      else
        {
          /* Calculate <conf_op> of successor ins */
          bitmap_zero(out[i]);
@@ -3646,7 +3632,7 @@ hybrid_search_bitmap (block, in, out, gen, kill, dir,
              if (e->dest == EXIT_BLOCK_PTR)
                continue;
              switch (conf_op)
-               {       
+               {
                case UNION:
                  bitmap_a_or_b (out[i], out[i], in[e->dest->index]);
                  break;
@@ -3655,7 +3641,7 @@ hybrid_search_bitmap (block, in, out, gen, kill, dir,
                  break;
                }
            }
-       }      
+       }
       /* Common part */
       (*transfun)(i, &changed, in[i], out[i], gen[i], kill[i], data);
       RESET_BIT (pending, i);
@@ -3688,8 +3674,8 @@ hybrid_search_bitmap (block, in, out, gen, kill, dir,
          if (e->dest == EXIT_BLOCK_PTR || e->dest->index == i)
            continue;
          if (!TEST_BIT (visited, e->dest->index))
-           hybrid_search_bitmap (e->dest, in, out, gen, kill, dir, 
-                                 conf_op, transfun, visited, pending, 
+           hybrid_search_bitmap (e->dest, in, out, gen, kill, dir,
+                                 conf_op, transfun, visited, pending,
                                  data);
        }
     }
@@ -3700,8 +3686,8 @@ hybrid_search_bitmap (block, in, out, gen, kill, dir,
          if (e->src == ENTRY_BLOCK_PTR || e->src->index == i)
            continue;
          if (!TEST_BIT (visited, e->src->index))
-           hybrid_search_bitmap (e->src, in, out, gen, kill, dir, 
-                                 conf_op, transfun, visited, pending, 
+           hybrid_search_bitmap (e->src, in, out, gen, kill, dir,
+                                 conf_op, transfun, visited, pending,
                                  data);
        }
     }
@@ -3709,8 +3695,8 @@ hybrid_search_bitmap (block, in, out, gen, kill, dir,
 
 
 /* Hybrid search for sbitmaps, rather than bitmaps.  */
-static void 
-hybrid_search_sbitmap (block, in, out, gen, kill, dir, 
+static void
+hybrid_search_sbitmap (block, in, out, gen, kill, dir,
                       conf_op, transfun, visited, pending,
                       data)
      basic_block block;
@@ -3748,7 +3734,7 @@ hybrid_search_sbitmap (block, in, out, gen, kill, dir,
                }
            }
        }
-      else 
+      else
        {
          /* Calculate <conf_op> of successor ins */
          sbitmap_zero(out[i]);
@@ -3757,7 +3743,7 @@ hybrid_search_sbitmap (block, in, out, gen, kill, dir,
              if (e->dest == EXIT_BLOCK_PTR)
                continue;
              switch (conf_op)
-               {       
+               {
                case UNION:
                  sbitmap_a_or_b (out[i], out[i], in[e->dest->index]);
                  break;
@@ -3766,7 +3752,7 @@ hybrid_search_sbitmap (block, in, out, gen, kill, dir,
                  break;
                }
            }
-       }      
+       }
       /* Common part */
       (*transfun)(i, &changed, in[i], out[i], gen[i], kill[i], data);
       RESET_BIT (pending, i);
@@ -3799,8 +3785,8 @@ hybrid_search_sbitmap (block, in, out, gen, kill, dir,
          if (e->dest == EXIT_BLOCK_PTR || e->dest->index == i)
            continue;
          if (!TEST_BIT (visited, e->dest->index))
-           hybrid_search_sbitmap (e->dest, in, out, gen, kill, dir, 
-                                  conf_op, transfun, visited, pending, 
+           hybrid_search_sbitmap (e->dest, in, out, gen, kill, dir,
+                                  conf_op, transfun, visited, pending,
                                   data);
        }
     }
@@ -3811,8 +3797,8 @@ hybrid_search_sbitmap (block, in, out, gen, kill, dir,
          if (e->src == ENTRY_BLOCK_PTR || e->src->index == i)
            continue;
          if (!TEST_BIT (visited, e->src->index))
-           hybrid_search_sbitmap (e->src, in, out, gen, kill, dir, 
-                                  conf_op, transfun, visited, pending, 
+           hybrid_search_sbitmap (e->src, in, out, gen, kill, dir,
+                                  conf_op, transfun, visited, pending,
                                   data);
        }
     }
@@ -3830,20 +3816,20 @@ hybrid_search_sbitmap (block, in, out, gen, kill, dir,
    transfun = Transfer function.
    order = Order to iterate in. (Should map block numbers -> order)
    data = Whatever you want.  It's passed to the transfer function.
-   
+
    This function will perform iterative bitvector dataflow, producing
    the in and out sets.  Even if you only want to perform it for a
    small number of blocks, the vectors for in and out must be large
    enough for *all* blocks, because changing one block might affect
    others.  However, it'll only put what you say to analyze on the
    initial worklist.
-   
+
    For forward problems, you probably want to pass in a mapping of
    block number to rc_order (like df->inverse_rc_map).
 */
 void
-iterative_dataflow_sbitmap (in, out, gen, kill, blocks, 
-                           dir, conf_op, transfun, order, data)     
+iterative_dataflow_sbitmap (in, out, gen, kill, blocks,
+                           dir, conf_op, transfun, order, data)
      sbitmap *in, *out, *gen, *kill;
      bitmap blocks;
      enum df_flow_dir dir;
@@ -3856,14 +3842,14 @@ iterative_dataflow_sbitmap (in, out, gen, kill, blocks,
   fibheap_t worklist;
   basic_block bb;
   sbitmap visited, pending;
-  pending = sbitmap_alloc (n_basic_blocks);
-  visited = sbitmap_alloc (n_basic_blocks);
+  pending = sbitmap_alloc (last_basic_block);
+  visited = sbitmap_alloc (last_basic_block);
   sbitmap_zero (pending);
   sbitmap_zero (visited);
   worklist = fibheap_new ();
   EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i,
   {
-    fibheap_insert (worklist, order[i], (void *) (size_t) i); 
+    fibheap_insert (worklist, order[i], (void *) (size_t) i);
     SET_BIT (pending, i);
     if (dir == FORWARD)
       sbitmap_copy (out[i], gen[i]);
@@ -3877,7 +3863,7 @@ iterative_dataflow_sbitmap (in, out, gen, kill, blocks,
          i = (size_t) fibheap_extract_min (worklist);
          bb = BASIC_BLOCK (i);
          if (!TEST_BIT (visited, bb->index))
-           hybrid_search_sbitmap (bb, in, out, gen, kill, dir, 
+           hybrid_search_sbitmap (bb, in, out, gen, kill, dir,
                                   conf_op, transfun, visited, pending, data);
        }
       if (sbitmap_first_set_bit (pending) != -1)
@@ -3891,7 +3877,7 @@ iterative_dataflow_sbitmap (in, out, gen, kill, blocks,
       else
        {
          break;
-       }      
+       }
     }
   sbitmap_free (pending);
   sbitmap_free (visited);
@@ -3901,8 +3887,8 @@ iterative_dataflow_sbitmap (in, out, gen, kill, blocks,
 /* Exactly the same as iterative_dataflow_sbitmap, except it works on
    bitmaps instead */
 void
-iterative_dataflow_bitmap (in, out, gen, kill, blocks, 
-                          dir, conf_op, transfun, order, data)     
+iterative_dataflow_bitmap (in, out, gen, kill, blocks,
+                          dir, conf_op, transfun, order, data)
      bitmap *in, *out, *gen, *kill;
      bitmap blocks;
      enum df_flow_dir dir;
@@ -3915,8 +3901,8 @@ iterative_dataflow_bitmap (in, out, gen, kill, blocks,
   fibheap_t worklist;
   basic_block bb;
   sbitmap visited, pending;
-  pending = sbitmap_alloc (n_basic_blocks);
-  visited = sbitmap_alloc (n_basic_blocks);
+  pending = sbitmap_alloc (last_basic_block);
+  visited = sbitmap_alloc (last_basic_block);
   sbitmap_zero (pending);
   sbitmap_zero (visited);
   worklist = fibheap_new ();
@@ -3936,7 +3922,7 @@ iterative_dataflow_bitmap (in, out, gen, kill, blocks,
          i = (size_t) fibheap_extract_min (worklist);
          bb = BASIC_BLOCK (i);
          if (!TEST_BIT (visited, bb->index))
-           hybrid_search_bitmap (bb, in, out, gen, kill, dir, 
+           hybrid_search_bitmap (bb, in, out, gen, kill, dir,
                                  conf_op, transfun, visited, pending, data);
        }
       if (sbitmap_first_set_bit (pending) != -1)
@@ -3950,9 +3936,9 @@ iterative_dataflow_bitmap (in, out, gen, kill, blocks,
       else
        {
          break;
-       }     
+       }
     }
   sbitmap_free (pending);
   sbitmap_free (visited);
-  fibheap_delete (worklist);  
+  fibheap_delete (worklist);
 }