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/var-tracking.c | |
parent | 56b400624349b998a808ebc3ded750a517e696bb (diff) | |
download | gcc-fb0b291494898e922f9b8def65da1702d2ae756e.zip gcc-fb0b291494898e922f9b8def65da1702d2ae756e.tar.gz gcc-fb0b291494898e922f9b8def65da1702d2ae756e.tar.bz2 |
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/var-tracking.c')
-rw-r--r-- | gcc/var-tracking.c | 107 |
1 files changed, 27 insertions, 80 deletions
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index b5b0cb6..da9de28 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -261,21 +261,6 @@ typedef struct attrs_def /* Offset from start of DECL. */ HOST_WIDE_INT offset; - - /* 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 ((attrs_def *) ptr); - } - - /* Memory allocation pool. */ - static pool_allocator<attrs_def> pool; } *attrs; /* Structure for chaining the locations. */ @@ -292,21 +277,6 @@ typedef struct location_chain_def /* Initialized? */ enum var_init_status init; - - /* 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 ((location_chain_def *) ptr); - } - - /* Memory allocation pool. */ - static pool_allocator<location_chain_def> pool; } *location_chain; /* A vector of loc_exp_dep holds the active dependencies of a one-part @@ -324,21 +294,6 @@ typedef struct loc_exp_dep_s /* A pointer to the pointer to this entry (head or prev's next) in the doubly-linked list. */ struct loc_exp_dep_s **pprev; - - /* 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 ((loc_exp_dep_s *) ptr); - } - - /* Memory allocation pool. */ - static pool_allocator<loc_exp_dep_s> pool; } loc_exp_dep; @@ -577,21 +532,6 @@ typedef struct shared_hash_def /* Actual hash table. */ variable_table_type *htab; - - /* 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 ((shared_hash_def *) ptr); - } - - /* Memory allocation pool. */ - static pool_allocator<shared_hash_def> pool; } *shared_hash; /* Structure holding the IN or OUT set for a basic block. */ @@ -636,28 +576,28 @@ typedef struct variable_tracking_info_def } *variable_tracking_info; /* Alloc pool for struct attrs_def. */ -pool_allocator<attrs_def> attrs_def::pool ("attrs_def pool", 1024); +object_allocator<attrs_def> attrs_def_pool ("attrs_def pool", 1024); /* Alloc pool for struct variable_def with MAX_VAR_PARTS entries. */ -static pool_allocator<variable_def> var_pool - ("variable_def pool", 64, +static pool_allocator var_pool + ("variable_def pool", 64, sizeof (variable_def) + (MAX_VAR_PARTS - 1) * sizeof (((variable)NULL)->var_part[0])); /* Alloc pool for struct variable_def with a single var_part entry. */ -static pool_allocator<variable_def> valvar_pool - ("small variable_def pool", 256); +static pool_allocator valvar_pool + ("small variable_def pool", 256, sizeof (variable_def)); /* Alloc pool for struct location_chain_def. */ -pool_allocator<location_chain_def> location_chain_def::pool +static object_allocator<location_chain_def> location_chain_def_pool ("location_chain_def pool", 1024); /* Alloc pool for struct shared_hash_def. */ -pool_allocator<shared_hash_def> shared_hash_def::pool +static object_allocator<shared_hash_def> shared_hash_def_pool ("shared_hash_def pool", 256); /* Alloc pool for struct loc_exp_dep_s for NOT_ONEPART variables. */ -pool_allocator<loc_exp_dep> loc_exp_dep::pool ("loc_exp_dep pool", 64); +object_allocator<loc_exp_dep> loc_exp_dep_pool ("loc_exp_dep pool", 64); /* Changed variables, notes will be emitted for them. */ static variable_table_type *changed_variables; @@ -1418,12 +1358,19 @@ dv_onepart_p (decl_or_value dv) } /* Return the variable pool to be used for a dv of type ONEPART. */ -static inline pool_allocator <variable_def> & +static inline pool_allocator & onepart_pool (onepart_enum_t onepart) { return onepart ? valvar_pool : var_pool; } +/* Allocate a variable_def from the corresponding variable pool. */ +static inline variable_def * +onepart_pool_allocate (onepart_enum_t onepart) +{ + return (variable_def*) onepart_pool (onepart).allocate (); +} + /* Build a decl_or_value out of a decl. */ static inline decl_or_value dv_from_decl (tree decl) @@ -1778,7 +1725,7 @@ unshare_variable (dataflow_set *set, variable_def **slot, variable var, variable new_var; int i; - new_var = onepart_pool (var->onepart).allocate (); + new_var = onepart_pool_allocate (var->onepart); new_var->dv = var->dv; new_var->refcount = 1; var->refcount--; @@ -4056,7 +4003,7 @@ variable_merge_over_cur (variable s1var, struct dfset_merge *dsm) { if (node) { - dvar = onepart_pool (onepart).allocate (); + dvar = onepart_pool_allocate (onepart); dvar->dv = dv; dvar->refcount = 1; dvar->n_var_parts = 1; @@ -4192,7 +4139,7 @@ variable_merge_over_cur (variable s1var, struct dfset_merge *dsm) INSERT); if (!*slot) { - variable var = onepart_pool (ONEPART_VALUE).allocate (); + variable var = onepart_pool_allocate (ONEPART_VALUE); var->dv = dv; var->refcount = 1; var->n_var_parts = 1; @@ -7341,7 +7288,7 @@ variable_from_dropped (decl_or_value dv, enum insert_option insert) gcc_checking_assert (onepart == ONEPART_VALUE || onepart == ONEPART_DEXPR); - empty_var = onepart_pool (onepart).allocate (); + empty_var = onepart_pool_allocate (onepart); empty_var->dv = dv; empty_var->refcount = 1; empty_var->n_var_parts = 0; @@ -7445,7 +7392,7 @@ variable_was_changed (variable var, dataflow_set *set) if (!empty_var) { - empty_var = onepart_pool (onepart).allocate (); + empty_var = onepart_pool_allocate (onepart); empty_var->dv = var->dv; empty_var->refcount = 1; empty_var->n_var_parts = 0; @@ -7569,7 +7516,7 @@ set_slot_part (dataflow_set *set, rtx loc, variable_def **slot, if (!var) { /* Create new variable information. */ - var = onepart_pool (onepart).allocate (); + var = onepart_pool_allocate (onepart); var->dv = dv; var->refcount = 1; var->n_var_parts = 1; @@ -9049,7 +8996,7 @@ emit_notes_for_differences_1 (variable_def **slot, variable_table_type *new_vars if (!empty_var) { - empty_var = onepart_pool (old_var->onepart).allocate (); + empty_var = onepart_pool_allocate (old_var->onepart); empty_var->dv = old_var->dv; empty_var->refcount = 0; empty_var->n_var_parts = 0; @@ -10266,17 +10213,17 @@ vt_finalize (void) empty_shared_hash->htab = NULL; delete changed_variables; changed_variables = NULL; - attrs_def::pool.release (); + attrs_def_pool.release (); var_pool.release (); - location_chain_def::pool.release (); - shared_hash_def::pool.release (); + location_chain_def_pool.release (); + shared_hash_def_pool.release (); if (MAY_HAVE_DEBUG_INSNS) { if (global_get_addr_cache) delete global_get_addr_cache; global_get_addr_cache = NULL; - loc_exp_dep::pool.release (); + loc_exp_dep_pool.release (); valvar_pool.release (); preserved_values.release (); cselib_finish (); |