From 153e42282e7b27189cea89d4be6f2b251bdbae08 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 1 Jun 2015 14:46:24 +0200 Subject: [PATCH] Change use to type-based pool allocator in * tree-ssa-reassoc.c (add_to_ops_vec): Use new type-based pool allocator. (add_repeat_to_ops_vec): Likewise. (get_ops): Likewise. (maybe_optimize_range_tests): Likewise. (init_reassoc): Likewise. (fini_reassoc): Likewise. From-SVN: r223964 --- gcc/ChangeLog | 9 +++++++++ gcc/tree-ssa-reassoc.c | 19 ++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff8ac033efd..0ba22d658bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-06-01 Martin Liska + + * tree-ssa-reassoc.c (add_to_ops_vec): Use new type-based pool allocator. + (add_repeat_to_ops_vec): Likewise. + (get_ops): Likewise. + (maybe_optimize_range_tests): Likewise. + (init_reassoc): Likewise. + (fini_reassoc): Likewise. + 2015-06-01 Martin Liska * tree-ssa-pre.c (get_or_alloc_expr_for_name): Use new type-based pool allocator. diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 8a645112c7e..367f0eb93e1 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -235,7 +235,8 @@ typedef struct operand_entry unsigned int count; } *operand_entry_t; -static alloc_pool operand_entry_pool; +static pool_allocator operand_entry_pool ("operand entry pool", + 30); /* This is used to assign a unique ID to each struct operand_entry so that qsort results are identical on different hosts. */ @@ -592,7 +593,7 @@ sort_by_operand_rank (const void *pa, const void *pb) static void add_to_ops_vec (vec *ops, tree op) { - operand_entry_t oe = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe->op = op; oe->rank = get_rank (op); @@ -608,7 +609,7 @@ static void add_repeat_to_ops_vec (vec *ops, tree op, HOST_WIDE_INT repeat) { - operand_entry_t oe = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe->op = op; oe->rank = get_rank (op); @@ -2963,7 +2964,7 @@ get_ops (tree var, enum tree_code code, vec *ops, && !get_ops (rhs[i], code, ops, loop) && has_single_use (rhs[i])) { - operand_entry_t oe = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe->op = rhs[i]; oe->rank = code; @@ -3196,8 +3197,7 @@ maybe_optimize_range_tests (gimple stmt) && has_single_use (rhs)) { /* Otherwise, push the _234 range test itself. */ - operand_entry_t oe - = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe->op = rhs; oe->rank = code; @@ -3229,8 +3229,7 @@ maybe_optimize_range_tests (gimple stmt) loop_containing_stmt (stmt)))) { /* Or push the GIMPLE_COND stmt itself. */ - operand_entry_t oe - = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe->op = NULL; oe->rank = (e->flags & EDGE_TRUE_VALUE) @@ -5008,8 +5007,6 @@ init_reassoc (void) memset (&reassociate_stats, 0, sizeof (reassociate_stats)); - operand_entry_pool = create_alloc_pool ("operand entry pool", - sizeof (struct operand_entry), 30); next_operand_entry_id = 0; /* Reverse RPO (Reverse Post Order) will give us something where @@ -5058,7 +5055,7 @@ fini_reassoc (void) reassociate_stats.pows_created); delete operand_rank; - free_alloc_pool (operand_entry_pool); + operand_entry_pool.release (); free (bb_rank); plus_negates.release (); free_dominance_info (CDI_POST_DOMINATORS); -- 2.30.2