Commit 5c7337c5 by Martin Liska Committed by Martin Liska

Change use to type-based pool allocator in regcprop.c.

	* regcprop.c (free_debug_insn_changes): Use new type-based pool allocator.
	(replace_oldest_value_reg): Likewise.
	(pass_cprop_hardreg::execute): Likewise.

From-SVN: r223961
parent 3599f64a
2015-06-01 Martin Liska <mliska@suse.cz> 2015-06-01 Martin Liska <mliska@suse.cz>
* regcprop.c (free_debug_insn_changes): Use new type-based pool allocator.
(replace_oldest_value_reg): Likewise.
(pass_cprop_hardreg::execute): Likewise.
2015-06-01 Martin Liska <mliska@suse.cz>
* ira-build.c (initiate_cost_vectors): Use new type-based pool allocator. * ira-build.c (initiate_cost_vectors): Use new type-based pool allocator.
(ira_allocate_cost_vector): Likewise. (ira_allocate_cost_vector): Likewise.
(ira_free_cost_vector): Likewise. (ira_free_cost_vector): Likewise.
......
...@@ -62,6 +62,21 @@ struct queued_debug_insn_change ...@@ -62,6 +62,21 @@ struct queued_debug_insn_change
rtx_insn *insn; rtx_insn *insn;
rtx *loc; rtx *loc;
rtx new_rtx; rtx new_rtx;
/* 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 ((queued_debug_insn_change *) ptr);
}
/* Memory allocation pool. */
static pool_allocator<queued_debug_insn_change> pool;
}; };
/* For each register, we have a list of registers that contain the same /* For each register, we have a list of registers that contain the same
...@@ -85,7 +100,9 @@ struct value_data ...@@ -85,7 +100,9 @@ struct value_data
unsigned int n_debug_insn_changes; unsigned int n_debug_insn_changes;
}; };
static alloc_pool debug_insn_changes_pool; pool_allocator<queued_debug_insn_change> queued_debug_insn_change::pool
("debug insn changes pool", 256);
static bool skip_debug_insn_p; static bool skip_debug_insn_p;
static void kill_value_one_regno (unsigned, struct value_data *); static void kill_value_one_regno (unsigned, struct value_data *);
...@@ -124,7 +141,7 @@ free_debug_insn_changes (struct value_data *vd, unsigned int regno) ...@@ -124,7 +141,7 @@ free_debug_insn_changes (struct value_data *vd, unsigned int regno)
{ {
next = cur->next; next = cur->next;
--vd->n_debug_insn_changes; --vd->n_debug_insn_changes;
pool_free (debug_insn_changes_pool, cur); delete cur;
} }
vd->e[regno].debug_insn_changes = NULL; vd->e[regno].debug_insn_changes = NULL;
} }
...@@ -495,8 +512,7 @@ replace_oldest_value_reg (rtx *loc, enum reg_class cl, rtx_insn *insn, ...@@ -495,8 +512,7 @@ replace_oldest_value_reg (rtx *loc, enum reg_class cl, rtx_insn *insn,
fprintf (dump_file, "debug_insn %u: queued replacing reg %u with %u\n", fprintf (dump_file, "debug_insn %u: queued replacing reg %u with %u\n",
INSN_UID (insn), REGNO (*loc), REGNO (new_rtx)); INSN_UID (insn), REGNO (*loc), REGNO (new_rtx));
change = (struct queued_debug_insn_change *) change = new queued_debug_insn_change;
pool_alloc (debug_insn_changes_pool);
change->next = vd->e[REGNO (new_rtx)].debug_insn_changes; change->next = vd->e[REGNO (new_rtx)].debug_insn_changes;
change->insn = insn; change->insn = insn;
change->loc = loc; change->loc = loc;
...@@ -1244,11 +1260,6 @@ pass_cprop_hardreg::execute (function *fun) ...@@ -1244,11 +1260,6 @@ pass_cprop_hardreg::execute (function *fun)
visited = sbitmap_alloc (last_basic_block_for_fn (fun)); visited = sbitmap_alloc (last_basic_block_for_fn (fun));
bitmap_clear (visited); bitmap_clear (visited);
if (MAY_HAVE_DEBUG_INSNS)
debug_insn_changes_pool
= create_alloc_pool ("debug insn changes pool",
sizeof (struct queued_debug_insn_change), 256);
FOR_EACH_BB_FN (bb, fun) FOR_EACH_BB_FN (bb, fun)
{ {
bitmap_set_bit (visited, bb->index); bitmap_set_bit (visited, bb->index);
...@@ -1308,7 +1319,7 @@ pass_cprop_hardreg::execute (function *fun) ...@@ -1308,7 +1319,7 @@ pass_cprop_hardreg::execute (function *fun)
} }
} }
free_alloc_pool (debug_insn_changes_pool); queued_debug_insn_change::pool.release ();
} }
sbitmap_free (visited); sbitmap_free (visited);
......
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