+2015-06-01 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.
+
2015-06-01 Martin Liska <mliska@suse.cz>
* ipa-cp.c (ipcp_value::add_source): Use new type-based pool allocator.
\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. */
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;
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;
{
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)
{
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;
{
live_range_t p;
- p = (live_range_t) pool_alloc (live_range_pool);
+ p = live_range_pool.allocate ();
*p = *r;
return p;
}
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. */
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;
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. */
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. */
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;
{
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;
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
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. */
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;
{
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;
static void
finish_copy (ira_copy_t cp)
{
- pool_free (copy_pool, cp);
+ copy_pool.remove (cp);
}
FOR_EACH_COPY (cp, ci)
finish_copy (cp);
copy_vec.release ();
- free_alloc_pool (copy_pool);
+ copy_pool.release ();
}
\f