This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 17/35] Change use to type-based pool allocator in tree-ssa-math-opts.c.
- From: Martin Liška <mliska at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 29 May 2015 15:38:23 +0200
- Subject: Re: [PATCH 17/35] Change use to type-based pool allocator in tree-ssa-math-opts.c.
- Authentication-results: sourceware.org; auth=none
- References: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0 dot 1432735040 dot git dot mliska at suse dot cz> <9a2dac9b68f3bb6862414da1078abf810e86bbbf dot 1432735040 dot git dot mliska at suse dot cz> <5566070E dot 4070501 at redhat dot com>
On 05/27/2015 08:03 PM, Jeff Law wrote:
On 05/27/2015 07:56 AM, mliska wrote:
gcc/ChangeLog:
2015-04-30 Martin Liska <mliska@suse.cz>
* tree-ssa-math-opts.c (occ_new): Use new type-based pool allocator.
(free_bb): Likewise.
(pass_cse_reciprocals::execute): Likewise.
OK.
jeff
v2
>From 3fffec068dfb9ee2b8c23a6b95db33afd8dc6c90 Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Wed, 27 May 2015 15:56:49 +0200
Subject: [PATCH 16/32] Change use to type-based pool allocator in
tree-ssa-math-opts.c.
gcc/ChangeLog:
2015-04-30 Martin Liska <mliska@suse.cz>
* tree-ssa-math-opts.c (occ_new): Use new type-based pool allocator.
(free_bb): Likewise.
(pass_cse_reciprocals::execute): Likewise.
---
gcc/tree-ssa-math-opts.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 98e2c49..0df755b 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -229,7 +229,7 @@ static struct
static struct occurrence *occ_head;
/* Allocation pool for getting instances of "struct occurrence". */
-static alloc_pool occ_pool;
+static pool_allocator<occurrence> *occ_pool;
@@ -240,7 +240,7 @@ occ_new (basic_block bb, struct occurrence *children)
{
struct occurrence *occ;
- bb->aux = occ = (struct occurrence *) pool_alloc (occ_pool);
+ bb->aux = occ = occ_pool->allocate ();
memset (occ, 0, sizeof (struct occurrence));
occ->bb = bb;
@@ -468,7 +468,7 @@ free_bb (struct occurrence *occ)
next = occ->next;
child = occ->children;
occ->bb->aux = NULL;
- pool_free (occ_pool, occ);
+ occ_pool->remove (occ);
/* Now ensure that we don't recurse unless it is necessary. */
if (!child)
@@ -572,9 +572,8 @@ pass_cse_reciprocals::execute (function *fun)
basic_block bb;
tree arg;
- occ_pool = create_alloc_pool ("dominators for recip",
- sizeof (struct occurrence),
- n_basic_blocks_for_fn (fun) / 3 + 1);
+ occ_pool = new pool_allocator<occurrence>
+ ("dominators for recip", n_basic_blocks_for_fn (fun) / 3 + 1);
memset (&reciprocal_stats, 0, sizeof (reciprocal_stats));
calculate_dominance_info (CDI_DOMINATORS);
@@ -704,7 +703,7 @@ pass_cse_reciprocals::execute (function *fun)
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
- free_alloc_pool (occ_pool);
+ delete occ_pool;
return 0;
}
--
2.1.4