/* Offset from start of DECL. */
HOST_WIDE_INT offset;
+
+ /* 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 ((attrs_def *) ptr);
+ }
+
+ /* Memory allocation pool. */
+ static pool_allocator<attrs_def> pool;
} *attrs;
/* Structure for chaining the locations. */
/* Initialized? */
enum var_init_status init;
+
+ /* 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 ((location_chain_def *) ptr);
+ }
+
+ /* Memory allocation pool. */
+ static pool_allocator<location_chain_def> pool;
} *location_chain;
/* A vector of loc_exp_dep holds the active dependencies of a one-part
/* A pointer to the pointer to this entry (head or prev's next) in
the doubly-linked list. */
struct loc_exp_dep_s **pprev;
+
+ /* 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 ((loc_exp_dep_s *) ptr);
+ }
+
+ /* Memory allocation pool. */
+ static pool_allocator<loc_exp_dep_s> pool;
} loc_exp_dep;
/* Actual hash table. */
variable_table_type *htab;
+
+ /* 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 ((shared_hash_def *) ptr);
+ }
+
+ /* Memory allocation pool. */
+ static pool_allocator<shared_hash_def> pool;
} *shared_hash;
/* Structure holding the IN or OUT set for a basic block. */
} *variable_tracking_info;
/* Alloc pool for struct attrs_def. */
-static alloc_pool attrs_pool;
+pool_allocator<attrs_def> attrs_def::pool ("attrs_def pool", 1024);
/* Alloc pool for struct variable_def with MAX_VAR_PARTS entries. */
-static alloc_pool var_pool;
+
+static pool_allocator<variable_def> var_pool
+ ("variable_def pool", 64,
+ (MAX_VAR_PARTS - 1) * sizeof (((variable)NULL)->var_part[0]));
/* Alloc pool for struct variable_def with a single var_part entry. */
-static alloc_pool valvar_pool;
+static pool_allocator<variable_def> valvar_pool
+ ("small variable_def pool", 256);
/* Alloc pool for struct location_chain_def. */
-static alloc_pool loc_chain_pool;
+pool_allocator<location_chain_def> location_chain_def::pool
+ ("location_chain_def pool", 1024);
/* Alloc pool for struct shared_hash_def. */
-static alloc_pool shared_hash_pool;
+pool_allocator<shared_hash_def> shared_hash_def::pool
+ ("shared_hash_def pool", 256);
/* Alloc pool for struct loc_exp_dep_s for NOT_ONEPART variables. */
-static alloc_pool loc_exp_dep_pool;
+pool_allocator<loc_exp_dep> loc_exp_dep::pool ("loc_exp_dep pool", 64);
/* Changed variables, notes will be emitted for them. */
static variable_table_type *changed_variables;
*post += INTVAL (XEXP (src, 1));
else
*post -= INTVAL (XEXP (src, 1));
- return;
+ return;
}
HOST_WIDE_INT res[2] = { 0, 0 };
for_each_inc_dec (pattern, stack_adjust_offset_pre_post_cb, res);
}
/* Return the variable pool to be used for a dv of type ONEPART. */
-static inline alloc_pool
+static inline pool_allocator <variable_def> &
onepart_pool (onepart_enum_t onepart)
{
return onepart ? valvar_pool : var_pool;
for (node = var->var_part[i].loc_chain; node; node = next)
{
next = node->next;
- pool_free (loc_chain_pool, node);
+ delete node;
}
var->var_part[i].loc_chain = NULL;
}
if (var->onepart == ONEPART_DEXPR)
set_dv_changed (var->dv, true);
}
- pool_free (onepart_pool (var->onepart), var);
+ onepart_pool (var->onepart).remove (var);
}
/* Initialize the set (array) SET of attrs to empty lists. */
for (list = *listp; list; list = next)
{
next = list->next;
- pool_free (attrs_pool, list);
+ delete list;
}
*listp = NULL;
}
attrs_list_insert (attrs *listp, decl_or_value dv,
HOST_WIDE_INT offset, rtx loc)
{
- attrs list;
-
- list = (attrs) pool_alloc (attrs_pool);
+ attrs list = new attrs_def;
list->loc = loc;
list->dv = dv;
list->offset = offset;
static void
attrs_list_copy (attrs *dstp, attrs src)
{
- attrs n;
-
attrs_list_clear (dstp);
for (; src; src = src->next)
{
- n = (attrs) pool_alloc (attrs_pool);
+ attrs n = new attrs_def;
n->loc = src->loc;
n->dv = src->dv;
n->offset = src->offset;
static shared_hash
shared_hash_unshare (shared_hash vars)
{
- shared_hash new_vars = (shared_hash) pool_alloc (shared_hash_pool);
+ shared_hash new_vars = new shared_hash_def;
gcc_assert (vars->refcount > 1);
new_vars->refcount = 1;
new_vars->htab = new variable_table_type (vars->htab->elements () + 3);
if (--vars->refcount == 0)
{
delete vars->htab;
- pool_free (shared_hash_pool, vars);
+ delete vars;
}
}
variable new_var;
int i;
- new_var = (variable) pool_alloc (onepart_pool (var->onepart));
+ new_var = onepart_pool (var->onepart).allocate ();
new_var->dv = var->dv;
new_var->refcount = 1;
var->refcount--;
{
location_chain new_lc;
- new_lc = (location_chain) pool_alloc (loc_chain_pool);
+ new_lc = new location_chain_def;
new_lc->next = NULL;
if (node->init > initialized)
new_lc->init = node->init;
if (dv_as_opaque (node->dv) != decl || node->offset != offset)
{
delete_variable_part (set, node->loc, node->dv, node->offset);
- pool_free (attrs_pool, node);
+ delete node;
*nextp = next;
}
else
if (clobber || !dv_onepart_p (node->dv))
{
delete_variable_part (set, node->loc, node->dv, node->offset);
- pool_free (attrs_pool, node);
+ delete node;
*nextp = next;
}
else
{
next = node->next;
delete_variable_part (set, node->loc, node->dv, node->offset);
- pool_free (attrs_pool, node);
+ delete node;
}
*reg = NULL;
}
rtx x;
gcc_checking_assert (GET_CODE (loc) == VALUE);
-
+
bool existed;
rtx *slot = &global_get_addr_cache->get_or_insert (loc, &existed);
if (existed)
location_chain l;
gcc_checking_assert (GET_CODE (loc) == VALUE);
-
+
bool existed;
rtx *slot = &local_get_addr_cache->get_or_insert (loc, &existed);
if (existed)
return *slot;
x = get_addr_from_global_cache (loc);
-
+
/* Tentative, avoiding infinite recursion. */
*slot = x;
if (VAR_LOC_1PAUX (var))
VAR_LOC_FROM (var) = NULL;
}
- pool_free (loc_chain_pool, loc);
+ delete loc;
}
if (!var->var_part[0].loc_chain)
if (var->onepart == ONEPART_VALUE)
{
rtx x = dv_as_value (dv);
-
+
/* Relationships in the global cache don't change, so reset the
local cache entry only. */
rtx *slot = local_get_addr_cache->get (x);
goto restart_onepart_unshared;
}
- *nodep = nnode = (location_chain) pool_alloc (loc_chain_pool);
+ *nodep = nnode = new location_chain_def;
nnode->loc = snode->loc;
nnode->init = snode->init;
if (!snode->set_src || MEM_P (snode->set_src))
location_chain new_node;
/* Copy the location from SRC. */
- new_node = (location_chain) pool_alloc (loc_chain_pool);
+ new_node = new location_chain_def;
new_node->loc = node->loc;
new_node->init = node->init;
if (!node->set_src || MEM_P (node->set_src))
location_chain new_node;
/* Copy the location from SRC. */
- new_node = (location_chain) pool_alloc (loc_chain_pool);
+ new_node = new location_chain_def;
new_node->loc = node->loc;
new_node->init = node->init;
if (!node->set_src || MEM_P (node->set_src))
{
location_chain new_lc;
- new_lc = (location_chain) pool_alloc (loc_chain_pool);
+ new_lc = new location_chain_def;
new_lc->next = NULL;
new_lc->init = node->init;
if (!node->set_src || MEM_P (node->set_src))
else if (r > 0)
break;
- node = (location_chain) pool_alloc (loc_chain_pool);
+ node = new location_chain_def;
node->loc = loc;
node->set_src = NULL;
if (dv_as_opaque (list->dv) == dv_as_opaque (cdv))
{
*listp = list->next;
- pool_free (attrs_pool, list);
+ delete list;
list = *listp;
break;
}
if (dv_as_opaque (list->dv) == dv_as_opaque (dv))
{
*listp = list->next;
- pool_free (attrs_pool, list);
+ delete list;
list = *listp;
break;
}
{
if (node)
{
- dvar = (variable) pool_alloc (onepart_pool (onepart));
+ dvar = onepart_pool (onepart).allocate ();
dvar->dv = dv;
dvar->refcount = 1;
dvar->n_var_parts = 1;
INSERT);
if (!*slot)
{
- variable var = (variable) pool_alloc (onepart_pool
- (ONEPART_VALUE));
+ variable var = onepart_pool (ONEPART_VALUE).allocate ();
var->dv = dv;
var->refcount = 1;
var->n_var_parts = 1;
dataflow_set_init (dst);
dst->stack_adjust = cur.stack_adjust;
shared_hash_destroy (dst->vars);
- dst->vars = (shared_hash) pool_alloc (shared_hash_pool);
+ dst->vars = new shared_hash_def;
dst->vars->refcount = 1;
dst->vars->htab = new variable_table_type (MAX (src1_elems, src2_elems));
{
/* Remove duplicate value node. */
*nodep = node->next;
- pool_free (loc_chain_pool, node);
+ delete node;
continue;
}
else
to be added when we bring perm in. */
att = *curp;
*curp = att->next;
- pool_free (attrs_pool, att);
+ delete att;
}
}
}
}
*locp = loc->next;
- pool_free (loc_chain_pool, loc);
+ delete loc;
}
if (!var->var_part[0].loc_chain)
if (VAR_LOC_1PAUX (var))
VAR_LOC_FROM (var) = NULL;
}
- pool_free (loc_chain_pool, loc);
+ delete loc;
}
if (!var->var_part[0].loc_chain)
gcc_checking_assert (onepart == ONEPART_VALUE || onepart == ONEPART_DEXPR);
- empty_var = (variable) pool_alloc (onepart_pool (onepart));
+ empty_var = onepart_pool (onepart).allocate ();
empty_var->dv = dv;
empty_var->refcount = 1;
empty_var->n_var_parts = 0;
if (!empty_var)
{
- empty_var = (variable) pool_alloc (onepart_pool (onepart));
+ empty_var = onepart_pool (onepart).allocate ();
empty_var->dv = var->dv;
empty_var->refcount = 1;
empty_var->n_var_parts = 0;
if (!var)
{
/* Create new variable information. */
- var = (variable) pool_alloc (onepart_pool (onepart));
+ var = onepart_pool (onepart).allocate ();
var->dv = dv;
var->refcount = 1;
var->n_var_parts = 1;
set_src = node->set_src;
if (var->var_part[pos].cur_loc == node->loc)
var->var_part[pos].cur_loc = NULL;
- pool_free (loc_chain_pool, node);
+ delete node;
*nextp = next;
break;
}
}
/* Add the location to the beginning. */
- node = (location_chain) pool_alloc (loc_chain_pool);
+ node = new location_chain_def;
node->loc = loc;
node->init = initialized;
node->set_src = set_src;
if (dv_as_opaque (anode->dv) == dv_as_opaque (var->dv)
&& anode->offset == offset)
{
- pool_free (attrs_pool, anode);
+ delete anode;
*anextp = anext;
}
else
if (pos == 0 && var->onepart && VAR_LOC_1PAUX (var))
VAR_LOC_FROM (var) = NULL;
}
- pool_free (loc_chain_pool, node);
+ delete node;
*nextp = next;
break;
}
return;
if (var->onepart == NOT_ONEPART)
- led = (loc_exp_dep *) pool_alloc (loc_exp_dep_pool);
+ led = new loc_exp_dep;
else
{
loc_exp_dep empty;
break;
case NOT_ONEPART:
- pool_free (loc_exp_dep_pool, led);
+ delete led;
ivar = htab->find_with_hash (ldv, dv_htab_hash (ldv));
if (ivar)
{
if (!empty_var)
{
- empty_var = (variable) pool_alloc (onepart_pool (old_var->onepart));
+ empty_var = onepart_pool (old_var->onepart).allocate ();
empty_var->dv = old_var->dv;
empty_var->refcount = 0;
empty_var->n_var_parts = 0;
if (MAY_HAVE_DEBUG_INSNS)
{
dropped_values = new variable_table_type (cselib_get_next_uid () * 2);
- loc_exp_dep_pool = create_alloc_pool ("loc_exp_dep pool",
- sizeof (loc_exp_dep), 64);
}
dataflow_set_init (&cur);
alloc_aux_for_blocks (sizeof (struct variable_tracking_info_def));
- attrs_pool = create_alloc_pool ("attrs_def pool",
- sizeof (struct attrs_def), 1024);
- var_pool = create_alloc_pool ("variable_def pool",
- sizeof (struct variable_def)
- + (MAX_VAR_PARTS - 1)
- * sizeof (((variable)NULL)->var_part[0]), 64);
- loc_chain_pool = create_alloc_pool ("location_chain_def pool",
- sizeof (struct location_chain_def),
- 1024);
- shared_hash_pool = create_alloc_pool ("shared_hash_def pool",
- sizeof (struct shared_hash_def), 256);
- empty_shared_hash = (shared_hash) pool_alloc (shared_hash_pool);
+ empty_shared_hash = new shared_hash_def;
empty_shared_hash->refcount = 1;
empty_shared_hash->htab = new variable_table_type (1);
changed_variables = new variable_table_type (10);
{
cselib_init (CSELIB_RECORD_MEMORY | CSELIB_PRESERVE_CONSTANTS);
scratch_regs = BITMAP_ALLOC (NULL);
- valvar_pool = create_alloc_pool ("small variable_def pool",
- sizeof (struct variable_def), 256);
preserved_values.create (256);
global_get_addr_cache = new hash_map<rtx, rtx>;
}
else
{
scratch_regs = NULL;
- valvar_pool = NULL;
global_get_addr_cache = NULL;
}
empty_shared_hash->htab = NULL;
delete changed_variables;
changed_variables = NULL;
- free_alloc_pool (attrs_pool);
- free_alloc_pool (var_pool);
- free_alloc_pool (loc_chain_pool);
- free_alloc_pool (shared_hash_pool);
+ attrs_def::pool.release ();
+ var_pool.release ();
+ location_chain_def::pool.release ();
+ shared_hash_def::pool.release ();
if (MAY_HAVE_DEBUG_INSNS)
{
if (global_get_addr_cache)
delete global_get_addr_cache;
global_get_addr_cache = NULL;
- if (loc_exp_dep_pool)
- free_alloc_pool (loc_exp_dep_pool);
- loc_exp_dep_pool = NULL;
- free_alloc_pool (valvar_pool);
+ loc_exp_dep::pool.release ();
+ valvar_pool.release ();
preserved_values.release ();
cselib_finish ();
BITMAP_FREE (scratch_regs);