diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-05-17 08:34:48 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2005-05-17 08:34:48 +0200 |
commit | b96917bffef6c486ceedbc93d994e2016e070e30 (patch) | |
tree | 4d0630c9230d9c00c783fe5d8b8a6cc1265b7388 /gcc | |
parent | 8de1f441bb72de63213667ce2af8152e3d2ce801 (diff) | |
download | gcc-b96917bffef6c486ceedbc93d994e2016e070e30.zip gcc-b96917bffef6c486ceedbc93d994e2016e070e30.tar.gz gcc-b96917bffef6c486ceedbc93d994e2016e070e30.tar.bz2 |
varasm.c (struct constant_descriptor_tree): Add hash field.
* varasm.c (struct constant_descriptor_tree): Add hash field.
(const_desc_hash): Just return hash field.
(const_desc_eq): If hash values are different, return 0 immediately.
(output_constant_def): Compute hash field of temporary key, use
htab_find_slot_with_hash instead of htab_find_slot. Set hash in
newly built constant descriptor.
(lookup_constant_def): Compute hash field of temporary key, use
htab_find_with_hash instead of htab_find.
From-SVN: r99813
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/varasm.c | 21 |
2 files changed, 27 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f42032b..8ba8ea9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2005-05-17 Jakub Jelinek <jakub@redhat.com> + + * varasm.c (struct constant_descriptor_tree): Add hash field. + (const_desc_hash): Just return hash field. + (const_desc_eq): If hash values are different, return 0 immediately. + (output_constant_def): Compute hash field of temporary key, use + htab_find_slot_with_hash instead of htab_find_slot. Set hash in + newly built constant descriptor. + (lookup_constant_def): Compute hash field of temporary key, use + htab_find_with_hash instead of htab_find. + 2005-05-16 Richard Henderson <rth@redhat.com> * config/i386/sse.md (mulv4si3): New. diff --git a/gcc/varasm.c b/gcc/varasm.c index 1f51e2e..4590d92 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2361,6 +2361,11 @@ struct constant_descriptor_tree GTY(()) /* The value of the constant. */ tree value; + + /* Hash of value. Computing the hash from value each time + hashfn is called can't work properly, as that means recursive + use of the hash table during hash table expansion. */ + hashval_t hash; }; static GTY((param_is (struct constant_descriptor_tree))) @@ -2374,7 +2379,7 @@ static void maybe_output_constant_def_contents (struct constant_descriptor_tree static hashval_t const_desc_hash (const void *ptr) { - return const_hash_1 (((struct constant_descriptor_tree *)ptr)->value); + return ((struct constant_descriptor_tree *)ptr)->hash; } static hashval_t @@ -2474,8 +2479,11 @@ const_hash_1 (const tree exp) static int const_desc_eq (const void *p1, const void *p2) { - return compare_constant (((struct constant_descriptor_tree *)p1)->value, - ((struct constant_descriptor_tree *)p2)->value); + const struct constant_descriptor_tree *c1 = p1; + const struct constant_descriptor_tree *c2 = p2; + if (c1->hash != c2->hash) + return 0; + return compare_constant (c1->value, c2->value); } /* Compare t1 and t2, and return 1 only if they are known to result in @@ -2745,12 +2753,14 @@ output_constant_def (tree exp, int defer) /* Look up EXP in the table of constant descriptors. If we didn't find it, create a new one. */ key.value = exp; - loc = htab_find_slot (const_desc_htab, &key, INSERT); + key.hash = const_hash_1 (exp); + loc = htab_find_slot_with_hash (const_desc_htab, &key, key.hash, INSERT); desc = *loc; if (desc == 0) { desc = build_constant_desc (exp); + desc->hash = key.hash; *loc = desc; } @@ -2853,7 +2863,8 @@ lookup_constant_def (tree exp) struct constant_descriptor_tree key; key.value = exp; - desc = htab_find (const_desc_htab, &key); + key.hash = const_hash_1 (exp); + desc = htab_find_with_hash (const_desc_htab, &key, key.hash); return (desc ? desc->rtl : NULL_RTX); } |