From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 32/35] Change use to type-based pool allocator in ira-build.c.
Date: Fri, 29 May 2015 13:44:00 -0000 [thread overview]
Message-ID: <55686CA2.4070509@suse.cz> (raw)
In-Reply-To: <55660B46.9080301@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
On 05/27/2015 08:21 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 (finish_allocnos): Use new type-based pool allocator.
>> (finish_prefs): Likewise.
>> (finish_copies): Likewise.
> Is this a partial duplicate of patch #34? Something seems amiss here.
>
>
> jeff
>
v2
[-- Attachment #2: 0031-Change-use-to-type-based-pool-allocator-in-ira-build.patch --]
[-- Type: text/x-patch, Size: 6608 bytes --]
From b5e1163dc80daf303431589eb71611afd60c08ef Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Wed, 27 May 2015 15:56:56 +0200
Subject: [PATCH 31/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_allocnos): Use new type-based pool allocator.
(ira_create_object): Likewise.
(ira_create_allocno): Likewise.
(ira_create_live_range): Likewise.
(copy_live_range): Likewise.
(ira_finish_live_range): Likewise.
(ira_free_allocno_costs): Likewise.
(finish_allocno): Likewise.
(finish_allocnos): Likewise.
(initiate_prefs): Likewise.
(ira_create_pref): Likewise.
(finish_pref): Likewise.
(finish_prefs): Likewise.
(initiate_copies): Likewise.
(ira_create_copy): Likewise.
(finish_copy): Likewise.
(finish_copies): Likewise.
(finish_prefs): Likewise.
---
gcc/ira-build.c | 51 +++++++++++++++++++++------------------------------
1 file changed, 21 insertions(+), 30 deletions(-)
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index 2de7d34..534d0bc 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -428,7 +428,9 @@ rebuild_regno_allocno_maps (void)
\f
/* Pools for allocnos, allocno live ranges and objects. */
-static alloc_pool allocno_pool, live_range_pool, object_pool;
+static pool_allocator<live_range> live_range_pool ("live ranges", 100);
+static pool_allocator<ira_allocno> allocno_pool ("allocnos", 100);
+static pool_allocator<ira_object> object_pool ("objects", 100);
/* Vec containing references to all created allocnos. It is a
container of array allocnos. */
@@ -442,13 +444,6 @@ static vec<ira_object_t> ira_object_id_map_vec;
static void
initiate_allocnos (void)
{
- live_range_pool
- = create_alloc_pool ("live ranges",
- sizeof (struct live_range), 100);
- allocno_pool
- = create_alloc_pool ("allocnos", sizeof (struct ira_allocno), 100);
- object_pool
- = create_alloc_pool ("objects", sizeof (struct ira_object), 100);
allocno_vec.create (max_reg_num () * 2);
ira_allocnos = NULL;
ira_allocnos_num = 0;
@@ -466,7 +461,7 @@ static ira_object_t
ira_create_object (ira_allocno_t a, int subword)
{
enum reg_class aclass = ALLOCNO_CLASS (a);
- ira_object_t obj = (ira_object_t) pool_alloc (object_pool);
+ ira_object_t obj = object_pool.allocate ();
OBJECT_ALLOCNO (obj) = a;
OBJECT_SUBWORD (obj) = subword;
@@ -501,7 +496,7 @@ ira_create_allocno (int regno, bool cap_p,
{
ira_allocno_t a;
- a = (ira_allocno_t) pool_alloc (allocno_pool);
+ a = allocno_pool.allocate ();
ALLOCNO_REGNO (a) = regno;
ALLOCNO_LOOP_TREE_NODE (a) = loop_tree_node;
if (! cap_p)
@@ -943,7 +938,7 @@ ira_create_live_range (ira_object_t obj, int start, int finish,
{
live_range_t p;
- p = (live_range_t) pool_alloc (live_range_pool);
+ p = live_range_pool.allocate ();
p->object = obj;
p->start = start;
p->finish = finish;
@@ -968,7 +963,7 @@ copy_live_range (live_range_t r)
{
live_range_t p;
- p = (live_range_t) pool_alloc (live_range_pool);
+ p = live_range_pool.allocate ();
*p = *r;
return p;
}
@@ -1089,7 +1084,7 @@ ira_live_ranges_intersect_p (live_range_t r1, live_range_t r2)
void
ira_finish_live_range (live_range_t r)
{
- pool_free (live_range_pool, r);
+ live_range_pool.remove (r);
}
/* Free list of allocno live ranges starting with R. */
@@ -1136,7 +1131,7 @@ ira_free_allocno_costs (ira_allocno_t a)
ira_object_id_map[OBJECT_CONFLICT_ID (obj)] = NULL;
if (OBJECT_CONFLICT_ARRAY (obj) != NULL)
ira_free (OBJECT_CONFLICT_ARRAY (obj));
- pool_free (object_pool, obj);
+ object_pool.remove (obj);
}
ira_allocnos[ALLOCNO_NUM (a)] = NULL;
@@ -1160,7 +1155,7 @@ static void
finish_allocno (ira_allocno_t a)
{
ira_free_allocno_costs (a);
- pool_free (allocno_pool, a);
+ allocno_pool.remove (a);
}
/* Free the memory allocated for all allocnos. */
@@ -1175,15 +1170,15 @@ finish_allocnos (void)
ira_free (ira_regno_allocno_map);
ira_object_id_map_vec.release ();
allocno_vec.release ();
- free_alloc_pool (allocno_pool);
- free_alloc_pool (object_pool);
- free_alloc_pool (live_range_pool);
+ allocno_pool.release ();
+ object_pool.release ();
+ live_range_pool.release ();
}
\f
/* Pools for allocno preferences. */
-static alloc_pool pref_pool;
+static pool_allocator <ira_allocno_pref> pref_pool ("prefs", 100);
/* Vec containing references to all created preferences. It is a
container of array ira_prefs. */
@@ -1193,8 +1188,6 @@ static vec<ira_pref_t> pref_vec;
static void
initiate_prefs (void)
{
- pref_pool
- = create_alloc_pool ("prefs", sizeof (struct ira_allocno_pref), 100);
pref_vec.create (get_max_uid ());
ira_prefs = NULL;
ira_prefs_num = 0;
@@ -1218,7 +1211,7 @@ ira_create_pref (ira_allocno_t a, int hard_regno, int freq)
{
ira_pref_t pref;
- pref = (ira_pref_t) pool_alloc (pref_pool);
+ pref = pref_pool.allocate ();
pref->num = ira_prefs_num;
pref->allocno = a;
pref->hard_regno = hard_regno;
@@ -1316,7 +1309,7 @@ static void
finish_pref (ira_pref_t pref)
{
ira_prefs[pref->num] = NULL;
- pool_free (pref_pool, pref);
+ pref_pool.remove (pref);
}
/* Remove PREF from the list of allocno prefs and free memory for
@@ -1366,13 +1359,13 @@ finish_prefs (void)
FOR_EACH_PREF (pref, pi)
finish_pref (pref);
pref_vec.release ();
- free_alloc_pool (pref_pool);
+ pref_pool.release ();
}
\f
/* Pools for copies. */
-static alloc_pool copy_pool;
+static pool_allocator<ira_allocno_copy> copy_pool ("copies", 100);
/* Vec containing references to all created copies. It is a
container of array ira_copies. */
@@ -1382,8 +1375,6 @@ static vec<ira_copy_t> copy_vec;
static void
initiate_copies (void)
{
- copy_pool
- = create_alloc_pool ("copies", sizeof (struct ira_allocno_copy), 100);
copy_vec.create (get_max_uid ());
ira_copies = NULL;
ira_copies_num = 0;
@@ -1428,7 +1419,7 @@ ira_create_copy (ira_allocno_t first, ira_allocno_t second, int freq,
{
ira_copy_t cp;
- cp = (ira_copy_t) pool_alloc (copy_pool);
+ cp = copy_pool.allocate ();
cp->num = ira_copies_num;
cp->first = first;
cp->second = second;
@@ -1613,7 +1604,7 @@ ira_debug_allocno_copies (ira_allocno_t a)
static void
finish_copy (ira_copy_t cp)
{
- pool_free (copy_pool, cp);
+ copy_pool.remove (cp);
}
@@ -1627,7 +1618,7 @@ finish_copies (void)
FOR_EACH_COPY (cp, ci)
finish_copy (cp);
copy_vec.release ();
- free_alloc_pool (copy_pool);
+ copy_pool.release ();
}
\f
--
2.1.4
next prev parent reply other threads:[~2015-05-29 13:42 UTC|newest]
Thread overview: 108+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-27 14:09 [PATCH 01/35] Introduce new type-based pool allocator mliska
2015-05-27 14:00 ` [PATCH 09/35] Change use to type-based pool allocator in c-format.c mliska
2015-05-27 14:16 ` Jakub Jelinek
2015-05-27 18:01 ` Jeff Law
2015-05-29 13:35 ` Martin Liška
2015-05-27 14:00 ` [PATCH 06/35] Change use to type-based pool allocator in ira-color.c mliska
2015-05-27 14:00 ` [PATCH 12/35] Change use to type-based pool allocator in cselib.c mliska
2015-05-29 13:38 ` Martin Liška
2015-05-27 14:00 ` [PATCH 10/35] Change use to type-based pool allocator in cfg.c mliska
2015-05-27 18:01 ` Jeff Law
2015-05-29 13:34 ` Martin Liška
2015-05-27 14:00 ` [PATCH 04/35] Change use to type-based pool allocator in lra.c mliska
2015-05-27 17:55 ` Jeff Law
2015-05-29 13:34 ` Martin Liška
2015-05-27 14:00 ` [PATCH 03/35] Change use to type-based pool allocator in lra-lives.c mliska
2015-05-27 17:53 ` Jeff Law
2015-05-29 13:34 ` Martin Liška
2015-05-28 0:48 ` Trevor Saunders
2015-05-27 14:07 ` [PATCH 19/35] Change use to type-based pool allocator in sel-sched-ir.c mliska
2015-05-27 18:12 ` Jeff Law
2015-05-29 13:40 ` Martin Liška
2015-05-27 14:09 ` [PATCH 02/35] Change use to type-based pool allocator in et-forest.c mliska
2015-05-27 17:50 ` Jeff Law
2015-05-29 13:33 ` Martin Liška
2015-05-27 14:15 ` [PATCH 05/35] Change use to type-based pool allocator in ira-color.c mliska
2015-05-27 17:59 ` Jeff Law
2015-05-29 13:34 ` Martin Liška
2015-05-27 14:17 ` [PATCH 32/35] Change use to type-based pool allocator in ira-build.c mliska
2015-05-27 19:34 ` Jeff Law
2015-05-29 13:44 ` Martin Liška [this message]
2015-05-27 14:17 ` [PATCH 35/35] Remove old pool allocator mliska
2015-05-27 19:40 ` Jeff Law
2015-05-29 14:11 ` Martin Liška
2015-05-27 14:17 ` [PATCH 34/35] Change use to type-based pool allocator in ira-build.c mliska
2015-05-27 14:17 ` [PATCH 21/35] Change use to type-based pool allocator in regcprop.c mliska
2015-05-27 18:14 ` Jeff Law
2015-05-29 13:40 ` Martin Liška
2015-05-27 14:17 ` [PATCH 23/35] Change use to type-based pool allocator in tree-ssa-pre.c mliska
2015-05-27 18:59 ` Jeff Law
2015-05-29 13:41 ` Martin Liška
2015-05-27 14:17 ` [PATCH 28/35] Change use to type-based pool allocator in ipa-profile.c mliska
2015-05-27 18:18 ` Jeff Law
2015-05-29 13:42 ` Martin Liška
2015-05-27 14:18 ` [PATCH 27/35] Change use to type-based pool allocator in tree-ssa-structalias.c mliska
2015-05-27 18:20 ` Jeff Law
2015-05-29 13:42 ` Martin Liška
2015-05-27 14:19 ` [PATCH 25/35] Change use to type-based pool allocator in tree-ssa-sccvn.c mliska
2015-05-27 18:16 ` Jeff Law
2015-05-29 13:41 ` Martin Liška
2015-05-27 14:19 ` [PATCH 08/35] Change use to type-based pool allocator in asan.c mliska
2015-05-27 18:01 ` Jeff Law
2015-05-27 14:19 ` [PATCH 11/35] Change use to type-based pool allocator in sh.c mliska
2015-05-27 18:03 ` Jeff Law
2015-05-29 13:37 ` Martin Liška
2015-05-27 14:19 ` [PATCH 14/35] Change use to type-based pool allocator in df-scan.c mliska
2015-05-29 13:38 ` Martin Liška
2015-05-27 14:20 ` [PATCH 31/35] Change use to type-based pool allocator in ipa-prop.c and ipa-cp.c mliska
2015-05-29 14:09 ` Martin Liška
2015-05-27 14:20 ` [PATCH 07/35] Change use to type-based pool allocator in var-tracking.c mliska
2015-05-29 13:34 ` Martin Liška
2015-05-27 14:20 ` [PATCH 29/35] Change use to type-based pool allocator in ipa-prop.c mliska
2015-05-27 18:22 ` Jeff Law
2015-05-29 13:42 ` Martin Liška
2015-05-27 14:21 ` [PATCH 16/35] Change use to type-based pool allocator in tree-sra.c mliska
2015-05-27 18:11 ` Jeff Law
2015-05-29 13:39 ` Martin Liška
2015-05-27 14:21 ` [PATCH 20/35] Change use to type-based pool allocator in ira-build.c mliska
2015-05-27 18:15 ` Jeff Law
2015-05-29 13:39 ` Martin Liška
2015-05-27 14:21 ` [PATCH 24/35] Change use to type-based pool allocator in tree-ssa-reassoc.c mliska
2015-05-27 18:15 ` Jeff Law
2015-05-29 13:41 ` Martin Liška
2015-05-27 14:21 ` [PATCH 30/35] Change use to type-based pool allocator in ipa-inline-analysis.c mliska
2015-05-29 14:06 ` Martin Liška
2015-05-27 14:21 ` [PATCH 18/35] Change use to type-based pool allocator in stmt.c mliska
2015-05-27 18:13 ` Jeff Law
2015-05-29 13:39 ` Martin Liška
2015-05-27 14:21 ` [PATCH 26/35] Change use to type-based pool allocator in tree-ssa-strlen.c mliska
2015-05-27 18:17 ` Jeff Law
2015-05-29 13:42 ` Martin Liška
2015-05-27 14:21 ` [PATCH 15/35] Change use to type-based pool allocator in dse.c mliska
2015-05-29 13:38 ` Martin Liška
2015-05-27 14:42 ` [PATCH 22/35] Change use to type-based pool allocator in sched-deps.c mliska
2015-05-27 18:16 ` Jeff Law
2015-05-29 13:40 ` Martin Liška
2015-05-27 14:55 ` [PATCH 17/35] Change use to type-based pool allocator in tree-ssa-math-opts.c mliska
2015-05-27 18:12 ` Jeff Law
2015-05-29 13:39 ` Martin Liška
2015-05-27 14:58 ` [PATCH 33/35] Change use to type-based pool allocator in ira-color.c mliska
2015-05-27 18:24 ` Jeff Law
2015-05-28 11:23 ` Statically-allocated objects with non-trivial ctors (was Re: [PATCH 33/35] Change use to type-based pool allocator in ira-color.c.) David Malcolm
2015-05-28 17:38 ` Jeff Law
2015-05-28 18:30 ` Richard Biener
2015-05-28 18:34 ` Jakub Jelinek
2015-05-28 19:25 ` Martin Liška
2015-05-28 20:42 ` Trevor Saunders
2015-05-29 5:16 ` Trevor Saunders
2015-05-27 15:04 ` [PATCH 13/35] Change use to type-based pool allocator in df-problems.c mliska
2015-05-27 18:05 ` Jeff Law
2015-05-29 13:37 ` Martin Liška
2015-05-27 17:50 ` [PATCH 01/35] Introduce new type-based pool allocator Jeff Law
2015-05-28 13:27 ` Martin Liška
2015-05-28 18:04 ` Jeff Law
2015-05-29 13:33 ` Martin Liška
2015-05-30 5:14 ` Jeff Law
2015-06-02 10:10 ` Andreas Schwab
2015-06-02 13:57 ` Martin Liška
2015-06-02 14:00 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55686CA2.4070509@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).