aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/lra-coalesce.c1
-rw-r--r--gcc/lra-int.h15
-rw-r--r--gcc/lra-lives.c35
-rw-r--r--gcc/lra-spills.c1
-rw-r--r--gcc/lra.c1
6 files changed, 39 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9a2ec6c..be5ce2a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,16 @@
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_new_tree): Likewise.
(et_free_tree): Likewise.
diff --git a/gcc/lra-coalesce.c b/gcc/lra-coalesce.c
index 045691d..b385603 100644
--- a/gcc/lra-coalesce.c
+++ b/gcc/lra-coalesce.c
@@ -84,6 +84,7 @@ along with GCC; see the file COPYING3. If not see
#include "except.h"
#include "timevar.h"
#include "ira.h"
+#include "alloc-pool.h"
#include "lra-int.h"
#include "df.h"
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index 12923ee..42e4a54 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -54,6 +54,21 @@ struct lra_live_range
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;
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 085411e..4dfe30f 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -121,14 +121,7 @@ static sparseset unused_set, dead_set;
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
@@ -139,7 +132,7 @@ free_live_range_list (lra_live_range_t lr)
while (lr != NULL)
{
next = lr->next;
- free_live_range (lr);
+ delete lr;
lr = next;
}
}
@@ -148,9 +141,7 @@ free_live_range_list (lra_live_range_t lr)
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;
@@ -162,11 +153,7 @@ create_live_range (int regno, int start, int finish, lra_live_range_t next)
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. */
@@ -209,7 +196,7 @@ lra_merge_live_ranges (lra_live_range_t r1, lra_live_range_t r2)
r1->start = r2->start;
lra_live_range_t temp = r2;
r2 = r2->next;
- pool_free (live_range_pool, temp);
+ delete temp;
}
else
{
@@ -480,7 +467,7 @@ live_con_fun_n (edge e)
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);
}
@@ -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))
check_pseudos_live_through_calls (j);
}
-
+
if (need_curr_point_incr)
next_program_point (curr_point, freq);
@@ -1109,7 +1096,7 @@ remove_some_program_points_and_update_live_ranges (void)
}
prev_r->start = r->start;
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)
}
}
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. */
@@ -1380,8 +1367,6 @@ lra_clear_live_ranges (void)
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);
initiate_live_solver ();
}
@@ -1392,5 +1377,5 @@ lra_live_ranges_finish (void)
{
finish_live_solver ();
bitmap_clear (&temp_bitmap);
- free_alloc_pool (live_range_pool);
+ lra_live_range::pool.release ();
}
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index 19ece20..caece9a 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -98,6 +98,7 @@ along with GCC; see the file COPYING3. If not see
#include "except.h"
#include "timevar.h"
#include "target.h"
+#include "alloc-pool.h"
#include "lra-int.h"
#include "ira.h"
#include "df.h"
diff --git a/gcc/lra.c b/gcc/lra.c
index 7c33636..7440668 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -149,6 +149,7 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "target.h"
#include "ira.h"
+#include "alloc-pool.h"
#include "lra-int.h"
#include "df.h"