+2015-06-01 Martin Liska <mliska@suse.cz>
+
+ * 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.
+
2015-06-01 Martin Liska <mliska@suse.cz>
* regcprop.c (free_debug_insn_changes): Use new type-based pool allocator.
}
/* 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;
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);
--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;
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;
--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.
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. */
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;