summaryrefslogtreecommitdiff
path: root/gcc/sched-deps.c
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-01 12:45:14 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-01 12:45:14 +0000
commit3da86c6b1a6e1ad506026fb40733c918ffe92a56 (patch)
treec2d08a3bf8829ed9c5c57d927ed592cd4c88c6cf /gcc/sched-deps.c
parentfe4549c40bf679db88478cf11277e0545bc00add (diff)
downloadgcc-3da86c6b1a6e1ad506026fb40733c918ffe92a56.tar.gz
Change use to type-based pool allocator in
* sched-deps.c (create_dep_node): Use new type-based pool allocator. (delete_dep_node): Likewise. (create_deps_list): Likewise. (free_deps_list): Likewise. (sched_deps_init): Likewise. (sched_deps_finish): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223962 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sched-deps.c')
-rw-r--r--gcc/sched-deps.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index ac41d529814..f65431116f1 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -334,7 +334,7 @@ dep_link_is_detached_p (dep_link_t link)
}
/* Pool to hold all dependency nodes (dep_node_t). */
-static alloc_pool dn_pool;
+static pool_allocator<_dep_node> *dn_pool;
/* Number of dep_nodes out there. */
static int dn_pool_diff = 0;
@@ -343,7 +343,7 @@ static int dn_pool_diff = 0;
static dep_node_t
create_dep_node (void)
{
- dep_node_t n = (dep_node_t) pool_alloc (dn_pool);
+ dep_node_t n = dn_pool->allocate ();
dep_link_t back = DEP_NODE_BACK (n);
dep_link_t forw = DEP_NODE_FORW (n);
@@ -371,11 +371,11 @@ delete_dep_node (dep_node_t n)
--dn_pool_diff;
- pool_free (dn_pool, n);
+ dn_pool->remove (n);
}
/* Pool to hold dependencies lists (deps_list_t). */
-static alloc_pool dl_pool;
+static pool_allocator<_deps_list> *dl_pool;
/* Number of deps_lists out there. */
static int dl_pool_diff = 0;
@@ -393,7 +393,7 @@ deps_list_empty_p (deps_list_t l)
static deps_list_t
create_deps_list (void)
{
- deps_list_t l = (deps_list_t) pool_alloc (dl_pool);
+ deps_list_t l = dl_pool->allocate ();
DEPS_LIST_FIRST (l) = NULL;
DEPS_LIST_N_LINKS (l) = 0;
@@ -410,7 +410,7 @@ free_deps_list (deps_list_t l)
--dl_pool_diff;
- pool_free (dl_pool, l);
+ dl_pool->remove (l);
}
/* Return true if there is no dep_nodes and deps_lists out there.
@@ -4075,10 +4075,10 @@ sched_deps_init (bool global_p)
if (global_p)
{
- dl_pool = create_alloc_pool ("deps_list", sizeof (struct _deps_list),
+ dl_pool = new pool_allocator<_deps_list> ("deps_list",
/* Allocate lists for one block at a time. */
insns_in_block);
- dn_pool = create_alloc_pool ("dep_node", sizeof (struct _dep_node),
+ dn_pool = new pool_allocator<_dep_node> ("dep_node",
/* Allocate nodes for one block at a time.
We assume that average insn has
5 producers. */
@@ -4128,9 +4128,10 @@ void
sched_deps_finish (void)
{
gcc_assert (deps_pools_are_empty_p ());
- free_alloc_pool_if_empty (&dn_pool);
- free_alloc_pool_if_empty (&dl_pool);
- gcc_assert (dn_pool == NULL && dl_pool == NULL);
+ dn_pool->release_if_empty ();
+ dn_pool = NULL;
+ dl_pool->release_if_empty ();
+ dl_pool = NULL;
h_d_i_d.release ();
cache_size = 0;