* domwalk.c (walk_dominator_tree, init_walk_dominator_tree,
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 May 2005 22:43:05 +0000 (22:43 +0000)
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 May 2005 22:43:05 +0000 (22:43 +0000)
fini_walk_dominator_tree): Use VEC instead of VARRAY.
* domwalk.h (dom_walk_data): Change the type of
block_data_stack and free_block_data to VEC(void_p,heap)*.
* tree-ssa-dse.c (dse_initialize_block_local_data,
dse_optimize_stmt, dse_record_phis, dse_finalize_block): Use
VEC instead of VARRAY.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100281 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/domwalk.c
gcc/domwalk.h
gcc/tree-ssa-dse.c

index f9753e9..b46c46d 100644 (file)
        * tree.h: Move the prototype of threaded_through_blocks to
        tree-flow.h.
 
+       * domwalk.c (walk_dominator_tree, init_walk_dominator_tree,
+       fini_walk_dominator_tree): Use VEC instead of VARRAY.
+       * domwalk.h (dom_walk_data): Change the type of
+       block_data_stack and free_block_data to VEC(void_p,heap)*.
+       * tree-ssa-dse.c (dse_initialize_block_local_data,
+       dse_optimize_stmt, dse_record_phis, dse_finalize_block): Use
+       VEC instead of VARRAY.
+
 2005-05-27  Jan Hubicka  <jh@suse.cz>
 
        * cgraph.c: Include tree-gimple.h
index 2713e04..389dac2 100644 (file)
@@ -161,10 +161,9 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
 
       /* First get some local data, reusing any local data pointer we may
         have saved.  */
-      if (VARRAY_ACTIVE_SIZE (walk_data->free_block_data) > 0)
+      if (VEC_length (void_p, walk_data->free_block_data) > 0)
        {
-         bd = VARRAY_TOP_GENERIC_PTR (walk_data->free_block_data);
-         VARRAY_POP (walk_data->free_block_data);
+         bd = VEC_pop (void_p, walk_data->free_block_data);
          recycled = 1;
        }
       else
@@ -174,7 +173,7 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
        }
 
       /* Push the local data into the local data stack.  */
-      VARRAY_PUSH_GENERIC_PTR (walk_data->block_data_stack, bd);
+      VEC_safe_push (void_p, heap, walk_data->block_data_stack, bd);
 
       /* Call the initializer.  */
       walk_data->initialize_block_local_data (walk_data, bb, recycled);
@@ -237,26 +236,18 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
   if (walk_data->initialize_block_local_data)
     {
       /* And save the block data so that we can re-use it.  */
-      VARRAY_PUSH_GENERIC_PTR (walk_data->free_block_data, bd);
+      VEC_safe_push (void_p, heap, walk_data->free_block_data, bd);
 
       /* And finally pop the record off the block local data stack.  */
-      VARRAY_POP (walk_data->block_data_stack);
+      VEC_pop (void_p, walk_data->block_data_stack);
     }
 }
 
 void
 init_walk_dominator_tree (struct dom_walk_data *walk_data)
 {
-  if (walk_data->initialize_block_local_data)
-    {
-      VARRAY_GENERIC_PTR_INIT (walk_data->free_block_data, 2, "freelist ");
-      VARRAY_GENERIC_PTR_INIT (walk_data->block_data_stack, 2, "block_data");
-    }
-  else
-    {
-      walk_data->free_block_data = NULL;
-      walk_data->block_data_stack = NULL;
-    }
+  walk_data->free_block_data = NULL;
+  walk_data->block_data_stack = NULL;
 }
 
 void
@@ -264,10 +255,10 @@ fini_walk_dominator_tree (struct dom_walk_data *walk_data)
 {
   if (walk_data->initialize_block_local_data)
     {
-      while (VARRAY_ACTIVE_SIZE (walk_data->free_block_data) > 0)
-       {
-         free (VARRAY_TOP_GENERIC_PTR (walk_data->free_block_data));
-         VARRAY_POP (walk_data->free_block_data);
-       }
+      while (VEC_length (void_p, walk_data->free_block_data) > 0)
+       free (VEC_pop (void_p, walk_data->free_block_data));
     }
+
+  VEC_free (void_p, heap, walk_data->free_block_data);
+  VEC_free (void_p, heap, walk_data->block_data_stack);
 }
index bf16229..ba0624e 100644 (file)
@@ -19,6 +19,10 @@ along with GCC; see the file COPYING.  If not, write to
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
+typedef void *void_p;
+DEF_VEC_P(void_p);
+DEF_VEC_ALLOC_P(void_p,heap);
+
 /* This is the main data structure for the dominator walker.  It provides
    the callback hooks as well as a convenient place to hang block local
    data and pass-global data.  */
@@ -94,7 +98,7 @@ struct dom_walk_data
   /* Stack of any data we need to keep on a per-block basis.
 
      If you have no local data, then BLOCK_DATA_STACK will be NULL.  */
-  varray_type block_data_stack;
+  VEC(void_p,heap) *block_data_stack;
 
   /* Size of the block local data.   If this is zero, then it is assumed
      you have no local data and thus no BLOCK_DATA_STACK as well.  */
@@ -104,7 +108,7 @@ struct dom_walk_data
      information/data outside domwalk.c.  */
 
   /* Stack of available block local structures.  */
-  varray_type free_block_data;
+  VEC(void_p,heap) *free_block_data;
 
   /* Interesting blocks to process.  If this field is not NULL, this
      set is used to determine which blocks to walk.  If we encounter
index 5461b3d..e2d063f 100644 (file)
@@ -135,7 +135,7 @@ dse_initialize_block_local_data (struct dom_walk_data *walk_data,
                                 bool recycled)
 {
   struct dse_block_local_data *bd
-    = VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
+    = VEC_last (void_p, walk_data->block_data_stack);
 
   /* If we are given a recycled block local data structure, ensure any
      bitmap associated with the block is cleared.  */
@@ -163,7 +163,7 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
                   block_stmt_iterator bsi)
 {
   struct dse_block_local_data *bd
-    = VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
+    = VEC_last (void_p, walk_data->block_data_stack);
   struct dse_global_data *dse_gd = walk_data->global_data;
   tree stmt = bsi_stmt (bsi);
   stmt_ann_t ann = stmt_ann (stmt);
@@ -298,7 +298,7 @@ static void
 dse_record_phis (struct dom_walk_data *walk_data, basic_block bb)
 {
   struct dse_block_local_data *bd
-    = VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
+    = VEC_last (void_p, walk_data->block_data_stack);
   struct dse_global_data *dse_gd = walk_data->global_data;
   tree phi;
 
@@ -314,7 +314,7 @@ dse_finalize_block (struct dom_walk_data *walk_data,
                    basic_block bb ATTRIBUTE_UNUSED)
 {
   struct dse_block_local_data *bd
-    = VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
+    = VEC_last (void_p, walk_data->block_data_stack);
   struct dse_global_data *dse_gd = walk_data->global_data;
   bitmap stores = dse_gd->stores;
   unsigned int i;