This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 20/35] Change use to type-based pool allocator in ira-build.c.
- From: Martin Liška <mliska at suse dot cz>
- To: Jeff Law <law at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 29 May 2015 15:39:05 +0200
- Subject: Re: [PATCH 20/35] Change use to type-based pool allocator in ira-build.c.
- Authentication-results: sourceware.org; auth=none
- References: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0 dot 1432735040 dot git dot mliska at suse dot cz> <8a64b779e2d82b444eee21755545c8530c3322a3 dot 1432735040 dot git dot mliska at suse dot cz> <55660901 dot 3030408 at redhat dot com>
On 05/27/2015 08:12 PM, Jeff Law wrote:
On 05/27/2015 07:56 AM, mliska wrote:
gcc/ChangeLog:
2015-04-30 Martin Liska <mliska@suse.cz>
* ira-build.c (initiate_cost_vectors): Use new type-based pool allocator.
(ira_allocate_cost_vector): Likewise.
(ira_free_cost_vector): Likewise.
(finish_cost_vectors): Likewise.
OK.
jeff
v2
>From 3df359fb77e6e60341ef5f9dec2898708245f5ee Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Wed, 27 May 2015 15:56:51 +0200
Subject: [PATCH 19/32] Change use to type-based pool allocator in ira-build.c.
gcc/ChangeLog:
2015-04-30 Martin Liska <mliska@suse.cz>
* ira-build.c (initiate_cost_vectors): Use new type-based pool allocator.
(ira_allocate_cost_vector): Likewise.
(ira_free_cost_vector): Likewise.
(finish_cost_vectors): Likewise.
---
gcc/ira-build.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index 8b6b956..2de7d34 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -1633,7 +1633,7 @@ finish_copies (void)
/* Pools for cost vectors. It is defined only for allocno classes. */
-static alloc_pool cost_vector_pool[N_REG_CLASSES];
+static pool_allocator<int> * cost_vector_pool[N_REG_CLASSES];
/* The function initiates work with hard register cost vectors. It
creates allocation pool for each allocno class. */
@@ -1646,10 +1646,9 @@ initiate_cost_vectors (void)
for (i = 0; i < ira_allocno_classes_num; i++)
{
aclass = ira_allocno_classes[i];
- cost_vector_pool[aclass]
- = create_alloc_pool ("cost vectors",
- sizeof (int) * ira_class_hard_regs_num[aclass],
- 100);
+ cost_vector_pool[aclass] = new pool_allocator<int>
+ ("cost vectors", 100,
+ sizeof (int) * (ira_class_hard_regs_num[aclass] - 1));
}
}
@@ -1657,7 +1656,7 @@ initiate_cost_vectors (void)
int *
ira_allocate_cost_vector (reg_class_t aclass)
{
- return (int *) pool_alloc (cost_vector_pool[(int) aclass]);
+ return cost_vector_pool[(int) aclass]->allocate ();
}
/* Free a cost vector VEC for ACLASS. */
@@ -1665,7 +1664,7 @@ void
ira_free_cost_vector (int *vec, reg_class_t aclass)
{
ira_assert (vec != NULL);
- pool_free (cost_vector_pool[(int) aclass], vec);
+ cost_vector_pool[(int) aclass]->remove (vec);
}
/* Finish work with hard register cost vectors. Release allocation
@@ -1679,7 +1678,7 @@ finish_cost_vectors (void)
for (i = 0; i < ira_allocno_classes_num; i++)
{
aclass = ira_allocno_classes[i];
- free_alloc_pool (cost_vector_pool[aclass]);
+ delete cost_vector_pool[aclass];
}
}
--
2.1.4