tree-ssa-structalias.c: alloc_pool for struct equiv_class_label

Submitted by Dimitrios Apostolou on Aug. 22, 2011, 7:53 a.m.

Details

Message ID alpine.LNX.2.02.1108221051490.1374@localhost.localdomain
State New
Headers show

Commit Message

Dimitrios Apostolou Aug. 22, 2011, 7:53 a.m.
Forgot the patch...

On Mon, 22 Aug 2011, Dimitrios Apostolou wrote:
>
> 2011-08-22  Dimitrios Apostolou  <jimis@gmx.net>
>
> 	* tree-ssa-structalias.c (equiv_class_add)
> 	(perform_var_substitution, free_var_substitution_info): Created a
> 	new equiv_class_pool allocator pool for struct
> 	equiv_class_label. Changed the pointer_equiv_class_table and
> 	location_equiv_class_table hash tables to not iterate freeing all
> 	elements in the end, but just free the pool.
>
>
>

Patch hide | download patch | download mbox

=== modified file 'gcc/tree-ssa-structalias.c'
--- gcc/tree-ssa-structalias.c	2011-04-29 10:59:33 +0000
+++ gcc/tree-ssa-structalias.c	2011-08-18 06:53:12 +0000
@@ -1899,6 +1899,9 @@  static htab_t pointer_equiv_class_table;
    classes.  */
 static htab_t location_equiv_class_table;
 
+/* Pool of memory for storing the above */
+static alloc_pool equiv_class_pool;
+
 /* Hash function for a equiv_class_label_t */
 
 static hashval_t
@@ -1948,7 +1951,8 @@  equiv_class_add (htab_t table, unsigned 
 		 bitmap labels)
 {
   void **slot;
-  equiv_class_label_t ecl = XNEW (struct equiv_class_label);
+  equiv_class_label_t ecl
+    = (equiv_class_label_t) pool_alloc (equiv_class_pool);
 
   ecl->labels = labels;
   ecl->equivalence_class = equivalence_class;
@@ -2159,10 +2163,14 @@  perform_var_substitution (constraint_gra
   struct scc_info *si = init_scc_info (size);
 
   bitmap_obstack_initialize (&iteration_obstack);
+  equiv_class_pool = create_alloc_pool ("equiv_class_label pool",
+					sizeof (struct equiv_class_label),
+					64);
+  /* NULL free function, we'll free the whole pool at the end of the pass. */
   pointer_equiv_class_table = htab_create (511, equiv_class_label_hash,
-					   equiv_class_label_eq, free);
+					   equiv_class_label_eq, NULL);
   location_equiv_class_table = htab_create (511, equiv_class_label_hash,
-					    equiv_class_label_eq, free);
+					    equiv_class_label_eq, NULL);
   pointer_equiv_class = 1;
   location_equiv_class = 1;
 
@@ -2269,6 +2277,7 @@  free_var_substitution_info (struct scc_i
   sbitmap_free (graph->direct_nodes);
   htab_delete (pointer_equiv_class_table);
   htab_delete (location_equiv_class_table);
+  free_alloc_pool (equiv_class_pool);
   bitmap_obstack_release (&iteration_obstack);
 }