GCC Middle and Back End API Reference
tree-hasher.h
Go to the documentation of this file.
1/* Hash Table Helper for Trees
2 Copyright (C) 2012-2024 Free Software Foundation, Inc.
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
25 unsigned int uid;
27};
28
29/* Hashtable helpers. */
30
32{
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 const bool empty_zero_p = true;
44 static void mark_empty (value_type &v) { v.to = NULL; }
45 static void remove (value_type &) {}
46};
47
48/* Hash a UID in a int_tree_map. */
49
50inline hashval_t
52{
53 return item.uid;
54}
55
56/* Return true if the uid in both int tree maps are equal. */
57
58inline bool
60{
61 return (a.uid == b.uid);
62}
63
65
66#endif /* GCC_TREE_HASHER_H */
union tree_node * tree
Definition coretypes.h:97
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
Ca const poly_int< N, Cb > & b
Definition poly-int.h:767
Ca & a
Definition poly-int.h:766
Definition tree-hasher.h:32
int_tree_map compare_type
Definition tree-hasher.h:34
static bool is_deleted(const value_type &v)
Definition tree-hasher.h:37
int_tree_map value_type
Definition tree-hasher.h:33
static hashval_t hash(const value_type &)
Definition tree-hasher.h:51
static void mark_deleted(value_type &v)
Definition tree-hasher.h:41
static const bool empty_zero_p
Definition tree-hasher.h:43
static void remove(value_type &)
Definition tree-hasher.h:45
static bool is_empty(const value_type &v)
Definition tree-hasher.h:42
static void mark_empty(value_type &v)
Definition tree-hasher.h:44
static bool equal(const value_type &, const compare_type &)
Definition tree-hasher.h:59
Definition tree-hasher.h:24
unsigned int uid
Definition tree-hasher.h:25
tree to
Definition tree-hasher.h:26
#define NULL
Definition system.h:50
hash_table< int_tree_hasher > int_tree_htab_type
Definition tree-hasher.h:64