[AArch64] Properly handle mvn-register and add EON+shift pattern and cost appropriately
[official-gcc.git] / gcc / tree-hasher.h
blob228e317e1aec6aca6474f83376e9c8def5838e75
1 /* Hash Table Helper for Trees
2 Copyright (C) 2012-2015 Free Software Foundation, Inc.
3 Contributed by Lawrence Crowl <crowl@google.com>
5 This file is part of GCC.
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.
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.
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/>. */
21 #ifndef GCC_TREE_HASHER_H
22 #define GCC_TREE_HASHER_H 1
24 #include "hash-table.h"
26 struct int_tree_map {
27 unsigned int uid;
28 tree to;
31 /* Hashtable helpers. */
33 struct int_tree_hasher
35 typedef int_tree_map value_type;
36 typedef int_tree_map compare_type;
37 static inline hashval_t hash (const value_type &);
38 static inline bool equal (const value_type &, const compare_type &);
39 static bool is_deleted (const value_type &v)
41 return v.to == reinterpret_cast<tree> (1);
43 static void mark_deleted (value_type &v) { v.to = reinterpret_cast<tree> (0x1); }
44 static bool is_empty (const value_type &v) { return v.to == NULL; }
45 static void mark_empty (value_type &v) { v.to = NULL; }
46 static void remove (value_type &) {}
49 /* Hash a UID in a int_tree_map. */
51 inline hashval_t
52 int_tree_hasher::hash (const value_type &item)
54 return item.uid;
57 /* Return true if the uid in both int tree maps are equal. */
59 inline bool
60 int_tree_hasher::equal (const value_type &a, const compare_type &b)
62 return (a.uid == b.uid);
65 typedef hash_table <int_tree_hasher> int_tree_htab_type;
67 #endif /* GCC_TREE_HASHER_H */