Commit cb8abb1c by Martin Liska Committed by Martin Liska

Change use to type-based pool allocator in lra-lives.c.

	* 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.

From-SVN: r223944
parent 64afff5b
2015-06-01 Martin Liska <mliska@suse.cz> 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. * et-forest.c (et_new_occ): Use new type-based pool allocator.
(et_new_tree): Likewise. (et_new_tree): Likewise.
(et_free_tree): Likewise. (et_free_tree): Likewise.
......
...@@ -84,6 +84,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -84,6 +84,7 @@ along with GCC; see the file COPYING3. If not see
#include "except.h" #include "except.h"
#include "timevar.h" #include "timevar.h"
#include "ira.h" #include "ira.h"
#include "alloc-pool.h"
#include "lra-int.h" #include "lra-int.h"
#include "df.h" #include "df.h"
......
...@@ -54,6 +54,21 @@ struct lra_live_range ...@@ -54,6 +54,21 @@ struct lra_live_range
lra_live_range_t next; lra_live_range_t next;
/* Pointer to structures with the same start. */ /* Pointer to structures with the same start. */
lra_live_range_t start_next; 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; typedef struct lra_copy *lra_copy_t;
......
...@@ -121,14 +121,7 @@ static sparseset unused_set, dead_set; ...@@ -121,14 +121,7 @@ static sparseset unused_set, dead_set;
static bitmap_head temp_bitmap; static bitmap_head temp_bitmap;
/* Pool for pseudo live ranges. */ /* Pool for pseudo live ranges. */
static alloc_pool live_range_pool; pool_allocator <lra_live_range> lra_live_range::pool ("live ranges", 100);
/* Free live range LR. */
static void
free_live_range (lra_live_range_t lr)
{
pool_free (live_range_pool, lr);
}
/* Free live range list LR. */ /* Free live range list LR. */
static void static void
...@@ -139,7 +132,7 @@ free_live_range_list (lra_live_range_t lr) ...@@ -139,7 +132,7 @@ free_live_range_list (lra_live_range_t lr)
while (lr != NULL) while (lr != NULL)
{ {
next = lr->next; next = lr->next;
free_live_range (lr); delete lr;
lr = next; lr = next;
} }
} }
...@@ -148,9 +141,7 @@ free_live_range_list (lra_live_range_t lr) ...@@ -148,9 +141,7 @@ free_live_range_list (lra_live_range_t lr)
static lra_live_range_t static lra_live_range_t
create_live_range (int regno, int start, int finish, lra_live_range_t next) create_live_range (int regno, int start, int finish, lra_live_range_t next)
{ {
lra_live_range_t p; lra_live_range_t p = new lra_live_range;
p = (lra_live_range_t) pool_alloc (live_range_pool);
p->regno = regno; p->regno = regno;
p->start = start; p->start = start;
p->finish = finish; p->finish = finish;
...@@ -162,11 +153,7 @@ create_live_range (int regno, int start, int finish, lra_live_range_t next) ...@@ -162,11 +153,7 @@ create_live_range (int regno, int start, int finish, lra_live_range_t next)
static lra_live_range_t static lra_live_range_t
copy_live_range (lra_live_range_t r) copy_live_range (lra_live_range_t r)
{ {
lra_live_range_t p; return new lra_live_range (*r);
p = (lra_live_range_t) pool_alloc (live_range_pool);
*p = *r;
return p;
} }
/* Copy live range list given by its head R and return the result. */ /* Copy live range list given by its head R and return the result. */
...@@ -209,7 +196,7 @@ lra_merge_live_ranges (lra_live_range_t r1, lra_live_range_t r2) ...@@ -209,7 +196,7 @@ lra_merge_live_ranges (lra_live_range_t r1, lra_live_range_t r2)
r1->start = r2->start; r1->start = r2->start;
lra_live_range_t temp = r2; lra_live_range_t temp = r2;
r2 = r2->next; r2 = r2->next;
pool_free (live_range_pool, temp); delete temp;
} }
else else
{ {
...@@ -480,7 +467,7 @@ live_con_fun_n (edge e) ...@@ -480,7 +467,7 @@ live_con_fun_n (edge e)
basic_block dest = e->dest; basic_block dest = e->dest;
bitmap bb_liveout = df_get_live_out (bb); bitmap bb_liveout = df_get_live_out (bb);
bitmap dest_livein = df_get_live_in (dest); bitmap dest_livein = df_get_live_in (dest);
return bitmap_ior_and_compl_into (bb_liveout, return bitmap_ior_and_compl_into (bb_liveout,
dest_livein, &all_hard_regs_bitmap); dest_livein, &all_hard_regs_bitmap);
} }
...@@ -1024,7 +1011,7 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p) ...@@ -1024,7 +1011,7 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p)
if (sparseset_bit_p (pseudos_live_through_calls, j)) if (sparseset_bit_p (pseudos_live_through_calls, j))
check_pseudos_live_through_calls (j); check_pseudos_live_through_calls (j);
} }
if (need_curr_point_incr) if (need_curr_point_incr)
next_program_point (curr_point, freq); next_program_point (curr_point, freq);
...@@ -1109,7 +1096,7 @@ remove_some_program_points_and_update_live_ranges (void) ...@@ -1109,7 +1096,7 @@ remove_some_program_points_and_update_live_ranges (void)
} }
prev_r->start = r->start; prev_r->start = r->start;
prev_r->next = next_r; prev_r->next = next_r;
free_live_range (r); delete r;
} }
} }
} }
...@@ -1252,7 +1239,7 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p) ...@@ -1252,7 +1239,7 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
} }
} }
lra_free_copies (); lra_free_copies ();
/* Under some circumstances, we can have functions without pseudo /* Under some circumstances, we can have functions without pseudo
registers. For such functions, lra_live_max_point will be 0, 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. */ see e.g. PR55604, and there's nothing more to do for us here. */
...@@ -1380,8 +1367,6 @@ lra_clear_live_ranges (void) ...@@ -1380,8 +1367,6 @@ lra_clear_live_ranges (void)
void void
lra_live_ranges_init (void) lra_live_ranges_init (void)
{ {
live_range_pool = create_alloc_pool ("live ranges",
sizeof (struct lra_live_range), 100);
bitmap_initialize (&temp_bitmap, &reg_obstack); bitmap_initialize (&temp_bitmap, &reg_obstack);
initiate_live_solver (); initiate_live_solver ();
} }
...@@ -1392,5 +1377,5 @@ lra_live_ranges_finish (void) ...@@ -1392,5 +1377,5 @@ lra_live_ranges_finish (void)
{ {
finish_live_solver (); finish_live_solver ();
bitmap_clear (&temp_bitmap); bitmap_clear (&temp_bitmap);
free_alloc_pool (live_range_pool); lra_live_range::pool.release ();
} }
...@@ -98,6 +98,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -98,6 +98,7 @@ along with GCC; see the file COPYING3. If not see
#include "except.h" #include "except.h"
#include "timevar.h" #include "timevar.h"
#include "target.h" #include "target.h"
#include "alloc-pool.h"
#include "lra-int.h" #include "lra-int.h"
#include "ira.h" #include "ira.h"
#include "df.h" #include "df.h"
......
...@@ -149,6 +149,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -149,6 +149,7 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h" #include "timevar.h"
#include "target.h" #include "target.h"
#include "ira.h" #include "ira.h"
#include "alloc-pool.h"
#include "lra-int.h" #include "lra-int.h"
#include "df.h" #include "df.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment