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/sol2.c | |
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/sol2.c')
-rw-r--r-- | gcc/config/sol2.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c index 718134e2b90..7c7c429db3d 100644 --- a/gcc/config/sol2.c +++ b/gcc/config/sol2.c @@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "tm_p.h" #include "diagnostic-core.h" #include "ggc.h" -#include "hashtab.h" +#include "hash-table.h" tree solaris_pending_aligns, solaris_pending_inits, solaris_pending_finis; @@ -157,10 +157,6 @@ solaris_assemble_visibility (tree decl, int vis ATTRIBUTE_UNUSED) #endif } -/* Hash table of group signature symbols. */ - -static htab_t solaris_comdat_htab; - /* Group section information entry stored in solaris_comdat_htab. */ typedef struct comdat_entry @@ -171,25 +167,34 @@ typedef struct comdat_entry const char *sig; } comdat_entry; -/* Helper routines for maintaining solaris_comdat_htab. */ +/* Helpers for maintaining solaris_comdat_htab. */ -static hashval_t -comdat_hash (const void *p) +struct comdat_entry_hasher : typed_noop_remove <comdat_entry> +{ + 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 *); +}; + +inline hashval_t +comdat_entry_hasher::hash (const value_type *entry) { - const comdat_entry *entry = (const comdat_entry *) p; - return htab_hash_string (entry->sig); } -static int -comdat_eq (const void *p1, const void *p2) +inline bool +comdat_entry_hasher::equal (const value_type *entry1, + const compare_type *entry2) { - const comdat_entry *entry1 = (const comdat_entry *) p1; - const comdat_entry *entry2 = (const comdat_entry *) p2; - return strcmp (entry1->sig, entry2->sig) == 0; } +/* Hash table of group signature symbols. */ + +static hash_table <comdat_entry_hasher> solaris_comdat_htab; + /* Output assembly to switch to COMDAT group section NAME with attributes FLAGS and group signature symbol DECL, using Sun as syntax. */ @@ -229,12 +234,11 @@ solaris_elf_asm_comdat_section (const char *name, unsigned int flags, tree decl) identify the missing ones without changing the affected frontents, remember the signature symbols and emit those not marked TREE_SYMBOL_REFERENCED in solaris_file_end. */ - if (solaris_comdat_htab == NULL) - solaris_comdat_htab = htab_create_alloc (37, comdat_hash, comdat_eq, NULL, - xcalloc, free); + if (!solaris_comdat_htab.is_created ()) + solaris_comdat_htab.create (37); entry.sig = signature; - slot = (comdat_entry **) htab_find_slot (solaris_comdat_htab, &entry, INSERT); + slot = solaris_comdat_htab.find_slot (&entry, INSERT); if (*slot == NULL) { @@ -250,10 +254,11 @@ solaris_elf_asm_comdat_section (const char *name, unsigned int flags, tree decl) /* Define unreferenced COMDAT group signature symbol corresponding to SLOT. */ -static int -solaris_define_comdat_signature (void **slot, void *aux ATTRIBUTE_UNUSED) +int +solaris_define_comdat_signature (comdat_entry **slot, + void *aux ATTRIBUTE_UNUSED) { - comdat_entry *entry = *(comdat_entry **) slot; + comdat_entry *entry = *slot; tree decl = entry->decl; if (TREE_CODE (decl) != IDENTIFIER_NODE) @@ -277,10 +282,10 @@ solaris_define_comdat_signature (void **slot, void *aux ATTRIBUTE_UNUSED) void solaris_file_end (void) { - if (solaris_comdat_htab == NULL) + if (!solaris_comdat_htab.is_created ()) return; - htab_traverse (solaris_comdat_htab, solaris_define_comdat_signature, NULL); + solaris_comdat_htab.traverse <void *, solaris_define_comdat_signature> (NULL); } void |