diff options
author | Martin Liska <mliska@suse.cz> | 2015-06-01 14:45:14 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2015-06-01 12:45:14 +0000 |
commit | 973004cbce925b39f2f6953e36afd2202b9868dc (patch) | |
tree | c2d08a3bf8829ed9c5c57d927ed592cd4c88c6cf /gcc/sched-deps.c | |
parent | 5c7337c58f152e35a823cc51228efa4b06c06618 (diff) | |
download | gcc-973004cbce925b39f2f6953e36afd2202b9868dc.zip gcc-973004cbce925b39f2f6953e36afd2202b9868dc.tar.gz gcc-973004cbce925b39f2f6953e36afd2202b9868dc.tar.bz2 |
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.
From-SVN: r223962
Diffstat (limited to 'gcc/sched-deps.c')
-rw-r--r-- | gcc/sched-deps.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index ac41d529..f654311 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; |