]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/tree-hasher.h
[testsuite] Add missing dg-require-effective-target label_values
[thirdparty/gcc.git] / gcc / tree-hasher.h
CommitLineData
d9dd21a8 1/* Hash Table Helper for Trees
fbd26352 2 Copyright (C) 2012-2019 Free Software Foundation, Inc.
d9dd21a8 3 Contributed by Lawrence Crowl <crowl@google.com>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along 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
582791b0 24struct int_tree_map {
25 unsigned int uid;
26 tree to;
27};
d9dd21a8 28
29/* Hashtable helpers. */
30
2933f7af 31struct int_tree_hasher
d9dd21a8 32{
33 typedef int_tree_map value_type;
34 typedef int_tree_map compare_type;
2933f7af 35 static inline hashval_t hash (const value_type &);
36 static inline bool equal (const value_type &, const compare_type &);
37 static bool is_deleted (const value_type &v)
38 {
39 return v.to == reinterpret_cast<tree> (1);
40 }
41 static void mark_deleted (value_type &v) { v.to = reinterpret_cast<tree> (0x1); }
42 static bool is_empty (const value_type &v) { return v.to == NULL; }
43 static void mark_empty (value_type &v) { v.to = NULL; }
44 static void remove (value_type &) {}
d9dd21a8 45};
46
47/* Hash a UID in a int_tree_map. */
48
49inline hashval_t
2933f7af 50int_tree_hasher::hash (const value_type &item)
d9dd21a8 51{
2933f7af 52 return item.uid;
d9dd21a8 53}
54
55/* Return true if the uid in both int tree maps are equal. */
56
57inline bool
2933f7af 58int_tree_hasher::equal (const value_type &a, const compare_type &b)
d9dd21a8 59{
2933f7af 60 return (a.uid == b.uid);
d9dd21a8 61}
62
63typedef hash_table <int_tree_hasher> int_tree_htab_type;
64
65#endif /* GCC_TREE_HASHER_H */