aboutsummaryrefslogtreecommitdiff
path: root/gcc/cselib.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cselib.c')
-rw-r--r--gcc/cselib.c46
1 files changed, 15 insertions, 31 deletions
diff --git a/gcc/cselib.c b/gcc/cselib.c
index fc7deab..2149959 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -45,21 +45,6 @@ struct elt_list
{
struct elt_list *next;
cselib_val *elt;
-
- /* 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 ((elt_list *) ptr);
- }
-
- /* Memory allocation pool. */
- static pool_allocator<elt_list> pool;
};
static bool cselib_record_memory;
@@ -261,12 +246,11 @@ static unsigned int cfa_base_preserved_regno = INVALID_REGNUM;
each time memory is invalidated. */
static cselib_val *first_containing_mem = &dummy_val;
-pool_allocator<elt_list> elt_list::pool ("elt_list", 10);
-pool_allocator<elt_loc_list> elt_loc_list::pool ("elt_loc_list", 10);
-pool_allocator<cselib_val> cselib_val::pool ("cselib_val_list", 10);
+static object_allocator<elt_list> elt_list_pool ("elt_list", 10);
+static object_allocator<elt_loc_list> elt_loc_list_pool ("elt_loc_list", 10);
+static object_allocator<cselib_val> cselib_val_pool ("cselib_val_list", 10);
-static pool_allocator<rtx_def> value_pool ("value", 100, RTX_CODE_SIZE (VALUE),
- true);
+static pool_allocator value_pool ("value", 100, RTX_CODE_SIZE (VALUE));
/* If nonnull, cselib will call this function before freeing useless
VALUEs. A VALUE is deemed useless if its "locs" field is null. */
@@ -294,7 +278,7 @@ void (*cselib_record_sets_hook) (rtx_insn *insn, struct cselib_set *sets,
static inline struct elt_list *
new_elt_list (struct elt_list *next, cselib_val *elt)
{
- elt_list *el = new elt_list ();
+ elt_list *el = elt_list_pool.allocate ();
el->next = next;
el->elt = elt;
return el;
@@ -378,14 +362,14 @@ new_elt_loc_list (cselib_val *val, rtx loc)
}
/* Chain LOC back to VAL. */
- el = new elt_loc_list;
+ el = elt_loc_list_pool.allocate ();
el->loc = val->val_rtx;
el->setting_insn = cselib_current_insn;
el->next = NULL;
CSELIB_VAL_PTR (loc)->locs = el;
}
- el = new elt_loc_list;
+ el = elt_loc_list_pool.allocate ();
el->loc = loc;
el->setting_insn = cselib_current_insn;
el->next = next;
@@ -425,7 +409,7 @@ unchain_one_elt_list (struct elt_list **pl)
struct elt_list *l = *pl;
*pl = l->next;
- delete l;
+ elt_list_pool.remove (l);
}
/* Likewise for elt_loc_lists. */
@@ -436,7 +420,7 @@ unchain_one_elt_loc_list (struct elt_loc_list **pl)
struct elt_loc_list *l = *pl;
*pl = l->next;
- delete l;
+ elt_loc_list_pool.remove (l);
}
/* Likewise for cselib_vals. This also frees the addr_list associated with
@@ -448,7 +432,7 @@ unchain_one_value (cselib_val *v)
while (v->addr_list)
unchain_one_elt_list (&v->addr_list);
- delete v;
+ cselib_val_pool.remove (v);
}
/* Remove all entries from the hash table. Also used during
@@ -1311,7 +1295,7 @@ cselib_hash_rtx (rtx x, int create, machine_mode memmode)
static inline cselib_val *
new_cselib_val (unsigned int hash, machine_mode mode, rtx x)
{
- cselib_val *e = new cselib_val;
+ cselib_val *e = cselib_val_pool.allocate ();
gcc_assert (hash);
gcc_assert (next_uid);
@@ -1323,7 +1307,7 @@ new_cselib_val (unsigned int hash, machine_mode mode, rtx x)
precisely when we can have VALUE RTXen (when cselib is active)
so we don't need to put them in garbage collected memory.
??? Why should a VALUE be an RTX in the first place? */
- e->val_rtx = value_pool.allocate ();
+ e->val_rtx = (rtx_def*) value_pool.allocate ();
memset (e->val_rtx, 0, RTX_HDR_SIZE);
PUT_CODE (e->val_rtx, VALUE);
PUT_MODE (e->val_rtx, mode);
@@ -2775,9 +2759,9 @@ cselib_finish (void)
cselib_any_perm_equivs = false;
cfa_base_preserved_val = NULL;
cfa_base_preserved_regno = INVALID_REGNUM;
- elt_list::pool.release ();
- elt_loc_list::pool.release ();
- cselib_val::pool.release ();
+ elt_list_pool.release ();
+ elt_loc_list_pool.release ();
+ cselib_val_pool.release ();
value_pool.release ();
cselib_clear_table ();
delete cselib_hash_table;