From 84a98514b3d659ab6ca4b6bc624a1b7453fa0daa Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 25 Jun 2015 17:16:15 +0000 Subject: [PATCH] tree-hash-traits.h (tree_hash): New class. gcc/ * tree-hash-traits.h (tree_hash): New class. * except.c: Include tree-hash-traits.h. (tree_hash_traits): Use tree_hash. From-SVN: r224970 --- gcc/ChangeLog | 6 ++++++ gcc/except.c | 7 ++----- gcc/tree-hash-traits.h | 12 ++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f95f2dcc947..6389191c133 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-06-25 Richard Sandiford + + * tree-hash-traits.h (tree_hash): New class. + * except.c: Include tree-hash-traits.h. + (tree_hash_traits): Use tree_hash. + 2015-06-25 Richard Sandiford * tree-hash-traits.h (tree_ssa_name_hasher): New class. diff --git a/gcc/except.c b/gcc/except.c index ce1e31f0645..081b402fc50 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -159,14 +159,11 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "cfgloop.h" #include "builtins.h" +#include "tree-hash-traits.h" static GTY(()) int call_site_base; -struct tree_hash_traits : default_hashmap_traits -{ - static hashval_t hash (tree t) { return TREE_HASH (t); } -}; - +struct tree_hash_traits : simple_hashmap_traits {}; static GTY (()) hash_map *type_to_runtime_map; /* Describe the SjLj_Function_Context structure. */ diff --git a/gcc/tree-hash-traits.h b/gcc/tree-hash-traits.h index 1f4364f591e..1edc49eda46 100644 --- a/gcc/tree-hash-traits.h +++ b/gcc/tree-hash-traits.h @@ -67,4 +67,16 @@ tree_ssa_name_hash::hash (tree t) return SSA_NAME_VERSION (t); } +/* Hasher for general trees, based on their TREE_HASH. */ +struct tree_hash : ggc_ptr_hash +{ + static hashval_t hash (tree); +}; + +inline hashval_t +tree_hash::hash (tree t) +{ + return TREE_HASH (t); +} + #endif -- 2.30.2