OSDN Git Service

* cfgrtl.c (rtl_create_basic_block): Pre-allocate basic_block_info
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Mar 2004 11:42:10 +0000 (11:42 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Mar 2004 11:42:10 +0000 (11:42 +0000)
array.

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

gcc/ChangeLog
gcc/cfgrtl.c

index 2cfe0c1..ea5a37d 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-17  Jan Hubicka  <jh@suse.cz>
+
+       * cfgrtl.c (rtl_create_basic_block): Pre-allocate basic_block_info
+       array.
+
 2004-03-17  James E Wilson  <wilson@specifixinc.com>
 
        * config/mips/mips.md (zero_extendsidi2): Add length attribute.
index 3363a2d..f38c53c 100644 (file)
@@ -338,8 +338,12 @@ rtl_create_basic_block (void *headp, void *endp, basic_block after)
   rtx head = headp, end = endp;
   basic_block bb;
 
-  /* Place the new block just after the end.  */
-  VARRAY_GROW (basic_block_info, last_basic_block + 1);
+  /* Grow the basic block array if needed.  */
+  if ((size_t) last_basic_block >= VARRAY_SIZE (basic_block_info))
+    {
+      size_t new_size = last_basic_block + (last_basic_block + 3) / 4;
+      VARRAY_GROW (basic_block_info, new_size);
+    }
 
   n_basic_blocks++;