+2015-06-01 Martin Liska <mliska@suse.cz>
+
+ * lra-lives.c (free_live_range): Use new type-based pool allocator.
+ (free_live_range_list) Likewise.
+ (create_live_range) Likewise.
+ (copy_live_range) Likewise.
+ (lra_merge_live_ranges) Likewise.
+ (remove_some_program_points_and_update_live_ranges) Likewise.
+ (lra_live_ranges_init) Likewise.
+ (lra_live_ranges_finish) Likewise.
+
2015-06-01 Martin Liska <mliska@suse.cz>
* et-forest.c (et_new_occ): Use new type-based pool allocator.
lra_live_range_t next;
/* Pointer to structures with the same start. */
lra_live_range_t start_next;
+
+ /* Pool allocation new operator. */
+ inline void *operator new (size_t)
+ {
+ return pool.allocate ();
+ }
+
+ /* Delete operator utilizing pool allocation. */
+ inline void operator delete (void *ptr)
+ {
+ pool.remove ((lra_live_range *) ptr);
+ }
+
+ /* Memory allocation pool. */
+ static pool_allocator<lra_live_range> pool;
};
typedef struct lra_copy *lra_copy_t;
static bitmap_head temp_bitmap;
/* Pool for pseudo live ranges. */
-static alloc_pool live_range_pool;
-
-/* Free live range LR. */
-static void
-free_live_range (lra_live_range_t lr)
-{
- pool_free (live_range_pool, lr);
-}
+pool_allocator <lra_live_range> lra_live_range::pool ("live ranges", 100);
/* Free live range list LR. */
static void
while (lr != NULL)
{
next = lr->next;
- free_live_range (lr);
+ delete lr;
lr = next;
}
}
static lra_live_range_t
create_live_range (int regno, int start, int finish, lra_live_range_t next)
{
- lra_live_range_t p;
-
- p = (lra_live_range_t) pool_alloc (live_range_pool);
+ lra_live_range_t p = new lra_live_range;
p->regno = regno;
p->start = start;
p->finish = finish;
static lra_live_range_t
copy_live_range (lra_live_range_t r)
{
- lra_live_range_t p;
-
- p = (lra_live_range_t) pool_alloc (live_range_pool);
- *p = *r;
- return p;
+ return new lra_live_range (*r);
}
/* Copy live range list given by its head R and return the result. */
r1->start = r2->start;
lra_live_range_t temp = r2;
r2 = r2->next;
- pool_free (live_range_pool, temp);
+ delete temp;
}
else
{
basic_block dest = e->dest;
bitmap bb_liveout = df_get_live_out (bb);
bitmap dest_livein = df_get_live_in (dest);
-
+
return bitmap_ior_and_compl_into (bb_liveout,
dest_livein, &all_hard_regs_bitmap);
}
if (sparseset_bit_p (pseudos_live_through_calls, j))
check_pseudos_live_through_calls (j);
}
-
+
if (need_curr_point_incr)
next_program_point (curr_point, freq);
}
prev_r->start = r->start;
prev_r->next = next_r;
- free_live_range (r);
+ delete r;
}
}
}
}
}
lra_free_copies ();
-
+
/* Under some circumstances, we can have functions without pseudo
registers. For such functions, lra_live_max_point will be 0,
see e.g. PR55604, and there's nothing more to do for us here. */
void
lra_live_ranges_init (void)
{
- live_range_pool = create_alloc_pool ("live ranges",
- sizeof (struct lra_live_range), 100);
bitmap_initialize (&temp_bitmap, ®_obstack);
initiate_live_solver ();
}
{
finish_live_solver ();
bitmap_clear (&temp_bitmap);
- free_alloc_pool (live_range_pool);
+ lra_live_range::pool.release ();
}