]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
alloc-pool.h (free_alloc_pool_if_empty): Prototype new function.
authorRichard Guenther <rguenther@suse.de>
Tue, 20 Jun 2006 16:19:29 +0000 (16:19 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 20 Jun 2006 16:19:29 +0000 (16:19 +0000)
2006-06-20  Richard Guenther  <rguenther@suse.de>
Michael Matz  <matz@suse.de>

* alloc-pool.h (free_alloc_pool_if_empty): Prototype new
function.
* alloc-pool.c (free_alloc_pool_if_empty): New function.
* et-forest.h (et_free_pools): Prototype new function.
* et-forest.c (et_free_tree_force): Free parent occurrence.
(et_free_pools): New function.
* dominance.c (free_dominance_info): Free et-forest alloc
pools.

Co-Authored-By: Michael Matz <matz@suse.de>
From-SVN: r114817

gcc/ChangeLog
gcc/alloc-pool.c
gcc/alloc-pool.h
gcc/dominance.c
gcc/et-forest.c
gcc/et-forest.h

index 0a56b814167ce5ec382577095095f5fe71e9220a..f0e8292fe75737be791ce4808767d46e8b6f510e 100644 (file)
@@ -1,3 +1,15 @@
+2006-06-20  Richard Guenther  <rguenther@suse.de>
+       Michael Matz  <matz@suse.de>
+
+       * alloc-pool.h (free_alloc_pool_if_empty): Prototype new
+       function.
+       * alloc-pool.c (free_alloc_pool_if_empty): New function.
+       * et-forest.h (et_free_pools): Prototype new function.
+       * et-forest.c (et_free_tree_force): Free parent occurrence. 
+       (et_free_pools): New function.
+       * dominance.c (free_dominance_info): Free et-forest alloc
+       pools.
+
 2006-06-20  Roger Sayle  <roger@eyesopen.com>
 
        * expr.c (expand_expr_real_1) <VECTOR_CST>: For vector constants with
index 17d4073cee5bc4f63fea1a0cdc0d3499448d903a..d85cd9ef57cc117abdc4e15d8cd27632c0d6183f 100644 (file)
@@ -207,6 +207,17 @@ free_alloc_pool (alloc_pool pool)
   free (pool);
 }
 
+/* Frees the alloc_pool, if it is empty and zero *POOL in this case.  */
+void
+free_alloc_pool_if_empty (alloc_pool *pool)
+{
+  if ((*pool)->elts_free == (*pool)->elts_allocated)
+    {
+      free_alloc_pool (*pool);
+      *pool = NULL;
+    }
+}
+
 /* Allocates one element from the pool specified.  */
 void *
 pool_alloc (alloc_pool pool)
index 5152f9ee458ffd27197c0554658a1165eede1bc8..82188f4c064fe12f51ad9ae45db2cdf9d233acbe 100644 (file)
@@ -49,6 +49,7 @@ typedef struct alloc_pool_def
 
 extern alloc_pool create_alloc_pool (const char *, size_t, size_t);
 extern void free_alloc_pool (alloc_pool);
+extern void free_alloc_pool_if_empty (alloc_pool *);
 extern void *pool_alloc (alloc_pool);
 extern void pool_free (alloc_pool, void *);
 extern void dump_alloc_pool_statistics (void);
index 92496b77ac11a66292885f32ba483d686c79ed7f..ca6d1543f77918aef525eb517015573ade49cae6 100644 (file)
@@ -663,6 +663,7 @@ free_dominance_info (enum cdi_direction dir)
       et_free_tree_force (bb->dom[dir]);
       bb->dom[dir] = NULL;
     }
+  et_free_pools ();
 
   n_bbs_in_dom_tree[dir] = 0;
 
index f193afd52d0c3212ded853f326eacd0327622be2..b8e552741096df82c5a21d2fd1c743b1a9aee67e 100644 (file)
@@ -505,9 +505,20 @@ void
 et_free_tree_force (struct et_node *t)
 {
   pool_free (et_occurrences, t->rightmost_occ);
+  if (t->parent_occ)
+    pool_free (et_occurrences, t->parent_occ);
   pool_free (et_nodes, t);
 }
 
+/* Release the alloc pools, if they are empty.  */
+
+void
+et_free_pools (void)
+{
+  free_alloc_pool_if_empty (&et_occurrences);
+  free_alloc_pool_if_empty (&et_nodes);
+}
+
 /* Sets father of et tree T to FATHER.  */
 
 void
index ccf5aff852c670a78f4aa718f74a2f791332e63a..1de715f40b53fe8922ea4c6a63b6ca7c02f95b4a 100644 (file)
@@ -74,6 +74,7 @@ struct et_node
 struct et_node *et_new_tree (void *data);
 void et_free_tree (struct et_node *);
 void et_free_tree_force (struct et_node *);
+void et_free_pools (void);
 void et_set_father (struct et_node *, struct et_node *);
 void et_split (struct et_node *);
 struct et_node *et_nca (struct et_node *, struct et_node *);