OSDN Git Service

* doc/invoke.texi: Add mcmodel to powerpc options.
[pf3gnuchains/gcc-fork.git] / gcc / df-problems.c
index 774cc9e..f9d5f6b 100644 (file)
@@ -54,8 +54,8 @@ along with GCC; see the file COPYING3.  If not see
 
 #define DF_SPARSE_THRESHOLD 32
 
-static bitmap seen_in_block = NULL;
-static bitmap seen_in_insn = NULL;
+static bitmap_head seen_in_block;
+static bitmap_head seen_in_insn;
 
 \f
 /*----------------------------------------------------------------------------
@@ -100,22 +100,6 @@ df_get_live_in (basic_block bb)
 /* Generic versions to get the void* version of the block info.  Only
    used inside the problem instance vectors.  */
 
-/* Grow the bb_info array.  */
-
-void
-df_grow_bb_info (struct dataflow *dflow)
-{
-  unsigned int new_size = last_basic_block + 1;
-  if (dflow->block_info_size < new_size)
-    {
-      new_size += new_size / 4;
-      dflow->block_info = XRESIZEVEC (void *, dflow->block_info, new_size);
-      memset (dflow->block_info + dflow->block_info_size, 0,
-             (new_size - dflow->block_info_size) *sizeof (void *));
-      dflow->block_info_size = new_size;
-    }
-}
-
 /* Dump a def-use or use-def chain for REF to FILE.  */
 
 void
@@ -195,24 +179,13 @@ df_print_bb_index (basic_block bb, FILE *file)
 struct df_rd_problem_data
 {
   /* The set of defs to regs invalidated by call.  */
-  bitmap sparse_invalidated_by_call;
+  bitmap_head sparse_invalidated_by_call;
   /* The set of defs to regs invalidate by call for rd.  */
-  bitmap dense_invalidated_by_call;
+  bitmap_head dense_invalidated_by_call;
   /* An obstack for the bitmaps we need for this problem.  */
   bitmap_obstack rd_bitmaps;
 };
 
-/* Set basic block info.  */
-
-static void
-df_rd_set_bb_info (unsigned int index,
-                  struct df_rd_bb_info *bb_info)
-{
-  gcc_assert (df_rd);
-  gcc_assert (index < df_rd->block_info_size);
-  df_rd->block_info[index] = bb_info;
-}
-
 
 /* Free basic block info.  */
 
@@ -228,7 +201,6 @@ df_rd_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
       bitmap_clear (&bb_info->gen);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_rd->block_pool, bb_info);
     }
 }
 
@@ -243,15 +215,11 @@ df_rd_alloc (bitmap all_blocks)
   bitmap_iterator bi;
   struct df_rd_problem_data *problem_data;
 
-  if (!df_rd->block_pool)
-    df_rd->block_pool = create_alloc_pool ("df_rd_block pool",
-                                          sizeof (struct df_rd_bb_info), 50);
-
   if (df_rd->problem_data)
     {
       problem_data = (struct df_rd_problem_data *) df_rd->problem_data;
-      bitmap_clear (problem_data->sparse_invalidated_by_call);
-      bitmap_clear (problem_data->dense_invalidated_by_call);
+      bitmap_clear (&problem_data->sparse_invalidated_by_call);
+      bitmap_clear (&problem_data->dense_invalidated_by_call);
     }
   else
     {
@@ -259,10 +227,10 @@ df_rd_alloc (bitmap all_blocks)
       df_rd->problem_data = problem_data;
 
       bitmap_obstack_initialize (&problem_data->rd_bitmaps);
-      problem_data->sparse_invalidated_by_call
-       = BITMAP_ALLOC (&problem_data->rd_bitmaps);
-      problem_data->dense_invalidated_by_call
-       = BITMAP_ALLOC (&problem_data->rd_bitmaps);
+      bitmap_initialize (&problem_data->sparse_invalidated_by_call,
+                        &problem_data->rd_bitmaps);
+      bitmap_initialize (&problem_data->dense_invalidated_by_call,
+                        &problem_data->rd_bitmaps);
     }
 
   df_grow_bb_info (df_rd);
@@ -274,7 +242,9 @@ df_rd_alloc (bitmap all_blocks)
   EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi)
     {
       struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
-      if (bb_info)
+      
+      /* When bitmaps are already initialized, just clear them.  */
+      if (bb_info->kill.obstack)
        {
          bitmap_clear (&bb_info->kill);
          bitmap_clear (&bb_info->sparse_kill);
@@ -282,8 +252,6 @@ df_rd_alloc (bitmap all_blocks)
        }
       else
        {
-         bb_info = (struct df_rd_bb_info *) pool_alloc (df_rd->block_pool);
-         df_rd_set_bb_info (bb_index, bb_info);
          bitmap_initialize (&bb_info->kill, &problem_data->rd_bitmaps);
          bitmap_initialize (&bb_info->sparse_kill, &problem_data->rd_bitmaps);
          bitmap_initialize (&bb_info->gen, &problem_data->rd_bitmaps);
@@ -370,11 +338,11 @@ df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info,
            {
              /* Only the last def(s) for a regno in the block has any
                 effect.  */
-             if (!bitmap_bit_p (seen_in_block, regno))
+             if (!bitmap_bit_p (&seen_in_block, regno))
                {
                  /* The first def for regno in insn gets to knock out the
                     defs from other instructions.  */
-                 if ((!bitmap_bit_p (seen_in_insn, regno))
+                 if ((!bitmap_bit_p (&seen_in_insn, regno))
                      /* If the def is to only part of the reg, it does
                         not kill the other defs that reach here.  */
                      && (!(DF_REF_FLAGS (def) &
@@ -392,7 +360,7 @@ df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info,
                        }
                    }
 
-                 bitmap_set_bit (seen_in_insn, regno);
+                 bitmap_set_bit (&seen_in_insn, regno);
                  /* All defs for regno in the instruction may be put into
                     the gen set.  */
                  if (!(DF_REF_FLAGS (def)
@@ -414,8 +382,8 @@ df_rd_bb_local_compute (unsigned int bb_index)
   struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
   rtx insn;
 
-  bitmap_clear (seen_in_block);
-  bitmap_clear (seen_in_insn);
+  bitmap_clear (&seen_in_block);
+  bitmap_clear (&seen_in_insn);
 
   /* Artificials are only hard regs.  */
   if (!(df->changeable_flags & DF_NO_HARD_REGS))
@@ -439,8 +407,8 @@ df_rd_bb_local_compute (unsigned int bb_index)
         result and another def for the clobber.  If only one vector
         is used and the clobber goes first, the result will be
         lost.  */
-      bitmap_ior_into (seen_in_block, seen_in_insn);
-      bitmap_clear (seen_in_insn);
+      bitmap_ior_into (&seen_in_block, &seen_in_insn);
+      bitmap_clear (&seen_in_insn);
     }
 
   /* Process the artificial defs at the top of the block last since we
@@ -463,11 +431,11 @@ df_rd_local_compute (bitmap all_blocks)
   unsigned int regno;
   struct df_rd_problem_data *problem_data
     = (struct df_rd_problem_data *) df_rd->problem_data;
-  bitmap sparse_invalidated = problem_data->sparse_invalidated_by_call;
-  bitmap dense_invalidated = problem_data->dense_invalidated_by_call;
+  bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_call;
+  bitmap dense_invalidated = &problem_data->dense_invalidated_by_call;
 
-  seen_in_block = BITMAP_ALLOC (&df_bitmap_obstack);
-  seen_in_insn = BITMAP_ALLOC (&df_bitmap_obstack);
+  bitmap_initialize (&seen_in_block, &df_bitmap_obstack);
+  bitmap_initialize (&seen_in_insn, &df_bitmap_obstack);
 
   df_maybe_reorganize_def_refs (DF_REF_ORDER_BY_REG);
 
@@ -487,8 +455,8 @@ df_rd_local_compute (bitmap all_blocks)
                          DF_DEFS_COUNT (regno));
     }
 
-  BITMAP_FREE (seen_in_block);
-  BITMAP_FREE (seen_in_insn);
+  bitmap_clear (&seen_in_block);
+  bitmap_clear (&seen_in_insn);
 }
 
 
@@ -524,23 +492,24 @@ df_rd_confluence_n (edge e)
     {
       struct df_rd_problem_data *problem_data
        = (struct df_rd_problem_data *) df_rd->problem_data;
-      bitmap sparse_invalidated = problem_data->sparse_invalidated_by_call;
-      bitmap dense_invalidated = problem_data->dense_invalidated_by_call;
+      bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_call;
+      bitmap dense_invalidated = &problem_data->dense_invalidated_by_call;
       bitmap_iterator bi;
       unsigned int regno;
-      bitmap tmp = BITMAP_ALLOC (&df_bitmap_obstack);
+      bitmap_head tmp;
 
-      bitmap_copy (tmp, op2);
-      bitmap_and_compl_into (tmp, dense_invalidated);
+      bitmap_initialize (&tmp, &df_bitmap_obstack);
+      bitmap_copy (&tmp, op2);
+      bitmap_and_compl_into (&tmp, dense_invalidated);
 
       EXECUTE_IF_SET_IN_BITMAP (sparse_invalidated, 0, regno, bi)
        {
-         bitmap_clear_range (tmp,
+         bitmap_clear_range (&tmp,
                              DF_DEFS_BEGIN (regno),
                              DF_DEFS_COUNT (regno));
        }
-      bitmap_ior_into (op1, tmp);
-      BITMAP_FREE (tmp);
+      bitmap_ior_into (op1, &tmp);
+      bitmap_clear (&tmp);
     }
   else
     bitmap_ior_into (op1, op2);
@@ -567,30 +536,30 @@ df_rd_transfer_function (int bb_index)
     {
       struct df_rd_problem_data *problem_data;
       bool changed = false;
-      bitmap tmp;
+      bitmap_head tmp;
 
       /* Note that TMP is _not_ a temporary bitmap if we end up replacing
         OUT with TMP.  Therefore, allocate TMP in the RD bitmaps obstack.  */
       problem_data = (struct df_rd_problem_data *) df_rd->problem_data;
-      tmp = BITMAP_ALLOC (&problem_data->rd_bitmaps);
+      bitmap_initialize (&tmp, &problem_data->rd_bitmaps);
 
-      bitmap_copy (tmp, in);
+      bitmap_copy (&tmp, in);
       EXECUTE_IF_SET_IN_BITMAP (sparse_kill, 0, regno, bi)
        {
-         bitmap_clear_range (tmp,
+         bitmap_clear_range (&tmp,
                              DF_DEFS_BEGIN (regno),
                              DF_DEFS_COUNT (regno));
        }
-      bitmap_and_compl_into (tmp, kill);
-      bitmap_ior_into (tmp, gen);
-      changed = !bitmap_equal_p (tmp, out);
+      bitmap_and_compl_into (&tmp, kill);
+      bitmap_ior_into (&tmp, gen);
+      changed = !bitmap_equal_p (&tmp, out);
       if (changed)
        {
          bitmap_clear (out);
-         bb_info->out = *tmp;
+         bb_info->out = tmp;
        }
       else
-         bitmap_clear (tmp);
+         bitmap_clear (&tmp);
       return changed;
     }
 }
@@ -606,11 +575,11 @@ df_rd_free (void)
 
   if (problem_data)
     {
-      free_alloc_pool (df_rd->block_pool);
       bitmap_obstack_release (&problem_data->rd_bitmaps);
 
       df_rd->block_info_size = 0;
       free (df_rd->block_info);
+      df_rd->block_info = NULL;
       free (df_rd->problem_data);
     }
   free (df_rd);
@@ -633,9 +602,9 @@ df_rd_start_dump (FILE *file)
   fprintf (file, ";; Reaching defs:\n\n");
 
   fprintf (file, "  sparse invalidated \t");
-  dump_bitmap (file, problem_data->sparse_invalidated_by_call);
+  dump_bitmap (file, &problem_data->sparse_invalidated_by_call);
   fprintf (file, "  dense invalidated \t");
-  dump_bitmap (file, problem_data->dense_invalidated_by_call);
+  dump_bitmap (file, &problem_data->dense_invalidated_by_call);
 
   for (regno = 0; regno < m; regno++)
     if (DF_DEFS_COUNT (regno))
@@ -702,6 +671,7 @@ static struct df_problem problem_RD =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verify end.  */
   NULL,                       /* Dependent problem.  */
+  sizeof (struct df_rd_bb_info),/* Size of entry of block_info array.  */
   TV_DF_RD,                   /* Timing variable.  */
   true                        /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -733,21 +703,10 @@ struct df_lr_problem_data
 {
   bitmap_head *in;
   bitmap_head *out;
+  /* An obstack for the bitmaps we need for this problem.  */
+  bitmap_obstack lr_bitmaps;
 };
 
-
-/* Set basic block info.  */
-
-static void
-df_lr_set_bb_info (unsigned int index,
-                  struct df_lr_bb_info *bb_info)
-{
-  gcc_assert (df_lr);
-  gcc_assert (index < df_lr->block_info_size);
-  df_lr->block_info[index] = bb_info;
-}
-
-
 /* Free basic block info.  */
 
 static void
@@ -761,7 +720,6 @@ df_lr_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
       bitmap_clear (&bb_info->def);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_lr->block_pool, bb_info);
     }
 }
 
@@ -774,29 +732,37 @@ df_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
 {
   unsigned int bb_index;
   bitmap_iterator bi;
-
-  if (!df_lr->block_pool)
-    df_lr->block_pool = create_alloc_pool ("df_lr_block pool",
-                                          sizeof (struct df_lr_bb_info), 50);
+  struct df_lr_problem_data *problem_data;
 
   df_grow_bb_info (df_lr);
+  if (df_lr->problem_data)
+    problem_data = (struct df_lr_problem_data *) df_lr->problem_data;
+  else
+    {
+      problem_data = XNEW (struct df_lr_problem_data);
+      df_lr->problem_data = problem_data;
+
+      problem_data->out = NULL;
+      problem_data->in = NULL;
+      bitmap_obstack_initialize (&problem_data->lr_bitmaps);
+    }
 
   EXECUTE_IF_SET_IN_BITMAP (df_lr->out_of_date_transfer_functions, 0, bb_index, bi)
     {
       struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index);
-      if (bb_info)
+      
+      /* When bitmaps are already initialized, just clear them.  */
+      if (bb_info->use.obstack)
        {
          bitmap_clear (&bb_info->def);
          bitmap_clear (&bb_info->use);
        }
       else
        {
-         bb_info = (struct df_lr_bb_info *) pool_alloc (df_lr->block_pool);
-         df_lr_set_bb_info (bb_index, bb_info);
-         bitmap_initialize (&bb_info->use, &bitmap_default_obstack);
-         bitmap_initialize (&bb_info->def, &bitmap_default_obstack);
-         bitmap_initialize (&bb_info->in, &bitmap_default_obstack);
-         bitmap_initialize (&bb_info->out, &bitmap_default_obstack);
+         bitmap_initialize (&bb_info->use, &problem_data->lr_bitmaps);
+         bitmap_initialize (&bb_info->def, &problem_data->lr_bitmaps);
+         bitmap_initialize (&bb_info->in, &problem_data->lr_bitmaps);
+         bitmap_initialize (&bb_info->out, &problem_data->lr_bitmaps);
        }
     }
 
@@ -924,10 +890,10 @@ df_lr_local_compute (bitmap all_blocks ATTRIBUTE_UNUSED)
   unsigned int bb_index;
   bitmap_iterator bi;
 
-  bitmap_clear (df->hardware_regs_used);
+  bitmap_clear (&df->hardware_regs_used);
 
   /* The all-important stack pointer must always be live.  */
-  bitmap_set_bit (df->hardware_regs_used, STACK_POINTER_REGNUM);
+  bitmap_set_bit (&df->hardware_regs_used, STACK_POINTER_REGNUM);
 
   /* Before reload, there are a few registers that must be forced
      live everywhere -- which might not already be the case for
@@ -936,20 +902,20 @@ df_lr_local_compute (bitmap all_blocks ATTRIBUTE_UNUSED)
     {
       /* Any reference to any pseudo before reload is a potential
         reference of the frame pointer.  */
-      bitmap_set_bit (df->hardware_regs_used, FRAME_POINTER_REGNUM);
+      bitmap_set_bit (&df->hardware_regs_used, FRAME_POINTER_REGNUM);
 
 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
       /* Pseudos with argument area equivalences may require
         reloading via the argument pointer.  */
       if (fixed_regs[ARG_POINTER_REGNUM])
-       bitmap_set_bit (df->hardware_regs_used, ARG_POINTER_REGNUM);
+       bitmap_set_bit (&df->hardware_regs_used, ARG_POINTER_REGNUM);
 #endif
 
       /* Any constant, or pseudo with constant equivalences, may
         require reloading from memory using the pic register.  */
       if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
          && fixed_regs[PIC_OFFSET_TABLE_REGNUM])
-       bitmap_set_bit (df->hardware_regs_used, PIC_OFFSET_TABLE_REGNUM);
+       bitmap_set_bit (&df->hardware_regs_used, PIC_OFFSET_TABLE_REGNUM);
     }
 
   EXECUTE_IF_SET_IN_BITMAP (df_lr->out_of_date_transfer_functions, 0, bb_index, bi)
@@ -994,7 +960,7 @@ df_lr_confluence_0 (basic_block bb)
 {
   bitmap op1 = &df_lr_get_bb_info (bb->index)->out;
   if (bb != EXIT_BLOCK_PTR)
-    bitmap_copy (op1, df->hardware_regs_used);
+    bitmap_copy (op1, &df->hardware_regs_used);
 }
 
 
@@ -1014,7 +980,7 @@ df_lr_confluence_n (edge e)
   else
     bitmap_ior_into (op1, op2);
 
-  bitmap_ior_into (op1, df->hardware_regs_used);
+  bitmap_ior_into (op1, &df->hardware_regs_used);
 }
 
 
@@ -1072,24 +1038,17 @@ df_lr_finalize (bitmap all_blocks)
 static void
 df_lr_free (void)
 {
+  struct df_lr_problem_data *problem_data
+    = (struct df_lr_problem_data *) df_lr->problem_data;
   if (df_lr->block_info)
     {
-      unsigned int i;
-      for (i = 0; i < df_lr->block_info_size; i++)
-       {
-         struct df_lr_bb_info *bb_info = df_lr_get_bb_info (i);
-         if (bb_info)
-           {
-             bitmap_clear (&bb_info->use);
-             bitmap_clear (&bb_info->def);
-             bitmap_clear (&bb_info->in);
-             bitmap_clear (&bb_info->out);
-           }
-       }
-      free_alloc_pool (df_lr->block_pool);
 
       df_lr->block_info_size = 0;
       free (df_lr->block_info);
+      df_lr->block_info = NULL;
+      bitmap_obstack_release (&problem_data->lr_bitmaps);
+      free (df_lr->problem_data);
+      df_lr->problem_data = NULL;
     }
 
   BITMAP_FREE (df_lr->out_of_date_transfer_functions);
@@ -1112,8 +1071,11 @@ df_lr_top_dump (basic_block bb, FILE *file)
   if (df_lr->problem_data)
     {
       problem_data = (struct df_lr_problem_data *)df_lr->problem_data;
-      fprintf (file, ";;  old in  \t");
-      df_print_regset (file, &problem_data->in[bb->index]);
+      if (problem_data->in)
+       {
+         fprintf (file, ";;  old in  \t");
+         df_print_regset (file, &problem_data->in[bb->index]);
+       }
     }
   fprintf (file, ";; lr  use \t");
   df_print_regset (file, &bb_info->use);
@@ -1137,8 +1099,11 @@ df_lr_bottom_dump (basic_block bb, FILE *file)
   if (df_lr->problem_data)
     {
       problem_data = (struct df_lr_problem_data *)df_lr->problem_data;
-      fprintf (file, ";;  old out  \t");
-      df_print_regset (file, &problem_data->out[bb->index]);
+      if (problem_data->out)
+       {
+          fprintf (file, ";;  old out  \t");
+          df_print_regset (file, &problem_data->out[bb->index]);
+       }
     }
 }
 
@@ -1152,23 +1117,19 @@ df_lr_verify_solution_start (void)
   basic_block bb;
   struct df_lr_problem_data *problem_data;
   if (df_lr->solutions_dirty)
-    {
-      df_lr->problem_data = NULL;
-      return;
-    }
+    return;
 
   /* Set it true so that the solution is recomputed.  */
   df_lr->solutions_dirty = true;
 
-  problem_data = XNEW (struct df_lr_problem_data);
-  df_lr->problem_data = problem_data;
+  problem_data = (struct df_lr_problem_data *)df_lr->problem_data;
   problem_data->in = XNEWVEC (bitmap_head, last_basic_block);
   problem_data->out = XNEWVEC (bitmap_head, last_basic_block);
 
   FOR_ALL_BB (bb)
     {
-      bitmap_initialize (&problem_data->in[bb->index], &bitmap_default_obstack);
-      bitmap_initialize (&problem_data->out[bb->index], &bitmap_default_obstack);
+      bitmap_initialize (&problem_data->in[bb->index], &problem_data->lr_bitmaps);
+      bitmap_initialize (&problem_data->out[bb->index], &problem_data->lr_bitmaps);
       bitmap_copy (&problem_data->in[bb->index], DF_LR_IN (bb));
       bitmap_copy (&problem_data->out[bb->index], DF_LR_OUT (bb));
     }
@@ -1184,11 +1145,11 @@ df_lr_verify_solution_end (void)
   struct df_lr_problem_data *problem_data;
   basic_block bb;
 
-  if (df_lr->problem_data == NULL)
-    return;
-
   problem_data = (struct df_lr_problem_data *)df_lr->problem_data;
 
+  if (!problem_data->out)
+    return;
+
   if (df_lr->solutions_dirty)
     /* Do not check if the solution is still dirty.  See the comment
        in df_lr_finalize for details.  */
@@ -1214,8 +1175,8 @@ df_lr_verify_solution_end (void)
 
   free (problem_data->in);
   free (problem_data->out);
-  free (problem_data);
-  df_lr->problem_data = NULL;
+  problem_data->in = NULL;
+  problem_data->out = NULL;
 }
 
 
@@ -1243,6 +1204,7 @@ static struct df_problem problem_LR =
   df_lr_verify_solution_start,/* Incremental solution verify start.  */
   df_lr_verify_solution_end,  /* Incremental solution verify end.  */
   NULL,                       /* Dependent problem.  */
+  sizeof (struct df_lr_bb_info),/* Size of entry of block_info array.  */
   TV_DF_LR,                   /* Timing variable.  */
   false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -1269,25 +1231,21 @@ void
 df_lr_verify_transfer_functions (void)
 {
   basic_block bb;
-  bitmap saved_def;
-  bitmap saved_use;
-  bitmap saved_adef;
-  bitmap saved_ause;
-  bitmap all_blocks;
+  bitmap_head saved_def;
+  bitmap_head saved_use;
+  bitmap_head all_blocks;
 
   if (!df)
     return;
 
-  saved_def = BITMAP_ALLOC (NULL);
-  saved_use = BITMAP_ALLOC (NULL);
-  saved_adef = BITMAP_ALLOC (NULL);
-  saved_ause = BITMAP_ALLOC (NULL);
-  all_blocks = BITMAP_ALLOC (NULL);
+  bitmap_initialize (&saved_def, &bitmap_default_obstack); 
+  bitmap_initialize (&saved_use, &bitmap_default_obstack);
+  bitmap_initialize (&all_blocks, &bitmap_default_obstack);
 
   FOR_ALL_BB (bb)
     {
       struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index);
-      bitmap_set_bit (all_blocks, bb->index);
+      bitmap_set_bit (&all_blocks, bb->index);
 
       if (bb_info)
        {
@@ -1297,14 +1255,14 @@ df_lr_verify_transfer_functions (void)
          if (!bitmap_bit_p (df_lr->out_of_date_transfer_functions,
                             bb->index))
            {
-             bitmap_copy (saved_def, &bb_info->def);
-             bitmap_copy (saved_use, &bb_info->use);
+             bitmap_copy (&saved_def, &bb_info->def);
+             bitmap_copy (&saved_use, &bb_info->use);
              bitmap_clear (&bb_info->def);
              bitmap_clear (&bb_info->use);
 
              df_lr_bb_local_compute (bb->index);
-             gcc_assert (bitmap_equal_p (saved_def, &bb_info->def));
-             gcc_assert (bitmap_equal_p (saved_use, &bb_info->use));
+             gcc_assert (bitmap_equal_p (&saved_def, &bb_info->def));
+             gcc_assert (bitmap_equal_p (&saved_use, &bb_info->use));
            }
        }
       else
@@ -1322,13 +1280,11 @@ df_lr_verify_transfer_functions (void)
 
   /* Make sure there are no dirty bits in blocks that have been deleted.  */
   gcc_assert (!bitmap_intersect_compl_p (df_lr->out_of_date_transfer_functions,
-                                        all_blocks));
+                                        &all_blocks));
 
-  BITMAP_FREE (saved_def);
-  BITMAP_FREE (saved_use);
-  BITMAP_FREE (saved_adef);
-  BITMAP_FREE (saved_ause);
-  BITMAP_FREE (all_blocks);
+  bitmap_clear (&saved_def);
+  bitmap_clear (&saved_use);
+  bitmap_clear (&all_blocks);
 }
 
 
@@ -1357,23 +1313,14 @@ struct df_live_problem_data
 {
   bitmap_head *in;
   bitmap_head *out;
+  /* An obstack for the bitmaps we need for this problem.  */
+  bitmap_obstack live_bitmaps;
 };
 
 /* Scratch var used by transfer functions.  This is used to implement
    an optimization to reduce the amount of space used to compute the
    combined lr and live analysis.  */
-static bitmap df_live_scratch;
-
-/* Set basic block info.  */
-
-static void
-df_live_set_bb_info (unsigned int index,
-                  struct df_live_bb_info *bb_info)
-{
-  gcc_assert (df_live);
-  gcc_assert (index < df_live->block_info_size);
-  df_live->block_info[index] = bb_info;
-}
+static bitmap_head df_live_scratch;
 
 
 /* Free basic block info.  */
@@ -1389,7 +1336,6 @@ df_live_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
       bitmap_clear (&bb_info->kill);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_live->block_pool, bb_info);
     }
 }
 
@@ -1402,31 +1348,39 @@ df_live_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
 {
   unsigned int bb_index;
   bitmap_iterator bi;
+  struct df_live_problem_data *problem_data;
 
-  if (!df_live->block_pool)
-    df_live->block_pool = create_alloc_pool ("df_live_block pool",
-                                          sizeof (struct df_live_bb_info), 100);
-  if (!df_live_scratch)
-    df_live_scratch = BITMAP_ALLOC (NULL);
+  if (df_live->problem_data)
+    problem_data = (struct df_live_problem_data *) df_live->problem_data;
+  else
+    {
+      problem_data = XNEW (struct df_live_problem_data);
+      df_live->problem_data = problem_data;
+
+      problem_data->out = NULL;
+      problem_data->in = NULL;
+      bitmap_obstack_initialize (&problem_data->live_bitmaps);
+      bitmap_initialize (&df_live_scratch, &problem_data->live_bitmaps);
+    }
 
   df_grow_bb_info (df_live);
 
   EXECUTE_IF_SET_IN_BITMAP (df_live->out_of_date_transfer_functions, 0, bb_index, bi)
     {
       struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index);
-      if (bb_info)
+      
+      /* When bitmaps are already initialized, just clear them.  */
+      if (bb_info->kill.obstack)
        {
          bitmap_clear (&bb_info->kill);
          bitmap_clear (&bb_info->gen);
        }
       else
        {
-         bb_info = (struct df_live_bb_info *) pool_alloc (df_live->block_pool);
-         df_live_set_bb_info (bb_index, bb_info);
-         bitmap_initialize (&bb_info->kill, &bitmap_default_obstack);
-         bitmap_initialize (&bb_info->gen, &bitmap_default_obstack);
-         bitmap_initialize (&bb_info->in, &bitmap_default_obstack);
-         bitmap_initialize (&bb_info->out, &bitmap_default_obstack);
+         bitmap_initialize (&bb_info->kill, &problem_data->live_bitmaps);
+         bitmap_initialize (&bb_info->gen, &problem_data->live_bitmaps);
+         bitmap_initialize (&bb_info->in, &problem_data->live_bitmaps);
+         bitmap_initialize (&bb_info->out, &problem_data->live_bitmaps);
        }
     }
   df_live->optional_p = (optimize <= 1);
@@ -1577,12 +1531,12 @@ df_live_transfer_function (int bb_index)
   /* We need to use a scratch set here so that the value returned from this
      function invocation properly reflects whether the sets changed in a
      significant way; i.e. not just because the lr set was anded in.  */
-  bitmap_and (df_live_scratch, gen, &bb_lr_info->out);
+  bitmap_and (&df_live_scratch, gen, &bb_lr_info->out);
   /* No register may reach a location where it is not used.  Thus
      we trim the rr result to the places where it is used.  */
   bitmap_and_into (in, &bb_lr_info->in);
 
-  return bitmap_ior_and_compl (out, df_live_scratch, in, kill);
+  return bitmap_ior_and_compl (out, &df_live_scratch, in, kill);
 }
 
 
@@ -1618,28 +1572,17 @@ df_live_finalize (bitmap all_blocks)
 static void
 df_live_free (void)
 {
+  struct df_live_problem_data *problem_data
+    = (struct df_live_problem_data *) df_live->problem_data;
   if (df_live->block_info)
     {
-      unsigned int i;
-
-      for (i = 0; i < df_live->block_info_size; i++)
-       {
-         struct df_live_bb_info *bb_info = df_live_get_bb_info (i);
-         if (bb_info)
-           {
-             bitmap_clear (&bb_info->gen);
-             bitmap_clear (&bb_info->kill);
-             bitmap_clear (&bb_info->in);
-             bitmap_clear (&bb_info->out);
-           }
-       }
-
-      free_alloc_pool (df_live->block_pool);
       df_live->block_info_size = 0;
       free (df_live->block_info);
-
-      if (df_live_scratch)
-       BITMAP_FREE (df_live_scratch);
+      df_live->block_info = NULL;
+      bitmap_clear (&df_live_scratch);
+      bitmap_obstack_release (&problem_data->live_bitmaps);
+      free (problem_data);
+      df_live->problem_data = NULL;
     }
   BITMAP_FREE (df_live->out_of_date_transfer_functions);
   free (df_live);
@@ -1662,8 +1605,11 @@ df_live_top_dump (basic_block bb, FILE *file)
   if (df_live->problem_data)
     {
       problem_data = (struct df_live_problem_data *)df_live->problem_data;
-      fprintf (file, ";;  old in  \t");
-      df_print_regset (file, &problem_data->in[bb->index]);
+      if (problem_data->in)
+       {
+         fprintf (file, ";;  old in  \t");
+         df_print_regset (file, &problem_data->in[bb->index]);
+       }
     }
   fprintf (file, ";; live  gen \t");
   df_print_regset (file, &bb_info->gen);
@@ -1688,8 +1634,11 @@ df_live_bottom_dump (basic_block bb, FILE *file)
   if (df_live->problem_data)
     {
       problem_data = (struct df_live_problem_data *)df_live->problem_data;
-      fprintf (file, ";;  old out  \t");
-      df_print_regset (file, &problem_data->out[bb->index]);
+      if (problem_data->out)
+       {
+         fprintf (file, ";;  old out  \t");
+         df_print_regset (file, &problem_data->out[bb->index]);
+       }
     }
 }
 
@@ -1703,23 +1652,19 @@ df_live_verify_solution_start (void)
   basic_block bb;
   struct df_live_problem_data *problem_data;
   if (df_live->solutions_dirty)
-    {
-      df_live->problem_data = NULL;
-      return;
-    }
+    return;
 
   /* Set it true so that the solution is recomputed.  */
   df_live->solutions_dirty = true;
 
-  problem_data = XNEW (struct df_live_problem_data);
-  df_live->problem_data = problem_data;
+  problem_data = (struct df_live_problem_data *)df_live->problem_data;
   problem_data->in = XNEWVEC (bitmap_head, last_basic_block);
   problem_data->out = XNEWVEC (bitmap_head, last_basic_block);
 
   FOR_ALL_BB (bb)
     {
-      bitmap_initialize (&problem_data->in[bb->index], &bitmap_default_obstack);
-      bitmap_initialize (&problem_data->out[bb->index], &bitmap_default_obstack);
+      bitmap_initialize (&problem_data->in[bb->index], &problem_data->live_bitmaps);
+      bitmap_initialize (&problem_data->out[bb->index], &problem_data->live_bitmaps);
       bitmap_copy (&problem_data->in[bb->index], DF_LIVE_IN (bb));
       bitmap_copy (&problem_data->out[bb->index], DF_LIVE_OUT (bb));
     }
@@ -1735,10 +1680,9 @@ df_live_verify_solution_end (void)
   struct df_live_problem_data *problem_data;
   basic_block bb;
 
-  if (df_live->problem_data == NULL)
-    return;
-
   problem_data = (struct df_live_problem_data *)df_live->problem_data;
+  if (!problem_data->out)
+    return;
 
   FOR_ALL_BB (bb)
     {
@@ -1789,6 +1733,7 @@ static struct df_problem problem_LIVE =
   df_live_verify_solution_start,/* Incremental solution verify start.  */
   df_live_verify_solution_end,  /* Incremental solution verify end.  */
   &problem_LR,                  /* Dependent problem.  */
+  sizeof (struct df_live_bb_info),/* Size of entry of block_info array.  */
   TV_DF_LIVE,                   /* Timing variable.  */
   false                         /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -1828,23 +1773,23 @@ void
 df_live_verify_transfer_functions (void)
 {
   basic_block bb;
-  bitmap saved_gen;
-  bitmap saved_kill;
-  bitmap all_blocks;
+  bitmap_head saved_gen;
+  bitmap_head saved_kill;
+  bitmap_head all_blocks;
 
   if (!df)
     return;
 
-  saved_gen = BITMAP_ALLOC (NULL);
-  saved_kill = BITMAP_ALLOC (NULL);
-  all_blocks = BITMAP_ALLOC (NULL);
+  bitmap_initialize (&saved_gen, &bitmap_default_obstack);
+  bitmap_initialize (&saved_kill, &bitmap_default_obstack);
+  bitmap_initialize (&all_blocks, &bitmap_default_obstack);
 
   df_grow_insn_info ();
 
   FOR_ALL_BB (bb)
     {
       struct df_live_bb_info *bb_info = df_live_get_bb_info (bb->index);
-      bitmap_set_bit (all_blocks, bb->index);
+      bitmap_set_bit (&all_blocks, bb->index);
 
       if (bb_info)
        {
@@ -1854,14 +1799,14 @@ df_live_verify_transfer_functions (void)
          if (!bitmap_bit_p (df_live->out_of_date_transfer_functions,
                             bb->index))
            {
-             bitmap_copy (saved_gen, &bb_info->gen);
-             bitmap_copy (saved_kill, &bb_info->kill);
+             bitmap_copy (&saved_gen, &bb_info->gen);
+             bitmap_copy (&saved_kill, &bb_info->kill);
              bitmap_clear (&bb_info->gen);
              bitmap_clear (&bb_info->kill);
 
              df_live_bb_local_compute (bb->index);
-             gcc_assert (bitmap_equal_p (saved_gen, &bb_info->gen));
-             gcc_assert (bitmap_equal_p (saved_kill, &bb_info->kill));
+             gcc_assert (bitmap_equal_p (&saved_gen, &bb_info->gen));
+             gcc_assert (bitmap_equal_p (&saved_kill, &bb_info->kill));
            }
        }
       else
@@ -1879,10 +1824,10 @@ df_live_verify_transfer_functions (void)
 
   /* Make sure there are no dirty bits in blocks that have been deleted.  */
   gcc_assert (!bitmap_intersect_compl_p (df_live->out_of_date_transfer_functions,
-                                        all_blocks));
-  BITMAP_FREE (saved_gen);
-  BITMAP_FREE (saved_kill);
-  BITMAP_FREE (all_blocks);
+                                        &all_blocks));
+  bitmap_clear (&saved_gen);
+  bitmap_clear (&saved_kill);
+  bitmap_clear (&all_blocks);
 }
 \f
 /*----------------------------------------------------------------------------
@@ -2109,9 +2054,10 @@ df_chain_create_bb (unsigned int bb_index)
   basic_block bb = BASIC_BLOCK (bb_index);
   struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
   rtx insn;
-  bitmap cpy = BITMAP_ALLOC (NULL);
+  bitmap_head cpy;
 
-  bitmap_copy (cpy, &bb_info->in);
+  bitmap_initialize (&cpy, &bitmap_default_obstack);
+  bitmap_copy (&cpy, &bb_info->in);
   bitmap_set_bit (df_chain->out_of_date_transfer_functions, bb_index);
 
   /* Since we are going forwards, process the artificial uses first
@@ -2123,12 +2069,12 @@ df_chain_create_bb (unsigned int bb_index)
 
   /* Artificials are only hard regs.  */
   if (!(df->changeable_flags & DF_NO_HARD_REGS))
-    df_chain_create_bb_process_use (cpy,
+    df_chain_create_bb_process_use (&cpy,
                                    df_get_artificial_uses (bb->index),
                                    DF_REF_AT_TOP);
 #endif
 
-  df_rd_simulate_artificial_defs_at_top (bb, cpy);
+  df_rd_simulate_artificial_defs_at_top (bb, &cpy);
 
   /* Process the regular instructions next.  */
   FOR_BB_INSNS (bb, insn)
@@ -2138,22 +2084,22 @@ df_chain_create_bb (unsigned int bb_index)
 
         /* First scan the uses and link them up with the defs that remain
           in the cpy vector.  */
-        df_chain_create_bb_process_use (cpy, DF_INSN_UID_USES (uid), 0);
+        df_chain_create_bb_process_use (&cpy, DF_INSN_UID_USES (uid), 0);
         if (df->changeable_flags & DF_EQ_NOTES)
-         df_chain_create_bb_process_use (cpy, DF_INSN_UID_EQ_USES (uid), 0);
+         df_chain_create_bb_process_use (&cpy, DF_INSN_UID_EQ_USES (uid), 0);
 
         /* Since we are going forwards, process the defs second.  */
-        df_rd_simulate_one_insn (bb, insn, cpy);
+        df_rd_simulate_one_insn (bb, insn, &cpy);
       }
 
   /* Create the chains for the artificial uses of the hard registers
      at the end of the block.  */
   if (!(df->changeable_flags & DF_NO_HARD_REGS))
-    df_chain_create_bb_process_use (cpy,
+    df_chain_create_bb_process_use (&cpy,
                                    df_get_artificial_uses (bb->index),
                                    0);
 
-  BITMAP_FREE (cpy);
+  bitmap_clear (&cpy);
 }
 
 /* Create def-use chains from reaching use bitmaps for basic blocks
@@ -2314,6 +2260,7 @@ static struct df_problem problem_CHAIN =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verify end.  */
   &problem_RD,                /* Dependent problem.  */
+  sizeof (struct df_scan_bb_info),/* Size of entry of block_info array.  */
   TV_DF_CHAIN,                /* Timing variable.  */
   false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -2368,12 +2315,12 @@ df_chain_add_problem (unsigned int chain_flags)
 struct df_byte_lr_problem_data
 {
   /* Expanded versions of bitvectors used in lr.  */
-  bitmap invalidated_by_call;
-  bitmap hardware_regs_used;
+  bitmap_head invalidated_by_call;
+  bitmap_head hardware_regs_used;
 
   /* Indexed by regno, this is true if there are subregs, extracts or
      strict_low_parts for this regno.  */
-  bitmap needs_expansion;
+  bitmap_head needs_expansion;
 
   /* The start position and len for each regno in the various bit
      vectors.  */
@@ -2406,18 +2353,6 @@ df_byte_lr_get_regno_len (unsigned int regno)
 }
 
 
-/* Set basic block info.  */
-
-static void
-df_byte_lr_set_bb_info (unsigned int index,
-                       struct df_byte_lr_bb_info *bb_info)
-{
-  gcc_assert (df_byte_lr);
-  gcc_assert (index < df_byte_lr->block_info_size);
-  df_byte_lr->block_info[index] = bb_info;
-}
-
-
 /* Free basic block info.  */
 
 static void
@@ -2431,7 +2366,6 @@ df_byte_lr_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
       bitmap_clear (&bb_info->def);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_byte_lr->block_pool, bb_info);
     }
 }
 
@@ -2452,7 +2386,7 @@ df_byte_lr_check_regs (df_ref *ref_rec)
                               | DF_REF_ZERO_EXTRACT
                               | DF_REF_STRICT_LOW_PART)
          || GET_CODE (DF_REF_REG (ref)) == SUBREG)
-       bitmap_set_bit (problem_data->needs_expansion, DF_REF_REGNO (ref));
+       bitmap_set_bit (&problem_data->needs_expansion, DF_REF_REGNO (ref));
     }
 }
 
@@ -2494,10 +2428,6 @@ df_byte_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
 
   df_byte_lr->problem_data = problem_data;
 
-  if (!df_byte_lr->block_pool)
-    df_byte_lr->block_pool = create_alloc_pool ("df_byte_lr_block pool",
-                                          sizeof (struct df_byte_lr_bb_info), 50);
-
   df_grow_bb_info (df_byte_lr);
 
   /* Create the mapping from regnos to slots. This does not change
@@ -2509,9 +2439,12 @@ df_byte_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
   bitmap_obstack_initialize (&problem_data->byte_lr_bitmaps);
   problem_data->regno_start = XNEWVEC (unsigned int, max_reg);
   problem_data->regno_len = XNEWVEC (unsigned int, max_reg);
-  problem_data->hardware_regs_used = BITMAP_ALLOC (&problem_data->byte_lr_bitmaps);
-  problem_data->invalidated_by_call = BITMAP_ALLOC (&problem_data->byte_lr_bitmaps);
-  problem_data->needs_expansion = BITMAP_ALLOC (&problem_data->byte_lr_bitmaps);
+  bitmap_initialize (&problem_data->hardware_regs_used,
+                    &problem_data->byte_lr_bitmaps);
+  bitmap_initialize (&problem_data->invalidated_by_call,
+                    &problem_data->byte_lr_bitmaps);
+  bitmap_initialize (&problem_data->needs_expansion,
+                    &problem_data->byte_lr_bitmaps);
 
   /* Discover which regno's use subregs, extracts or
      strict_low_parts.  */
@@ -2538,7 +2471,7 @@ df_byte_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
     {
       int len;
       problem_data->regno_start[regno] = index;
-      if (bitmap_bit_p (problem_data->needs_expansion, regno))
+      if (bitmap_bit_p (&problem_data->needs_expansion, regno))
        len = GET_MODE_SIZE (GET_MODE (regno_reg_rtx[regno]));
       else
        len = 1;
@@ -2547,23 +2480,23 @@ df_byte_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
       index += len;
     }
 
-  df_byte_lr_expand_bitmap (problem_data->hardware_regs_used,
-                           df->hardware_regs_used);
-  df_byte_lr_expand_bitmap (problem_data->invalidated_by_call,
+  df_byte_lr_expand_bitmap (&problem_data->hardware_regs_used,
+                           &df->hardware_regs_used);
+  df_byte_lr_expand_bitmap (&problem_data->invalidated_by_call,
                            regs_invalidated_by_call_regset);
 
   EXECUTE_IF_SET_IN_BITMAP (df_byte_lr->out_of_date_transfer_functions, 0, bb_index, bi)
     {
       struct df_byte_lr_bb_info *bb_info = df_byte_lr_get_bb_info (bb_index);
-      if (bb_info)
+      
+      /* When bitmaps are already initialized, just clear them.  */
+      if (bb_info->use.obstack)
        {
          bitmap_clear (&bb_info->def);
          bitmap_clear (&bb_info->use);
        }
       else
        {
-         bb_info = (struct df_byte_lr_bb_info *) pool_alloc (df_byte_lr->block_pool);
-         df_byte_lr_set_bb_info (bb_index, bb_info);
          bitmap_initialize (&bb_info->use, &problem_data->byte_lr_bitmaps);
          bitmap_initialize (&bb_info->def, &problem_data->byte_lr_bitmaps);
          bitmap_initialize (&bb_info->in, &problem_data->byte_lr_bitmaps);
@@ -2771,7 +2704,7 @@ df_byte_lr_confluence_0 (basic_block bb)
     = (struct df_byte_lr_problem_data *)df_byte_lr->problem_data;
   bitmap op1 = &df_byte_lr_get_bb_info (bb->index)->out;
   if (bb != EXIT_BLOCK_PTR)
-    bitmap_copy (op1, problem_data->hardware_regs_used);
+    bitmap_copy (op1, &problem_data->hardware_regs_used);
 }
 
 
@@ -2789,11 +2722,11 @@ df_byte_lr_confluence_n (edge e)
   /* ??? Abnormal call edges ignored for the moment, as this gets
      confused by sibling call edges, which crashes reg-stack.  */
   if (e->flags & EDGE_EH)
-    bitmap_ior_and_compl_into (op1, op2, problem_data->invalidated_by_call);
+    bitmap_ior_and_compl_into (op1, op2, &problem_data->invalidated_by_call);
   else
     bitmap_ior_into (op1, op2);
 
-  bitmap_ior_into (op1, problem_data->hardware_regs_used);
+  bitmap_ior_into (op1, &problem_data->hardware_regs_used);
 }
 
 
@@ -2823,9 +2756,9 @@ df_byte_lr_free (void)
 
   if (df_byte_lr->block_info)
     {
-      free_alloc_pool (df_byte_lr->block_pool);
       df_byte_lr->block_info_size = 0;
       free (df_byte_lr->block_info);
+      df_byte_lr->block_info = NULL;
     }
 
   BITMAP_FREE (df_byte_lr->out_of_date_transfer_functions);
@@ -2892,7 +2825,8 @@ static struct df_problem problem_BYTE_LR =
   df_byte_lr_bottom_dump,          /* Debugging end block.  */
   NULL,                            /* Incremental solution verify start.  */
   NULL,                            /* Incremental solution verify end.  */
-  NULL,                            /* Dependent problem.  */
+  NULL,                       /* Dependent problem.  */
+  sizeof (struct df_byte_lr_bb_info),/* Size of entry of block_info array.  */
   TV_DF_BYTE_LR,                   /* Timing variable.  */
   false                            /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -3808,9 +3742,11 @@ df_note_compute (bitmap all_blocks)
 {
   unsigned int bb_index;
   bitmap_iterator bi;
-  bitmap live = BITMAP_ALLOC (&df_bitmap_obstack);
-  bitmap do_not_gen = BITMAP_ALLOC (&df_bitmap_obstack);
-  bitmap artificial_uses = BITMAP_ALLOC (&df_bitmap_obstack);
+  bitmap_head live, do_not_gen, artificial_uses;
+
+  bitmap_initialize (&live, &df_bitmap_obstack);
+  bitmap_initialize (&do_not_gen, &df_bitmap_obstack);
+  bitmap_initialize (&artificial_uses, &df_bitmap_obstack);
 
 #ifdef REG_DEAD_DEBUGGING
   if (dump_file)
@@ -3819,12 +3755,12 @@ df_note_compute (bitmap all_blocks)
 
   EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi)
   {
-    df_note_bb_compute (bb_index, live, do_not_gen, artificial_uses);
+    df_note_bb_compute (bb_index, &live, &do_not_gen, &artificial_uses);
   }
 
-  BITMAP_FREE (live);
-  BITMAP_FREE (do_not_gen);
-  BITMAP_FREE (artificial_uses);
+  bitmap_clear (&live);
+  bitmap_clear (&do_not_gen);
+  bitmap_clear (&artificial_uses);
 }
 
 
@@ -3861,6 +3797,7 @@ static struct df_problem problem_NOTE =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verify end.  */
   &problem_LR,                /* Dependent problem.  */
+  sizeof (struct df_scan_bb_info),/* Size of entry of block_info array.  */
   TV_DF_NOTE,                 /* Timing variable.  */
   false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -3978,9 +3915,9 @@ df_simulate_fixup_sets (basic_block bb, bitmap live)
   /* These regs are considered always live so if they end up dying
      because of some def, we need to bring the back again.  */
   if (bb_has_eh_pred (bb))
-    bitmap_ior_into (live, df->eh_block_artificial_uses);
+    bitmap_ior_into (live, &df->eh_block_artificial_uses);
   else
-    bitmap_ior_into (live, df->regular_block_artificial_uses);
+    bitmap_ior_into (live, &df->regular_block_artificial_uses);
 }
 
 
@@ -4189,20 +4126,16 @@ df_simulate_one_insn_forwards (basic_block bb, rtx insn, bitmap live)
     propagating the information to BB3's successors.
    ---------------------------------------------------------------------------*/
 
+/* Private data used to verify the solution for this problem.  */
+struct df_md_problem_data
+{
+  /* An obstack for the bitmaps we need for this problem.  */
+  bitmap_obstack md_bitmaps;
+};
+
 /* Scratch var used by transfer functions.  This is used to do md analysis
    only for live registers.  */
-static bitmap df_md_scratch;
-
-/* Set basic block info.  */
-
-static void
-df_md_set_bb_info (unsigned int index,
-                   struct df_md_bb_info *bb_info)
-{
-  gcc_assert (df_md);
-  gcc_assert (index < df_md->block_info_size);
-  df_md->block_info[index] = bb_info;
-}
+static bitmap_head df_md_scratch;
 
 
 static void
@@ -4217,7 +4150,6 @@ df_md_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
       bitmap_clear (&bb_info->init);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_md->block_pool, bb_info);
     }
 }
 
@@ -4230,18 +4162,24 @@ df_md_alloc (bitmap all_blocks)
 {
   unsigned int bb_index;
   bitmap_iterator bi;
-
-  if (!df_md->block_pool)
-    df_md->block_pool = create_alloc_pool ("df_md_block pool",
-                                           sizeof (struct df_md_bb_info), 50);
+  struct df_md_problem_data *problem_data;
 
   df_grow_bb_info (df_md);
-  df_md_scratch = BITMAP_ALLOC (NULL);
+  if (df_md->problem_data)
+    problem_data = (struct df_md_problem_data *) df_md->problem_data;
+  else
+    {
+      problem_data = XNEW (struct df_md_problem_data);
+      df_md->problem_data = problem_data;
+      bitmap_obstack_initialize (&problem_data->md_bitmaps);
+    }
+  bitmap_initialize (&df_md_scratch, &problem_data->md_bitmaps);
 
   EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi)
     {
       struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index);
-      if (bb_info)
+      /* When bitmaps are already initialized, just clear them.  */
+      if (bb_info->init.obstack)
         {
           bitmap_clear (&bb_info->init);
           bitmap_clear (&bb_info->gen);
@@ -4251,13 +4189,11 @@ df_md_alloc (bitmap all_blocks)
         }
       else
         {
-          bb_info = (struct df_md_bb_info *) pool_alloc (df_md->block_pool);
-          df_md_set_bb_info (bb_index, bb_info);
-         bitmap_initialize (&bb_info->init, &bitmap_default_obstack);
-         bitmap_initialize (&bb_info->gen, &bitmap_default_obstack);
-         bitmap_initialize (&bb_info->kill, &bitmap_default_obstack);
-         bitmap_initialize (&bb_info->in, &bitmap_default_obstack);
-         bitmap_initialize (&bb_info->out, &bitmap_default_obstack);
+         bitmap_initialize (&bb_info->init, &problem_data->md_bitmaps);
+         bitmap_initialize (&bb_info->gen, &problem_data->md_bitmaps);
+         bitmap_initialize (&bb_info->kill, &problem_data->md_bitmaps);
+         bitmap_initialize (&bb_info->in, &problem_data->md_bitmaps);
+         bitmap_initialize (&bb_info->out, &problem_data->md_bitmaps);
         }
     }
 
@@ -4320,7 +4256,7 @@ df_md_bb_local_compute_process_def (struct df_md_bb_info *bb_info,
                                     int top_flag)
 {
   df_ref def;
-  bitmap_clear (seen_in_insn);
+  bitmap_clear (&seen_in_insn);
 
   while ((def = *def_rec++) != NULL)
     {
@@ -4329,7 +4265,7 @@ df_md_bb_local_compute_process_def (struct df_md_bb_info *bb_info,
            || (dregno >= FIRST_PSEUDO_REGISTER))
          && top_flag == (DF_REF_FLAGS (def) & DF_REF_AT_TOP))
        {
-          if (!bitmap_bit_p (seen_in_insn, dregno))
+          if (!bitmap_bit_p (&seen_in_insn, dregno))
            {
              if (DF_REF_FLAGS (def)
                  & (DF_REF_PARTIAL | DF_REF_CONDITIONAL | DF_REF_MAY_CLOBBER))
@@ -4341,7 +4277,7 @@ df_md_bb_local_compute_process_def (struct df_md_bb_info *bb_info,
                {
                  /* When we find a clobber and a regular def,
                     make sure the regular def wins.  */
-                 bitmap_set_bit (seen_in_insn, dregno);
+                 bitmap_set_bit (&seen_in_insn, dregno);
                  bitmap_set_bit (&bb_info->kill, dregno);
                  bitmap_clear_bit (&bb_info->gen, dregno);
                }
@@ -4389,20 +4325,20 @@ df_md_local_compute (bitmap all_blocks)
   unsigned int bb_index, df_bb_index;
   bitmap_iterator bi1, bi2;
   basic_block bb;
-  bitmap *frontiers;
+  bitmap_head *frontiers;
 
-  seen_in_insn = BITMAP_ALLOC (NULL);
+  bitmap_initialize (&seen_in_insn, &bitmap_default_obstack);
 
   EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi1)
     {
       df_md_bb_local_compute (bb_index);
     }
 
-  BITMAP_FREE (seen_in_insn);
+  bitmap_clear (&seen_in_insn);
 
-  frontiers = XNEWVEC (bitmap, last_basic_block);
+  frontiers = XNEWVEC (bitmap_head, last_basic_block);
   FOR_ALL_BB (bb)
-    frontiers[bb->index] = BITMAP_ALLOC (NULL);
+    bitmap_initialize (&frontiers[bb->index], &bitmap_default_obstack);
 
   compute_dominance_frontiers (frontiers);
 
@@ -4410,7 +4346,7 @@ df_md_local_compute (bitmap all_blocks)
   EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi1)
     {
       bitmap kill = &df_md_get_bb_info (bb_index)->kill;
-      EXECUTE_IF_SET_IN_BITMAP (frontiers[bb_index], 0, df_bb_index, bi2)
+      EXECUTE_IF_SET_IN_BITMAP (&frontiers[bb_index], 0, df_bb_index, bi2)
        {
          basic_block bb = BASIC_BLOCK (df_bb_index);
          if (bitmap_bit_p (all_blocks, df_bb_index))
@@ -4420,7 +4356,7 @@ df_md_local_compute (bitmap all_blocks)
     }
 
   FOR_ALL_BB (bb)
-    BITMAP_FREE (frontiers[bb->index]);
+    bitmap_clear (&frontiers[bb->index]);
   free (frontiers);
 }
 
@@ -4455,13 +4391,13 @@ df_md_transfer_function (int bb_index)
   /* We need to use a scratch set here so that the value returned from this
      function invocation properly reflects whether the sets changed in a
      significant way; i.e. not just because the live set was anded in.  */
-  bitmap_and (df_md_scratch, gen, df_get_live_out (bb));
+  bitmap_and (&df_md_scratch, gen, df_get_live_out (bb));
 
   /* Multiple definitions of a register are not relevant if it is not
      live.  Thus we trim the result to the places where it is live.  */
   bitmap_and_into (in, df_get_live_in (bb));
 
-  return bitmap_ior_and_compl (out, df_md_scratch, in, kill);
+  return bitmap_ior_and_compl (out, &df_md_scratch, in, kill);
 }
 
 /* Initialize the solution bit vectors for problem.  */
@@ -4510,25 +4446,16 @@ df_md_confluence_n (edge e)
 static void
 df_md_free (void)
 {
-  unsigned int i;
-  for (i = 0; i < df_md->block_info_size; i++)
-    {
-      struct df_md_bb_info *bb_info = df_md_get_bb_info (i);
-      if (bb_info)
-       {
-         bitmap_clear (&bb_info->kill);
-         bitmap_clear (&bb_info->gen);
-         bitmap_clear (&bb_info->init);
-         bitmap_clear (&bb_info->in);
-         bitmap_clear (&bb_info->out);
-       }
-    }
+  struct df_md_problem_data *problem_data
+    = (struct df_md_problem_data *) df_md->problem_data;
 
-  BITMAP_FREE (df_md_scratch);
-  free_alloc_pool (df_md->block_pool);
+  bitmap_obstack_release (&problem_data->md_bitmaps);
+  free (problem_data);
+  df_md->problem_data = NULL;
 
   df_md->block_info_size = 0;
   free (df_md->block_info);
+  df_md->block_info = NULL;
   free (df_md);
 }
 
@@ -4587,6 +4514,7 @@ static struct df_problem problem_MD =
   NULL,                              /* Incremental solution verify start.  */
   NULL,                              /* Incremental solution verify end.  */
   NULL,                       /* Dependent problem.  */
+  sizeof (struct df_md_bb_info),/* Size of entry of block_info array.  */
   TV_DF_MD,                   /* Timing variable.  */
   false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };