public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/option-tweaking)] options: use cl_optimization_hash.
@ 2021-10-08 11:29 Martin Liska
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2021-10-08 11:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:da6fd12757eff45e25eb85be626b92f1e2412ab5

commit da6fd12757eff45e25eb85be626b92f1e2412ab5
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Oct 8 09:40:16 2021 +0200

    options: use cl_optimization_hash.
    
    gcc/ChangeLog:
    
            * tree.c (cl_option_hasher::hash): Use cl_optimization_hash
            and remove legacy hashing code.

Diff:
---
 gcc/tree.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index 561b9cd56bd..7bfd64160f4 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -11473,30 +11473,13 @@ hashval_t
 cl_option_hasher::hash (tree x)
 {
   const_tree const t = x;
-  const char *p;
-  size_t i;
-  size_t len = 0;
-  hashval_t hash = 0;
 
   if (TREE_CODE (t) == OPTIMIZATION_NODE)
-    {
-      p = (const char *)TREE_OPTIMIZATION (t);
-      len = sizeof (struct cl_optimization);
-    }
-
+    return cl_optimization_hash (TREE_OPTIMIZATION (t));
   else if (TREE_CODE (t) == TARGET_OPTION_NODE)
     return cl_target_option_hash (TREE_TARGET_OPTION (t));
-
   else
     gcc_unreachable ();
-
-  /* assume most opt flags are just 0/1, some are 2-3, and a few might be
-     something else.  */
-  for (i = 0; i < len; i++)
-    if (p[i])
-      hash = (hash << 4) ^ ((i << 2) | p[i]);
-
-  return hash;
 }
 
 /* Return nonzero if the value represented by *X (an OPTIMIZATION or


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/marxin/heads/option-tweaking)] options: use cl_optimization_hash.
@ 2021-10-08  7:54 Martin Liska
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2021-10-08  7:54 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ff5a4e413b94178bb8c6aa4a1d81313a4479f48b

commit ff5a4e413b94178bb8c6aa4a1d81313a4479f48b
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Oct 8 09:40:16 2021 +0200

    options: use cl_optimization_hash.
    
    gcc/ChangeLog:
    
            * tree.c (cl_option_hasher::hash): Use cl_optimization_hash
            and remove legacy hashing code.

Diff:
---
 gcc/tree.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index 561b9cd56bd..7bfd64160f4 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -11473,30 +11473,13 @@ hashval_t
 cl_option_hasher::hash (tree x)
 {
   const_tree const t = x;
-  const char *p;
-  size_t i;
-  size_t len = 0;
-  hashval_t hash = 0;
 
   if (TREE_CODE (t) == OPTIMIZATION_NODE)
-    {
-      p = (const char *)TREE_OPTIMIZATION (t);
-      len = sizeof (struct cl_optimization);
-    }
-
+    return cl_optimization_hash (TREE_OPTIMIZATION (t));
   else if (TREE_CODE (t) == TARGET_OPTION_NODE)
     return cl_target_option_hash (TREE_TARGET_OPTION (t));
-
   else
     gcc_unreachable ();
-
-  /* assume most opt flags are just 0/1, some are 2-3, and a few might be
-     something else.  */
-  for (i = 0; i < len; i++)
-    if (p[i])
-      hash = (hash << 4) ^ ((i << 2) | p[i]);
-
-  return hash;
 }
 
 /* Return nonzero if the value represented by *X (an OPTIMIZATION or


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-08 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-08 11:29 [gcc(refs/users/marxin/heads/option-tweaking)] options: use cl_optimization_hash Martin Liska
  -- strict thread matches above, loose matches on Subject: below --
2021-10-08  7:54 Martin Liska

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).