diff options
author | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-30 01:26:05 +0000 |
---|---|---|
committer | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-30 01:26:05 +0000 |
commit | 7b7a707b1cc831bfdf1d2ab4a32910867bef83f4 (patch) | |
tree | 5340933f027915d0e1c1ab4f652bfad732bb71ff /gcc/config/ia64 | |
parent | 3e26c4dfcfc2579c87c6185cd837ec63074f9409 (diff) | |
download | gcc-7b7a707b1cc831bfdf1d2ab4a32910867bef83f4.tar.gz |
This patch is a consolodation of the hash_table patches to the
cxx-conversion branch for files under gcc/config.
Update various hash tables from htab_t to hash_table.
Modify types and calls to match.
* config/arm/arm.c'arm_libcall_uses_aapcs_base::libcall_htab
Fold libcall_eq and libcall_hash into new struct libcall_hasher.
* config/ia64/ia64.c'bundle_state_table
Fold bundle_state_hash and bundle_state_eq_p into new struct
bundle_state_hasher.
* config/mips/mips.c'mips_offset_table
Fold mips_lo_sum_offset_hash and mips_lo_sum_offset_eq into new
struct mips_lo_sum_offset_hasher.
In mips_reorg_process_insns, change call to for_each_rtx to pass
a pointer to the hash_table rather than a htab_t. This change
requires then dereferencing that pointer in mips_record_lo_sum to
obtain the hash_table.
* config/sol2.c'solaris_comdat_htab
Fold comdat_hash and comdat_eq into new struct comdat_entry_hasher.
* config/i386/winnt.c'i386_pe_section_type_flags::htab
* config/i386/winnt.c'i386_find_on_wrapper_list::wrappers
Fold wrapper_strcmp into new struct wrapped_symbol_hasher.
Tested on x86_64. Tested with config-list.mk.
Index: gcc/ChangeLog
2013-05-29 Lawrence Crowl <crowl@google.com>
* config/arm/t-arm: Update for below.
* config/arm/arm.c (arm_libcall_uses_aapcs_base::libcall_htab):
Change type to hash_table. Update dependent calls and types.
* config/i386/t-cygming: Update for below.
* config/i386/t-interix: Update for below.
* config/i386/winnt.c (i386_pe_section_type_flags::htab):
Change type to hash_table. Update dependent calls and types.
(i386_find_on_wrapper_list::wrappers): Likewise.
* config/ia64/t-ia64: Update for below.
* config/ia64/ia64.c (bundle_state_table):
Change type to hash_table. Update dependent calls and types.
* config/mips/mips.c (mips_reorg_process_insns::htab):
Change type to hash_table. Update dependent calls and types.
* config/sol2.c (solaris_comdat_htab):
Change type to hash_table. Update dependent calls and types.
* config/t-sol2: Update for above.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199435 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/ia64')
-rw-r--r-- | gcc/config/ia64/ia64.c | 71 | ||||
-rw-r--r-- | gcc/config/ia64/t-ia64 | 3 |
2 files changed, 36 insertions, 38 deletions
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index ee8ee5be3df..a128b19c7ca 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see #include "target-def.h" #include "common/common-target.h" #include "tm_p.h" -#include "hashtab.h" +#include "hash-table.h" #include "langhooks.h" #include "gimple.h" #include "intl.h" @@ -257,8 +257,6 @@ static struct bundle_state *get_free_bundle_state (void); static void free_bundle_state (struct bundle_state *); static void initiate_bundle_states (void); static void finish_bundle_states (void); -static unsigned bundle_state_hash (const void *); -static int bundle_state_eq_p (const void *, const void *); static int insert_bundle_state (struct bundle_state *); static void initiate_bundle_state_table (void); static void finish_bundle_state_table (void); @@ -8526,18 +8524,21 @@ finish_bundle_states (void) } } -/* Hash table of the bundle states. The key is dfa_state and insn_num - of the bundle states. */ +/* Hashtable helpers. */ -static htab_t bundle_state_table; +struct bundle_state_hasher : typed_noop_remove <bundle_state> +{ + 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 *); +}; /* The function returns hash of BUNDLE_STATE. */ -static unsigned -bundle_state_hash (const void *bundle_state) +inline hashval_t +bundle_state_hasher::hash (const value_type *state) { - const struct bundle_state *const state - = (const struct bundle_state *) bundle_state; unsigned result, i; for (result = i = 0; i < dfa_state_size; i++) @@ -8548,19 +8549,20 @@ bundle_state_hash (const void *bundle_state) /* The function returns nonzero if the bundle state keys are equal. */ -static int -bundle_state_eq_p (const void *bundle_state_1, const void *bundle_state_2) +inline bool +bundle_state_hasher::equal (const value_type *state1, + const compare_type *state2) { - const struct bundle_state *const state1 - = (const struct bundle_state *) bundle_state_1; - const struct bundle_state *const state2 - = (const struct bundle_state *) bundle_state_2; - return (state1->insn_num == state2->insn_num && memcmp (state1->dfa_state, state2->dfa_state, dfa_state_size) == 0); } +/* Hash table of the bundle states. The key is dfa_state and insn_num + of the bundle states. */ + +static hash_table <bundle_state_hasher> bundle_state_table; + /* The function inserts the BUNDLE_STATE into the hash table. The function returns nonzero if the bundle has been inserted into the table. The table contains the best bundle state with given key. */ @@ -8568,39 +8570,35 @@ bundle_state_eq_p (const void *bundle_state_1, const void *bundle_state_2) static int insert_bundle_state (struct bundle_state *bundle_state) { - void **entry_ptr; + struct bundle_state **entry_ptr; - entry_ptr = htab_find_slot (bundle_state_table, bundle_state, INSERT); + entry_ptr = bundle_state_table.find_slot (bundle_state, INSERT); if (*entry_ptr == NULL) { bundle_state->next = index_to_bundle_states [bundle_state->insn_num]; index_to_bundle_states [bundle_state->insn_num] = bundle_state; - *entry_ptr = (void *) bundle_state; + *entry_ptr = bundle_state; return TRUE; } - else if (bundle_state->cost < ((struct bundle_state *) *entry_ptr)->cost - || (bundle_state->cost == ((struct bundle_state *) *entry_ptr)->cost - && (((struct bundle_state *)*entry_ptr)->accumulated_insns_num + else if (bundle_state->cost < (*entry_ptr)->cost + || (bundle_state->cost == (*entry_ptr)->cost + && ((*entry_ptr)->accumulated_insns_num > bundle_state->accumulated_insns_num - || (((struct bundle_state *) - *entry_ptr)->accumulated_insns_num + || ((*entry_ptr)->accumulated_insns_num == bundle_state->accumulated_insns_num - && (((struct bundle_state *) - *entry_ptr)->branch_deviation + && ((*entry_ptr)->branch_deviation > bundle_state->branch_deviation - || (((struct bundle_state *) - *entry_ptr)->branch_deviation + || ((*entry_ptr)->branch_deviation == bundle_state->branch_deviation - && ((struct bundle_state *) - *entry_ptr)->middle_bundle_stops + && (*entry_ptr)->middle_bundle_stops > bundle_state->middle_bundle_stops)))))) { struct bundle_state temp; - temp = *(struct bundle_state *) *entry_ptr; - *(struct bundle_state *) *entry_ptr = *bundle_state; - ((struct bundle_state *) *entry_ptr)->next = temp.next; + temp = **entry_ptr; + **entry_ptr = *bundle_state; + (*entry_ptr)->next = temp.next; *bundle_state = temp; } return FALSE; @@ -8611,8 +8609,7 @@ insert_bundle_state (struct bundle_state *bundle_state) static void initiate_bundle_state_table (void) { - bundle_state_table = htab_create (50, bundle_state_hash, bundle_state_eq_p, - (htab_del) 0); + bundle_state_table.create (50); } /* Finish work with the hash table. */ @@ -8620,7 +8617,7 @@ initiate_bundle_state_table (void) static void finish_bundle_state_table (void) { - htab_delete (bundle_state_table); + bundle_state_table.dispose (); } diff --git a/gcc/config/ia64/t-ia64 b/gcc/config/ia64/t-ia64 index 5c3ac644be3..b009cdf2bc5 100644 --- a/gcc/config/ia64/t-ia64 +++ b/gcc/config/ia64/t-ia64 @@ -24,4 +24,5 @@ ia64-c.o: $(srcdir)/config/ia64/ia64-c.c $(CONFIG_H) $(SYSTEM_H) \ # genattrtab generates very long string literals. insn-attrtab.o-warn = -Wno-error -ia64.o: debug.h $(PARAMS_H) sel-sched.h reload.h $(OPTS_H) dumpfile.h +ia64.o: $(srcdir)/config/ia64/ia64.c debug.h $(PARAMS_H) sel-sched.h reload.h \ + $(OPTS_H) dumpfile.h $(HASH_TABLE_H) |