From ac0539d7ac678bb4f7adbebb2e69ee96edf84523 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 1 Jun 2015 14:38:23 +0200 Subject: [PATCH] Change use to type-based pool allocator in cfg.c. * cfg.c (initialize_original_copy_tables):Use new type-based pool allocator. (free_original_copy_tables) Likewise. (copy_original_table_clear) Likewise. (copy_original_table_set) Likewise. From-SVN: r223950 --- gcc/ChangeLog | 7 +++++++ gcc/cfg.c | 17 +++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e1bdc4e57c8..ef7e40afee7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-06-01 Martin Liska + + * cfg.c (initialize_original_copy_tables):Use new type-based pool allocator. + (free_original_copy_tables) Likewise. + (copy_original_table_clear) Likewise. + (copy_original_table_set) Likewise. + 2015-06-01 Martin Liska * asan.c (asan_mem_ref_get_alloc_pool):Use new type-based pool allocator. diff --git a/gcc/cfg.c b/gcc/cfg.c index cdcc01c9a1c..ddfecdcd6fa 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -1066,18 +1066,16 @@ static hash_table *bb_copy; /* And between loops and copies. */ static hash_table *loop_copy; -static alloc_pool original_copy_bb_pool; - +static pool_allocator *original_copy_bb_pool; /* Initialize the data structures to maintain mapping between blocks and its copies. */ void initialize_original_copy_tables (void) { - gcc_assert (!original_copy_bb_pool); - original_copy_bb_pool - = create_alloc_pool ("original_copy", - sizeof (struct htab_bb_copy_original_entry), 10); + + original_copy_bb_pool = new pool_allocator + ("original_copy", 10); bb_original = new hash_table (10); bb_copy = new hash_table (10); loop_copy = new hash_table (10); @@ -1095,7 +1093,7 @@ free_original_copy_tables (void) bb_copy = NULL; delete loop_copy; loop_copy = NULL; - free_alloc_pool (original_copy_bb_pool); + delete original_copy_bb_pool; original_copy_bb_pool = NULL; } @@ -1117,7 +1115,7 @@ copy_original_table_clear (hash_table *tab, unsigned obj) elt = *slot; tab->clear_slot (slot); - pool_free (original_copy_bb_pool, elt); + original_copy_bb_pool->remove (elt); } /* Sets the value associated with OBJ in table TAB to VAL. @@ -1137,8 +1135,7 @@ copy_original_table_set (hash_table *tab, slot = tab->find_slot (&key, INSERT); if (!*slot) { - *slot = (struct htab_bb_copy_original_entry *) - pool_alloc (original_copy_bb_pool); + *slot = original_copy_bb_pool->allocate (); (*slot)->index1 = obj; } (*slot)->index2 = val; -- 2.30.2