]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
basic-block.h (control_flow_graph): Change the type of x_basic_block_info to VEC...
authorKazu Hirata <kazu@codesourcery.com>
Wed, 11 Jan 2006 18:43:15 +0000 (18:43 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Wed, 11 Jan 2006 18:43:15 +0000 (18:43 +0000)
* basic-block.h (control_flow_graph): Change the type of
x_basic_block_info to VEC(basic_block,gc) *.
(BASIC_BLOCK_FOR_FUNCTION, BASIC_BLOCK): Adjust the uses of
basic_block_info.
(SET_BASIC_BLOCK): New.
* cfg.c (compact_blocks, expunge_block): Use SET_BASIC_BLOCK
instead of BASIC_BLOCK when assigning to BASIC_BLOCK.
* cfgbuild.c (find_basic_blocks): Likewise.
* cfglayout.c (fixup_reorder_chain): Likewise.
* cfgrtl.c (create_basic_block_structure,
rtl_create_basic_block): Likewise.
* ifcvt.c (find_if_case_1): Likewise.
* tree-cfg.c (init_empty_tree_cfg, build_tree_cfg, create_bb):
Likewise.

From-SVN: r109596

gcc/ChangeLog
gcc/basic-block.h
gcc/cfg.c
gcc/cfgbuild.c
gcc/cfglayout.c
gcc/cfgrtl.c
gcc/ifcvt.c
gcc/tree-cfg.c

index b966da7b5d61f96ce3a7548eaa7e3f955fe67790..692e45a83393bd9a2c3fd9e4ed0a3f0bbb103911 100644 (file)
@@ -1,3 +1,20 @@
+2006-01-11  Kazu Hirata  <kazu@codesourcery.com>
+
+       * basic-block.h (control_flow_graph): Change the type of
+       x_basic_block_info to VEC(basic_block,gc) *.
+       (BASIC_BLOCK_FOR_FUNCTION, BASIC_BLOCK): Adjust the uses of
+       basic_block_info.
+       (SET_BASIC_BLOCK): New.
+       * cfg.c (compact_blocks, expunge_block): Use SET_BASIC_BLOCK
+       instead of BASIC_BLOCK when assigning to BASIC_BLOCK.
+       * cfgbuild.c (find_basic_blocks): Likewise.
+       * cfglayout.c (fixup_reorder_chain): Likewise.
+       * cfgrtl.c (create_basic_block_structure,
+       rtl_create_basic_block): Likewise.
+       * ifcvt.c (find_if_case_1): Likewise.
+       * tree-cfg.c (init_empty_tree_cfg, build_tree_cfg, create_bb):
+       Likewise.
+
 2005-01-11  Kenneth Zadeck <zadeck@naturalbridge.com>
 
        * Makefile.in Removed rotted odf.c entry.
index 26153820e1defd518c6caf7eb8d956d14c95e3fd..d9fd10c90d16d172fd0c57de2b6fb238f2fdd194 100644 (file)
@@ -367,7 +367,7 @@ struct control_flow_graph GTY(())
   basic_block x_exit_block_ptr;
 
   /* Index by basic block number, get basic block struct info.  */
-  varray_type x_basic_block_info;
+  VEC(basic_block,gc) *x_basic_block_info;
 
   /* Number of basic blocks in this flow graph.  */
   int x_n_basic_blocks;
@@ -399,7 +399,7 @@ struct control_flow_graph GTY(())
 #define label_to_block_map_for_function(FN)  ((FN)->cfg->x_label_to_block_map)
 
 #define BASIC_BLOCK_FOR_FUNCTION(FN,N) \
-  (VARRAY_BB (basic_block_info_for_function(FN), (N)))
+  (VEC_index (basic_block, basic_block_info_for_function(FN), (N)))
 
 /* Defines for textual backward source compatibility.  */
 #define ENTRY_BLOCK_PTR                (cfun->cfg->x_entry_block_ptr)
@@ -411,7 +411,8 @@ struct control_flow_graph GTY(())
 #define label_to_block_map     (cfun->cfg->x_label_to_block_map)
 #define profile_status         (cfun->cfg->x_profile_status)
 
-#define BASIC_BLOCK(N)         (VARRAY_BB (basic_block_info, (N)))
+#define BASIC_BLOCK(N)         (VEC_index (basic_block, basic_block_info, (N)))
+#define SET_BASIC_BLOCK(N,BB)  (VEC_replace (basic_block, basic_block_info, (N), (BB)))
 
 /* TRUE if we should re-run loop discovery after threading jumps, FALSE
    otherwise.  */
index 8f8593e24202b7dcce81d2de69df795f24ee8365..7b2a30fea6dd16e9cbf4641fdb6ca74c268fd74d 100644 (file)
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -163,13 +163,13 @@ compact_blocks (void)
   int i;
   basic_block bb;
 
-  BASIC_BLOCK (ENTRY_BLOCK) = ENTRY_BLOCK_PTR;
-  BASIC_BLOCK (EXIT_BLOCK) = EXIT_BLOCK_PTR;
+  SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR);
+  SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR);
 
   i = NUM_FIXED_BLOCKS;
   FOR_EACH_BB (bb) 
     {
-      BASIC_BLOCK (i) = bb;
+      SET_BASIC_BLOCK (i, bb);
       bb->index = i;
       i++;
     }
@@ -177,7 +177,7 @@ compact_blocks (void)
   gcc_assert (i == n_basic_blocks);
 
   for (; i < last_basic_block; i++)
-    BASIC_BLOCK (i) = NULL;
+    SET_BASIC_BLOCK (i, NULL);
 
   last_basic_block = n_basic_blocks;
 }
@@ -188,7 +188,7 @@ void
 expunge_block (basic_block b)
 {
   unlink_block (b);
-  BASIC_BLOCK (b->index) = NULL;
+  SET_BASIC_BLOCK (b->index, NULL);
   n_basic_blocks--;
   /* We should be able to ggc_free here, but we are not.
      The dead SSA_NAMES are left pointing to dead statements that are pointing
index 834119dbc0c8f9bdde536bec7f2c3e2d6355f35a..6a7395abeebb81b3ec7fc69007f14d127888e3fb 100644 (file)
@@ -542,9 +542,12 @@ find_basic_blocks (rtx f)
      instructions at all until close to the end of compilation when we
      actually lay them out.  */
 
-  VARRAY_BB_INIT (basic_block_info, n_basic_blocks, "basic_block_info");
-  BASIC_BLOCK (ENTRY_BLOCK) = ENTRY_BLOCK_PTR;
-  BASIC_BLOCK (EXIT_BLOCK) = EXIT_BLOCK_PTR;
+  basic_block_info = VEC_alloc (basic_block, gc, n_basic_blocks);
+  VEC_safe_grow (basic_block, gc, basic_block_info, n_basic_blocks);
+  memset (VEC_address (basic_block, basic_block_info), 0,
+         sizeof (basic_block) * n_basic_blocks);
+  SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR);
+  SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR);
 
   find_basic_blocks_1 (f);
 
index 5880819a9182326d2fa8fe35af5aa7f93f6db42e..265afd73f93c4927f5354b7e001a6e657599cf47 100644 (file)
@@ -814,7 +814,7 @@ fixup_reorder_chain (void)
   for (; bb; prev_bb = bb, bb = bb->aux, index ++)
     {
       bb->index = index;
-      BASIC_BLOCK (index) = bb;
+      SET_BASIC_BLOCK (index, bb);
 
       bb->prev_bb = prev_bb;
       prev_bb->next_bb = bb;
index 6ff6c3911931b5a10e9b024c4375f56dd1d447e9..765247260f2bbdc120680402dc262862bec62c17 100644 (file)
@@ -305,7 +305,7 @@ create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after)
   bb->index = last_basic_block++;
   bb->flags = BB_NEW | BB_RTL;
   link_block (bb, after);
-  BASIC_BLOCK (bb->index) = bb;
+  SET_BASIC_BLOCK (bb->index, bb);
   update_bb_for_insn (bb);
   BB_SET_PARTITION (bb, BB_UNPARTITIONED);
 
@@ -328,10 +328,14 @@ rtl_create_basic_block (void *headp, void *endp, basic_block after)
   basic_block bb;
 
   /* Grow the basic block array if needed.  */
-  if ((size_t) last_basic_block >= VARRAY_SIZE (basic_block_info))
+  if ((size_t) last_basic_block >= VEC_length (basic_block, basic_block_info))
     {
+      size_t old_size = VEC_length (basic_block, basic_block_info);
       size_t new_size = last_basic_block + (last_basic_block + 3) / 4;
-      VARRAY_GROW (basic_block_info, new_size);
+      basic_block *p;
+      VEC_safe_grow (basic_block, gc, basic_block_info, new_size);
+      p = VEC_address (basic_block, basic_block_info);
+      memset (&p[old_size], 0, sizeof (basic_block) * (new_size - old_size));
     }
 
   n_basic_blocks++;
index d89253573edb252dca1547ded3b5c5679a1aaa12..2390f2f3c899eb1b8e7f112a3cd2174cff9e7be7 100644 (file)
@@ -3135,7 +3135,7 @@ find_if_case_1 (basic_block test_bb, edge then_edge, edge else_edge)
   if (new_bb)
     {
       new_bb->index = then_bb_index;
-      BASIC_BLOCK (then_bb_index) = new_bb;
+      SET_BASIC_BLOCK (then_bb_index, new_bb);
       /* Since the fallthru edge was redirected from test_bb to new_bb,
          we need to ensure that new_bb is in the same partition as
          test bb (you can not fall through across section boundaries).  */
index 40a29bc7c2e3bf65b1994b8767e8467bb3280801..4b34ddac4ef304eeecb37b4f67941d3d0734c30c 100644 (file)
@@ -131,7 +131,10 @@ init_empty_tree_cfg (void)
   profile_status = PROFILE_ABSENT;
   n_basic_blocks = NUM_FIXED_BLOCKS;
   last_basic_block = NUM_FIXED_BLOCKS;
-  VARRAY_BB_INIT (basic_block_info, initial_cfg_capacity, "basic_block_info");
+  basic_block_info = VEC_alloc (basic_block, gc, initial_cfg_capacity);
+  VEC_safe_grow (basic_block, gc, basic_block_info, initial_cfg_capacity);
+  memset (VEC_address (basic_block, basic_block_info), 0,
+         sizeof (basic_block) * initial_cfg_capacity);
 
   /* Build a mapping of labels to their associated blocks.  */
   label_to_block_map = VEC_alloc (basic_block, gc, initial_cfg_capacity);
@@ -139,8 +142,8 @@ init_empty_tree_cfg (void)
   memset (VEC_address (basic_block, label_to_block_map),
          0, sizeof (basic_block) * initial_cfg_capacity);
 
-  BASIC_BLOCK (ENTRY_BLOCK) = ENTRY_BLOCK_PTR;
-  BASIC_BLOCK (EXIT_BLOCK) = EXIT_BLOCK_PTR;
+  SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR);
+  SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR);
   ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR;
   EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR;
 }
@@ -178,7 +181,15 @@ build_tree_cfg (tree *tp)
     create_empty_bb (ENTRY_BLOCK_PTR);
 
   /* Adjust the size of the array.  */
-  VARRAY_GROW (basic_block_info, n_basic_blocks);
+  if (VEC_length (basic_block, basic_block_info) < (size_t) n_basic_blocks)
+    {
+      size_t old_size = VEC_length (basic_block, basic_block_info);
+      basic_block *p;
+      VEC_safe_grow (basic_block, gc, basic_block_info, n_basic_blocks);
+      p = VEC_address (basic_block, basic_block_info);
+      memset (&p[old_size], 0,
+             sizeof (basic_block) * (n_basic_blocks - old_size));
+    }
 
   /* To speed up statement iterator walks, we first purge dead labels.  */
   cleanup_dead_labels ();
@@ -382,14 +393,18 @@ create_bb (void *h, void *e, basic_block after)
   link_block (bb, after);
 
   /* Grow the basic block array if needed.  */
-  if ((size_t) last_basic_block == VARRAY_SIZE (basic_block_info))
+  if ((size_t) last_basic_block == VEC_length (basic_block, basic_block_info))
     {
+      size_t old_size = VEC_length (basic_block, basic_block_info);
       size_t new_size = last_basic_block + (last_basic_block + 3) / 4;
-      VARRAY_GROW (basic_block_info, new_size);
+      basic_block *p;
+      VEC_safe_grow (basic_block, gc, basic_block_info, new_size);
+      p = VEC_address (basic_block, basic_block_info);
+      memset (&p[old_size], 0, sizeof (basic_block) * (new_size - old_size));
     }
 
   /* Add the newly created block to the array.  */
-  BASIC_BLOCK (last_basic_block) = bb;
+  SET_BASIC_BLOCK (last_basic_block, bb);
 
   n_basic_blocks++;
   last_basic_block++;