|
|
4e62ec |
2005-05-17 Jakub Jelinek <jakub@redhat.com>
|
|
|
4e62ec |
|
|
|
4e62ec |
* varasm.c (struct constant_descriptor_tree): Add hash field.
|
|
|
4e62ec |
(const_desc_hash): Just return hash field.
|
|
|
4e62ec |
(const_desc_eq): If hash values are different, return 0 immediately.
|
|
|
4e62ec |
(output_constant_def): Compute hash field of temporary key, use
|
|
|
4e62ec |
htab_find_slot_with_hash instead of htab_find_slot. Set hash in
|
|
|
4e62ec |
newly built constant descriptor.
|
|
|
4e62ec |
(lookup_constant_def): Compute hash field of temporary key, use
|
|
|
4e62ec |
htab_find_with_hash instead of htab_find.
|
|
|
4e62ec |
|
|
|
4e62ec |
--- gcc/varasm.c 16 May 2005 21:37:01 -0000 1.510
|
|
|
4e62ec |
+++ gcc/varasm.c 17 May 2005 06:34:48 -0000 1.511
|
|
|
4e62ec |
@@ -2361,6 +2361,11 @@ struct constant_descriptor_tree GTY(())
|
|
|
4e62ec |
|
|
|
4e62ec |
/* The value of the constant. */
|
|
|
4e62ec |
tree value;
|
|
|
4e62ec |
+
|
|
|
4e62ec |
+ /* Hash of value. Computing the hash from value each time
|
|
|
4e62ec |
+ hashfn is called can't work properly, as that means recursive
|
|
|
4e62ec |
+ use of the hash table during hash table expansion. */
|
|
|
4e62ec |
+ hashval_t hash;
|
|
|
4e62ec |
};
|
|
|
4e62ec |
|
|
|
4e62ec |
static GTY((param_is (struct constant_descriptor_tree)))
|
|
|
4e62ec |
@@ -2374,7 +2379,7 @@ static void maybe_output_constant_def_co
|
|
|
4e62ec |
static hashval_t
|
|
|
4e62ec |
const_desc_hash (const void *ptr)
|
|
|
4e62ec |
{
|
|
|
4e62ec |
- return const_hash_1 (((struct constant_descriptor_tree *)ptr)->value);
|
|
|
4e62ec |
+ return ((struct constant_descriptor_tree *)ptr)->hash;
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|
|
|
4e62ec |
static hashval_t
|
|
|
4e62ec |
@@ -2474,8 +2479,11 @@ const_hash_1 (const tree exp)
|
|
|
4e62ec |
static int
|
|
|
4e62ec |
const_desc_eq (const void *p1, const void *p2)
|
|
|
4e62ec |
{
|
|
|
4e62ec |
- return compare_constant (((struct constant_descriptor_tree *)p1)->value,
|
|
|
4e62ec |
- ((struct constant_descriptor_tree *)p2)->value);
|
|
|
4e62ec |
+ const struct constant_descriptor_tree *c1 = p1;
|
|
|
4e62ec |
+ const struct constant_descriptor_tree *c2 = p2;
|
|
|
4e62ec |
+ if (c1->hash != c2->hash)
|
|
|
4e62ec |
+ return 0;
|
|
|
4e62ec |
+ return compare_constant (c1->value, c2->value);
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|
|
|
4e62ec |
/* Compare t1 and t2, and return 1 only if they are known to result in
|
|
|
4e62ec |
@@ -2745,12 +2753,14 @@ output_constant_def (tree exp, int defer
|
|
|
4e62ec |
/* Look up EXP in the table of constant descriptors. If we didn't find
|
|
|
4e62ec |
it, create a new one. */
|
|
|
4e62ec |
key.value = exp;
|
|
|
4e62ec |
- loc = htab_find_slot (const_desc_htab, &key, INSERT);
|
|
|
4e62ec |
+ key.hash = const_hash_1 (exp);
|
|
|
4e62ec |
+ loc = htab_find_slot_with_hash (const_desc_htab, &key, key.hash, INSERT);
|
|
|
4e62ec |
|
|
|
4e62ec |
desc = *loc;
|
|
|
4e62ec |
if (desc == 0)
|
|
|
4e62ec |
{
|
|
|
4e62ec |
desc = build_constant_desc (exp);
|
|
|
4e62ec |
+ desc->hash = key.hash;
|
|
|
4e62ec |
*loc = desc;
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|
|
|
4e62ec |
@@ -2853,7 +2863,8 @@ lookup_constant_def (tree exp)
|
|
|
4e62ec |
struct constant_descriptor_tree key;
|
|
|
4e62ec |
|
|
|
4e62ec |
key.value = exp;
|
|
|
4e62ec |
- desc = htab_find (const_desc_htab, &key);
|
|
|
4e62ec |
+ key.hash = const_hash_1 (exp);
|
|
|
4e62ec |
+ desc = htab_find_with_hash (const_desc_htab, &key, key.hash);
|
|
|
4e62ec |
|
|
|
4e62ec |
return (desc ? desc->rtl : NULL_RTX);
|
|
|
4e62ec |
}
|