Patchwork Flatten block_info arrays

login
register
mail settings
Submitter Jan Hubicka
Date June 12, 2010, 12:48 p.m.
Message ID <20100612124805.GA6499@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/55393/
State New
Headers show

Comments

Jan Hubicka - June 12, 2010, 12:48 p.m.
> On 06/11/2010 05:45 PM, Jan Hubicka wrote:
>> +	  int size = last_basic_block * dflow->problem->block_info_elt_size;
>> +	  problem_temps = XNEWVAR (void *, size);
>
> Not a void* anymore.

Actually I need char to avoid multiplying size by 8 .
>
> Also, since you're doing it please move df_grow_bb_info to df-core.c
>
>> +      /* When bitmaps are already initialized, just clear them.  */
>> +      if (bb_info->kill.obstack)
>
> This is fine by me.

OK, I guess it is not that bad.  This is patch I committed after re-testing
on x86_64-linux (with df checking).

Honza


	* df-core.c (df_clear_bb_info): New function.
	(df_set_blocks): bb_info is always allocated.
	(df_get_bb_info): Use block_info_elt_size.
	(df_set_bb_info): Likewise.
	(df_compact_blocks): Update for new block_info.
	(grow_bb_info): New function.
	* df-problems.c (df_grow_bb_info): Move to df-core.c
	(df_rd_set_bb_info): Remove.
	(df_rd_free_bb_info): Do not free block pool.
	(df_rd_alloc): Do not create pool, use check for
	obstack presence instead of NULL pointer for new blocks.
	(df_rd_free): DO not free alloc pool; clear block_info.
	(problem_RD): Add size of block info structure.
	(df_lr_set_bb_info): Remove.
	(df_lr_free_bb_info): Do not free block pool.
	(df_lr_alloc): Do not create pool, use check for
	obstack presence instead of NULL pointer for new blocks.
	(df_lr_free): DO not free alloc pool; clear block_info.
	(problem_LR): Add size of block info structure.
	(df_live_set_bb_info): Remove.
	(df_live_free_bb_info): Do not free block pool.
	(df_live_alloc): Do not create pool, use check for
	obstack presence instead of NULL pointer for new blocks.
	(df_live_free): DO not free alloc pool; clear block_info.
	(problem_LIVE): Add size of block info structure.
	(problem_CHAIN): Add size of block info structure.
	(df_byte_lr_set_bb_info): Remove.
	(df_byte_lr_free_bb_info): Do not free block pool.
	(df_byte_lr_alloc): Do not create pool, use check for
	obstack presence instead of NULL pointer for new blocks.
	(df_byte_lr_free): DO not free alloc pool; clear block_info.
	(problem_BYTE_LR): Add size of block info structure.
	(problem_NOTE): Add size of block info structure.
	(df_byte_MD_set_bb_info): Remove.
	(df_byte_MD_free_bb_info): Do not free block pool.
	(df_byte_MD_alloc): Do not create pool, use check for
	obstack presence instead of NULL pointer for new blocks.
	(df_byte_MD_free): DO not free alloc pool; clear block_info.
	(problem_BD): Add size of block info structure.
	* df-scan.c (df_scan_free_internal): Free block pool.
	(df_scan_set_bb_info): Remove.
	(df_scan_free_bb_info): Check for artificial_defs instead
	of bb_info being non-NULL.
	(df_scan_alloc): DO not create df_scan_block pool.
	(problem_SCAN): Set size of block info.
	(df_bb_refs_record): Do not allocate bb_info.
	* df.h (df_problem): Add block_info_elt_size.
	(struct dataflow): Change block_info to void *.
	(df_scan_get_bb_info, df_rd_get_bb_info, df_lr_get_bb_info,
	df_md_get_bb_info, df_live_get_bb_info, df_byte_lr_get_bb_info): Return
	in-line structures.

Patch

Index: df-scan.c
===================================================================
--- df-scan.c	(revision 160658)
+++ df-scan.c	(working copy)
@@ -266,7 +266,6 @@  df_scan_free_internal (void)
   bitmap_clear (&df->insns_to_rescan);
   bitmap_clear (&df->insns_to_notes_rescan);
 
-  free_alloc_pool (df_scan->block_pool);
   free_alloc_pool (problem_data->ref_base_pool);
   free_alloc_pool (problem_data->ref_artificial_pool);
   free_alloc_pool (problem_data->ref_regular_pool);
@@ -280,17 +279,6 @@  df_scan_free_internal (void)
 }
 
 
-/* Set basic block info.  */
-
-static void
-df_scan_set_bb_info (unsigned int index,
-		     struct df_scan_bb_info *bb_info)
-{
-  df_grow_bb_info (df_scan);
-  df_scan->block_info[index] = (void *) bb_info;
-}
-
-
 /* Free basic block info.  */
 
 static void
@@ -298,7 +286,9 @@  df_scan_free_bb_info (basic_block bb, vo
 {
   struct df_scan_bb_info *bb_info = (struct df_scan_bb_info *) vbb_info;
   unsigned int bb_index = bb->index;
-  if (bb_info)
+
+  /* See if bb_info is initialized.  */
+  if (bb_info->artificial_defs)
     {
       rtx insn;
       FOR_BB_INSNS (bb, insn)
@@ -312,13 +302,15 @@  df_scan_free_bb_info (basic_block bb, vo
 	bb_info = df_scan_get_bb_info (bb_index);
 
       /* Get rid of any artificial uses or defs.  */
-      df_ref_chain_delete_du_chain (bb_info->artificial_defs);
-      df_ref_chain_delete_du_chain (bb_info->artificial_uses);
-      df_ref_chain_delete (bb_info->artificial_defs);
-      df_ref_chain_delete (bb_info->artificial_uses);
-      bb_info->artificial_defs = NULL;
-      bb_info->artificial_uses = NULL;
-      pool_free (df_scan->block_pool, bb_info);
+      if (bb_info->artificial_defs)
+	{
+	  df_ref_chain_delete_du_chain (bb_info->artificial_defs);
+	  df_ref_chain_delete_du_chain (bb_info->artificial_uses);
+	  df_ref_chain_delete (bb_info->artificial_defs);
+	  df_ref_chain_delete (bb_info->artificial_uses);
+	  bb_info->artificial_defs = NULL;
+	  bb_info->artificial_uses = NULL;
+	}
     }
 }
 
@@ -339,11 +331,6 @@  df_scan_alloc (bitmap all_blocks ATTRIBU
   if (df_scan->problem_data)
     df_scan_free_internal ();
 
-  df_scan->block_pool
-    = create_alloc_pool ("df_scan_block pool",
-			 sizeof (struct df_scan_bb_info),
-			 block_size);
-
   problem_data = XNEW (struct df_scan_problem_data);
   df_scan->problem_data = problem_data;
   df_scan->computed = true;
@@ -383,11 +370,6 @@  df_scan_alloc (bitmap all_blocks ATTRIBU
     {
       unsigned int bb_index = bb->index;
       struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index);
-      if (!bb_info)
-	{
-	  bb_info = (struct df_scan_bb_info *) pool_alloc (df_scan->block_pool);
-	  df_scan_set_bb_info (bb_index, bb_info);
-	}
       bb_info->artificial_defs = NULL;
       bb_info->artificial_uses = NULL;
     }
@@ -539,6 +521,7 @@  static struct df_problem problem_SCAN =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verify end.  */
   NULL,                       /* Dependent problem.  */
+  sizeof (struct df_scan_bb_info),/* Size of entry of block_info array.  */
   TV_DF_SCAN,                 /* Timing variable.  */
   false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -3698,23 +3681,12 @@  df_bb_refs_record (int bb_index, bool sc
   basic_block bb = BASIC_BLOCK (bb_index);
   rtx insn;
   int luid = 0;
-  struct df_scan_bb_info *bb_info;
   struct df_collection_rec collection_rec;
 
   if (!df)
     return;
 
-  bb_info = df_scan_get_bb_info (bb_index);
-
-  /* Need to make sure that there is a record in the basic block info. */
-  if (!bb_info)
-    {
-      bb_info = (struct df_scan_bb_info *) pool_alloc (df_scan->block_pool);
-      df_scan_set_bb_info (bb_index, bb_info);
-      bb_info->artificial_defs = NULL;
-      bb_info->artificial_uses = NULL;
-    }
-
+  df_grow_bb_info (df_scan);
   collection_rec.def_vec = VEC_alloc (df_ref, stack, 128);
   collection_rec.use_vec = VEC_alloc (df_ref, stack, 32);
   collection_rec.eq_use_vec = VEC_alloc (df_ref, stack, 32);
Index: df-core.c
===================================================================
--- df-core.c	(revision 160658)
+++ df-core.c	(working copy)
@@ -399,6 +399,7 @@  are write-only operations.
 
 static void *df_get_bb_info (struct dataflow *, unsigned int);
 static void df_set_bb_info (struct dataflow *, unsigned int, void *);
+static void df_clear_bb_info (struct dataflow *, unsigned int);
 #ifdef DF_DEBUG_CFG
 static void df_set_clean_cfg (void);
 #endif
@@ -523,11 +524,8 @@  df_set_blocks (bitmap blocks)
 		      if (bb)
 			{
 			  void *bb_info = df_get_bb_info (dflow, bb_index);
-			  if (bb_info)
-			    {
-			      dflow->problem->free_bb_fun (bb, bb_info);
-			      df_set_bb_info (dflow, bb_index, NULL);
-			    }
+			  dflow->problem->free_bb_fun (bb, bb_info);
+			  df_clear_bb_info (dflow, bb_index);
 			}
 		    }
 		}
@@ -1294,7 +1292,8 @@  df_get_bb_info (struct dataflow *dflow, 
     return NULL;
   if (index >= dflow->block_info_size)
     return NULL;
-  return (struct df_scan_bb_info *) dflow->block_info[index];
+  return (void *)((char *)dflow->block_info
+		  + index * dflow->problem->block_info_elt_size);
 }
 
 
@@ -1305,7 +1304,22 @@  df_set_bb_info (struct dataflow *dflow, 
 		void *bb_info)
 {
   gcc_assert (dflow->block_info);
-  dflow->block_info[index] = bb_info;
+  memcpy ((char *)dflow->block_info
+	  + index * dflow->problem->block_info_elt_size,
+	  bb_info, dflow->problem->block_info_elt_size);
+}
+
+
+/* Clear basic block info.  */
+
+static void
+df_clear_bb_info (struct dataflow *dflow, unsigned int index)
+{
+  gcc_assert (dflow->block_info);
+  gcc_assert (dflow->block_info_size > index);
+  memset ((char *)dflow->block_info
+	  + index * dflow->problem->block_info_elt_size,
+	  0, dflow->problem->block_info_elt_size);
 }
 
 
@@ -1378,6 +1392,29 @@  df_set_bb_dirty_nonlr (basic_block bb)
     }
 }
 
+/* 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
+         = (void *)XRESIZEVEC (char, (char *)dflow->block_info,
+			       new_size
+			       * dflow->problem->block_info_elt_size);
+      memset ((char *)dflow->block_info
+	      + dflow->block_info_size
+	      * dflow->problem->block_info_elt_size,
+	      0,
+	      (new_size - dflow->block_info_size)
+	      * dflow->problem->block_info_elt_size);
+      dflow->block_info_size = new_size;
+    }
+}
+
 
 /* Clear the dirty bits.  This is called from places that delete
    blocks.  */
@@ -1392,6 +1429,7 @@  df_clear_bb_dirty (basic_block bb)
 	bitmap_clear_bit (dflow->out_of_date_transfer_functions, bb->index);
     }
 }
+
 /* Called from the rtl_compact_blocks to reorganize the problems basic
    block info.  */
 
@@ -1400,10 +1438,8 @@  df_compact_blocks (void)
 {
   int i, p;
   basic_block bb;
-  void **problem_temps;
-  int size = last_basic_block * sizeof (void *);
+  void *problem_temps;
   bitmap_head tmp;
-  problem_temps = XNEWVAR (void *, size);
 
   bitmap_initialize (&tmp, &df_bitmap_obstack);
   for (p = 0; p < df->num_problems_defined; p++)
@@ -1433,6 +1469,8 @@  df_compact_blocks (void)
       /* Now shuffle the block info for the problem.  */
       if (dflow->problem->free_bb_fun)
 	{
+	  int size = last_basic_block * dflow->problem->block_info_elt_size;
+	  problem_temps = XNEWVAR (char, size);
 	  df_grow_bb_info (dflow);
 	  memcpy (problem_temps, dflow->block_info, size);
 
@@ -1442,22 +1480,15 @@  df_compact_blocks (void)
 	  i = NUM_FIXED_BLOCKS;
 	  FOR_EACH_BB (bb)
 	    {
-	      df_set_bb_info (dflow, i, problem_temps[bb->index]);
-	      problem_temps[bb->index] = NULL;
+	      df_set_bb_info (dflow, i,
+			      (char *)problem_temps
+			      + bb->index * dflow->problem->block_info_elt_size);
 	      i++;
 	    }
-	  memset (dflow->block_info + i, 0,
-		  (last_basic_block - i) *sizeof (void *));
-
-	  /* Free any block infos that were not copied (and NULLed).
-	     These are from orphaned blocks.  */
-	  for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
-	    {
-	      basic_block bb = BASIC_BLOCK (i);
-	      if (problem_temps[i] && bb)
-		dflow->problem->free_bb_fun
-		  (bb, problem_temps[i]);
-	    }
+	  memset ((char *)dflow->block_info
+		  + i * dflow->problem->block_info_elt_size, 0,
+		  (last_basic_block - i)
+		  * dflow->problem->block_info_elt_size);
 	}
     }
 
@@ -1482,8 +1513,6 @@  df_compact_blocks (void)
 
   bitmap_clear (&tmp);
 
-  free (problem_temps);
-
   i = NUM_FIXED_BLOCKS;
   FOR_EACH_BB (bb)
     {
@@ -1525,7 +1554,6 @@  df_bb_replace (int old_index, basic_bloc
       if (dflow->block_info)
 	{
 	  df_grow_bb_info (dflow);
-	  gcc_assert (df_get_bb_info (dflow, old_index) == NULL);
 	  df_set_bb_info (dflow, old_index,
 			  df_get_bb_info (dflow, new_block_index));
 	}
@@ -1561,7 +1589,7 @@  df_bb_delete (int bb_index)
 	  if (bb_info)
 	    {
 	      dflow->problem->free_bb_fun (bb, bb_info);
-	      df_set_bb_info (dflow, bb_index, NULL);
+	      df_clear_bb_info (dflow, bb_index);
 	    }
 	}
     }
Index: df.h
===================================================================
--- df.h	(revision 160658)
+++ df.h	(working copy)
@@ -277,6 +277,7 @@  struct df_problem {
   df_verify_solution_start verify_start_fun;
   df_verify_solution_end verify_end_fun;
   struct df_problem *dependent_problem;
+  unsigned int block_info_elt_size;
 
   /* The timevar id associated with this pass.  */
   timevar_id_t tv_id;
@@ -294,7 +295,7 @@  struct dataflow
 
   /* Array indexed by bb->index, that contains basic block problem and
      solution specific information.  */
-  void **block_info;
+  void *block_info;
   unsigned int block_info_size;
 
   /* The pool to allocate the block_info from. */
@@ -1037,7 +1038,7 @@  static inline struct df_scan_bb_info *
 df_scan_get_bb_info (unsigned int index)
 {
   if (index < df_scan->block_info_size)
-    return (struct df_scan_bb_info *) df_scan->block_info[index];
+    return &((struct df_scan_bb_info *) df_scan->block_info)[index];
   else
     return NULL;
 }
@@ -1046,7 +1047,7 @@  static inline struct df_rd_bb_info *
 df_rd_get_bb_info (unsigned int index)
 {
   if (index < df_rd->block_info_size)
-    return (struct df_rd_bb_info *) df_rd->block_info[index];
+    return &((struct df_rd_bb_info *) df_rd->block_info)[index];
   else
     return NULL;
 }
@@ -1055,7 +1056,7 @@  static inline struct df_lr_bb_info *
 df_lr_get_bb_info (unsigned int index)
 {
   if (index < df_lr->block_info_size)
-    return (struct df_lr_bb_info *) df_lr->block_info[index];
+    return &((struct df_lr_bb_info *) df_lr->block_info)[index];
   else
     return NULL;
 }
@@ -1064,7 +1065,7 @@  static inline struct df_md_bb_info *
 df_md_get_bb_info (unsigned int index)
 {
   if (index < df_md->block_info_size)
-    return (struct df_md_bb_info *) df_md->block_info[index];
+    return &((struct df_md_bb_info *) df_md->block_info)[index];
   else
     return NULL;
 }
@@ -1073,7 +1074,7 @@  static inline struct df_live_bb_info *
 df_live_get_bb_info (unsigned int index)
 {
   if (index < df_live->block_info_size)
-    return (struct df_live_bb_info *) df_live->block_info[index];
+    return &((struct df_live_bb_info *) df_live->block_info)[index];
   else
     return NULL;
 }
@@ -1082,7 +1083,7 @@  static inline struct df_byte_lr_bb_info 
 df_byte_lr_get_bb_info (unsigned int index)
 {
   if (index < df_byte_lr->block_info_size)
-    return (struct df_byte_lr_bb_info *) df_byte_lr->block_info[index];
+    return &((struct df_byte_lr_bb_info *) df_byte_lr->block_info)[index];
   else
     return NULL;
 }
Index: df-problems.c
===================================================================
--- df-problems.c	(revision 160658)
+++ df-problems.c	(working copy)
@@ -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
@@ -202,17 +186,6 @@  struct df_rd_problem_data
   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 ATTRI
       bitmap_clear (&bb_info->gen);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_rd->block_pool, bb_info);
     }
 }
 
@@ -243,10 +215,6 @@  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;
@@ -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);
@@ -607,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);
@@ -703,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.  */
 };
@@ -738,19 +707,6 @@  struct df_lr_problem_data
   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
@@ -764,7 +720,6 @@  df_lr_free_bb_info (basic_block bb ATTRI
       bitmap_clear (&bb_info->def);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_lr->block_pool, bb_info);
     }
 }
 
@@ -779,10 +734,6 @@  df_lr_alloc (bitmap all_blocks ATTRIBUTE
   bitmap_iterator bi;
   struct df_lr_problem_data *problem_data;
 
-  if (!df_lr->block_pool)
-    df_lr->block_pool = create_alloc_pool ("df_lr_block pool",
-					   sizeof (struct df_lr_bb_info), 50);
-
   df_grow_bb_info (df_lr);
   if (df_lr->problem_data)
     problem_data = (struct df_lr_problem_data *) df_lr->problem_data;
@@ -799,15 +750,15 @@  df_lr_alloc (bitmap all_blocks ATTRIBUTE
   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, &problem_data->lr_bitmaps);
 	  bitmap_initialize (&bb_info->def, &problem_data->lr_bitmaps);
 	  bitmap_initialize (&bb_info->in, &problem_data->lr_bitmaps);
@@ -1091,10 +1042,10 @@  df_lr_free (void)
     = (struct df_lr_problem_data *) df_lr->problem_data;
   if (df_lr->block_info)
     {
-      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;
@@ -1253,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.  */
 };
@@ -1370,17 +1322,6 @@  struct df_live_problem_data
    combined lr and live analysis.  */
 static bitmap_head 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;
-}
-
 
 /* Free basic block info.  */
 
@@ -1395,7 +1336,6 @@  df_live_free_bb_info (basic_block bb ATT
       bitmap_clear (&bb_info->kill);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_live->block_pool, bb_info);
     }
 }
 
@@ -1410,9 +1350,6 @@  df_live_alloc (bitmap all_blocks ATTRIBU
   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->problem_data)
     problem_data = (struct df_live_problem_data *) df_live->problem_data;
   else
@@ -1431,15 +1368,15 @@  df_live_alloc (bitmap all_blocks ATTRIBU
   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, &problem_data->live_bitmaps);
 	  bitmap_initialize (&bb_info->gen, &problem_data->live_bitmaps);
 	  bitmap_initialize (&bb_info->in, &problem_data->live_bitmaps);
@@ -1639,9 +1576,9 @@  df_live_free (void)
     = (struct df_live_problem_data *) df_live->problem_data;
   if (df_live->block_info)
     {
-      free_alloc_pool (df_live->block_pool);
       df_live->block_info_size = 0;
       free (df_live->block_info);
+      df_live->block_info = NULL;
       bitmap_clear (&df_live_scratch);
       bitmap_obstack_release (&problem_data->live_bitmaps);
       free (problem_data);
@@ -1796,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.  */
 };
@@ -2322,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.  */
 };
@@ -2414,18 +2353,6 @@  df_byte_lr_get_regno_len (unsigned int r
 }
 
 
-/* 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
@@ -2439,7 +2366,6 @@  df_byte_lr_free_bb_info (basic_block bb 
       bitmap_clear (&bb_info->def);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_byte_lr->block_pool, bb_info);
     }
 }
 
@@ -2502,10 +2428,6 @@  df_byte_lr_alloc (bitmap all_blocks ATTR
 
   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
@@ -2566,15 +2488,15 @@  df_byte_lr_alloc (bitmap all_blocks ATTR
   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);
@@ -2834,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);
@@ -2903,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.  */
 };
@@ -3874,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.  */
 };
@@ -4213,17 +4137,6 @@  struct df_md_problem_data
    only for live registers.  */
 static bitmap_head 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 void
 df_md_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
@@ -4237,7 +4150,6 @@  df_md_free_bb_info (basic_block bb ATTRI
       bitmap_clear (&bb_info->init);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_md->block_pool, bb_info);
     }
 }
 
@@ -4252,10 +4164,6 @@  df_md_alloc (bitmap all_blocks)
   bitmap_iterator bi;
   struct df_md_problem_data *problem_data;
 
-  if (!df_md->block_pool)
-    df_md->block_pool = create_alloc_pool ("df_md_block pool",
-                                           sizeof (struct df_md_bb_info), 50);
-
   df_grow_bb_info (df_md);
   if (df_md->problem_data)
     problem_data = (struct df_md_problem_data *) df_md->problem_data;
@@ -4270,7 +4178,8 @@  df_md_alloc (bitmap all_blocks)
   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);
@@ -4280,8 +4189,6 @@  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, &problem_data->md_bitmaps);
 	  bitmap_initialize (&bb_info->gen, &problem_data->md_bitmaps);
 	  bitmap_initialize (&bb_info->kill, &problem_data->md_bitmaps);
@@ -4543,12 +4450,12 @@  df_md_free (void)
     = (struct df_md_problem_data *) df_md->problem_data;
 
   bitmap_obstack_release (&problem_data->md_bitmaps);
-  free_alloc_pool (df_md->block_pool);
   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);
 }
 
@@ -4607,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.  */
 };