diff options
author | Martin Liska <mliska@suse.cz> | 2015-07-16 13:26:05 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2015-07-16 11:26:05 +0000 |
commit | fb0b291494898e922f9b8def65da1702d2ae756e (patch) | |
tree | 088c31e9845ca484c3b67a274c616d0222800086 /gcc/cselib.c | |
parent | 56b400624349b998a808ebc3ded750a517e696bb (diff) |
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.
From-SVN: r225869
Diffstat (limited to 'gcc/cselib.c')
-rw-r--r-- | gcc/cselib.c | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/gcc/cselib.c b/gcc/cselib.c index fc7deab76cf..214995927f5 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -45,21 +45,6 @@ struct elt_list { struct elt_list *next; cselib_val *elt; - - /* 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 ((elt_list *) ptr); - } - - /* Memory allocation pool. */ - static pool_allocator<elt_list> pool; }; static bool cselib_record_memory; @@ -261,12 +246,11 @@ static unsigned int cfa_base_preserved_regno = INVALID_REGNUM; each time memory is invalidated. */ static cselib_val *first_containing_mem = &dummy_val; -pool_allocator<elt_list> elt_list::pool ("elt_list", 10); -pool_allocator<elt_loc_list> elt_loc_list::pool ("elt_loc_list", 10); -pool_allocator<cselib_val> cselib_val::pool ("cselib_val_list", 10); +static object_allocator<elt_list> elt_list_pool ("elt_list", 10); +static object_allocator<elt_loc_list> elt_loc_list_pool ("elt_loc_list", 10); +static object_allocator<cselib_val> cselib_val_pool ("cselib_val_list", 10); -static pool_allocator<rtx_def> value_pool ("value", 100, RTX_CODE_SIZE (VALUE), - true); +static pool_allocator value_pool ("value", 100, RTX_CODE_SIZE (VALUE)); /* If nonnull, cselib will call this function before freeing useless VALUEs. A VALUE is deemed useless if its "locs" field is null. */ @@ -294,7 +278,7 @@ void (*cselib_record_sets_hook) (rtx_insn *insn, struct cselib_set *sets, static inline struct elt_list * new_elt_list (struct elt_list *next, cselib_val *elt) { - elt_list *el = new elt_list (); + elt_list *el = elt_list_pool.allocate (); el->next = next; el->elt = elt; return el; @@ -378,14 +362,14 @@ new_elt_loc_list (cselib_val *val, rtx loc) } /* Chain LOC back to VAL. */ - el = new elt_loc_list; + el = elt_loc_list_pool.allocate (); el->loc = val->val_rtx; el->setting_insn = cselib_current_insn; el->next = NULL; CSELIB_VAL_PTR (loc)->locs = el; } - el = new elt_loc_list; + el = elt_loc_list_pool.allocate (); el->loc = loc; el->setting_insn = cselib_current_insn; el->next = next; @@ -425,7 +409,7 @@ unchain_one_elt_list (struct elt_list **pl) struct elt_list *l = *pl; *pl = l->next; - delete l; + elt_list_pool.remove (l); } /* Likewise for elt_loc_lists. */ @@ -436,7 +420,7 @@ unchain_one_elt_loc_list (struct elt_loc_list **pl) struct elt_loc_list *l = *pl; *pl = l->next; - delete l; + elt_loc_list_pool.remove (l); } /* Likewise for cselib_vals. This also frees the addr_list associated with @@ -448,7 +432,7 @@ unchain_one_value (cselib_val *v) while (v->addr_list) unchain_one_elt_list (&v->addr_list); - delete v; + cselib_val_pool.remove (v); } /* Remove all entries from the hash table. Also used during @@ -1311,7 +1295,7 @@ cselib_hash_rtx (rtx x, int create, machine_mode memmode) static inline cselib_val * new_cselib_val (unsigned int hash, machine_mode mode, rtx x) { - cselib_val *e = new cselib_val; + cselib_val *e = cselib_val_pool.allocate (); gcc_assert (hash); gcc_assert (next_uid); @@ -1323,7 +1307,7 @@ new_cselib_val (unsigned int hash, machine_mode mode, rtx x) precisely when we can have VALUE RTXen (when cselib is active) so we don't need to put them in garbage collected memory. ??? Why should a VALUE be an RTX in the first place? */ - e->val_rtx = value_pool.allocate (); + e->val_rtx = (rtx_def*) value_pool.allocate (); memset (e->val_rtx, 0, RTX_HDR_SIZE); PUT_CODE (e->val_rtx, VALUE); PUT_MODE (e->val_rtx, mode); @@ -2775,9 +2759,9 @@ cselib_finish (void) cselib_any_perm_equivs = false; cfa_base_preserved_val = NULL; cfa_base_preserved_regno = INVALID_REGNUM; - elt_list::pool.release (); - elt_loc_list::pool.release (); - cselib_val::pool.release (); + elt_list_pool.release (); + elt_loc_list_pool.release (); + cselib_val_pool.release (); value_pool.release (); cselib_clear_table (); delete cselib_hash_table; |