From: Trevor Saunders Date: Sat, 18 Apr 2015 18:13:18 +0000 (+0000) Subject: remove need for store_values_directly X-Git-Tag: upstream/12.2.0~55632 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67f58944a75eaf9c193dc704f8128bfaaf6c3c3a;p=platform%2Fupstream%2Fgcc.git remove need for store_values_directly This switches all hash_table users to use the layout that stores elements of type value_type in the hash table instead of the one storing value_type *. Since it becomes unused support for the value_type * layout is removed. gcc/ * hash-table.h: Remove version of hash_table that stored value_type *. * asan.c, attribs.c, bitmap.c, cfg.c, cgraph.h, config/arm/arm.c, config/i386/winnt.c, config/ia64/ia64.c, config/mips/mips.c, config/sol2.c, coverage.c, cselib.c, dse.c, dwarf2cfi.c, dwarf2out.c, except.c, gcse.c, genmatch.c, ggc-common.c, gimple-ssa-strength-reduction.c, gimplify.c, haifa-sched.c, hard-reg-set.h, hash-map.h, hash-set.h, ipa-devirt.c, ipa-icf.h, ipa-profile.c, ira-color.c, ira-costs.c, loop-invariant.c, loop-iv.c, loop-unroll.c, lto-streamer.h, plugin.c, postreload-gcse.c, reginfo.c, statistics.c, store-motion.c, trans-mem.c, tree-cfg.c, tree-eh.c, tree-hasher.h, tree-into-ssa.c, tree-parloops.c, tree-sra.c, tree-ssa-coalesce.c, tree-ssa-dom.c, tree-ssa-live.c, tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-structalias.c, tree-ssa-tail-merge.c, tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vectorizer.h, valtrack.h, var-tracking.c, vtable-verify.c, vtable-verify.h: Adjust. libcc1/ * plugin.cc: Adjust for hash_table changes. gcc/java/ * jcf-io.c: Adjust for hash_table changes. gcc/lto/ * lto.c: Adjust for hash_table changes. gcc/objc/ * objc-act.c: Adjust for hash_table changes. From-SVN: r222213 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5da0cd2..f29a5c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2015-04-18 Trevor Saunders + + * hash-table.h: Remove version of hash_table that stored value_type *. + * asan.c, attribs.c, bitmap.c, cfg.c, cgraph.h, config/arm/arm.c, + config/i386/winnt.c, config/ia64/ia64.c, config/mips/mips.c, + config/sol2.c, coverage.c, cselib.c, dse.c, dwarf2cfi.c, + dwarf2out.c, except.c, gcse.c, genmatch.c, ggc-common.c, + gimple-ssa-strength-reduction.c, gimplify.c, haifa-sched.c, + hard-reg-set.h, hash-map.h, hash-set.h, ipa-devirt.c, ipa-icf.h, + ipa-profile.c, ira-color.c, ira-costs.c, loop-invariant.c, + loop-iv.c, loop-unroll.c, lto-streamer.h, plugin.c, postreload-gcse.c, + reginfo.c, statistics.c, store-motion.c, trans-mem.c, tree-cfg.c, + tree-eh.c, tree-hasher.h, tree-into-ssa.c, tree-parloops.c, + tree-sra.c, tree-ssa-coalesce.c, tree-ssa-dom.c, tree-ssa-live.c, + tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-phiopt.c, + tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.c, + tree-ssa-structalias.c, tree-ssa-tail-merge.c, + tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vectorizer.h, + valtrack.h, var-tracking.c, vtable-verify.c, vtable-verify.h: Adjust. + 2015-04-17 Bill Schmidt PR target/65787 diff --git a/gcc/asan.c b/gcc/asan.c index 6706af7..cd6ccdc 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -435,11 +435,11 @@ asan_mem_ref_get_end (const asan_mem_ref *ref, tree len) struct asan_mem_ref_hasher : typed_noop_remove { - typedef asan_mem_ref value_type; - typedef asan_mem_ref compare_type; + typedef asan_mem_ref *value_type; + typedef asan_mem_ref *compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + static inline hashval_t hash (const asan_mem_ref *); + static inline bool equal (const asan_mem_ref *, const asan_mem_ref *); }; /* Hash a memory reference. */ diff --git a/gcc/attribs.c b/gcc/attribs.c index c18bff2..7b7e2a9 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -67,21 +67,21 @@ substring_hash (const char *str, int l) struct attribute_hasher : typed_noop_remove { - typedef attribute_spec value_type; - typedef substring compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef attribute_spec *value_type; + typedef substring *compare_type; + static inline hashval_t hash (const attribute_spec *); + static inline bool equal (const attribute_spec *, const substring *); }; inline hashval_t -attribute_hasher::hash (const value_type *spec) +attribute_hasher::hash (const attribute_spec *spec) { const int l = strlen (spec->name); return substring_hash (spec->name, l); } inline bool -attribute_hasher::equal (const value_type *spec, const compare_type *str) +attribute_hasher::equal (const attribute_spec *spec, const substring *str) { return (strncmp (spec->name, str->str, str->length) == 0 && !spec->name[str->length]); diff --git a/gcc/bitmap.c b/gcc/bitmap.c index d43a39f..71d5b11 100644 --- a/gcc/bitmap.c +++ b/gcc/bitmap.c @@ -61,20 +61,20 @@ struct loc struct bitmap_desc_hasher : typed_noop_remove { - typedef bitmap_descriptor_d value_type; - typedef loc compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef bitmap_descriptor_d *value_type; + typedef loc *compare_type; + static inline hashval_t hash (const bitmap_descriptor_d *); + static inline bool equal (const bitmap_descriptor_d *, const loc *); }; inline hashval_t -bitmap_desc_hasher::hash (const value_type *d) +bitmap_desc_hasher::hash (const bitmap_descriptor_d *d) { return htab_hash_pointer (d->file) + d->line; } inline bool -bitmap_desc_hasher::equal (const value_type *d, const compare_type *l) +bitmap_desc_hasher::equal (const bitmap_descriptor_d *d, const loc *l) { return d->file == l->file && d->function == l->function && d->line == l->line; } diff --git a/gcc/cfg.c b/gcc/cfg.c index d96be45..3074500 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -1039,21 +1039,22 @@ struct htab_bb_copy_original_entry struct bb_copy_hasher : typed_noop_remove { - typedef htab_bb_copy_original_entry value_type; - typedef htab_bb_copy_original_entry compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *existing, - const compare_type * candidate); + typedef htab_bb_copy_original_entry *value_type; + typedef htab_bb_copy_original_entry *compare_type; + static inline hashval_t hash (const htab_bb_copy_original_entry *); + static inline bool equal (const htab_bb_copy_original_entry *existing, + const htab_bb_copy_original_entry * candidate); }; inline hashval_t -bb_copy_hasher::hash (const value_type *data) +bb_copy_hasher::hash (const htab_bb_copy_original_entry *data) { return data->index1; } inline bool -bb_copy_hasher::equal (const value_type *data, const compare_type *data2) +bb_copy_hasher::equal (const htab_bb_copy_original_entry *data, + const htab_bb_copy_original_entry *data2) { return data->index1 == data2->index1; } diff --git a/gcc/cgraph.h b/gcc/cgraph.h index cf8c7b6..29f65a8 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -1872,7 +1872,6 @@ struct asmname_hasher { typedef symtab_node *value_type; typedef const_tree compare_type; - typedef int store_values_directly; static hashval_t hash (symtab_node *n); static bool equal (symtab_node *n, const_tree t); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 0466399..6826c78 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -4897,21 +4897,21 @@ arm_function_value(const_tree type, const_tree func, struct libcall_hasher : typed_noop_remove { - typedef rtx_def value_type; - typedef rtx_def compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef const rtx_def *value_type; + typedef const rtx_def *compare_type; + static inline hashval_t hash (const rtx_def *); + static inline bool equal (const rtx_def *, const rtx_def *); + static inline void remove (rtx_def *); }; inline bool -libcall_hasher::equal (const value_type *p1, const compare_type *p2) +libcall_hasher::equal (const rtx_def *p1, const rtx_def *p2) { return rtx_equal_p (p1, p2); } inline hashval_t -libcall_hasher::hash (const value_type *p1) +libcall_hasher::hash (const rtx_def *p1) { return hash_rtx (p1, VOIDmode, NULL, NULL, FALSE); } diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 14fd253..f61412f 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -738,15 +738,15 @@ i386_pe_record_stub (const char *name) struct wrapped_symbol_hasher : typed_noop_remove { - typedef char value_type; - typedef char compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef char *value_type; + typedef char *compare_type; + static inline hashval_t hash (const char *); + static inline bool equal (const char *, const char *); + static inline void remove (char *); }; inline hashval_t -wrapped_symbol_hasher::hash (const value_type *v) +wrapped_symbol_hasher::hash (const char *v) { return htab_hash_string (v); } @@ -754,7 +754,7 @@ wrapped_symbol_hasher::hash (const value_type *v) /* Hash table equality helper function. */ inline bool -wrapped_symbol_hasher::equal (const value_type *x, const compare_type *y) +wrapped_symbol_hasher::equal (const char *x, const char *y) { return !strcmp (x, y); } diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 5132d2f..40e6ebe 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -8609,16 +8609,16 @@ finish_bundle_states (void) struct bundle_state_hasher : typed_noop_remove { - typedef bundle_state value_type; - typedef bundle_state compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef bundle_state *value_type; + typedef bundle_state *compare_type; + static inline hashval_t hash (const bundle_state *); + static inline bool equal (const bundle_state *, const bundle_state *); }; /* The function returns hash of BUNDLE_STATE. */ inline hashval_t -bundle_state_hasher::hash (const value_type *state) +bundle_state_hasher::hash (const bundle_state *state) { unsigned result, i; @@ -8631,8 +8631,8 @@ bundle_state_hasher::hash (const value_type *state) /* The function returns nonzero if the bundle state keys are equal. */ inline bool -bundle_state_hasher::equal (const value_type *state1, - const compare_type *state2) +bundle_state_hasher::equal (const bundle_state *state1, + const bundle_state *state2) { return (state1->insn_num == state2->insn_num && memcmp (state1->dfa_state, state2->dfa_state, diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 1733457..bf69850 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -16381,23 +16381,23 @@ mips_hash_base (rtx base) struct mips_lo_sum_offset_hasher : typed_free_remove { - typedef mips_lo_sum_offset value_type; - typedef rtx_def compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef mips_lo_sum_offset *value_type; + typedef rtx_def *compare_type; + static inline hashval_t hash (const mips_lo_sum_offset *); + static inline bool equal (const mips_lo_sum_offset *, const rtx_def *); }; /* Hash-table callbacks for mips_lo_sum_offsets. */ inline hashval_t -mips_lo_sum_offset_hasher::hash (const value_type *entry) +mips_lo_sum_offset_hasher::hash (const mips_lo_sum_offset *entry) { return mips_hash_base (entry->base); } inline bool -mips_lo_sum_offset_hasher::equal (const value_type *entry, - const compare_type *value) +mips_lo_sum_offset_hasher::equal (const mips_lo_sum_offset *entry, + const rtx_def *value) { return rtx_equal_p (entry->base, value); } diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c index d256776..d87c7b4 100644 --- a/gcc/config/sol2.c +++ b/gcc/config/sol2.c @@ -183,22 +183,22 @@ typedef struct comdat_entry struct comdat_entry_hasher : typed_noop_remove { - typedef comdat_entry value_type; - typedef comdat_entry compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef comdat_entry *value_type; + typedef comdat_entry *compare_type; + static inline hashval_t hash (const comdat_entry *); + static inline bool equal (const comdat_entry *, const comdat_entry *); + static inline void remove (comdat_entry *); }; inline hashval_t -comdat_entry_hasher::hash (const value_type *entry) +comdat_entry_hasher::hash (const comdat_entry *entry) { return htab_hash_string (entry->sig); } inline bool -comdat_entry_hasher::equal (const value_type *entry1, - const compare_type *entry2) +comdat_entry_hasher::equal (const comdat_entry *entry1, + const comdat_entry *entry2) { return strcmp (entry1->sig, entry2->sig) == 0; } diff --git a/gcc/coverage.c b/gcc/coverage.c index 661e441..e1d81ff 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -114,11 +114,11 @@ typedef struct counts_entry struct gcov_ctr_summary summary; /* hash_table support. */ - typedef counts_entry value_type; - typedef counts_entry compare_type; - static inline hashval_t hash (const value_type *); - static int equal (const value_type *, const compare_type *); - static void remove (value_type *); + typedef counts_entry *value_type; + typedef counts_entry *compare_type; + static inline hashval_t hash (const counts_entry *); + static int equal (const counts_entry *, const counts_entry *); + static void remove (counts_entry *); } counts_entry_t; static GTY(()) struct coverage_data *functions_head = 0; @@ -197,20 +197,19 @@ get_gcov_unsigned_t (void) } inline hashval_t -counts_entry::hash (const value_type *entry) +counts_entry::hash (const counts_entry *entry) { return entry->ident * GCOV_COUNTERS + entry->ctr; } inline int -counts_entry::equal (const value_type *entry1, - const compare_type *entry2) +counts_entry::equal (const counts_entry *entry1, const counts_entry *entry2) { return entry1->ident == entry2->ident && entry1->ctr == entry2->ctr; } inline void -counts_entry::remove (value_type *entry) +counts_entry::remove (counts_entry *entry) { free (entry->counts); free (entry); diff --git a/gcc/cselib.c b/gcc/cselib.c index d6ccbfb..30845ed 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -102,8 +102,8 @@ static rtx cselib_expand_value_rtx_1 (rtx, struct expand_value_data *, int); struct cselib_hasher : typed_noop_remove { - typedef cselib_val value_type; - struct compare_type { + typedef cselib_val *value_type; + struct key { /* The rtx value and its mode (needed separately for constant integers). */ machine_mode mode; @@ -111,8 +111,9 @@ struct cselib_hasher : typed_noop_remove /* The mode of the contaning MEM, if any, otherwise VOIDmode. */ machine_mode memmode; }; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef key *compare_type; + static inline hashval_t hash (const cselib_val *); + static inline bool equal (const cselib_val *, const key *); }; /* The hash function for our hash table. The value is always computed with @@ -120,7 +121,7 @@ struct cselib_hasher : typed_noop_remove hash value from a cselib_val structure. */ inline hashval_t -cselib_hasher::hash (const value_type *v) +cselib_hasher::hash (const cselib_val *v) { return v->hash; } @@ -131,7 +132,7 @@ cselib_hasher::hash (const value_type *v) CONST of an appropriate mode. */ inline bool -cselib_hasher::equal (const value_type *v, const compare_type *x_arg) +cselib_hasher::equal (const cselib_val *v, const key *x_arg) { struct elt_loc_list *l; rtx x = x_arg->x; @@ -507,7 +508,7 @@ preserve_constants_and_equivs (cselib_val **x, void *info ATTRIBUTE_UNUSED) if (invariant_or_equiv_p (v)) { - cselib_hasher::compare_type lookup = { + cselib_hasher::key lookup = { GET_MODE (v->val_rtx), v->val_rtx, VOIDmode }; cselib_val **slot @@ -592,7 +593,7 @@ cselib_find_slot (machine_mode mode, rtx x, hashval_t hash, enum insert_option insert, machine_mode memmode) { cselib_val **slot = NULL; - cselib_hasher::compare_type lookup = { mode, x, memmode }; + cselib_hasher::key lookup = { mode, x, memmode }; if (cselib_preserve_constants) slot = cselib_preserved_hash_table->find_slot_with_hash (&lookup, hash, NO_INSERT); diff --git a/gcc/dse.c b/gcc/dse.c index 2bb20d7..603cdbd 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -667,21 +667,21 @@ clear_alias_set_lookup (alias_set_type alias_set) struct invariant_group_base_hasher : typed_noop_remove { - typedef group_info value_type; - typedef group_info compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef group_info *value_type; + typedef group_info *compare_type; + static inline hashval_t hash (const group_info *); + static inline bool equal (const group_info *, const group_info *); }; inline bool -invariant_group_base_hasher::equal (const value_type *gi1, - const compare_type *gi2) +invariant_group_base_hasher::equal (const group_info *gi1, + const group_info *gi2) { return rtx_equal_p (gi1->rtx_base, gi2->rtx_base); } inline hashval_t -invariant_group_base_hasher::hash (const value_type *gi) +invariant_group_base_hasher::hash (const group_info *gi) { int do_not_record; return hash_rtx (gi->rtx_base, Pmode, &do_not_record, NULL, false); diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index ec2acc9..2469c25 100644 --- a/gcc/dwarf2cfi.c +++ b/gcc/dwarf2cfi.c @@ -182,20 +182,20 @@ typedef dw_trace_info *dw_trace_info_ref; struct trace_info_hasher : typed_noop_remove { - typedef dw_trace_info value_type; - typedef dw_trace_info compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef dw_trace_info *value_type; + typedef dw_trace_info *compare_type; + static inline hashval_t hash (const dw_trace_info *); + static inline bool equal (const dw_trace_info *, const dw_trace_info *); }; inline hashval_t -trace_info_hasher::hash (const value_type *ti) +trace_info_hasher::hash (const dw_trace_info *ti) { return INSN_UID (ti->head); } inline bool -trace_info_hasher::equal (const value_type *a, const compare_type *b) +trace_info_hasher::equal (const dw_trace_info *a, const dw_trace_info *b) { return a->head == b->head; } diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index e570120..3f29db3 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -6865,28 +6865,28 @@ struct cu_hash_table_entry struct cu_hash_table_entry_hasher { - typedef cu_hash_table_entry value_type; - typedef die_struct compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef cu_hash_table_entry *value_type; + typedef die_struct *compare_type; + static inline hashval_t hash (const cu_hash_table_entry *); + static inline bool equal (const cu_hash_table_entry *, const die_struct *); + static inline void remove (cu_hash_table_entry *); }; inline hashval_t -cu_hash_table_entry_hasher::hash (const value_type *entry) +cu_hash_table_entry_hasher::hash (const cu_hash_table_entry *entry) { return htab_hash_string (entry->cu->die_id.die_symbol); } inline bool -cu_hash_table_entry_hasher::equal (const value_type *entry1, - const compare_type *entry2) +cu_hash_table_entry_hasher::equal (const cu_hash_table_entry *entry1, + const die_struct *entry2) { return !strcmp (entry1->cu->die_id.die_symbol, entry2->die_id.die_symbol); } inline void -cu_hash_table_entry_hasher::remove (value_type *entry) +cu_hash_table_entry_hasher::remove (cu_hash_table_entry *entry) { struct cu_hash_table_entry *next; @@ -7202,21 +7202,21 @@ struct decl_table_entry struct decl_table_entry_hasher : typed_free_remove { - typedef decl_table_entry value_type; - typedef die_struct compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef decl_table_entry *value_type; + typedef die_struct *compare_type; + static inline hashval_t hash (const decl_table_entry *); + static inline bool equal (const decl_table_entry *, const die_struct *); }; inline hashval_t -decl_table_entry_hasher::hash (const value_type *entry) +decl_table_entry_hasher::hash (const decl_table_entry *entry) { return htab_hash_pointer (entry->orig); } inline bool -decl_table_entry_hasher::equal (const value_type *entry1, - const compare_type *entry2) +decl_table_entry_hasher::equal (const decl_table_entry *entry1, + const die_struct *entry2) { return entry1->orig == entry2; } @@ -7744,14 +7744,14 @@ struct external_ref struct external_ref_hasher : typed_free_remove { - typedef external_ref value_type; - typedef external_ref compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef external_ref *value_type; + typedef external_ref *compare_type; + static inline hashval_t hash (const external_ref *); + static inline bool equal (const external_ref *, const external_ref *); }; inline hashval_t -external_ref_hasher::hash (const value_type *r) +external_ref_hasher::hash (const external_ref *r) { dw_die_ref die = r->type; hashval_t h = 0; @@ -7772,7 +7772,7 @@ external_ref_hasher::hash (const value_type *r) } inline bool -external_ref_hasher::equal (const value_type *r1, const compare_type *r2) +external_ref_hasher::equal (const external_ref *r1, const external_ref *r2) { return r1->type == r2->type; } @@ -22230,21 +22230,21 @@ dwarf2out_undef (unsigned int lineno ATTRIBUTE_UNUSED, struct macinfo_entry_hasher : typed_noop_remove { - typedef macinfo_entry value_type; - typedef macinfo_entry compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef macinfo_entry *value_type; + typedef macinfo_entry *compare_type; + static inline hashval_t hash (const macinfo_entry *); + static inline bool equal (const macinfo_entry *, const macinfo_entry *); }; inline hashval_t -macinfo_entry_hasher::hash (const value_type *entry) +macinfo_entry_hasher::hash (const macinfo_entry *entry) { return htab_hash_string (entry->info); } inline bool -macinfo_entry_hasher::equal (const value_type *entry1, - const compare_type *entry2) +macinfo_entry_hasher::equal (const macinfo_entry *entry1, + const macinfo_entry *entry2) { return !strcmp (entry1->info, entry2->info); } @@ -23308,14 +23308,14 @@ file_table_relative_p (dwarf_file_data **slot, bool *p) struct comdat_type_hasher : typed_noop_remove { - typedef comdat_type_node value_type; - typedef comdat_type_node compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef comdat_type_node *value_type; + typedef comdat_type_node *compare_type; + static inline hashval_t hash (const comdat_type_node *); + static inline bool equal (const comdat_type_node *, const comdat_type_node *); }; inline hashval_t -comdat_type_hasher::hash (const value_type *type_node) +comdat_type_hasher::hash (const comdat_type_node *type_node) { hashval_t h; memcpy (&h, type_node->signature, sizeof (h)); @@ -23323,8 +23323,8 @@ comdat_type_hasher::hash (const value_type *type_node) } inline bool -comdat_type_hasher::equal (const value_type *type_node_1, - const compare_type *type_node_2) +comdat_type_hasher::equal (const comdat_type_node *type_node_1, + const comdat_type_node *type_node_2) { return (! memcmp (type_node_1->signature, type_node_2->signature, DWARF_TYPE_SIGNATURE_SIZE)); @@ -24411,16 +24411,17 @@ compare_locs (dw_loc_descr_ref x, dw_loc_descr_ref y) struct loc_list_hasher : typed_noop_remove { - typedef dw_loc_list_struct value_type; - typedef dw_loc_list_struct compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef dw_loc_list_struct *value_type; + typedef dw_loc_list_struct *compare_type; + static inline hashval_t hash (const dw_loc_list_struct *); + static inline bool equal (const dw_loc_list_struct *, + const dw_loc_list_struct *); }; /* Return precomputed hash of location list X. */ inline hashval_t -loc_list_hasher::hash (const value_type *x) +loc_list_hasher::hash (const dw_loc_list_struct *x) { return x->hash; } @@ -24428,7 +24429,8 @@ loc_list_hasher::hash (const value_type *x) /* Return true if location lists A and B are the same. */ inline bool -loc_list_hasher::equal (const value_type *a, const compare_type *b) +loc_list_hasher::equal (const dw_loc_list_struct *a, + const dw_loc_list_struct *b) { if (a == b) return 1; diff --git a/gcc/except.c b/gcc/except.c index 833ec21..f85e55a 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -227,20 +227,21 @@ struct action_record struct action_record_hasher : typed_free_remove { - typedef action_record value_type; - typedef action_record compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef action_record *value_type; + typedef action_record *compare_type; + static inline hashval_t hash (const action_record *); + static inline bool equal (const action_record *, const action_record *); }; inline hashval_t -action_record_hasher::hash (const value_type *entry) +action_record_hasher::hash (const action_record *entry) { return entry->next * 1009 + entry->filter; } inline bool -action_record_hasher::equal (const value_type *entry, const compare_type *data) +action_record_hasher::equal (const action_record *entry, + const action_record *data) { return entry->filter == data->filter && entry->next == data->next; } @@ -742,23 +743,23 @@ struct ttypes_filter { struct ttypes_filter_hasher : typed_free_remove { - typedef ttypes_filter value_type; - typedef tree_node compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef ttypes_filter *value_type; + typedef tree_node *compare_type; + static inline hashval_t hash (const ttypes_filter *); + static inline bool equal (const ttypes_filter *, const tree_node *); }; /* Compare ENTRY (a ttypes_filter entry in the hash table) with DATA (a tree) for a @TTypes type node we are thinking about adding. */ inline bool -ttypes_filter_hasher::equal (const value_type *entry, const compare_type *data) +ttypes_filter_hasher::equal (const ttypes_filter *entry, const tree_node *data) { return entry->t == data; } inline hashval_t -ttypes_filter_hasher::hash (const value_type *entry) +ttypes_filter_hasher::hash (const ttypes_filter *entry) { return TREE_HASH (entry->t); } @@ -770,10 +771,10 @@ typedef hash_table ttypes_hash_type; struct ehspec_hasher : typed_free_remove { - typedef ttypes_filter value_type; - typedef ttypes_filter compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef ttypes_filter *value_type; + typedef ttypes_filter *compare_type; + static inline hashval_t hash (const ttypes_filter *); + static inline bool equal (const ttypes_filter *, const ttypes_filter *); }; /* Compare ENTRY with DATA (both struct ttypes_filter) for a @TTypes @@ -782,7 +783,7 @@ struct ehspec_hasher : typed_free_remove should put these in some canonical order. */ inline bool -ehspec_hasher::equal (const value_type *entry, const compare_type *data) +ehspec_hasher::equal (const ttypes_filter *entry, const ttypes_filter *data) { return type_list_equal (entry->t, data->t); } @@ -790,7 +791,7 @@ ehspec_hasher::equal (const value_type *entry, const compare_type *data) /* Hash function for exception specification lists. */ inline hashval_t -ehspec_hasher::hash (const value_type *entry) +ehspec_hasher::hash (const ttypes_filter *entry) { hashval_t h = 0; tree list; diff --git a/gcc/gcse.c b/gcc/gcse.c index 37aac6a..4be3f36 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -388,15 +388,15 @@ static struct ls_expr * pre_ldst_mems = NULL; struct pre_ldst_expr_hasher : typed_noop_remove { - typedef ls_expr value_type; + typedef ls_expr *value_type; typedef value_type compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + static inline hashval_t hash (const ls_expr *); + static inline bool equal (const ls_expr *, const ls_expr *); }; /* Hashtable helpers. */ inline hashval_t -pre_ldst_expr_hasher::hash (const value_type *x) +pre_ldst_expr_hasher::hash (const ls_expr *x) { int do_not_record_p = 0; return @@ -406,8 +406,8 @@ pre_ldst_expr_hasher::hash (const value_type *x) static int expr_equiv_p (const_rtx, const_rtx); inline bool -pre_ldst_expr_hasher::equal (const value_type *ptr1, - const compare_type *ptr2) +pre_ldst_expr_hasher::equal (const ls_expr *ptr1, + const ls_expr *ptr2) { return expr_equiv_p (ptr1->pattern, ptr2->pattern); } diff --git a/gcc/genmatch.c b/gcc/genmatch.c index 560a371..fbd12a5 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -190,21 +190,21 @@ struct id_base : typed_noop_remove const char *id; /* hash_table support. */ - typedef id_base value_type; - typedef id_base compare_type; - static inline hashval_t hash (const value_type *); - static inline int equal (const value_type *, const compare_type *); + typedef id_base *value_type; + typedef id_base *compare_type; + static inline hashval_t hash (const id_base *); + static inline int equal (const id_base *, const id_base *); }; inline hashval_t -id_base::hash (const value_type *op) +id_base::hash (const id_base *op) { return op->hashval; } inline int -id_base::equal (const value_type *op1, - const compare_type *op2) +id_base::equal (const id_base *op1, + const id_base *op2) { return (op1->hashval == op2->hashval && strcmp (op1->id, op2->id) == 0); diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 03fbe7d..eff326a 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -242,20 +242,20 @@ struct ptr_data struct saving_hasher : typed_free_remove { - typedef ptr_data value_type; - typedef void compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef ptr_data *value_type; + typedef void *compare_type; + static inline hashval_t hash (const ptr_data *); + static inline bool equal (const ptr_data *, const void *); }; inline hashval_t -saving_hasher::hash (const value_type *p) +saving_hasher::hash (const ptr_data *p) { return POINTER_HASH (p->obj); } inline bool -saving_hasher::equal (const value_type *p1, const compare_type *p2) +saving_hasher::equal (const ptr_data *p1, const void *p2) { return p1->obj == p2; } @@ -847,20 +847,22 @@ struct ggc_loc_descriptor struct ggc_loc_desc_hasher : typed_noop_remove { - typedef ggc_loc_descriptor value_type; - typedef ggc_loc_descriptor compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef ggc_loc_descriptor *value_type; + typedef ggc_loc_descriptor *compare_type; + static inline hashval_t hash (const ggc_loc_descriptor *); + static inline bool equal (const ggc_loc_descriptor *, + const ggc_loc_descriptor *); }; inline hashval_t -ggc_loc_desc_hasher::hash (const value_type *d) +ggc_loc_desc_hasher::hash (const ggc_loc_descriptor *d) { return htab_hash_pointer (d->function) | d->line; } inline bool -ggc_loc_desc_hasher::equal (const value_type *d, const compare_type *d2) +ggc_loc_desc_hasher::equal (const ggc_loc_descriptor *d, + const ggc_loc_descriptor *d2) { return (d->file == d2->file && d->line == d2->line && d->function == d2->function); @@ -880,20 +882,20 @@ struct ggc_ptr_hash_entry struct ptr_hash_hasher : typed_noop_remove { - typedef ggc_ptr_hash_entry value_type; - typedef void compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef ggc_ptr_hash_entry *value_type; + typedef void *compare_type; + static inline hashval_t hash (const ggc_ptr_hash_entry *); + static inline bool equal (const ggc_ptr_hash_entry *, const void *); }; inline hashval_t -ptr_hash_hasher::hash (const value_type *d) +ptr_hash_hasher::hash (const ggc_ptr_hash_entry *d) { return htab_hash_pointer (d->ptr); } inline bool -ptr_hash_hasher::equal (const value_type *p, const compare_type *p2) +ptr_hash_hasher::equal (const ggc_ptr_hash_entry *p, const void *p2) { return (p->ptr == p2); } diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index 5b84bbe..afd3215 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -438,21 +438,21 @@ lookup_cand (cand_idx idx) struct cand_chain_hasher : typed_noop_remove { - typedef cand_chain value_type; - typedef cand_chain compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef cand_chain *value_type; + typedef cand_chain *compare_type; + static inline hashval_t hash (const cand_chain *); + static inline bool equal (const cand_chain *, const cand_chain *); }; inline hashval_t -cand_chain_hasher::hash (const value_type *p) +cand_chain_hasher::hash (const cand_chain *p) { tree base_expr = p->base_expr; return iterative_hash_expr (base_expr, 0); } inline bool -cand_chain_hasher::equal (const value_type *chain1, const compare_type *chain2) +cand_chain_hasher::equal (const cand_chain *chain1, const cand_chain *chain2) { return operand_equal_p (chain1->base_expr, chain2->base_expr, 0); } diff --git a/gcc/gimplify.c b/gcc/gimplify.c index c701ef3..0a8ef84 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -136,10 +136,10 @@ enum omp_region_type struct gimplify_hasher : typed_free_remove { - typedef elt_t value_type; - typedef elt_t compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef elt_t *value_type; + typedef elt_t *compare_type; + static inline hashval_t hash (const elt_t *); + static inline bool equal (const elt_t *, const elt_t *); }; struct gimplify_ctx @@ -9448,14 +9448,14 @@ gimplify_assign (tree dst, tree src, gimple_seq *seq_p) } inline hashval_t -gimplify_hasher::hash (const value_type *p) +gimplify_hasher::hash (const elt_t *p) { tree t = p->val; return iterative_hash_expr (t, 0); } inline bool -gimplify_hasher::equal (const value_type *p1, const compare_type *p2) +gimplify_hasher::equal (const elt_t *p1, const elt_t *p2) { tree t1 = p1->val; tree t2 = p2->val; diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index ad2450b..96c038f 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -621,16 +621,16 @@ struct delay_pair struct delay_i1_hasher : typed_noop_remove { - typedef delay_pair value_type; - typedef void compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef delay_pair *value_type; + typedef void *compare_type; + static inline hashval_t hash (const delay_pair *); + static inline bool equal (const delay_pair *, const void *); }; /* Returns a hash value for X, based on hashing just I1. */ inline hashval_t -delay_i1_hasher::hash (const value_type *x) +delay_i1_hasher::hash (const delay_pair *x) { return htab_hash_pointer (x->i1); } @@ -638,23 +638,23 @@ delay_i1_hasher::hash (const value_type *x) /* Return true if I1 of pair X is the same as that of pair Y. */ inline bool -delay_i1_hasher::equal (const value_type *x, const compare_type *y) +delay_i1_hasher::equal (const delay_pair *x, const void *y) { return x->i1 == y; } struct delay_i2_hasher : typed_free_remove { - typedef delay_pair value_type; - typedef void compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef delay_pair *value_type; + typedef void *compare_type; + static inline hashval_t hash (const delay_pair *); + static inline bool equal (const delay_pair *, const void *); }; /* Returns a hash value for X, based on hashing just I2. */ inline hashval_t -delay_i2_hasher::hash (const value_type *x) +delay_i2_hasher::hash (const delay_pair *x) { return htab_hash_pointer (x->i2); } @@ -662,7 +662,7 @@ delay_i2_hasher::hash (const value_type *x) /* Return true if I2 of pair X is the same as that of pair Y. */ inline bool -delay_i2_hasher::equal (const value_type *x, const compare_type *y) +delay_i2_hasher::equal (const delay_pair *x, const void *y) { return x->i2 == y; } diff --git a/gcc/hard-reg-set.h b/gcc/hard-reg-set.h index d1a6e51..89971d7 100644 --- a/gcc/hard-reg-set.h +++ b/gcc/hard-reg-set.h @@ -615,7 +615,17 @@ hard_reg_set_iter_next (hard_reg_set_iterator *iter, unsigned *regno) extern char global_regs[FIRST_PSEUDO_REGISTER]; -struct simplifiable_subregs_hasher; +struct simplifiable_subreg; +struct subreg_shape; + +struct simplifiable_subregs_hasher : typed_noop_remove +{ + typedef simplifiable_subreg *value_type; + typedef const subreg_shape *compare_type; + + static inline hashval_t hash (const simplifiable_subreg *); + static inline bool equal (const simplifiable_subreg *, const subreg_shape *); +}; struct target_hard_regs { void finalize (); diff --git a/gcc/hash-map.h b/gcc/hash-map.h index e1dea91..4cca702 100644 --- a/gcc/hash-map.h +++ b/gcc/hash-map.h @@ -114,7 +114,6 @@ class GTY((user)) hash_map typedef hash_entry value_type; typedef Key compare_type; - typedef int store_values_directly; static hashval_t hash (const hash_entry &e) { diff --git a/gcc/hash-set.h b/gcc/hash-set.h index c1e8872..9065451 100644 --- a/gcc/hash-set.h +++ b/gcc/hash-set.h @@ -112,7 +112,6 @@ class hash_set typedef hash_entry value_type; typedef Key compare_type; - typedef int store_values_directly; static hashval_t hash (const hash_entry &e) { diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 447eaff..f6375d1 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -278,7 +278,6 @@ struct pointer_hash : typed_noop_remove { typedef Type *value_type; typedef Type *compare_type; - typedef int store_values_directly; static inline hashval_t hash (const value_type &); @@ -310,7 +309,6 @@ struct ggc_hasher { typedef T value_type; typedef T compare_type; - typedef int store_values_directly; static void remove (T) {} @@ -342,7 +340,6 @@ struct ggc_cache_hasher { typedef T value_type; typedef T compare_type; - typedef int store_values_directly; static void remove (T &) {} @@ -438,26 +435,6 @@ hash_table_mod2 (hashval_t hash, unsigned int index) return 1 + mul_mod (hash, p->prime - 2, p->inv_m2, p->shift); } -/* The below is some template meta programming to decide if we should use the - hash table partial specialization that directly stores value_type instead of - pointers to value_type. If the Descriptor type defines the type - Descriptor::store_values_directly then values are stored directly otherwise - pointers to them are stored. */ -template struct notype { typedef void type; }; - -template -struct storage_tester -{ - static const bool value = false; -}; - -template -struct storage_tester::type> -{ - static const bool value = true; -}; - template struct has_is_deleted { @@ -576,9 +553,7 @@ struct mark_empty_helper /* User-facing hash table type. - The table stores elements of type Descriptor::value_type, or pointers to - objects of type value_type if the descriptor does not define the type - store_values_directly. + The table stores elements of type Descriptor::value_type. It hashes values with the hash member function. The table currently works with relatively weak hash functions. @@ -601,518 +576,9 @@ struct mark_empty_helper */ template class Allocator= xcallocator, - bool Storage = storage_tester::value> + template class Allocator = xcallocator> class hash_table { -}; - -template class Allocator> -class hash_table -{ - typedef typename Descriptor::value_type value_type; - typedef typename Descriptor::compare_type compare_type; - -public: - hash_table (size_t CXX_MEM_STAT_INFO); - ~hash_table (); - - /* Current size (in entries) of the hash table. */ - size_t size () const { return m_size; } - - /* Return the current number of elements in this hash table. */ - size_t elements () const { return m_n_elements - m_n_deleted; } - - /* Return the current number of elements in this hash table. */ - size_t elements_with_deleted () const { return m_n_elements; } - - /* This function clears all entries in the given hash table. */ - void empty (); - - /* This function clears a specified SLOT in a hash table. It is - useful when you've already done the lookup and don't want to do it - again. */ - - void clear_slot (value_type **); - - /* This function searches for a hash table entry equal to the given - COMPARABLE element starting with the given HASH value. It cannot - be used to insert or delete an element. */ - value_type *find_with_hash (const compare_type *, hashval_t); - -/* Like find_slot_with_hash, but compute the hash value from the element. */ - value_type *find (const value_type *value) - { - return find_with_hash (value, Descriptor::hash (value)); - } - - value_type **find_slot (const value_type *value, insert_option insert) - { - return find_slot_with_hash (value, Descriptor::hash (value), insert); - } - - /* This function searches for a hash table slot containing an entry - equal to the given COMPARABLE element and starting with the given - HASH. To delete an entry, call this with insert=NO_INSERT, then - call clear_slot on the slot returned (possibly after doing some - checks). To insert an entry, call this with insert=INSERT, then - write the value you want into the returned slot. When inserting an - entry, NULL may be returned if memory allocation fails. */ - value_type **find_slot_with_hash (const compare_type *comparable, - hashval_t hash, enum insert_option insert); - - /* This function deletes an element with the given COMPARABLE value - from hash table starting with the given HASH. If there is no - matching element in the hash table, this function does nothing. */ - void remove_elt_with_hash (const compare_type *, hashval_t); - -/* Like remove_elt_with_hash, but compute the hash value from the element. */ - void remove_elt (const value_type *value) - { - remove_elt_with_hash (value, Descriptor::hash (value)); - } - - /* This function scans over the entire hash table calling CALLBACK for - each live entry. If CALLBACK returns false, the iteration stops. - ARGUMENT is passed as CALLBACK's second argument. */ - template - void traverse_noresize (Argument argument); - - /* Like traverse_noresize, but does resize the table when it is too empty - to improve effectivity of subsequent calls. */ - template - void traverse (Argument argument); - - class iterator - { - public: - iterator () : m_slot (NULL), m_limit (NULL) {} - - iterator (value_type **slot, value_type **limit) : - m_slot (slot), m_limit (limit) {} - - inline value_type *operator * () { return *m_slot; } - void slide (); - inline iterator &operator ++ (); - bool operator != (const iterator &other) const - { - return m_slot != other.m_slot || m_limit != other.m_limit; - } - - private: - value_type **m_slot; - value_type **m_limit; - }; - - iterator begin () const - { - iterator iter (m_entries, m_entries + m_size); - iter.slide (); - return iter; - } - - iterator end () const { return iterator (); } - - double collisions () const - { - return m_searches ? static_cast (m_collisions) / m_searches : 0; - } - -private: - - value_type **find_empty_slot_for_expand (hashval_t); - void expand (); - - /* Table itself. */ - typename Descriptor::value_type **m_entries; - - size_t m_size; - - /* Current number of elements including also deleted elements. */ - size_t m_n_elements; - - /* Current number of deleted elements in the table. */ - size_t m_n_deleted; - - /* The following member is used for debugging. Its value is number - of all calls of `htab_find_slot' for the hash table. */ - unsigned int m_searches; - - /* The following member is used for debugging. Its value is number - of collisions fixed for time of work with the hash table. */ - unsigned int m_collisions; - - /* Current size (in entries) of the hash table, as an index into the - table of primes. */ - unsigned int m_size_prime_index; -}; - -template class Allocator> -hash_table::hash_table (size_t size - MEM_STAT_DECL) : - m_n_elements (0), m_n_deleted (0), m_searches (0), m_collisions (0) -{ - unsigned int size_prime_index; - - size_prime_index = hash_table_higher_prime_index (size); - size = prime_tab[size_prime_index].prime; - - m_entries = Allocator ::data_alloc (size); - gcc_assert (m_entries != NULL); - m_size = size; - m_size_prime_index = size_prime_index; -} - -template class Allocator> -hash_table::~hash_table () -{ - for (size_t i = m_size - 1; i < m_size; i--) - if (m_entries[i] != HTAB_EMPTY_ENTRY && m_entries[i] != HTAB_DELETED_ENTRY) - Descriptor::remove (m_entries[i]); - - Allocator ::data_free (m_entries); -} - -/* Similar to find_slot, but without several unwanted side effects: - - Does not call equal when it finds an existing entry. - - Does not change the count of elements/searches/collisions in the - hash table. - This function also assumes there are no deleted entries in the table. - HASH is the hash value for the element to be inserted. */ - -template class Allocator> -typename hash_table::value_type ** -hash_table -::find_empty_slot_for_expand (hashval_t hash) -{ - hashval_t index = hash_table_mod1 (hash, m_size_prime_index); - size_t size = m_size; - value_type **slot = m_entries + index; - hashval_t hash2; - - if (*slot == HTAB_EMPTY_ENTRY) - return slot; - gcc_checking_assert (*slot != HTAB_DELETED_ENTRY); - - hash2 = hash_table_mod2 (hash, m_size_prime_index); - for (;;) - { - index += hash2; - if (index >= size) - index -= size; - - slot = m_entries + index; - if (*slot == HTAB_EMPTY_ENTRY) - return slot; - gcc_checking_assert (*slot != HTAB_DELETED_ENTRY); - } -} - -/* The following function changes size of memory allocated for the - entries and repeatedly inserts the table elements. The occupancy - of the table after the call will be about 50%. Naturally the hash - table must already exist. Remember also that the place of the - table entries is changed. If memory allocation fails, this function - will abort. */ - -template class Allocator> -void -hash_table::expand () -{ - value_type **oentries = m_entries; - unsigned int oindex = m_size_prime_index; - size_t osize = size (); - value_type **olimit = oentries + osize; - size_t elts = elements (); - - /* Resize only when table after removal of unused elements is either - too full or too empty. */ - unsigned int nindex; - size_t nsize; - if (elts * 2 > osize || (elts * 8 < osize && osize > 32)) - { - nindex = hash_table_higher_prime_index (elts * 2); - nsize = prime_tab[nindex].prime; - } - else - { - nindex = oindex; - nsize = osize; - } - - value_type **nentries = Allocator ::data_alloc (nsize); - gcc_assert (nentries != NULL); - m_entries = nentries; - m_size = nsize; - m_size_prime_index = nindex; - m_n_elements -= m_n_deleted; - m_n_deleted = 0; - - value_type **p = oentries; - do - { - value_type *x = *p; - - if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY) - { - value_type **q = find_empty_slot_for_expand (Descriptor::hash (x)); - - *q = x; - } - - p++; - } - while (p < olimit); - - Allocator ::data_free (oentries); -} - -template class Allocator> -void -hash_table::empty () -{ - size_t size = m_size; - value_type **entries = m_entries; - int i; - - for (i = size - 1; i >= 0; i--) - if (entries[i] != HTAB_EMPTY_ENTRY && entries[i] != HTAB_DELETED_ENTRY) - Descriptor::remove (entries[i]); - - /* Instead of clearing megabyte, downsize the table. */ - if (size > 1024*1024 / sizeof (PTR)) - { - int nindex = hash_table_higher_prime_index (1024 / sizeof (PTR)); - int nsize = prime_tab[nindex].prime; - - Allocator ::data_free (m_entries); - m_entries = Allocator ::data_alloc (nsize); - m_size = nsize; - m_size_prime_index = nindex; - } - else - memset (entries, 0, size * sizeof (value_type *)); - m_n_deleted = 0; - m_n_elements = 0; -} - -/* This function clears a specified SLOT in a hash table. It is - useful when you've already done the lookup and don't want to do it - again. */ - -template class Allocator> -void -hash_table::clear_slot (value_type **slot) -{ - gcc_checking_assert (!(slot < m_entries || slot >= m_entries + size () - || *slot == HTAB_EMPTY_ENTRY - || *slot == HTAB_DELETED_ENTRY)); - - Descriptor::remove (*slot); - - *slot = static_cast (HTAB_DELETED_ENTRY); - m_n_deleted++; -} - -/* This function searches for a hash table entry equal to the given - COMPARABLE element starting with the given HASH value. It cannot - be used to insert or delete an element. */ - -template class Allocator> -typename hash_table::value_type * -hash_table -::find_with_hash (const compare_type *comparable, hashval_t hash) -{ - m_searches++; - size_t size = m_size; - hashval_t index = hash_table_mod1 (hash, m_size_prime_index); - - value_type *entry = m_entries[index]; - if (entry == HTAB_EMPTY_ENTRY - || (entry != HTAB_DELETED_ENTRY && Descriptor::equal (entry, comparable))) - return entry; - - hashval_t hash2 = hash_table_mod2 (hash, m_size_prime_index); - for (;;) - { - m_collisions++; - index += hash2; - if (index >= size) - index -= size; - - entry = m_entries[index]; - if (entry == HTAB_EMPTY_ENTRY - || (entry != HTAB_DELETED_ENTRY - && Descriptor::equal (entry, comparable))) - return entry; - } -} - -/* This function searches for a hash table slot containing an entry - equal to the given COMPARABLE element and starting with the given - HASH. To delete an entry, call this with insert=NO_INSERT, then - call clear_slot on the slot returned (possibly after doing some - checks). To insert an entry, call this with insert=INSERT, then - write the value you want into the returned slot. When inserting an - entry, NULL may be returned if memory allocation fails. */ - -template class Allocator> -typename hash_table::value_type ** -hash_table -::find_slot_with_hash (const compare_type *comparable, hashval_t hash, - enum insert_option insert) -{ - if (insert == INSERT && m_size * 3 <= m_n_elements * 4) - expand (); - - m_searches++; - - value_type **first_deleted_slot = NULL; - hashval_t index = hash_table_mod1 (hash, m_size_prime_index); - hashval_t hash2 = hash_table_mod2 (hash, m_size_prime_index); - value_type *entry = m_entries[index]; - size_t size = m_size; - if (entry == HTAB_EMPTY_ENTRY) - goto empty_entry; - else if (entry == HTAB_DELETED_ENTRY) - first_deleted_slot = &m_entries[index]; - else if (Descriptor::equal (entry, comparable)) - return &m_entries[index]; - - for (;;) - { - m_collisions++; - index += hash2; - if (index >= size) - index -= size; - - entry = m_entries[index]; - if (entry == HTAB_EMPTY_ENTRY) - goto empty_entry; - else if (entry == HTAB_DELETED_ENTRY) - { - if (!first_deleted_slot) - first_deleted_slot = &m_entries[index]; - } - else if (Descriptor::equal (entry, comparable)) - return &m_entries[index]; - } - - empty_entry: - if (insert == NO_INSERT) - return NULL; - - if (first_deleted_slot) - { - m_n_deleted--; - *first_deleted_slot = static_cast (HTAB_EMPTY_ENTRY); - return first_deleted_slot; - } - - m_n_elements++; - return &m_entries[index]; -} - -/* This function deletes an element with the given COMPARABLE value - from hash table starting with the given HASH. If there is no - matching element in the hash table, this function does nothing. */ - -template class Allocator> -void -hash_table -::remove_elt_with_hash (const compare_type *comparable, hashval_t hash) -{ - value_type **slot = find_slot_with_hash (comparable, hash, NO_INSERT); - if (*slot == HTAB_EMPTY_ENTRY) - return; - - Descriptor::remove (*slot); - - *slot = static_cast (HTAB_DELETED_ENTRY); - m_n_deleted++; -} - -/* This function scans over the entire hash table calling CALLBACK for - each live entry. If CALLBACK returns false, the iteration stops. - ARGUMENT is passed as CALLBACK's second argument. */ - -template class Allocator> -template::value_type **slot, - Argument argument)> -void -hash_table::traverse_noresize (Argument argument) -{ - value_type **slot = m_entries; - value_type **limit = slot + size (); - - do - { - value_type *x = *slot; - - if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY) - if (! Callback (slot, argument)) - break; - } - while (++slot < limit); -} - -/* Like traverse_noresize, but does resize the table when it is too empty - to improve effectivity of subsequent calls. */ - -template class Allocator> -template ::value_type **slot, - Argument argument)> -void -hash_table::traverse (Argument argument) -{ - size_t size = m_size; - if (elements () * 8 < size && size > 32) - expand (); - - traverse_noresize (argument); -} - -/* Slide down the iterator slots until an active entry is found. */ - -template class Allocator> -void -hash_table::iterator::slide () -{ - for ( ; m_slot < m_limit; ++m_slot ) - { - value_type *x = *m_slot; - if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY) - return; - } - m_slot = NULL; - m_limit = NULL; -} - -/* Bump the iterator. */ - -template class Allocator> -inline typename hash_table::iterator & -hash_table::iterator::operator ++ () -{ - ++m_slot; - slide (); - return *this; -} - -/* A partial specialization used when values should be stored directly. */ - -template class Allocator> -class hash_table -{ typedef typename Descriptor::value_type value_type; typedef typename Descriptor::compare_type compare_type; @@ -1296,7 +762,7 @@ private: }; template class Allocator> -hash_table::hash_table (size_t size, bool ggc +hash_table::hash_table (size_t size, bool ggc MEM_STAT_DECL) : m_n_elements (0), m_n_deleted (0), m_searches (0), m_collisions (0), m_ggc (ggc) @@ -1312,7 +778,7 @@ hash_table::hash_table (size_t size, bool ggc } template class Allocator> -hash_table::~hash_table () +hash_table::~hash_table () { for (size_t i = m_size - 1; i < m_size; i--) if (!is_empty (m_entries[i]) && !is_deleted (m_entries[i])) @@ -1327,9 +793,8 @@ hash_table::~hash_table () /* This function returns an array of empty hash table elements. */ template class Allocator> -inline typename hash_table::value_type * -hash_table::alloc_entries - (size_t n MEM_STAT_DECL) const +inline typename hash_table::value_type * +hash_table::alloc_entries (size_t n MEM_STAT_DECL) const { value_type *nentries; @@ -1353,9 +818,8 @@ hash_table::alloc_entries HASH is the hash value for the element to be inserted. */ template class Allocator> -typename hash_table::value_type * -hash_table -::find_empty_slot_for_expand (hashval_t hash) +typename hash_table::value_type * +hash_table::find_empty_slot_for_expand (hashval_t hash) { hashval_t index = hash_table_mod1 (hash, m_size_prime_index); size_t size = m_size; @@ -1393,7 +857,7 @@ hash_table template class Allocator> void -hash_table::expand () +hash_table::expand () { value_type *oentries = m_entries; unsigned int oindex = m_size_prime_index; @@ -1447,7 +911,7 @@ hash_table::expand () template class Allocator> void -hash_table::empty () +hash_table::empty () { size_t size = m_size; value_type *entries = m_entries; @@ -1484,7 +948,7 @@ hash_table::empty () template class Allocator> void -hash_table::clear_slot (value_type *slot) +hash_table::clear_slot (value_type *slot) { gcc_checking_assert (!(slot < m_entries || slot >= m_entries + size () || is_empty (*slot) || is_deleted (*slot))); @@ -1500,8 +964,8 @@ hash_table::clear_slot (value_type *slot) be used to insert or delete an element. */ template class Allocator> -typename hash_table::value_type & -hash_table +typename hash_table::value_type & +hash_table ::find_with_hash (const compare_type &comparable, hashval_t hash) { m_searches++; @@ -1537,8 +1001,8 @@ hash_table entry, NULL may be returned if memory allocation fails. */ template class Allocator> -typename hash_table::value_type * -hash_table +typename hash_table::value_type * +hash_table ::find_slot_with_hash (const compare_type &comparable, hashval_t hash, enum insert_option insert) { @@ -1599,7 +1063,7 @@ hash_table template class Allocator> void -hash_table +hash_table ::remove_elt_with_hash (const compare_type &comparable, hashval_t hash) { value_type *slot = find_slot_with_hash (comparable, hash, NO_INSERT); @@ -1619,11 +1083,11 @@ hash_table template class Allocator> template::value_type *slot, - Argument argument)> + int (*Callback) + (typename hash_table::value_type *slot, + Argument argument)> void -hash_table::traverse_noresize (Argument argument) +hash_table::traverse_noresize (Argument argument) { value_type *slot = m_entries; value_type *limit = slot + size (); @@ -1645,11 +1109,11 @@ hash_table::traverse_noresize (Argument argument) template class Allocator> template ::value_type *slot, - Argument argument)> + int (*Callback) + (typename hash_table::value_type *slot, + Argument argument)> void -hash_table::traverse (Argument argument) +hash_table::traverse (Argument argument) { size_t size = m_size; if (elements () * 8 < size && size > 32) @@ -1662,7 +1126,7 @@ hash_table::traverse (Argument argument) template class Allocator> void -hash_table::iterator::slide () +hash_table::iterator::slide () { for ( ; m_slot < m_limit; ++m_slot ) { @@ -1677,8 +1141,8 @@ hash_table::iterator::slide () /* Bump the iterator. */ template class Allocator> -inline typename hash_table::iterator & -hash_table::iterator::operator ++ () +inline typename hash_table::iterator & +hash_table::iterator::operator ++ () { ++m_slot; slide (); diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 6969f5a..7214a74 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -308,11 +308,11 @@ type_possibly_instantiated_p (tree t) struct odr_name_hasher { - typedef odr_type_d value_type; - typedef union tree_node compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef odr_type_d *value_type; + typedef union tree_node *compare_type; + static inline hashval_t hash (const odr_type_d *); + static inline bool equal (const odr_type_d *, const tree_node *); + static inline void remove (odr_type_d *); }; /* Has used to unify ODR types based on their associated virtual table. @@ -321,8 +321,8 @@ struct odr_name_hasher struct odr_vtable_hasher:odr_name_hasher { - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + static inline hashval_t hash (const odr_type_d *); + static inline bool equal (const odr_type_d *, const tree_node *); }; /* Return type that was declared with T's name so that T is an @@ -369,7 +369,7 @@ hash_odr_name (const_tree t) /* Return the computed hashcode for ODR_TYPE. */ inline hashval_t -odr_name_hasher::hash (const value_type *odr_type) +odr_name_hasher::hash (const odr_type_d *odr_type) { return hash_odr_name (odr_type->type); } @@ -414,7 +414,7 @@ hash_odr_vtable (const_tree t) /* Return the computed hashcode for ODR_TYPE. */ inline hashval_t -odr_vtable_hasher::hash (const value_type *odr_type) +odr_vtable_hasher::hash (const odr_type_d *odr_type) { return hash_odr_vtable (odr_type->type); } @@ -553,7 +553,7 @@ types_must_be_same_for_odr (tree t1, tree t2) equivalent. */ inline bool -odr_name_hasher::equal (const value_type *o1, const compare_type *t2) +odr_name_hasher::equal (const odr_type_d *o1, const tree_node *t2) { tree t1 = o1->type; @@ -578,7 +578,7 @@ odr_name_hasher::equal (const value_type *o1, const compare_type *t2) equivalent. */ inline bool -odr_vtable_hasher::equal (const value_type *o1, const compare_type *t2) +odr_vtable_hasher::equal (const odr_type_d *o1, const tree_node *t2) { tree t1 = o1->type; @@ -602,7 +602,7 @@ odr_vtable_hasher::equal (const value_type *o1, const compare_type *t2) /* Free ODR type V. */ inline void -odr_name_hasher::remove (value_type *v) +odr_name_hasher::remove (odr_type_d *v) { v->bases.release (); v->derived_types.release (); @@ -2507,17 +2507,18 @@ struct polymorphic_call_target_d struct polymorphic_call_target_hasher { - typedef polymorphic_call_target_d value_type; - typedef polymorphic_call_target_d compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef polymorphic_call_target_d *value_type; + typedef polymorphic_call_target_d *compare_type; + static inline hashval_t hash (const polymorphic_call_target_d *); + static inline bool equal (const polymorphic_call_target_d *, + const polymorphic_call_target_d *); + static inline void remove (polymorphic_call_target_d *); }; /* Return the computed hashcode for ODR_QUERY. */ inline hashval_t -polymorphic_call_target_hasher::hash (const value_type *odr_query) +polymorphic_call_target_hasher::hash (const polymorphic_call_target_d *odr_query) { inchash::hash hstate (odr_query->otr_token); @@ -2541,8 +2542,8 @@ polymorphic_call_target_hasher::hash (const value_type *odr_query) /* Compare cache entries T1 and T2. */ inline bool -polymorphic_call_target_hasher::equal (const value_type *t1, - const compare_type *t2) +polymorphic_call_target_hasher::equal (const polymorphic_call_target_d *t1, + const polymorphic_call_target_d *t2) { return (t1->type == t2->type && t1->otr_token == t2->otr_token && t1->speculative == t2->speculative @@ -2560,7 +2561,7 @@ polymorphic_call_target_hasher::equal (const value_type *t1, /* Remove entry in polymorphic call target cache hash. */ inline void -polymorphic_call_target_hasher::remove (value_type *v) +polymorphic_call_target_hasher::remove (polymorphic_call_target_d *v) { v->targets.release (); free (v); diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h index 7eb9f27..b9d70b4 100644 --- a/gcc/ipa-icf.h +++ b/gcc/ipa-icf.h @@ -429,15 +429,16 @@ struct congruence_class_group /* Congruence class set structure. */ struct congruence_class_group_hash: typed_noop_remove { - typedef congruence_class_group value_type; - typedef congruence_class_group compare_type; + typedef congruence_class_group *value_type; + typedef congruence_class_group *compare_type; - static inline hashval_t hash (const value_type *item) + static inline hashval_t hash (const congruence_class_group *item) { return item->hash; } - static inline int equal (const value_type *item1, const compare_type *item2) + static inline int equal (const congruence_class_group *item1, + const congruence_class_group *item2) { return item1->hash == item2->hash && item1->type == item2->type; } diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c index e9f937f..96fb810 100644 --- a/gcc/ipa-profile.c +++ b/gcc/ipa-profile.c @@ -113,10 +113,10 @@ static alloc_pool histogram_pool; struct histogram_hash : typed_noop_remove { - typedef histogram_entry value_type; - typedef histogram_entry compare_type; - static inline hashval_t hash (const value_type *); - static inline int equal (const value_type *, const compare_type *); + typedef histogram_entry *value_type; + typedef histogram_entry *compare_type; + static inline hashval_t hash (const histogram_entry *); + static inline int equal (const histogram_entry *, const histogram_entry *); }; inline hashval_t diff --git a/gcc/ira-color.c b/gcc/ira-color.c index d2d5102..0ed9edd 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -227,22 +227,24 @@ static vec allocno_hard_regs_vec; struct allocno_hard_regs_hasher : typed_noop_remove { - typedef allocno_hard_regs value_type; - typedef allocno_hard_regs compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef allocno_hard_regs *value_type; + typedef allocno_hard_regs *compare_type; + static inline hashval_t hash (const allocno_hard_regs *); + static inline bool equal (const allocno_hard_regs *, + const allocno_hard_regs *); }; /* Returns hash value for allocno hard registers V. */ inline hashval_t -allocno_hard_regs_hasher::hash (const value_type *hv) +allocno_hard_regs_hasher::hash (const allocno_hard_regs *hv) { return iterative_hash (&hv->set, sizeof (HARD_REG_SET), 0); } /* Compares allocno hard registers V1 and V2. */ inline bool -allocno_hard_regs_hasher::equal (const value_type *hv1, const compare_type *hv2) +allocno_hard_regs_hasher::equal (const allocno_hard_regs *hv1, + const allocno_hard_regs *hv2) { return hard_reg_set_equal_p (hv1->set, hv2->set); } diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index 354ba6b..5358440 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -161,23 +161,23 @@ static cost_classes_t *regno_cost_classes; struct cost_classes_hasher { - typedef cost_classes value_type; - typedef cost_classes compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef cost_classes *value_type; + typedef cost_classes *compare_type; + static inline hashval_t hash (const cost_classes *); + static inline bool equal (const cost_classes *, const cost_classes *); + static inline void remove (cost_classes *); }; /* Returns hash value for cost classes info HV. */ inline hashval_t -cost_classes_hasher::hash (const value_type *hv) +cost_classes_hasher::hash (const cost_classes *hv) { return iterative_hash (&hv->classes, sizeof (enum reg_class) * hv->num, 0); } /* Compares cost classes info HV1 and HV2. */ inline bool -cost_classes_hasher::equal (const value_type *hv1, const compare_type *hv2) +cost_classes_hasher::equal (const cost_classes *hv1, const cost_classes *hv2) { return (hv1->num == hv2->num && memcmp (hv1->classes, hv2->classes, @@ -186,7 +186,7 @@ cost_classes_hasher::equal (const value_type *hv1, const compare_type *hv2) /* Delete cost classes info V from the hash table. */ inline void -cost_classes_hasher::remove (value_type *v) +cost_classes_hasher::remove (cost_classes *v) { ira_free (v); } diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 0437f73..9ebc248 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2015-04-18 Trevor Saunders + + * jcf-io.c: Adjust for hash_table changes. + 2015-01-30 Joseph Myers * class.c, expr.c, jcf-parse.c, jvspec.c: All callers of diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c index 2c48f14..36ceb07 100644 --- a/gcc/java/jcf-io.c +++ b/gcc/java/jcf-io.c @@ -285,21 +285,20 @@ find_classfile (char *filename, JCF *jcf, const char *dep_name) struct charstar_hash : typed_noop_remove { - typedef const char value_type; - typedef const char compare_type; - static inline hashval_t hash (const value_type *candidate); - static inline bool equal (const value_type *existing, - const compare_type *candidate); + typedef const char *value_type; + typedef const char *compare_type; + static inline hashval_t hash (const char *candidate); + static inline bool equal (const char *existing, const char *candidate); }; inline hashval_t -charstar_hash::hash (const value_type *candidate) +charstar_hash::hash (const char *candidate) { return htab_hash_string (candidate); } inline bool -charstar_hash::equal (const value_type *existing, const compare_type *candidate) +charstar_hash::equal (const char *existing, const char *candidate) { return strcmp (existing, candidate) == 0; } diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index f79b497..52ecc05 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -455,16 +455,17 @@ invariant_expr_equal_p (rtx_insn *insn1, rtx e1, rtx_insn *insn2, rtx e2) struct invariant_expr_hasher : typed_free_remove { - typedef invariant_expr_entry value_type; - typedef invariant_expr_entry compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef invariant_expr_entry *value_type; + typedef invariant_expr_entry *compare_type; + static inline hashval_t hash (const invariant_expr_entry *); + static inline bool equal (const invariant_expr_entry *, + const invariant_expr_entry *); }; /* Returns hash value for invariant expression entry ENTRY. */ inline hashval_t -invariant_expr_hasher::hash (const value_type *entry) +invariant_expr_hasher::hash (const invariant_expr_entry *entry) { return entry->hash; } @@ -472,8 +473,8 @@ invariant_expr_hasher::hash (const value_type *entry) /* Compares invariant expression entries ENTRY1 and ENTRY2. */ inline bool -invariant_expr_hasher::equal (const value_type *entry1, - const compare_type *entry2) +invariant_expr_hasher::equal (const invariant_expr_entry *entry1, + const invariant_expr_entry *entry2) { if (entry1->mode != entry2->mode) return 0; diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index de2b15a..36a9a9f 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -138,16 +138,16 @@ static struct loop *current_loop; struct biv_entry_hasher : typed_free_remove { - typedef biv_entry value_type; - typedef rtx_def compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef biv_entry *value_type; + typedef rtx_def *compare_type; + static inline hashval_t hash (const biv_entry *); + static inline bool equal (const biv_entry *, const rtx_def *); }; /* Returns hash value for biv B. */ inline hashval_t -biv_entry_hasher::hash (const value_type *b) +biv_entry_hasher::hash (const biv_entry *b) { return b->regno; } @@ -155,7 +155,7 @@ biv_entry_hasher::hash (const value_type *b) /* Compares biv B and register R. */ inline bool -biv_entry_hasher::equal (const value_type *b, const compare_type *r) +biv_entry_hasher::equal (const biv_entry *b, const rtx_def *r) { return b->regno == REGNO (r); } diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 2befb61..ccf473d 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -126,17 +126,17 @@ struct var_to_expand struct iv_split_hasher : typed_free_remove { - typedef iv_to_split value_type; - typedef iv_to_split compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef iv_to_split *value_type; + typedef iv_to_split *compare_type; + static inline hashval_t hash (const iv_to_split *); + static inline bool equal (const iv_to_split *, const iv_to_split *); }; /* A hash function for information about insns to split. */ inline hashval_t -iv_split_hasher::hash (const value_type *ivts) +iv_split_hasher::hash (const iv_to_split *ivts) { return (hashval_t) INSN_UID (ivts->insn); } @@ -144,7 +144,7 @@ iv_split_hasher::hash (const value_type *ivts) /* An equality functions for information about insns to split. */ inline bool -iv_split_hasher::equal (const value_type *i1, const compare_type *i2) +iv_split_hasher::equal (const iv_to_split *i1, const iv_to_split *i2) { return i1->insn == i2->insn; } @@ -153,16 +153,16 @@ iv_split_hasher::equal (const value_type *i1, const compare_type *i2) struct var_expand_hasher : typed_free_remove { - typedef var_to_expand value_type; - typedef var_to_expand compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef var_to_expand *value_type; + typedef var_to_expand *compare_type; + static inline hashval_t hash (const var_to_expand *); + static inline bool equal (const var_to_expand *, const var_to_expand *); }; /* Return a hash for VES. */ inline hashval_t -var_expand_hasher::hash (const value_type *ves) +var_expand_hasher::hash (const var_to_expand *ves) { return (hashval_t) INSN_UID (ves->insn); } @@ -170,7 +170,7 @@ var_expand_hasher::hash (const value_type *ves) /* Return true if I1 and I2 refer to the same instruction. */ inline bool -var_expand_hasher::equal (const value_type *i1, const compare_type *i2) +var_expand_hasher::equal (const var_to_expand *i1, const var_to_expand *i2) { return i1->insn == i2->insn; } diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index b383631..e3465a8 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -657,17 +657,17 @@ struct string_slot struct string_slot_hasher : typed_noop_remove { - typedef string_slot value_type; - typedef string_slot compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef string_slot *value_type; + typedef string_slot *compare_type; + static inline hashval_t hash (const string_slot *); + static inline bool equal (const string_slot *, const string_slot *); }; /* Returns a hash code for DS. Adapted from libiberty's htab_hash_string to support strings that may not end in '\0'. */ inline hashval_t -string_slot_hasher::hash (const value_type *ds) +string_slot_hasher::hash (const string_slot *ds) { hashval_t r = ds->len; int i; @@ -680,7 +680,7 @@ string_slot_hasher::hash (const value_type *ds) /* Returns nonzero if DS1 and DS2 are equal. */ inline bool -string_slot_hasher::equal (const value_type *ds1, const compare_type *ds2) +string_slot_hasher::equal (const string_slot *ds1, const string_slot *ds2) { if (ds1->len == ds2->len) return memcmp (ds1->s, ds2->s, ds1->len) == 0; diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 085ce9f..0815e58 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2015-04-18 Trevor Saunders + + * lto.c: Adjust for hash_table changes. + 2015-03-27 Jan Hubicka * lto.c (lto_read_decls): Move code registering odr types out diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 360aeed..f3458c7 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -1143,20 +1143,20 @@ struct tree_scc struct tree_scc_hasher : typed_noop_remove { - typedef tree_scc value_type; - typedef tree_scc compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef tree_scc *value_type; + typedef tree_scc *compare_type; + static inline hashval_t hash (const tree_scc *); + static inline bool equal (const tree_scc *, const tree_scc *); }; hashval_t -tree_scc_hasher::hash (const value_type *scc) +tree_scc_hasher::hash (const tree_scc *scc) { return scc->hash; } bool -tree_scc_hasher::equal (const value_type *scc1, const compare_type *scc2) +tree_scc_hasher::equal (const tree_scc *scc1, const tree_scc *scc2) { if (scc1->hash != scc2->hash || scc1->len != scc2->len diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index c8d088b..84d27b2 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,7 @@ +2015-04-18 Trevor Saunders + + * objc-act.c: Adjust for hash_table changes. + 2015-01-09 Michael Collison * objc-act.c: Include hash-set.h, machmode.h, vec.h, double-int.h, diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 6bd4dcc..718fdf0 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -3871,20 +3871,20 @@ objc_get_class_ivars (tree class_name) struct decl_name_hash : typed_noop_remove { - typedef tree_node value_type; - typedef tree_node compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef tree_node *value_type; + typedef tree_node *compare_type; + static inline hashval_t hash (const tree_node *); + static inline bool equal (const tree_node *, const tree_node *); }; inline hashval_t -decl_name_hash::hash (const value_type *q) +decl_name_hash::hash (const tree_node *q) { return (hashval_t) ((intptr_t)(DECL_NAME (q)) >> 3); } inline bool -decl_name_hash::equal (const value_type *a, const compare_type *b) +decl_name_hash::equal (const tree_node *a, const tree_node *b) { return DECL_NAME (a) == DECL_NAME (b); } diff --git a/gcc/plugin.c b/gcc/plugin.c index d924438..6a7654f 100644 --- a/gcc/plugin.c +++ b/gcc/plugin.c @@ -66,16 +66,16 @@ const char **plugin_event_name = plugin_event_name_init; struct event_hasher : typed_noop_remove { - typedef const char *value_type; - typedef const char *compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef const char **value_type; + typedef const char **compare_type; + static inline hashval_t hash (const char **); + static inline bool equal (const char **, const char **); }; /* Helper function for the event hash table that hashes the entry V. */ inline hashval_t -event_hasher::hash (const value_type *v) +event_hasher::hash (const char **v) { return htab_hash_string (*v); } @@ -84,7 +84,7 @@ event_hasher::hash (const value_type *v) existing entry (S1) with the given string (S2). */ inline bool -event_hasher::equal (const value_type *s1, const compare_type *s2) +event_hasher::equal (const char **s1, const char **s2) { return !strcmp (*s1, *s2); } diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c index 83048bd..9014d69 100644 --- a/gcc/postreload-gcse.c +++ b/gcc/postreload-gcse.c @@ -134,10 +134,10 @@ struct expr struct expr_hasher : typed_noop_remove { - typedef expr value_type; - typedef expr compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef expr *value_type; + typedef expr *compare_type; + static inline hashval_t hash (const expr *); + static inline bool equal (const expr *, const expr *); }; @@ -159,7 +159,7 @@ hash_expr (rtx x, int *do_not_record_p) here, we just return the cached hash value. */ inline hashval_t -expr_hasher::hash (const value_type *exp) +expr_hasher::hash (const expr *exp) { return exp->hash; } @@ -168,7 +168,7 @@ expr_hasher::hash (const value_type *exp) Return nonzero if exp1 is equivalent to exp2. */ inline bool -expr_hasher::equal (const value_type *exp1, const compare_type *exp2) +expr_hasher::equal (const expr *exp1, const expr *exp2) { int equiv_p = exp_equiv_p (exp1->expr, exp2->expr, 0, true); diff --git a/gcc/reginfo.c b/gcc/reginfo.c index 9015eeb..6678688 100644 --- a/gcc/reginfo.c +++ b/gcc/reginfo.c @@ -85,15 +85,6 @@ struct simplifiable_subreg subreg_shape shape; HARD_REG_SET simplifiable_regs; }; - -struct simplifiable_subregs_hasher : typed_noop_remove -{ - typedef simplifiable_subreg value_type; - typedef subreg_shape compare_type; - - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); -}; struct target_hard_regs default_target_hard_regs; struct target_regs default_target_regs; @@ -1234,14 +1225,14 @@ reg_classes_intersect_p (reg_class_t c1, reg_class_t c2) inline hashval_t -simplifiable_subregs_hasher::hash (const value_type *value) +simplifiable_subregs_hasher::hash (const simplifiable_subreg *value) { return value->shape.unique_id (); } inline bool -simplifiable_subregs_hasher::equal (const value_type *value, - const compare_type *compare) +simplifiable_subregs_hasher::equal (const simplifiable_subreg *value, + const subreg_shape *compare) { return value->shape == *compare; } diff --git a/gcc/statistics.c b/gcc/statistics.c index b76de15..8cbe88d 100644 --- a/gcc/statistics.c +++ b/gcc/statistics.c @@ -55,17 +55,18 @@ typedef struct statistics_counter_s { struct stats_counter_hasher { - typedef statistics_counter_t value_type; - typedef statistics_counter_t compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef statistics_counter_t *value_type; + typedef statistics_counter_t *compare_type; + static inline hashval_t hash (const statistics_counter_t *); + static inline bool equal (const statistics_counter_t *, + const statistics_counter_t *); + static inline void remove (statistics_counter_t *); }; /* Hash a statistic counter by its string ID. */ inline hashval_t -stats_counter_hasher::hash (const value_type *c) +stats_counter_hasher::hash (const statistics_counter_t *c) { return htab_hash_string (c->id) + c->val; } @@ -73,7 +74,8 @@ stats_counter_hasher::hash (const value_type *c) /* Compare two statistic counters by their string IDs. */ inline bool -stats_counter_hasher::equal (const value_type *c1, const compare_type *c2) +stats_counter_hasher::equal (const statistics_counter_t *c1, + const statistics_counter_t *c2) { return c1->val == c2->val && strcmp (c1->id, c2->id) == 0; } @@ -81,7 +83,7 @@ stats_counter_hasher::equal (const value_type *c1, const compare_type *c2) /* Free a statistics entry. */ inline void -stats_counter_hasher::remove (value_type *v) +stats_counter_hasher::remove (statistics_counter_t *v) { free (CONST_CAST (char *, v->id)); free (v); diff --git a/gcc/store-motion.c b/gcc/store-motion.c index 530766f..d621ec1 100644 --- a/gcc/store-motion.c +++ b/gcc/store-motion.c @@ -137,21 +137,21 @@ static struct edge_list *edge_list; struct st_expr_hasher : typed_noop_remove { - typedef st_expr value_type; - typedef st_expr compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef st_expr *value_type; + typedef st_expr *compare_type; + static inline hashval_t hash (const st_expr *); + static inline bool equal (const st_expr *, const st_expr *); }; inline hashval_t -st_expr_hasher::hash (const value_type *x) +st_expr_hasher::hash (const st_expr *x) { int do_not_record_p = 0; return hash_rtx (x->pattern, GET_MODE (x->pattern), &do_not_record_p, NULL, false); } inline bool -st_expr_hasher::equal (const value_type *ptr1, const compare_type *ptr2) +st_expr_hasher::equal (const st_expr *ptr1, const st_expr *ptr2) { return exp_equiv_p (ptr1->pattern, ptr2->pattern, 0, true); } diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index 078c2da..d6cbd76 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -974,23 +974,23 @@ typedef struct tm_log_entry struct log_entry_hasher { - typedef tm_log_entry value_type; - typedef tm_log_entry compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef tm_log_entry *value_type; + typedef tm_log_entry *compare_type; + static inline hashval_t hash (const tm_log_entry *); + static inline bool equal (const tm_log_entry *, const tm_log_entry *); + static inline void remove (tm_log_entry *); }; /* Htab support. Return hash value for a `tm_log_entry'. */ inline hashval_t -log_entry_hasher::hash (const value_type *log) +log_entry_hasher::hash (const tm_log_entry *log) { return iterative_hash_expr (log->addr, 0); } /* Htab support. Return true if two log entries are the same. */ inline bool -log_entry_hasher::equal (const value_type *log1, const compare_type *log2) +log_entry_hasher::equal (const tm_log_entry *log1, const tm_log_entry *log2) { /* FIXME: @@ -1016,7 +1016,7 @@ log_entry_hasher::equal (const value_type *log1, const compare_type *log2) /* Htab support. Free one tm_log_entry. */ inline void -log_entry_hasher::remove (value_type *lp) +log_entry_hasher::remove (tm_log_entry *lp) { lp->stmts.release (); free (lp); @@ -1049,20 +1049,20 @@ typedef struct tm_new_mem_map struct tm_mem_map_hasher : typed_free_remove { - typedef tm_new_mem_map_t value_type; - typedef tm_new_mem_map_t compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef tm_new_mem_map_t *value_type; + typedef tm_new_mem_map_t *compare_type; + static inline hashval_t hash (const tm_new_mem_map_t *); + static inline bool equal (const tm_new_mem_map_t *, const tm_new_mem_map_t *); }; inline hashval_t -tm_mem_map_hasher::hash (const value_type *v) +tm_mem_map_hasher::hash (const tm_new_mem_map_t *v) { return (intptr_t)v->val >> 4; } inline bool -tm_mem_map_hasher::equal (const value_type *v, const compare_type *c) +tm_mem_map_hasher::equal (const tm_new_mem_map_t *v, const tm_new_mem_map_t *c) { return v->val == c->val; } @@ -3350,15 +3350,15 @@ typedef struct tm_memop struct tm_memop_hasher : typed_free_remove { - typedef tm_memop value_type; - typedef tm_memop compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef tm_memop *value_type; + typedef tm_memop *compare_type; + static inline hashval_t hash (const tm_memop *); + static inline bool equal (const tm_memop *, const tm_memop *); }; /* Htab support. Return a hash value for a `tm_memop'. */ inline hashval_t -tm_memop_hasher::hash (const value_type *mem) +tm_memop_hasher::hash (const tm_memop *mem) { tree addr = mem->addr; /* We drill down to the SSA_NAME/DECL for the hash, but equality is @@ -3370,7 +3370,7 @@ tm_memop_hasher::hash (const value_type *mem) /* Htab support. Return true if two tm_memop's are the same. */ inline bool -tm_memop_hasher::equal (const value_type *mem1, const compare_type *mem2) +tm_memop_hasher::equal (const tm_memop *mem1, const tm_memop *mem2) { return operand_equal_p (mem1->addr, mem2->addr, 0); } diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 1cfb67a..4929629 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -148,17 +148,18 @@ struct locus_discrim_map struct locus_discrim_hasher : typed_free_remove { - typedef locus_discrim_map value_type; - typedef locus_discrim_map compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef locus_discrim_map *value_type; + typedef locus_discrim_map *compare_type; + static inline hashval_t hash (const locus_discrim_map *); + static inline bool equal (const locus_discrim_map *, + const locus_discrim_map *); }; /* Trivial hash function for a location_t. ITEM is a pointer to a hash table entry that maps a location_t to a discriminator. */ inline hashval_t -locus_discrim_hasher::hash (const value_type *item) +locus_discrim_hasher::hash (const locus_discrim_map *item) { return LOCATION_LINE (item->locus); } @@ -167,7 +168,8 @@ locus_discrim_hasher::hash (const value_type *item) point to the two hash table entries to compare. */ inline bool -locus_discrim_hasher::equal (const value_type *a, const compare_type *b) +locus_discrim_hasher::equal (const locus_discrim_map *a, + const locus_discrim_map *b) { return LOCATION_LINE (a->locus) == LOCATION_LINE (b->locus); } diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index a111e9d..5d41cb4 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -214,20 +214,22 @@ struct finally_tree_node struct finally_tree_hasher : typed_free_remove { - typedef finally_tree_node value_type; - typedef finally_tree_node compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef finally_tree_node *value_type; + typedef finally_tree_node *compare_type; + static inline hashval_t hash (const finally_tree_node *); + static inline bool equal (const finally_tree_node *, + const finally_tree_node *); }; inline hashval_t -finally_tree_hasher::hash (const value_type *v) +finally_tree_hasher::hash (const finally_tree_node *v) { return (intptr_t)v->child.t >> 4; } inline bool -finally_tree_hasher::equal (const value_type *v, const compare_type *c) +finally_tree_hasher::equal (const finally_tree_node *v, + const finally_tree_node *c) { return v->child.t == c->child.t; } diff --git a/gcc/tree-hasher.h b/gcc/tree-hasher.h index 35eb9b2..228e317 100644 --- a/gcc/tree-hasher.h +++ b/gcc/tree-hasher.h @@ -34,7 +34,6 @@ struct int_tree_hasher { typedef int_tree_map value_type; typedef int_tree_map compare_type; - typedef int store_values_directly; static inline hashval_t hash (const value_type &); static inline bool equal (const value_type &, const compare_type &); static bool is_deleted (const value_type &v) diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 2589628..e8b55c1 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -232,7 +232,6 @@ struct var_info_hasher : typed_free_remove { typedef var_info_d *value_type; typedef var_info_d *compare_type; - typedef int store_values_directly; static inline hashval_t hash (const value_type &); static inline bool equal (const value_type &, const compare_type &); }; diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 62a6444..080d35e 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -228,22 +228,22 @@ struct reduction_info struct reduction_hasher : typed_free_remove { - typedef reduction_info value_type; - typedef reduction_info compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef reduction_info *value_type; + typedef reduction_info *compare_type; + static inline hashval_t hash (const reduction_info *); + static inline bool equal (const reduction_info *, const reduction_info *); }; /* Equality and hash functions for hashtab code. */ inline bool -reduction_hasher::equal (const value_type *a, const compare_type *b) +reduction_hasher::equal (const reduction_info *a, const reduction_info *b) { return (a->reduc_phi == b->reduc_phi); } inline hashval_t -reduction_hasher::hash (const value_type *a) +reduction_hasher::hash (const reduction_info *a) { return a->reduc_version; } @@ -280,22 +280,22 @@ struct name_to_copy_elt struct name_to_copy_hasher : typed_free_remove { - typedef name_to_copy_elt value_type; - typedef name_to_copy_elt compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef name_to_copy_elt *value_type; + typedef name_to_copy_elt *compare_type; + static inline hashval_t hash (const name_to_copy_elt *); + static inline bool equal (const name_to_copy_elt *, const name_to_copy_elt *); }; /* Equality and hash functions for hashtab code. */ inline bool -name_to_copy_hasher::equal (const value_type *a, const compare_type *b) +name_to_copy_hasher::equal (const name_to_copy_elt *a, const name_to_copy_elt *b) { return a->version == b->version; } inline hashval_t -name_to_copy_hasher::hash (const value_type *a) +name_to_copy_hasher::hash (const name_to_copy_elt *a) { return (hashval_t) a->version; } diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 6adee70..4b0d2a8 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -327,16 +327,16 @@ static hash_map > *base_access_vec; struct uid_decl_hasher : typed_noop_remove { - typedef tree_node value_type; - typedef tree_node compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef tree_node *value_type; + typedef tree_node *compare_type; + static inline hashval_t hash (const tree_node *); + static inline bool equal (const tree_node *, const tree_node *); }; /* Hash a tree in a uid_decl_map. */ inline hashval_t -uid_decl_hasher::hash (const value_type *item) +uid_decl_hasher::hash (const tree_node *item) { return item->decl_minimal.uid; } @@ -344,7 +344,7 @@ uid_decl_hasher::hash (const value_type *item) /* Return true if the DECL_UID in both trees are equal. */ inline bool -uid_decl_hasher::equal (const value_type *a, const compare_type *b) +uid_decl_hasher::equal (const tree_node *a, const tree_node *b) { return (a->decl_minimal.uid == b->decl_minimal.uid); } diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c index 1afeefe..eeac5a4 100644 --- a/gcc/tree-ssa-coalesce.c +++ b/gcc/tree-ssa-coalesce.c @@ -81,16 +81,16 @@ typedef const struct coalesce_pair *const_coalesce_pair_p; struct coalesce_pair_hasher : typed_noop_remove { - typedef coalesce_pair value_type; - typedef coalesce_pair compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef coalesce_pair *value_type; + typedef coalesce_pair *compare_type; + static inline hashval_t hash (const coalesce_pair *); + static inline bool equal (const coalesce_pair *, const coalesce_pair *); }; /* Hash function for coalesce list. Calculate hash for PAIR. */ inline hashval_t -coalesce_pair_hasher::hash (const value_type *pair) +coalesce_pair_hasher::hash (const coalesce_pair *pair) { hashval_t a = (hashval_t)(pair->first_element); hashval_t b = (hashval_t)(pair->second_element); @@ -102,7 +102,7 @@ coalesce_pair_hasher::hash (const value_type *pair) returning TRUE if the two pairs are equivalent. */ inline bool -coalesce_pair_hasher::equal (const value_type *p1, const compare_type *p2) +coalesce_pair_hasher::equal (const coalesce_pair *p1, const coalesce_pair *p2) { return (p1->first_element == p2->first_element && p1->second_element == p2->second_element); @@ -1253,10 +1253,10 @@ coalesce_partitions (var_map map, ssa_conflicts_p graph, coalesce_list_p cl, struct ssa_name_var_hash : typed_noop_remove { - typedef union tree_node value_type; - typedef union tree_node compare_type; - static inline hashval_t hash (const value_type *); - static inline int equal (const value_type *, const compare_type *); + typedef union tree_node *value_type; + typedef union tree_node *compare_type; + static inline hashval_t hash (const tree_node *); + static inline int equal (const tree_node *, const tree_node *); }; inline hashval_t @@ -1266,7 +1266,7 @@ ssa_name_var_hash::hash (const_tree n) } inline int -ssa_name_var_hash::equal (const value_type *n1, const compare_type *n2) +ssa_name_var_hash::equal (const tree_node *n1, const tree_node *n2) { return SSA_NAME_VAR (n1) == SSA_NAME_VAR (n2); } diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 8eec5d9..355c84c 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -183,7 +183,6 @@ struct expr_elt_hasher { typedef expr_hash_elt *value_type; typedef expr_hash_elt *compare_type; - typedef int store_values_directly; static inline hashval_t hash (const value_type &); static inline bool equal (const value_type &, const compare_type &); static inline void remove (value_type &); diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index df90229..2c7c072 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -104,20 +104,20 @@ static void verify_live_on_entry (tree_live_info_p); struct tree_int_map_hasher : typed_noop_remove { - typedef tree_int_map value_type; - typedef tree_int_map compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef tree_int_map *value_type; + typedef tree_int_map *compare_type; + static inline hashval_t hash (const tree_int_map *); + static inline bool equal (const tree_int_map *, const tree_int_map *); }; inline hashval_t -tree_int_map_hasher::hash (const value_type *v) +tree_int_map_hasher::hash (const tree_int_map *v) { return tree_map_base_hash (v); } inline bool -tree_int_map_hasher::equal (const value_type *v, const compare_type *c) +tree_int_map_hasher::equal (const tree_int_map *v, const tree_int_map *c) { return tree_int_map_eq (v, c); } diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 9aba79b..11fc699 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -172,16 +172,16 @@ typedef struct im_mem_ref struct mem_ref_hasher : typed_noop_remove { - typedef im_mem_ref value_type; - typedef tree_node compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef im_mem_ref *value_type; + typedef tree_node *compare_type; + static inline hashval_t hash (const im_mem_ref *); + static inline bool equal (const im_mem_ref *, const tree_node *); }; /* A hash function for struct im_mem_ref object OBJ. */ inline hashval_t -mem_ref_hasher::hash (const value_type *mem) +mem_ref_hasher::hash (const im_mem_ref *mem) { return mem->hash; } @@ -190,7 +190,7 @@ mem_ref_hasher::hash (const value_type *mem) memory reference OBJ2. */ inline bool -mem_ref_hasher::equal (const value_type *mem1, const compare_type *obj2) +mem_ref_hasher::equal (const im_mem_ref *mem1, const tree_node *obj2) { return operand_equal_p (mem1->mem.ref, (const_tree) obj2, 0); } diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 6c96430..d71e3a4 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -292,16 +292,16 @@ typedef struct iv_cand *iv_cand_p; struct iv_inv_expr_hasher : typed_free_remove { - typedef iv_inv_expr_ent value_type; - typedef iv_inv_expr_ent compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef iv_inv_expr_ent *value_type; + typedef iv_inv_expr_ent *compare_type; + static inline hashval_t hash (const iv_inv_expr_ent *); + static inline bool equal (const iv_inv_expr_ent *, const iv_inv_expr_ent *); }; /* Hash function for loop invariant expressions. */ inline hashval_t -iv_inv_expr_hasher::hash (const value_type *expr) +iv_inv_expr_hasher::hash (const iv_inv_expr_ent *expr) { return expr->hash; } @@ -309,7 +309,8 @@ iv_inv_expr_hasher::hash (const value_type *expr) /* Hash table equality function for expressions. */ inline bool -iv_inv_expr_hasher::equal (const value_type *expr1, const compare_type *expr2) +iv_inv_expr_hasher::equal (const iv_inv_expr_ent *expr1, + const iv_inv_expr_ent *expr2) { return expr1->hash == expr2->hash && operand_equal_p (expr1->expr, expr2->expr, 0); diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 14a7122..7c846c2 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1332,10 +1332,10 @@ struct name_to_bb struct ssa_names_hasher : typed_free_remove { - typedef name_to_bb value_type; - typedef name_to_bb compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef name_to_bb *value_type; + typedef name_to_bb *compare_type; + static inline hashval_t hash (const name_to_bb *); + static inline bool equal (const name_to_bb *, const name_to_bb *); }; /* Used for quick clearing of the hash-table when we see calls. @@ -1345,7 +1345,7 @@ static unsigned int nt_call_phase; /* The hash function. */ inline hashval_t -ssa_names_hasher::hash (const value_type *n) +ssa_names_hasher::hash (const name_to_bb *n) { return n->ssa_name_ver ^ (((hashval_t) n->store) << 31) ^ (n->offset << 6) ^ (n->size << 3); @@ -1354,7 +1354,7 @@ ssa_names_hasher::hash (const value_type *n) /* The equality function of *P1 and *P2. */ inline bool -ssa_names_hasher::equal (const value_type *n1, const compare_type *n2) +ssa_names_hasher::equal (const name_to_bb *n1, const name_to_bb *n2) { return n1->ssa_name_ver == n2->ssa_name_ver && n1->store == n2->store diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index c985e79..d857d84 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -228,8 +228,8 @@ typedef struct pre_expr_d : typed_noop_remove pre_expr_union u; /* hash_table support. */ - typedef pre_expr_d value_type; - typedef pre_expr_d compare_type; + typedef pre_expr_d *value_type; + typedef pre_expr_d *compare_type; static inline hashval_t hash (const pre_expr_d *); static inline int equal (const pre_expr_d *, const pre_expr_d *); } *pre_expr; @@ -242,7 +242,7 @@ typedef struct pre_expr_d : typed_noop_remove /* Compare E1 and E1 for equality. */ inline int -pre_expr_d::equal (const value_type *e1, const compare_type *e2) +pre_expr_d::equal (const pre_expr_d *e1, const pre_expr_d *e2) { if (e1->kind != e2->kind) return false; @@ -267,7 +267,7 @@ pre_expr_d::equal (const value_type *e1, const compare_type *e2) /* Hash E. */ inline hashval_t -pre_expr_d::hash (const value_type *e) +pre_expr_d::hash (const pre_expr_d *e) { switch (e->kind) { @@ -547,10 +547,10 @@ typedef struct expr_pred_trans_d : typed_free_remove hashval_t hashcode; /* hash_table support. */ - typedef expr_pred_trans_d value_type; - typedef expr_pred_trans_d compare_type; - static inline hashval_t hash (const value_type *); - static inline int equal (const value_type *, const compare_type *); + typedef expr_pred_trans_d *value_type; + typedef expr_pred_trans_d *compare_type; + static inline hashval_t hash (const expr_pred_trans_d *); + static inline int equal (const expr_pred_trans_d *, const expr_pred_trans_d *); } *expr_pred_trans_t; typedef const struct expr_pred_trans_d *const_expr_pred_trans_t; @@ -561,8 +561,8 @@ expr_pred_trans_d::hash (const expr_pred_trans_d *e) } inline int -expr_pred_trans_d::equal (const value_type *ve1, - const compare_type *ve2) +expr_pred_trans_d::equal (const expr_pred_trans_d *ve1, + const expr_pred_trans_d *ve2) { basic_block b1 = ve1->pred; basic_block b2 = ve2->pred; diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 77640e5..ae9d631 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1061,7 +1061,6 @@ struct oecount_hasher { typedef int value_type; typedef int compare_type; - typedef int store_values_directly; static inline hashval_t hash (const value_type &); static inline bool equal (const value_type &, const compare_type &); static bool is_deleted (int &v) { return v == 1; } diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 46ce285..c6a16bc 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -148,16 +148,16 @@ along with GCC; see the file COPYING3. If not see struct vn_nary_op_hasher : typed_noop_remove { - typedef vn_nary_op_s value_type; - typedef vn_nary_op_s compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef vn_nary_op_s *value_type; + typedef vn_nary_op_s *compare_type; + static inline hashval_t hash (const vn_nary_op_s *); + static inline bool equal (const vn_nary_op_s *, const vn_nary_op_s *); }; /* Return the computed hashcode for nary operation P1. */ inline hashval_t -vn_nary_op_hasher::hash (const value_type *vno1) +vn_nary_op_hasher::hash (const vn_nary_op_s *vno1) { return vno1->hashcode; } @@ -166,7 +166,7 @@ vn_nary_op_hasher::hash (const value_type *vno1) equivalent. */ inline bool -vn_nary_op_hasher::equal (const value_type *vno1, const compare_type *vno2) +vn_nary_op_hasher::equal (const vn_nary_op_s *vno1, const vn_nary_op_s *vno2) { return vn_nary_op_eq (vno1, vno2); } @@ -182,17 +182,17 @@ vn_phi_eq (const_vn_phi_t const vp1, const_vn_phi_t const vp2); struct vn_phi_hasher { - typedef vn_phi_s value_type; - typedef vn_phi_s compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef vn_phi_s *value_type; + typedef vn_phi_s *compare_type; + static inline hashval_t hash (const vn_phi_s *); + static inline bool equal (const vn_phi_s *, const vn_phi_s *); + static inline void remove (vn_phi_s *); }; /* Return the computed hashcode for phi operation P1. */ inline hashval_t -vn_phi_hasher::hash (const value_type *vp1) +vn_phi_hasher::hash (const vn_phi_s *vp1) { return vp1->hashcode; } @@ -200,7 +200,7 @@ vn_phi_hasher::hash (const value_type *vp1) /* Compare two phi entries for equality, ignoring VN_TOP arguments. */ inline bool -vn_phi_hasher::equal (const value_type *vp1, const compare_type *vp2) +vn_phi_hasher::equal (const vn_phi_s *vp1, const vn_phi_s *vp2) { return vn_phi_eq (vp1, vp2); } @@ -208,7 +208,7 @@ vn_phi_hasher::equal (const value_type *vp1, const compare_type *vp2) /* Free a phi operation structure VP. */ inline void -vn_phi_hasher::remove (value_type *phi) +vn_phi_hasher::remove (vn_phi_s *phi) { phi->phiargs.release (); } @@ -250,29 +250,29 @@ free_reference (vn_reference_s *vr) struct vn_reference_hasher { - typedef vn_reference_s value_type; - typedef vn_reference_s compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef vn_reference_s *value_type; + typedef vn_reference_s *compare_type; + static inline hashval_t hash (const vn_reference_s *); + static inline bool equal (const vn_reference_s *, const vn_reference_s *); + static inline void remove (vn_reference_s *); }; /* Return the hashcode for a given reference operation P1. */ inline hashval_t -vn_reference_hasher::hash (const value_type *vr1) +vn_reference_hasher::hash (const vn_reference_s *vr1) { return vr1->hashcode; } inline bool -vn_reference_hasher::equal (const value_type *v, const compare_type *c) +vn_reference_hasher::equal (const vn_reference_s *v, const vn_reference_s *c) { return vn_reference_eq (v, c); } inline void -vn_reference_hasher::remove (value_type *v) +vn_reference_hasher::remove (vn_reference_s *v) { free_reference (v); } @@ -298,16 +298,16 @@ typedef struct vn_tables_s struct vn_constant_hasher : typed_free_remove { - typedef vn_constant_s value_type; - typedef vn_constant_s compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef vn_constant_s *value_type; + typedef vn_constant_s *compare_type; + static inline hashval_t hash (const vn_constant_s *); + static inline bool equal (const vn_constant_s *, const vn_constant_s *); }; /* Hash table hash function for vn_constant_t. */ inline hashval_t -vn_constant_hasher::hash (const value_type *vc1) +vn_constant_hasher::hash (const vn_constant_s *vc1) { return vc1->hashcode; } @@ -315,7 +315,7 @@ vn_constant_hasher::hash (const value_type *vc1) /* Hash table equality function for vn_constant_t. */ inline bool -vn_constant_hasher::equal (const value_type *vc1, const compare_type *vc2) +vn_constant_hasher::equal (const vn_constant_s *vc1, const vn_constant_s *vc2) { if (vc1->hashcode != vc2->hashcode) return false; diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index fd0f535..d6a9f67 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -1940,16 +1940,17 @@ typedef const struct equiv_class_label *const_equiv_class_label_t; struct equiv_class_hasher : typed_free_remove { - typedef equiv_class_label value_type; - typedef equiv_class_label compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef equiv_class_label *value_type; + typedef equiv_class_label *compare_type; + static inline hashval_t hash (const equiv_class_label *); + static inline bool equal (const equiv_class_label *, + const equiv_class_label *); }; /* Hash function for a equiv_class_label_t */ inline hashval_t -equiv_class_hasher::hash (const value_type *ecl) +equiv_class_hasher::hash (const equiv_class_label *ecl) { return ecl->hashcode; } @@ -1957,7 +1958,8 @@ equiv_class_hasher::hash (const value_type *ecl) /* Equality function for two equiv_class_label_t's. */ inline bool -equiv_class_hasher::equal (const value_type *eql1, const compare_type *eql2) +equiv_class_hasher::equal (const equiv_class_label *eql1, + const equiv_class_label *eql2) { return (eql1->hashcode == eql2->hashcode && bitmap_equal_p (eql1->labels, eql2->labels)); @@ -5963,16 +5965,17 @@ typedef const struct shared_bitmap_info *const_shared_bitmap_info_t; struct shared_bitmap_hasher : typed_free_remove { - typedef shared_bitmap_info value_type; - typedef shared_bitmap_info compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef shared_bitmap_info *value_type; + typedef shared_bitmap_info *compare_type; + static inline hashval_t hash (const shared_bitmap_info *); + static inline bool equal (const shared_bitmap_info *, + const shared_bitmap_info *); }; /* Hash function for a shared_bitmap_info_t */ inline hashval_t -shared_bitmap_hasher::hash (const value_type *bi) +shared_bitmap_hasher::hash (const shared_bitmap_info *bi) { return bi->hashcode; } @@ -5980,7 +5983,8 @@ shared_bitmap_hasher::hash (const value_type *bi) /* Equality function for two shared_bitmap_info_t's. */ inline bool -shared_bitmap_hasher::equal (const value_type *sbi1, const compare_type *sbi2) +shared_bitmap_hasher::equal (const shared_bitmap_info *sbi1, + const shared_bitmap_info *sbi2) { return bitmap_equal_p (sbi1->pt_vars, sbi2->pt_vars); } diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index 2c48cb6..4afe94e 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -260,11 +260,11 @@ struct same_succ_def hashval_t hashval; /* hash_table support. */ - typedef same_succ_def value_type; - typedef same_succ_def compare_type; - static inline hashval_t hash (const value_type *); - static int equal (const value_type *, const compare_type *); - static void remove (value_type *); + typedef same_succ_def *value_type; + typedef same_succ_def *compare_type; + static inline hashval_t hash (const same_succ_def *); + static int equal (const same_succ_def *, const same_succ_def *); + static void remove (same_succ_def *); }; typedef struct same_succ_def *same_succ; typedef const struct same_succ_def *const_same_succ; @@ -272,7 +272,7 @@ typedef const struct same_succ_def *const_same_succ; /* hash routine for hash_table support, returns hashval of E. */ inline hashval_t -same_succ_def::hash (const value_type *e) +same_succ_def::hash (const same_succ_def *e) { return e->hashval; } @@ -568,7 +568,7 @@ inverse_flags (const_same_succ e1, const_same_succ e2) /* Compares SAME_SUCCs E1 and E2. */ int -same_succ_def::equal (const value_type *e1, const compare_type *e2) +same_succ_def::equal (const same_succ_def *e1, const same_succ_def *e2) { unsigned int i, first1, first2; gimple_stmt_iterator gsi1, gsi2; diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 610e807..709b16e 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -160,10 +160,10 @@ struct redirection_data : typed_free_remove struct el *incoming_edges; /* hash_table support. */ - typedef redirection_data value_type; - typedef redirection_data compare_type; - static inline hashval_t hash (const value_type *); - static inline int equal (const value_type *, const compare_type *); + typedef redirection_data *value_type; + typedef redirection_data *compare_type; + static inline hashval_t hash (const redirection_data *); + static inline int equal (const redirection_data *, const redirection_data *); }; /* Dump a jump threading path, including annotations about each @@ -209,7 +209,7 @@ dump_jump_thread_path (FILE *dump_file, vec path, path. So hash on the block index of the final edge in the path. */ inline hashval_t -redirection_data::hash (const value_type *p) +redirection_data::hash (const redirection_data *p) { vec *path = p->path; return path->last ()->e->dest->index; @@ -218,7 +218,7 @@ redirection_data::hash (const value_type *p) /* Given two hash table entries, return true if they have the same jump threading path. */ inline int -redirection_data::equal (const value_type *p1, const compare_type *p2) +redirection_data::equal (const redirection_data *p1, const redirection_data *p2) { vec *path1 = p1->path; vec *path2 = p2->path; diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 415bffa..313e936 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -118,20 +118,20 @@ struct simduid_to_vf : typed_free_remove int vf; /* hash_table support. */ - typedef simduid_to_vf value_type; - typedef simduid_to_vf compare_type; - static inline hashval_t hash (const value_type *); - static inline int equal (const value_type *, const compare_type *); + typedef simduid_to_vf *value_type; + typedef simduid_to_vf *compare_type; + static inline hashval_t hash (const simduid_to_vf *); + static inline int equal (const simduid_to_vf *, const simduid_to_vf *); }; inline hashval_t -simduid_to_vf::hash (const value_type *p) +simduid_to_vf::hash (const simduid_to_vf *p) { return p->simduid; } inline int -simduid_to_vf::equal (const value_type *p1, const value_type *p2) +simduid_to_vf::equal (const simduid_to_vf *p1, const simduid_to_vf *p2) { return p1->simduid == p2->simduid; } @@ -154,20 +154,22 @@ struct simd_array_to_simduid : typed_free_remove unsigned int simduid; /* hash_table support. */ - typedef simd_array_to_simduid value_type; - typedef simd_array_to_simduid compare_type; - static inline hashval_t hash (const value_type *); - static inline int equal (const value_type *, const compare_type *); + typedef simd_array_to_simduid *value_type; + typedef simd_array_to_simduid *compare_type; + static inline hashval_t hash (const simd_array_to_simduid *); + static inline int equal (const simd_array_to_simduid *, + const simd_array_to_simduid *); }; inline hashval_t -simd_array_to_simduid::hash (const value_type *p) +simd_array_to_simduid::hash (const simd_array_to_simduid *p) { return DECL_UID (p->decl); } inline int -simd_array_to_simduid::equal (const value_type *p1, const value_type *p2) +simd_array_to_simduid::equal (const simd_array_to_simduid *p1, + const simd_array_to_simduid *p2) { return p1->decl == p2->decl; } diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 66d592d..f22d6cf 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -220,20 +220,20 @@ typedef struct _vect_peel_extended_info struct peel_info_hasher : typed_free_remove <_vect_peel_info> { - typedef _vect_peel_info value_type; - typedef _vect_peel_info compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef _vect_peel_info *value_type; + typedef _vect_peel_info *compare_type; + static inline hashval_t hash (const _vect_peel_info *); + static inline bool equal (const _vect_peel_info *, const _vect_peel_info *); }; inline hashval_t -peel_info_hasher::hash (const value_type *peel_info) +peel_info_hasher::hash (const _vect_peel_info *peel_info) { return (hashval_t) peel_info->npeel; } inline bool -peel_info_hasher::equal (const value_type *a, const compare_type *b) +peel_info_hasher::equal (const _vect_peel_info *a, const _vect_peel_info *b) { return (a->npeel == b->npeel); } diff --git a/gcc/valtrack.h b/gcc/valtrack.h index 402fef9..b7b53f3 100644 --- a/gcc/valtrack.h +++ b/gcc/valtrack.h @@ -45,33 +45,35 @@ struct dead_debug_global_entry struct dead_debug_hash_descr { /* The hash table contains pointers to entries of this type. */ - typedef struct dead_debug_global_entry value_type; - typedef struct dead_debug_global_entry compare_type; + typedef struct dead_debug_global_entry *value_type; + typedef struct dead_debug_global_entry *compare_type; /* Hash on the pseudo number. */ - static inline hashval_t hash (const value_type *my); + static inline hashval_t hash (const dead_debug_global_entry *my); /* Entries are identical if they refer to the same pseudo. */ - static inline bool equal (const value_type *my, const compare_type *other); + static inline bool equal (const dead_debug_global_entry *my, + const dead_debug_global_entry *other); /* Release entries when they're removed. */ - static inline void remove (value_type *p); + static inline void remove (dead_debug_global_entry *p); }; /* Hash on the pseudo number. */ inline hashval_t -dead_debug_hash_descr::hash (const value_type *my) +dead_debug_hash_descr::hash (const dead_debug_global_entry *my) { return REGNO (my->reg); } /* Entries are identical if they refer to the same pseudo. */ inline bool -dead_debug_hash_descr::equal (const value_type *my, const compare_type *other) +dead_debug_hash_descr::equal (const dead_debug_global_entry *my, + const dead_debug_global_entry *other) { return my->reg == other->reg; } /* Release entries when they're removed. */ inline void -dead_debug_hash_descr::remove (value_type *p) +dead_debug_hash_descr::remove (dead_debug_global_entry *p) { XDELETE (p); } diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 18eff20..685fcc38c 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -494,18 +494,18 @@ static void variable_htab_free (void *); struct variable_hasher { - typedef variable_def value_type; - typedef void compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); - static inline void remove (value_type *); + typedef variable_def *value_type; + typedef void *compare_type; + static inline hashval_t hash (const variable_def *); + static inline bool equal (const variable_def *, const void *); + static inline void remove (variable_def *); }; /* The hash function for variable_htab, computes the hash value from the declaration of variable X. */ inline hashval_t -variable_hasher::hash (const value_type *v) +variable_hasher::hash (const variable_def *v) { return dv_htab_hash (v->dv); } @@ -513,7 +513,7 @@ variable_hasher::hash (const value_type *v) /* Compare the declaration of variable X with declaration Y. */ inline bool -variable_hasher::equal (const value_type *v, const compare_type *y) +variable_hasher::equal (const variable_def *v, const void *y) { decl_or_value dv = CONST_CAST2 (decl_or_value, const void *, y); @@ -523,7 +523,7 @@ variable_hasher::equal (const value_type *v, const compare_type *y) /* Free the element of VARIABLE_HTAB (its type is struct variable_def). */ inline void -variable_hasher::remove (value_type *var) +variable_hasher::remove (variable_def *var) { variable_htab_free (var); } diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c index 22b7b81..8ced835 100644 --- a/gcc/vtable-verify.c +++ b/gcc/vtable-verify.c @@ -268,14 +268,15 @@ vtbl_map_node_registration_insert (struct vtbl_map_node *node, /* Hashtable functions for vtable_registration hashtables. */ inline hashval_t -registration_hasher::hash (const value_type *p) +registration_hasher::hash (const vtable_registration *p) { const struct vtable_registration *n = (const struct vtable_registration *) p; return (hashval_t) (DECL_UID (n->vtable_decl)); } inline bool -registration_hasher::equal (const value_type *p1, const compare_type *p2) +registration_hasher::equal (const vtable_registration *p1, + const vtable_registration *p2) { const struct vtable_registration *n1 = (const struct vtable_registration *) p1; @@ -292,16 +293,16 @@ registration_hasher::equal (const value_type *p1, const compare_type *p2) struct vtbl_map_hasher : typed_noop_remove { - typedef struct vtbl_map_node value_type; - typedef struct vtbl_map_node compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef struct vtbl_map_node *value_type; + typedef struct vtbl_map_node *compare_type; + static inline hashval_t hash (const vtbl_map_node *); + static inline bool equal (const vtbl_map_node *, const vtbl_map_node *); }; /* Returns a hash code for P. */ inline hashval_t -vtbl_map_hasher::hash (const value_type *p) +vtbl_map_hasher::hash (const vtbl_map_node *p) { const struct vtbl_map_node n = *((const struct vtbl_map_node *) p); return (hashval_t) IDENTIFIER_HASH_VALUE (n.class_name); @@ -310,7 +311,7 @@ vtbl_map_hasher::hash (const value_type *p) /* Returns nonzero if P1 and P2 are equal. */ inline bool -vtbl_map_hasher::equal (const value_type *p1, const compare_type *p2) +vtbl_map_hasher::equal (const vtbl_map_node *p1, const vtbl_map_node *p2) { const struct vtbl_map_node n1 = *((const struct vtbl_map_node *) p1); const struct vtbl_map_node n2 = *((const struct vtbl_map_node *) p2); diff --git a/gcc/vtable-verify.h b/gcc/vtable-verify.h index b0169ad..6fb2b60 100644 --- a/gcc/vtable-verify.h +++ b/gcc/vtable-verify.h @@ -58,10 +58,11 @@ struct vtable_registration struct registration_hasher : typed_noop_remove { - typedef struct vtable_registration value_type; - typedef struct vtable_registration compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef struct vtable_registration *value_type; + typedef struct vtable_registration *compare_type; + static inline hashval_t hash (const vtable_registration *); + static inline bool equal (const vtable_registration *, + const vtable_registration *); }; typedef hash_table register_table_type; diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog index 100e115..ed43b63 100644 --- a/libcc1/ChangeLog +++ b/libcc1/ChangeLog @@ -1,3 +1,7 @@ +2015-04-18 Trevor Saunders + + * plugin.cc: Adjust for hash_table changes. + 2015-04-15 Andreas Schwab PR bootstrap/65763 diff --git a/libcc1/plugin.cc b/libcc1/plugin.cc index c4caf05..74a7ec3 100644 --- a/libcc1/plugin.cc +++ b/libcc1/plugin.cc @@ -113,38 +113,38 @@ struct decl_addr_value struct decl_addr_hasher : typed_free_remove { - typedef decl_addr_value value_type; - typedef decl_addr_value compare_type; + typedef decl_addr_value *value_type; + typedef decl_addr_value *compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + static inline hashval_t hash (const decl_addr_value *); + static inline bool equal (const decl_addr_value *, const decl_addr_value *); }; inline hashval_t -decl_addr_hasher::hash (const value_type *e) +decl_addr_hasher::hash (const decl_addr_value *e) { return IDENTIFIER_HASH_VALUE (DECL_NAME (e->decl)); } inline bool -decl_addr_hasher::equal (const value_type *p1, const compare_type *p2) +decl_addr_hasher::equal (const decl_addr_value *p1, const decl_addr_value *p2) { return p1->decl == p2->decl; } -struct string_hasher : typed_noop_remove +struct string_hasher : typed_noop_remove { - typedef char value_type; - typedef char compare_type; + typedef const char *value_type; + typedef const char *compare_type; - static inline hashval_t hash (const value_type *s) + static inline hashval_t hash (const char *s) { return htab_hash_string (s); } - static inline bool equal (const value_type *p1, const value_type *p2) + static inline bool equal (const char *p1, const char *p2) { return strcmp (p1, p2) == 0; } @@ -210,7 +210,7 @@ private: // Add a file name to FILE_NAMES and return the canonical copy. const char *intern_filename (const char *filename) { - char **slot = file_names.find_slot (filename, INSERT); + const char **slot = file_names.find_slot (filename, INSERT); if (*slot == NULL) { /* The file name must live as long as the line map, which