* [patch] Don't allocate df_link objects in the df_chain basic block pool
@ 2008-06-28 13:15 Steven Bosscher
2008-06-28 17:26 ` Kenneth Zadeck
0 siblings, 1 reply; 2+ messages in thread
From: Steven Bosscher @ 2008-06-28 13:15 UTC (permalink / raw)
To: gcc-patches, Kenneth Zadeck
[-- Attachment #1: Type: text/plain, Size: 617 bytes --]
Hi,
The df_chain problem currently has no basic block specific data.
Every df problem has an alloc pool for the problem-specific basic
block data, but df_chain allocates df_link objects there. On the
rtl-fud-branch, the df_chain problem does have problem-specific basic
block data, which holds the PHI nodes for the basic block. So we have
to allocate df_link objects from another pool, which I've hung from
df_chain->problem_data in the attached patch.
Bootstrapped&tested (trunk and rtl-fud-branch) on ia64-unknown-linux-gnu.
I will commit this on the rtl-fud branch. Is this OK for the trunk too?
Gr.
Steven
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: df_chain_link_pool.diff --]
[-- Type: text/x-patch; name=df_chain_link_pool.diff, Size: 4612 bytes --]
* df-problems.c (struct df_chain_problem_data): New struct with
an alloc pool for df_link objects.
(df_chain_create): Allocate links in the new pool.
(df_chain_unlink_1): Free links from the new pool.
(df_chain_unlink): Likewise.
(df_chain_remove_problem): Free df_chain->problem_data and
everything in it.
(df_chain_free): Likewise.
(df_chain_alloc): Allocate df_chain->problem data and the alloc
pool for df_link objects.
Index: df-problems.c
===================================================================
--- df-problems.c (revision 137206)
+++ df-problems.c (working copy)
@@ -1855,15 +1855,26 @@ df_live_verify_transfer_functions (void)
#define df_chain_problem_p(FLAG) (((enum df_chain_flags)df_chain->local_flags)&(FLAG))
+/* Private data used for the CHAIN problem. */
+struct df_chain_problem_data
+{
+ /* An alloc pool for df_link objects. */
+ alloc_pool df_link_pool;
+};
+
/* Create a du or ud chain from SRC to DST and link it into SRC. */
struct df_link *
df_chain_create (struct df_ref *src, struct df_ref *dst)
{
+ struct df_chain_problem_data *problem_data;
struct df_link *head = DF_REF_CHAIN (src);
- struct df_link *link = (struct df_link *) pool_alloc (df_chain->block_pool);
-
+ struct df_link *link;
+
+ problem_data = (struct df_chain_problem_data *) df_chain->problem_data;
+ link = (struct df_link *) pool_alloc (problem_data->df_link_pool);
DF_REF_CHAIN (src) = link;
+
link->next = head;
link->ref = dst;
return link;
@@ -1875,9 +1886,11 @@ df_chain_create (struct df_ref *src, str
static void
df_chain_unlink_1 (struct df_ref *ref, struct df_ref *target)
{
+ struct df_chain_problem_data *problem_data;
struct df_link *chain = DF_REF_CHAIN (ref);
struct df_link *prev = NULL;
+ problem_data = (struct df_chain_problem_data *) df_chain->problem_data;
while (chain)
{
if (chain->ref == target)
@@ -1886,7 +1899,7 @@ df_chain_unlink_1 (struct df_ref *ref, s
prev->next = chain->next;
else
DF_REF_CHAIN (ref) = chain->next;
- pool_free (df_chain->block_pool, chain);
+ pool_free (problem_data->df_link_pool, chain);
return;
}
prev = chain;
@@ -1900,13 +1913,16 @@ df_chain_unlink_1 (struct df_ref *ref, s
void
df_chain_unlink (struct df_ref *ref)
{
+ struct df_chain_problem_data *problem_data;
struct df_link *chain = DF_REF_CHAIN (ref);
+
+ problem_data = (struct df_chain_problem_data *) df_chain->problem_data;
while (chain)
{
struct df_link *next = chain->next;
/* Delete the other side if it exists. */
df_chain_unlink_1 (chain->ref, ref);
- pool_free (df_chain->block_pool, chain);
+ pool_free (problem_data->df_link_pool, chain);
chain = next;
}
DF_REF_CHAIN (ref) = NULL;
@@ -1933,12 +1949,20 @@ df_chain_copy (struct df_ref *to_ref,
static void
df_chain_remove_problem (void)
{
+ struct df_chain_problem_data *problem_data;
bitmap_iterator bi;
unsigned int bb_index;
+ problem_data = (struct df_chain_problem_data *) df_chain->problem_data;
+
/* Wholesale destruction of the old chains. */
- if (df_chain->block_pool)
- free_alloc_pool (df_chain->block_pool);
+ if (problem_data)
+ {
+ free_alloc_pool (problem_data->df_link_pool);
+ problem_data->df_link_pool = NULL;
+ free (df_chain->problem_data);
+ }
+ df_chain->problem_data = NULL;
EXECUTE_IF_SET_IN_BITMAP (df_chain->out_of_date_transfer_functions, 0, bb_index, bi)
{
@@ -1995,9 +2019,16 @@ df_chain_fully_remove_problem (void)
static void
df_chain_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
{
+ struct df_chain_problem_data *problem_data;
+
df_chain_remove_problem ();
- df_chain->block_pool = create_alloc_pool ("df_chain_block pool",
- sizeof (struct df_link), 50);
+
+ df_chain->block_pool = NULL;
+ problem_data = XNEW (struct df_chain_problem_data);
+ df_chain->problem_data = problem_data;
+ problem_data->df_link_pool = create_alloc_pool ("df_chain link pool",
+ sizeof (struct df_link), 50);
+
df_chain->optional_p = true;
}
@@ -2169,7 +2200,15 @@ df_chain_finalize (bitmap all_blocks)
static void
df_chain_free (void)
{
- free_alloc_pool (df_chain->block_pool);
+ struct df_chain_problem_data *problem_data;
+
+ problem_data = (struct df_chain_problem_data *) df_chain->problem_data;
+ if (problem_data)
+ {
+ free_alloc_pool (problem_data->df_link_pool);
+ problem_data->df_link_pool = NULL;
+ free (df_chain->problem_data);
+ }
BITMAP_FREE (df_chain->out_of_date_transfer_functions);
free (df_chain);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] Don't allocate df_link objects in the df_chain basic block pool
2008-06-28 13:15 [patch] Don't allocate df_link objects in the df_chain basic block pool Steven Bosscher
@ 2008-06-28 17:26 ` Kenneth Zadeck
0 siblings, 0 replies; 2+ messages in thread
From: Kenneth Zadeck @ 2008-06-28 17:26 UTC (permalink / raw)
To: Steven Bosscher; +Cc: gcc-patches
Steven Bosscher wrote:
> Hi,
>
> The df_chain problem currently has no basic block specific data.
> Every df problem has an alloc pool for the problem-specific basic
> block data, but df_chain allocates df_link objects there. On the
> rtl-fud-branch, the df_chain problem does have problem-specific basic
> block data, which holds the PHI nodes for the basic block. So we have
> to allocate df_link objects from another pool, which I've hung from
> df_chain->problem_data in the attached patch.
>
> Bootstrapped&tested (trunk and rtl-fud-branch) on ia64-unknown-linux-gnu.
> I will commit this on the rtl-fud branch. Is this OK for the trunk too?
>
> Gr.
> Steven
>
this is fine for trunk.
kenny
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-28 17:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-28 13:15 [patch] Don't allocate df_link objects in the df_chain basic block pool Steven Bosscher
2008-06-28 17:26 ` Kenneth Zadeck
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).