aboutsummaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2015-06-01 14:43:16 +0200
committerMartin Liska <marxin@gcc.gnu.org>2015-06-01 12:43:16 +0000
commit5f8446975976236285093df11f5c6318b3cea58c (patch)
treec6bf566c20e860c8ca8fe05a536cbf1c008ff753 /gcc/stmt.c
parent2cc777fbf4b866db1477f25e06358b1de7fb3500 (diff)
downloadgcc-5f8446975976236285093df11f5c6318b3cea58c.zip
gcc-5f8446975976236285093df11f5c6318b3cea58c.tar.gz
gcc-5f8446975976236285093df11f5c6318b3cea58c.tar.bz2
Change use to type-based pool allocator in stmt.c.
* stmt.c (add_case_node): Use new type-based pool allocator. (expand_case): Likewise. (expand_sjlj_dispatch_table): Likewise. From-SVN: r223958
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 303df72..a04f69b 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -748,7 +748,7 @@ do_jump_if_equal (machine_mode mode, rtx op0, rtx op1, rtx_code_label *label,
static struct case_node *
add_case_node (struct case_node *head, tree low, tree high,
- tree label, int prob, alloc_pool case_node_pool)
+ tree label, int prob, pool_allocator<case_node> &case_node_pool)
{
struct case_node *r;
@@ -756,7 +756,7 @@ add_case_node (struct case_node *head, tree low, tree high,
gcc_checking_assert (high && (TREE_TYPE (low) == TREE_TYPE (high)));
/* Add this label to the chain. */
- r = (struct case_node *) pool_alloc (case_node_pool);
+ r = case_node_pool.allocate ();
r->low = low;
r->high = high;
r->code_label = label;
@@ -1160,7 +1160,7 @@ expand_case (gswitch *stmt)
struct case_node *case_list = 0;
/* A pool for case nodes. */
- alloc_pool case_node_pool;
+ pool_allocator<case_node> case_node_pool ("struct case_node pool", 100);
/* An ERROR_MARK occurs for various reasons including invalid data type.
??? Can this still happen, with GIMPLE and all? */
@@ -1171,9 +1171,6 @@ expand_case (gswitch *stmt)
expressions being INTEGER_CST. */
gcc_assert (TREE_CODE (index_expr) != INTEGER_CST);
- case_node_pool = create_alloc_pool ("struct case_node pool",
- sizeof (struct case_node),
- 100);
do_pending_stack_adjust ();
@@ -1273,7 +1270,6 @@ expand_case (gswitch *stmt)
reorder_insns (NEXT_INSN (before_case), get_last_insn (), before_case);
free_temp_slots ();
- free_alloc_pool (case_node_pool);
}
/* Expand the dispatch to a short decrement chain if there are few cases
@@ -1340,9 +1336,8 @@ expand_sjlj_dispatch_table (rtx dispatch_index,
{
/* Similar to expand_case, but much simpler. */
struct case_node *case_list = 0;
- alloc_pool case_node_pool = create_alloc_pool ("struct sjlj_case pool",
- sizeof (struct case_node),
- ncases);
+ pool_allocator<case_node> case_node_pool ("struct sjlj_case pool",
+ ncases);
tree index_expr = make_tree (index_type, dispatch_index);
tree minval = build_int_cst (index_type, 0);
tree maxval = CASE_LOW (dispatch_table.last ());
@@ -1362,7 +1357,6 @@ expand_sjlj_dispatch_table (rtx dispatch_index,
minval, maxval, range,
BLOCK_FOR_INSN (before_case));
emit_label (default_label);
- free_alloc_pool (case_node_pool);
}
/* Dispatching something not handled? Trap! */