summaryrefslogtreecommitdiff
path: root/gcc/dse.c
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-16 11:26:05 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-16 11:26:05 +0000
commite16712b16d4a03d50a93a0d70c6f0ba6e5121885 (patch)
tree088c31e9845ca484c3b67a274c616d0222800086 /gcc/dse.c
parent9ea91b789f57946363e453edfc43c29046e61d35 (diff)
downloadgcc-e16712b16d4a03d50a93a0d70c6f0ba6e5121885.tar.gz
Add new object_allocator and clean-up allocator usage.
* c-format.c (static void check_format_info_main): Use object_allocator instead of pool_allocator. (check_format_arg): Likewise. (check_format_info_main): Likewise. * alloc-pool.h (object_allocator): Add new class. (pool_allocator::initialize): Use the underlying class. (pool_allocator::allocate): Likewise. (pool_allocator::remove): Likewise. (operator new): A new generic allocator. * asan.c (struct asan_mem_ref): Remove unused members. (asan_mem_ref_new): Replace new operator with object_allocator::allocate. (free_mem_ref_resources): Change deallocation. * cfg.c (initialize_original_copy_tables): Replace pool_allocator with object_allocator. * config/sh/sh.c (add_constant): Replace new operator with object_allocator::allocate. (sh_reorg): Change call to a release method. * cselib.c (struct elt_list): Remove unused members. (new_elt_list): Replace new operator with object_allocator::allocate. (new_elt_loc_list): Likewise. (new_cselib_val): Likewise. (unchain_one_elt_list): Change delete operator with remove method. (unchain_one_elt_loc_list): Likewise. (unchain_one_value): Likewise. (cselib_finish): Release newly added static allocators. * cselib.h (struct cselib_val): Remove unused members. (struct elt_loc_list): Likewise. * df-problems.c (df_chain_alloc): Replace pool_allocator with object_allocator. * df-scan.c (struct df_scan_problem_data): Likewise. (df_scan_alloc): Likewise. * df.h (struct dataflow): Likewise. * dse.c (struct read_info_type): Likewise. (struct insn_info_type): Likewise. (struct dse_bb_info_type): Likewise. (struct group_info): Likewise. (struct deferred_change): Likewise. (get_group_info): Likewise. (delete_dead_store_insn): Likewise. (free_read_records): Likewise. (replace_read): Likewise. (check_mem_read_rtx): Likewise. (scan_insn): Likewise. (dse_step1): Likewise. (dse_step7): Likewise. * et-forest.c (struct et_occ): Remove unused members. (et_new_occ): Use allocate instead of new operator. (et_new_tree): Likewise. (et_free_tree): Call release method explicitly. (et_free_tree_force): Likewise. (et_free_pools): Likewise. (et_split): Use remove instead of delete operator. * et-forest.h (struct et_node): Remove unused members. * ipa-cp.c: Change pool_allocator to object_allocator. * ipa-inline-analysis.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ira-build.c (initiate_cost_vectors): Cast return value. (ira_allocate_cost_vector): Likewise. * ira-color.c (struct update_cost_record): Remove unused members. * lra-int.h (struct lra_live_range): Likewise. (struct lra_copy): Likewise. (struct lra_insn_reg): Likewise. * lra-lives.c (lra_live_ranges_finish): Release new static allocator. * lra.c (new_insn_reg): Replace new operator with allocate method. (free_insn_regs): Same for operator delete. (finish_insn_regs): Release new static allocator. (finish_insn_recog_data): Likewise. (lra_free_copies): Replace delete operator with remove method. (lra_create_copy): Replace operator new with allocate method. (invalidate_insn_data_regno_info): Same for remove method. * regcprop.c (struct queued_debug_insn_change): Remove unused members. (free_debug_insn_changes): Replace delete operator with remove method. (replace_oldest_value_reg): Replace operator new with allocate method. (pass_cprop_hardreg::execute): Release new static variable. * sched-deps.c (sched_deps_init): Change pool_allocator to object_allocator. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * stmt.c (expand_case): Likewise. (expand_sjlj_dispatch_table): Likewise. * tree-sra.c (struct access): Remove unused members. (struct assign_link): Likewise. (sra_deinitialize): Release newly added static pools. (create_access_1):Replace operator new with allocate method. (build_accesses_from_assign): Likewise. (create_artificial_child_access): Likewise. * tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Change pool_allocator to object_allocator. * tree-ssa-pre.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c (allocate_vn_table): Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * var-tracking.c (onepart_pool_allocate): New function. (unshare_variable): Use the newly added function. (variable_merge_over_cur): Likewise. (variable_from_dropped): Likewise. (variable_was_changed): Likewise. (set_slot_part): Likewise. (emit_notes_for_differences_1): Likewise. (vt_finalize): Release newly added static pools. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225869 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dse.c')
-rw-r--r--gcc/dse.c124
1 files changed, 27 insertions, 97 deletions
diff --git a/gcc/dse.c b/gcc/dse.c
index 339fb2df273..ff26fc0cb05 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -308,10 +308,10 @@ lowpart_bitmask (int n)
}
typedef struct store_info *store_info_t;
-static pool_allocator<store_info> cse_store_info_pool ("cse_store_info_pool",
+static object_allocator<store_info> cse_store_info_pool ("cse_store_info_pool",
100);
-static pool_allocator<store_info> rtx_store_info_pool ("rtx_store_info_pool",
+static object_allocator<store_info> rtx_store_info_pool ("rtx_store_info_pool",
100);
/* This structure holds information about a load. These are only
@@ -334,25 +334,11 @@ struct read_info_type
/* The next read_info for this insn. */
struct read_info_type *next;
-
- /* 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 ((read_info_type *) ptr);
- }
-
- /* Memory allocation pool. */
- static pool_allocator<read_info_type> pool;
};
typedef struct read_info_type *read_info_t;
-pool_allocator<read_info_type> read_info_type::pool ("read_info_pool", 100);
+static object_allocator<read_info_type> read_info_type_pool
+ ("read_info_pool", 100);
/* One of these records is created for each insn. */
@@ -438,25 +424,11 @@ struct insn_info_type
time it is guaranteed to be correct is when the traversal starts
at active_local_stores. */
struct insn_info_type * next_local_store;
-
- /* 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 ((insn_info_type *) ptr);
- }
-
- /* Memory allocation pool. */
- static pool_allocator<insn_info_type> pool;
};
typedef struct insn_info_type *insn_info_t;
-pool_allocator<insn_info_type> insn_info_type::pool ("insn_info_pool", 100);
+static object_allocator<insn_info_type> insn_info_type_pool
+ ("insn_info_pool", 100);
/* The linked list of stores that are under consideration in this
basic block. */
@@ -518,25 +490,12 @@ struct dse_bb_info_type
to assure that shift and/or add sequences that are inserted do not
accidentally clobber live hard regs. */
bitmap regs_live;
-
- /* 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 ((dse_bb_info_type *) ptr);
- }
-
- /* Memory allocation pool. */
- static pool_allocator<dse_bb_info_type> pool;
};
typedef struct dse_bb_info_type *bb_info_t;
-pool_allocator<dse_bb_info_type> dse_bb_info_type::pool ("bb_info_pool", 100);
+
+static object_allocator<dse_bb_info_type> dse_bb_info_type_pool
+ ("bb_info_pool", 100);
/* Table to hold all bb_infos. */
static bb_info_t *bb_table;
@@ -604,26 +563,12 @@ struct group_info
care about. */
int *offset_map_n, *offset_map_p;
int offset_map_size_n, offset_map_size_p;
-
- /* 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 ((group_info *) ptr);
- }
-
- /* Memory allocation pool. */
- static pool_allocator<group_info> pool;
};
typedef struct group_info *group_info_t;
typedef const struct group_info *const_group_info_t;
-pool_allocator<group_info> group_info::pool ("rtx_group_info_pool", 100);
+static object_allocator<group_info> group_info_pool
+ ("rtx_group_info_pool", 100);
/* Index into the rtx_group_vec. */
static int rtx_group_next_id;
@@ -644,26 +589,11 @@ struct deferred_change
rtx reg;
struct deferred_change *next;
-
- /* 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 ((deferred_change *) ptr);
- }
-
- /* Memory allocation pool. */
- static pool_allocator<deferred_change> pool;
};
typedef struct deferred_change *deferred_change_t;
-pool_allocator<deferred_change> deferred_change::pool
+static object_allocator<deferred_change> deferred_change_pool
("deferred_change_pool", 10);
static deferred_change_t deferred_change_list = NULL;
@@ -769,7 +699,7 @@ get_group_info (rtx base)
{
if (!clear_alias_group)
{
- clear_alias_group = gi = new group_info;
+ clear_alias_group = gi = group_info_pool.allocate ();
memset (gi, 0, sizeof (struct group_info));
gi->id = rtx_group_next_id++;
gi->store1_n = BITMAP_ALLOC (&dse_bitmap_obstack);
@@ -791,7 +721,7 @@ get_group_info (rtx base)
if (gi == NULL)
{
- *slot = gi = new group_info;
+ *slot = gi = group_info_pool.allocate ();
gi->rtx_base = base;
gi->id = rtx_group_next_id++;
gi->base_mem = gen_rtx_MEM (BLKmode, base);
@@ -1027,7 +957,7 @@ delete_dead_store_insn (insn_info_t insn_info)
while (read_info)
{
read_info_t next = read_info->next;
- delete read_info;
+ read_info_type_pool.remove (read_info);
read_info = next;
}
insn_info->read_rec = NULL;
@@ -1151,7 +1081,7 @@ free_read_records (bb_info_t bb_info)
read_info_t next = (*ptr)->next;
if ((*ptr)->alias_set == 0)
{
- delete *ptr;
+ read_info_type_pool.remove (*ptr);
*ptr = next;
}
else
@@ -2099,7 +2029,7 @@ replace_read (store_info_t store_info, insn_info_t store_insn,
if (validate_change (read_insn->insn, loc, read_reg, 0))
{
- deferred_change_t change = new deferred_change;
+ deferred_change_t change = deferred_change_pool.allocate ();
/* Insert this right before the store insn where it will be safe
from later insns that might change it before the read. */
@@ -2137,7 +2067,7 @@ replace_read (store_info_t store_info, insn_info_t store_insn,
/* Get rid of the read_info, from the point of view of the
rest of dse, play like this read never happened. */
read_insn->read_rec = read_info->next;
- delete read_info;
+ read_info_type_pool.remove (read_info);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " -- replaced the loaded MEM with ");
@@ -2203,7 +2133,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info)
else
width = GET_MODE_SIZE (GET_MODE (mem));
- read_info = new read_info_type;
+ read_info = read_info_type_pool.allocate ();
read_info->group_id = group_id;
read_info->mem = mem;
read_info->alias_set = spill_alias_set;
@@ -2519,7 +2449,7 @@ static void
scan_insn (bb_info_t bb_info, rtx_insn *insn)
{
rtx body;
- insn_info_type *insn_info = new insn_info_type;
+ insn_info_type *insn_info = insn_info_type_pool.allocate ();
int mems_found = 0;
memset (insn_info, 0, sizeof (struct insn_info_type));
@@ -2778,7 +2708,7 @@ dse_step1 (void)
FOR_ALL_BB_FN (bb, cfun)
{
insn_info_t ptr;
- bb_info_t bb_info = new dse_bb_info_type;
+ bb_info_t bb_info = dse_bb_info_type_pool.allocate ();
memset (bb_info, 0, sizeof (dse_bb_info_type));
bitmap_set_bit (all_blocks, bb->index);
@@ -2855,7 +2785,7 @@ dse_step1 (void)
/* There is no reason to validate this change. That was
done earlier. */
*deferred_change_list->loc = deferred_change_list->reg;
- delete deferred_change_list;
+ deferred_change_pool.remove (deferred_change_list);
deferred_change_list = next;
}
@@ -3740,11 +3670,11 @@ dse_step7 (void)
BITMAP_FREE (scratch);
rtx_store_info_pool.release ();
- read_info_type::pool.release ();
- insn_info_type::pool.release ();
- dse_bb_info_type::pool.release ();
- group_info::pool.release ();
- deferred_change::pool.release ();
+ read_info_type_pool.release ();
+ insn_info_type_pool.release ();
+ dse_bb_info_type_pool.release ();
+ group_info_pool.release ();
+ deferred_change_pool.release ();
}