This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Use IDENTIFIER_HASH_VALUE where possible
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jan Hubicka <jh at suse dot de>, fortran at gcc dot gnu dot org
- Date: Sun, 16 May 2010 14:54:38 +0200 (CEST)
- Subject: [PATCH] Use IDENTIFIER_HASH_VALUE where possible
The following replaces htab_hash_string (IDENTIFIER_POINTER (base->id))
with IDENTIFIER_HASH_VALUE where possible. One case in tree.c
remains (decl_assembler_name_hash) - even though it should be
possible to replace that use we miscompile libgfortran in that case
(which hints at that we are corrupting shared identifiers - ugh).
decl_assembler_name_hash is only used by cgraph.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
Richard.
2010-05-16 Richard Guenther <rguenther@suse.de>
* lto-symtab.c (lto_symtab_entry_hash): Use IDENTIFIER_HASH_VALUE.
* optabs.c (libfunc_decl_hash): Likewise.
* varasm.c (emutls_decl): Likewise.
fortran/
* trans-decl.c (module_htab_decls_hash): Use IDENTIFIER_HASH_VALUE.
Index: gcc/lto-symtab.c
===================================================================
--- gcc/lto-symtab.c (revision 159433)
+++ gcc/lto-symtab.c (working copy)
@@ -81,7 +81,7 @@ lto_symtab_entry_hash (const void *p)
{
const struct lto_symtab_entry_def *base =
(const struct lto_symtab_entry_def *) p;
- return htab_hash_string (IDENTIFIER_POINTER (base->id));
+ return IDENTIFIER_HASH_VALUE (base->id);
}
/* Return non-zero if P1 and P2 points to lto_symtab_entry_def structs
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c (revision 159433)
+++ gcc/optabs.c (working copy)
@@ -6032,7 +6032,7 @@ static GTY ((param_is (union tree_node))
static hashval_t
libfunc_decl_hash (const void *entry)
{
- return htab_hash_string (IDENTIFIER_POINTER (DECL_NAME ((const_tree) entry)));
+ return IDENTIFIER_HASH_VALUE (DECL_NAME ((const_tree) entry));
}
static int
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c (revision 159433)
+++ gcc/fortran/trans-decl.c (working copy)
@@ -3374,7 +3374,7 @@ module_htab_decls_hash (const void *x)
const_tree n = DECL_NAME (t);
if (n == NULL_TREE)
n = TYPE_NAME (TREE_TYPE (t));
- return htab_hash_string (IDENTIFIER_POINTER (n));
+ return IDENTIFIER_HASH_VALUE (n);
}
static int
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c (revision 159433)
+++ gcc/varasm.c (working copy)
@@ -365,7 +365,7 @@ emutls_decl (tree decl)
/* Note that we use the hash of the decl's name, rather than a hash
of the decl's pointer. In emutls_finish we iterate through the
hash table, and we want this traversal to be predictable. */
- in.hash = htab_hash_string (IDENTIFIER_POINTER (name));
+ in.hash = IDENTIFIER_HASH_VALUE (name);
in.base.from = decl;
loc = htab_find_slot_with_hash (emutls_htab, &in, in.hash, INSERT);
h = (struct tree_map *) *loc;