lto-cgraph.c (get_alias_symbol): Remove weakref sanity check.
[gcc.git] / gcc / tree-hasher.h
1 /* Hash Table Helper for Trees
2 Copyright (C) 2012 Free Software Foundation, Inc.
3 Contributed by Lawrence Crowl <crowl@google.com>
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
21 #ifndef GCC_TREE_HASHER_H
22 #define GCC_TREE_HASHER_H 1
23
24 #include "hash-table.h"
25 #include "tree-flow.h"
26
27 /* Hashtable helpers. */
28
29 struct int_tree_hasher : typed_free_remove <int_tree_map>
30 {
31 typedef int_tree_map value_type;
32 typedef int_tree_map compare_type;
33 static inline hashval_t hash (const value_type *);
34 static inline bool equal (const value_type *, const compare_type *);
35 };
36
37 /* Hash a UID in a int_tree_map. */
38
39 inline hashval_t
40 int_tree_hasher::hash (const value_type *item)
41 {
42 return item->uid;
43 }
44
45 /* Return true if the uid in both int tree maps are equal. */
46
47 inline bool
48 int_tree_hasher::equal (const value_type *a, const compare_type *b)
49 {
50 return (a->uid == b->uid);
51 }
52
53 typedef hash_table <int_tree_hasher> int_tree_htab_type;
54
55 #endif /* GCC_TREE_HASHER_H */