/home/arjun/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- llvm/ADT/DenseMapInfo.h - Type traits for DenseMap -------*- C++ -*-===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // This file defines DenseMapInfo traits for DenseMap. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #ifndef LLVM_ADT_DENSEMAPINFO_H |
14 | | #define LLVM_ADT_DENSEMAPINFO_H |
15 | | |
16 | | #include "llvm/ADT/ArrayRef.h" |
17 | | #include "llvm/ADT/Hashing.h" |
18 | | #include "llvm/ADT/StringRef.h" |
19 | | #include <cassert> |
20 | | #include <cstddef> |
21 | | #include <cstdint> |
22 | | #include <utility> |
23 | | |
24 | | namespace llvm { |
25 | | |
26 | | namespace detail { |
27 | | |
28 | | /// Simplistic combination of 32-bit hash values into 32-bit hash values. |
29 | 0 | static inline unsigned combineHashValue(unsigned a, unsigned b) { |
30 | 0 | uint64_t key = (uint64_t)a << 32 | (uint64_t)b; |
31 | 0 | key += ~(key << 32); |
32 | 0 | key ^= (key >> 22); |
33 | 0 | key += ~(key << 13); |
34 | 0 | key ^= (key >> 8); |
35 | 0 | key += (key << 3); |
36 | 0 | key ^= (key >> 15); |
37 | 0 | key += ~(key << 27); |
38 | 0 | key ^= (key >> 31); |
39 | 0 | return (unsigned)key; |
40 | 0 | } Unexecuted instantiation: AffineStructuresTest.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: ErrorHandling.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: CommandLine.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: ManagedStatic.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: SmallPtrSet.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: StringSaver.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: VirtualFileSystem.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: CrashRecoveryContext.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Program.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Signals.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: ThreadLocal.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Threading.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: AffineStructures.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: AffineOps.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: AffineValueMap.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Simplex.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Ops.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: ControlFlowInterfaces.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: SideEffectInterfaces.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: AffineExpr.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: AffineMap.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: AsmPrinter.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Attributes.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Block.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Builders.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Diagnostics.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Dialect.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: IntegerSet.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Location.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: MLIRContext.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Function.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: FunctionImplementation.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Module.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Operation.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: OperationSupport.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: PatternMatch.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Region.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: StandardTypes.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: SymbolTable.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Types.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: TypeUtilities.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Value.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: Visitors.cpp:_ZN4llvm6detailL16combineHashValueEjj Unexecuted instantiation: StorageUniquer.cpp:_ZN4llvm6detailL16combineHashValueEjj |
41 | | |
42 | | } // end namespace detail |
43 | | |
44 | | template<typename T> |
45 | | struct DenseMapInfo { |
46 | | //static inline T getEmptyKey(); |
47 | | //static inline T getTombstoneKey(); |
48 | | //static unsigned getHashValue(const T &Val); |
49 | | //static bool isEqual(const T &LHS, const T &RHS); |
50 | | }; |
51 | | |
52 | | // Provide DenseMapInfo for all pointers. Come up with sentinel pointer values |
53 | | // that are aligned to alignof(T) bytes, but try to avoid requiring T to be |
54 | | // complete. This allows clients to instantiate DenseMap<T*, ...> with forward |
55 | | // declared key types. Assume that no pointer key type requires more than 4096 |
56 | | // bytes of alignment. |
57 | | template<typename T> |
58 | | struct DenseMapInfo<T*> { |
59 | | // The following should hold, but it would require T to be complete: |
60 | | // static_assert(alignof(T) <= (1 << Log2MaxAlign), |
61 | | // "DenseMap does not support pointer keys requiring more than " |
62 | | // "Log2MaxAlign bits of alignment"); |
63 | | static constexpr uintptr_t Log2MaxAlign = 12; |
64 | | |
65 | 0 | static inline T* getEmptyKey() { |
66 | 0 | uintptr_t Val = static_cast<uintptr_t>(-1); |
67 | 0 | Val <<= Log2MaxAlign; |
68 | 0 | return reinterpret_cast<T*>(Val); |
69 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPvE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir12BlockOperandEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPKvE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPKN4mlir16DialectInterfaceEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir9OperationEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir5BlockEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir14StorageUniquer11BaseStorageEE11getEmptyKeyEv |
70 | | |
71 | 0 | static inline T* getTombstoneKey() { |
72 | 0 | uintptr_t Val = static_cast<uintptr_t>(-2); |
73 | 0 | Val <<= Log2MaxAlign; |
74 | 0 | return reinterpret_cast<T*>(Val); |
75 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPvE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir12BlockOperandEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPKvE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPKN4mlir16DialectInterfaceEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir9OperationEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir5BlockEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir14StorageUniquer11BaseStorageEE15getTombstoneKeyEv |
76 | | |
77 | 0 | static unsigned getHashValue(const T *PtrVal) { |
78 | 0 | return (unsigned((uintptr_t)PtrVal) >> 4) ^ |
79 | 0 | (unsigned((uintptr_t)PtrVal) >> 9); |
80 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPvE12getHashValueEPKv Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir9OperationEE12getHashValueEPKS2_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir5BlockEE12getHashValueEPKS2_ |
81 | | |
82 | 0 | static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; } Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPKN4mlir16DialectInterfaceEE7isEqualES4_S4_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir9OperationEE7isEqualEPKS2_S6_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPN4mlir5BlockEE7isEqualEPKS2_S6_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoIPvE7isEqualEPKvS4_ |
83 | | }; |
84 | | |
85 | | // Provide DenseMapInfo for chars. |
86 | | template<> struct DenseMapInfo<char> { |
87 | 0 | static inline char getEmptyKey() { return ~0; } |
88 | 0 | static inline char getTombstoneKey() { return ~0 - 1; } |
89 | 0 | static unsigned getHashValue(const char& Val) { return Val * 37U; } |
90 | | |
91 | 0 | static bool isEqual(const char &LHS, const char &RHS) { |
92 | 0 | return LHS == RHS; |
93 | 0 | } |
94 | | }; |
95 | | |
96 | | // Provide DenseMapInfo for unsigned chars. |
97 | | template <> struct DenseMapInfo<unsigned char> { |
98 | 0 | static inline unsigned char getEmptyKey() { return ~0; } |
99 | 0 | static inline unsigned char getTombstoneKey() { return ~0 - 1; } |
100 | 0 | static unsigned getHashValue(const unsigned char &Val) { return Val * 37U; } |
101 | | |
102 | 0 | static bool isEqual(const unsigned char &LHS, const unsigned char &RHS) { |
103 | 0 | return LHS == RHS; |
104 | 0 | } |
105 | | }; |
106 | | |
107 | | // Provide DenseMapInfo for unsigned shorts. |
108 | | template <> struct DenseMapInfo<unsigned short> { |
109 | 0 | static inline unsigned short getEmptyKey() { return 0xFFFF; } |
110 | 0 | static inline unsigned short getTombstoneKey() { return 0xFFFF - 1; } |
111 | 0 | static unsigned getHashValue(const unsigned short &Val) { return Val * 37U; } |
112 | | |
113 | 0 | static bool isEqual(const unsigned short &LHS, const unsigned short &RHS) { |
114 | 0 | return LHS == RHS; |
115 | 0 | } |
116 | | }; |
117 | | |
118 | | // Provide DenseMapInfo for unsigned ints. |
119 | | template<> struct DenseMapInfo<unsigned> { |
120 | 0 | static inline unsigned getEmptyKey() { return ~0U; } |
121 | 0 | static inline unsigned getTombstoneKey() { return ~0U - 1; } |
122 | 0 | static unsigned getHashValue(const unsigned& Val) { return Val * 37U; } |
123 | | |
124 | 0 | static bool isEqual(const unsigned& LHS, const unsigned& RHS) { |
125 | 0 | return LHS == RHS; |
126 | 0 | } |
127 | | }; |
128 | | |
129 | | // Provide DenseMapInfo for unsigned longs. |
130 | | template<> struct DenseMapInfo<unsigned long> { |
131 | 0 | static inline unsigned long getEmptyKey() { return ~0UL; } |
132 | 0 | static inline unsigned long getTombstoneKey() { return ~0UL - 1L; } |
133 | | |
134 | 0 | static unsigned getHashValue(const unsigned long& Val) { |
135 | 0 | return (unsigned)(Val * 37UL); |
136 | 0 | } |
137 | | |
138 | 0 | static bool isEqual(const unsigned long& LHS, const unsigned long& RHS) { |
139 | 0 | return LHS == RHS; |
140 | 0 | } |
141 | | }; |
142 | | |
143 | | // Provide DenseMapInfo for unsigned long longs. |
144 | | template<> struct DenseMapInfo<unsigned long long> { |
145 | 0 | static inline unsigned long long getEmptyKey() { return ~0ULL; } |
146 | 0 | static inline unsigned long long getTombstoneKey() { return ~0ULL - 1ULL; } |
147 | | |
148 | 0 | static unsigned getHashValue(const unsigned long long& Val) { |
149 | 0 | return (unsigned)(Val * 37ULL); |
150 | 0 | } |
151 | | |
152 | | static bool isEqual(const unsigned long long& LHS, |
153 | 0 | const unsigned long long& RHS) { |
154 | 0 | return LHS == RHS; |
155 | 0 | } |
156 | | }; |
157 | | |
158 | | // Provide DenseMapInfo for shorts. |
159 | | template <> struct DenseMapInfo<short> { |
160 | 0 | static inline short getEmptyKey() { return 0x7FFF; } |
161 | 0 | static inline short getTombstoneKey() { return -0x7FFF - 1; } |
162 | 0 | static unsigned getHashValue(const short &Val) { return Val * 37U; } |
163 | 0 | static bool isEqual(const short &LHS, const short &RHS) { return LHS == RHS; } |
164 | | }; |
165 | | |
166 | | // Provide DenseMapInfo for ints. |
167 | | template<> struct DenseMapInfo<int> { |
168 | 0 | static inline int getEmptyKey() { return 0x7fffffff; } |
169 | 0 | static inline int getTombstoneKey() { return -0x7fffffff - 1; } |
170 | 0 | static unsigned getHashValue(const int& Val) { return (unsigned)(Val * 37U); } |
171 | | |
172 | 0 | static bool isEqual(const int& LHS, const int& RHS) { |
173 | 0 | return LHS == RHS; |
174 | 0 | } |
175 | | }; |
176 | | |
177 | | // Provide DenseMapInfo for longs. |
178 | | template<> struct DenseMapInfo<long> { |
179 | 0 | static inline long getEmptyKey() { |
180 | 0 | return (1UL << (sizeof(long) * 8 - 1)) - 1UL; |
181 | 0 | } |
182 | | |
183 | 0 | static inline long getTombstoneKey() { return getEmptyKey() - 1L; } |
184 | | |
185 | 0 | static unsigned getHashValue(const long& Val) { |
186 | 0 | return (unsigned)(Val * 37UL); |
187 | 0 | } |
188 | | |
189 | 0 | static bool isEqual(const long& LHS, const long& RHS) { |
190 | 0 | return LHS == RHS; |
191 | 0 | } |
192 | | }; |
193 | | |
194 | | // Provide DenseMapInfo for long longs. |
195 | | template<> struct DenseMapInfo<long long> { |
196 | 0 | static inline long long getEmptyKey() { return 0x7fffffffffffffffLL; } |
197 | 0 | static inline long long getTombstoneKey() { return -0x7fffffffffffffffLL-1; } |
198 | | |
199 | 0 | static unsigned getHashValue(const long long& Val) { |
200 | 0 | return (unsigned)(Val * 37ULL); |
201 | 0 | } |
202 | | |
203 | | static bool isEqual(const long long& LHS, |
204 | 0 | const long long& RHS) { |
205 | 0 | return LHS == RHS; |
206 | 0 | } |
207 | | }; |
208 | | |
209 | | // Provide DenseMapInfo for all pairs whose members have info. |
210 | | template<typename T, typename U> |
211 | | struct DenseMapInfo<std::pair<T, U>> { |
212 | | using Pair = std::pair<T, U>; |
213 | | using FirstInfo = DenseMapInfo<T>; |
214 | | using SecondInfo = DenseMapInfo<U>; |
215 | | |
216 | | static inline Pair getEmptyKey() { |
217 | | return std::make_pair(FirstInfo::getEmptyKey(), |
218 | | SecondInfo::getEmptyKey()); |
219 | | } |
220 | | |
221 | | static inline Pair getTombstoneKey() { |
222 | | return std::make_pair(FirstInfo::getTombstoneKey(), |
223 | | SecondInfo::getTombstoneKey()); |
224 | | } |
225 | | |
226 | 0 | static unsigned getHashValue(const Pair& PairVal) { |
227 | 0 | return detail::combineHashValue(FirstInfo::getHashValue(PairVal.first), |
228 | 0 | SecondInfo::getHashValue(PairVal.second)); |
229 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt4pairIjNS_8ArrayRefImEEEE12getHashValueERKS4_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt4pairIN4mlir10AffineExprES3_EE12getHashValueERKS4_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt4pairINS_9StringRefENS_8ArrayRefIN4mlir17FlatSymbolRefAttrEEEEE12getHashValueERKS7_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt4pairINS_9StringRefEN4mlir4TypeEEE12getHashValueERKS5_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt4pairIN4mlir8LocationES3_EE12getHashValueERKS4_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt4pairINS_8ArrayRefIN4mlir8LocationEEENS3_9AttributeEEE12getHashValueERKS7_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt4pairIN4mlir10IdentifierENS2_8LocationEEE12getHashValueERKS5_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt4pairINS_8ArrayRefIlEEN4mlir4TypeEEE12getHashValueERKS6_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt4pairINS_8ArrayRefIN4mlir4TypeEEES5_EE12getHashValueERKS6_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt4pairIN4mlir10IdentifierENS_9StringRefEEE12getHashValueERKS5_ |
230 | | |
231 | | static bool isEqual(const Pair &LHS, const Pair &RHS) { |
232 | | return FirstInfo::isEqual(LHS.first, RHS.first) && |
233 | | SecondInfo::isEqual(LHS.second, RHS.second); |
234 | | } |
235 | | }; |
236 | | |
237 | | // Provide DenseMapInfo for all tuples whose members have info. |
238 | | template <typename... Ts> struct DenseMapInfo<std::tuple<Ts...>> { |
239 | | using Tuple = std::tuple<Ts...>; |
240 | | |
241 | | static inline Tuple getEmptyKey() { |
242 | | return Tuple(DenseMapInfo<Ts>::getEmptyKey()...); |
243 | | } |
244 | | |
245 | | static inline Tuple getTombstoneKey() { |
246 | | return Tuple(DenseMapInfo<Ts>::getTombstoneKey()...); |
247 | | } |
248 | | |
249 | | template <unsigned I> |
250 | 0 | static unsigned getHashValueImpl(const Tuple &values, std::false_type) { |
251 | 0 | using EltType = typename std::tuple_element<I, Tuple>::type; |
252 | 0 | std::integral_constant<bool, I + 1 == sizeof...(Ts)> atEnd; |
253 | 0 | return detail::combineHashValue( |
254 | 0 | DenseMapInfo<EltType>::getHashValue(std::get<I>(values)), |
255 | 0 | getHashValueImpl<I + 1>(values, atEnd)); |
256 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir10IdentifierENS_9StringRefENS2_4TypeEEEE16getHashValueImplILj0EEEjRKS6_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir10IdentifierENS_9StringRefENS2_4TypeEEEE16getHashValueImplILj1EEEjRKS6_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir10IdentifierENS_9StringRefENS2_4TypeEEEE16getHashValueImplILj2EEEjRKS6_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir10IdentifierEjjEEE16getHashValueImplILj0EEEjRKS4_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir10IdentifierEjjEEE16getHashValueImplILj1EEEjRKS4_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir10IdentifierEjjEEE16getHashValueImplILj2EEEjRKS4_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJmN4mlir6TypeIDENS2_8LocationEEEE16getHashValueImplILj0EEEjRKS5_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJmN4mlir6TypeIDENS2_8LocationEEEE16getHashValueImplILj1EEEjRKS5_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJmN4mlir6TypeIDENS2_8LocationEEEE16getHashValueImplILj2EEEjRKS5_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJNS_8ArrayRefIlEEN4mlir4TypeENS2_INS4_9AffineMapEEEjEEE16getHashValueImplILj0EEEjRKS8_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJNS_8ArrayRefIlEEN4mlir4TypeENS2_INS4_9AffineMapEEEjEEE16getHashValueImplILj1EEEjRKS8_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJNS_8ArrayRefIlEEN4mlir4TypeENS2_INS4_9AffineMapEEEjEEE16getHashValueImplILj2EEEjRKS8_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJNS_8ArrayRefIlEEN4mlir4TypeENS2_INS4_9AffineMapEEEjEEE16getHashValueImplILj3EEEjRKS8_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir4TypeEjEEE16getHashValueImplILj0EEEjRKS4_St17integral_constantIbLb0EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir4TypeEjEEE16getHashValueImplILj1EEEjRKS4_St17integral_constantIbLb0EE |
257 | | |
258 | | template <unsigned I> |
259 | 0 | static unsigned getHashValueImpl(const Tuple &values, std::true_type) { |
260 | 0 | return 0; |
261 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir10IdentifierENS_9StringRefENS2_4TypeEEEE16getHashValueImplILj3EEEjRKS6_St17integral_constantIbLb1EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir10IdentifierEjjEEE16getHashValueImplILj3EEEjRKS4_St17integral_constantIbLb1EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJmN4mlir6TypeIDENS2_8LocationEEEE16getHashValueImplILj3EEEjRKS5_St17integral_constantIbLb1EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJNS_8ArrayRefIlEEN4mlir4TypeENS2_INS4_9AffineMapEEEjEEE16getHashValueImplILj4EEEjRKS8_St17integral_constantIbLb1EE Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir4TypeEjEEE16getHashValueImplILj2EEEjRKS4_St17integral_constantIbLb1EE |
262 | | |
263 | 0 | static unsigned getHashValue(const std::tuple<Ts...> &values) { |
264 | 0 | std::integral_constant<bool, 0 == sizeof...(Ts)> atEnd; |
265 | 0 | return getHashValueImpl<0>(values, atEnd); |
266 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir10IdentifierENS_9StringRefENS2_4TypeEEEE12getHashValueERKS6_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir10IdentifierEjjEEE12getHashValueERKS4_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJmN4mlir6TypeIDENS2_8LocationEEEE12getHashValueERKS5_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJNS_8ArrayRefIlEEN4mlir4TypeENS2_INS4_9AffineMapEEEjEEE12getHashValueERKS8_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoISt5tupleIJN4mlir4TypeEjEEE12getHashValueERKS4_ |
267 | | |
268 | | template <unsigned I> |
269 | | static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::false_type) { |
270 | | using EltType = typename std::tuple_element<I, Tuple>::type; |
271 | | std::integral_constant<bool, I + 1 == sizeof...(Ts)> atEnd; |
272 | | return DenseMapInfo<EltType>::isEqual(std::get<I>(lhs), std::get<I>(rhs)) && |
273 | | isEqualImpl<I + 1>(lhs, rhs, atEnd); |
274 | | } |
275 | | |
276 | | template <unsigned I> |
277 | | static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::true_type) { |
278 | | return true; |
279 | | } |
280 | | |
281 | | static bool isEqual(const Tuple &lhs, const Tuple &rhs) { |
282 | | std::integral_constant<bool, 0 == sizeof...(Ts)> atEnd; |
283 | | return isEqualImpl<0>(lhs, rhs, atEnd); |
284 | | } |
285 | | }; |
286 | | |
287 | | // Provide DenseMapInfo for StringRefs. |
288 | | template <> struct DenseMapInfo<StringRef> { |
289 | 0 | static inline StringRef getEmptyKey() { |
290 | 0 | return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(0)), |
291 | 0 | 0); |
292 | 0 | } |
293 | | |
294 | 0 | static inline StringRef getTombstoneKey() { |
295 | 0 | return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(1)), |
296 | 0 | 0); |
297 | 0 | } |
298 | | |
299 | 0 | static unsigned getHashValue(StringRef Val) { |
300 | 0 | assert(Val.data() != getEmptyKey().data() && "Cannot hash the empty key!"); |
301 | 0 | assert(Val.data() != getTombstoneKey().data() && |
302 | 0 | "Cannot hash the tombstone key!"); |
303 | 0 | return (unsigned)(hash_value(Val)); |
304 | 0 | } |
305 | | |
306 | 0 | static bool isEqual(StringRef LHS, StringRef RHS) { |
307 | 0 | if (RHS.data() == getEmptyKey().data()) |
308 | 0 | return LHS.data() == getEmptyKey().data(); |
309 | 0 | if (RHS.data() == getTombstoneKey().data()) |
310 | 0 | return LHS.data() == getTombstoneKey().data(); |
311 | 0 | return LHS == RHS; |
312 | 0 | } |
313 | | }; |
314 | | |
315 | | // Provide DenseMapInfo for ArrayRefs. |
316 | | template <typename T> struct DenseMapInfo<ArrayRef<T>> { |
317 | 0 | static inline ArrayRef<T> getEmptyKey() { |
318 | 0 | return ArrayRef<T>(reinterpret_cast<const T *>(~static_cast<uintptr_t>(0)), |
319 | 0 | size_t(0)); |
320 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefImEEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIlEEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir9AttributeEEEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefISt4pairIN4mlir10IdentifierENS3_9AttributeEEEEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir17FlatSymbolRefAttrEEEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir8LocationEEEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir9AffineMapEEEE11getEmptyKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir4TypeEEEE11getEmptyKeyEv |
321 | | |
322 | 0 | static inline ArrayRef<T> getTombstoneKey() { |
323 | 0 | return ArrayRef<T>(reinterpret_cast<const T *>(~static_cast<uintptr_t>(1)), |
324 | 0 | size_t(0)); |
325 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefImEEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIlEEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir9AttributeEEEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefISt4pairIN4mlir10IdentifierENS3_9AttributeEEEEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir17FlatSymbolRefAttrEEEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir8LocationEEEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir9AffineMapEEEE15getTombstoneKeyEv Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir4TypeEEEE15getTombstoneKeyEv |
326 | | |
327 | 0 | static unsigned getHashValue(ArrayRef<T> Val) { |
328 | 0 | assert(Val.data() != getEmptyKey().data() && "Cannot hash the empty key!"); |
329 | 0 | assert(Val.data() != getTombstoneKey().data() && |
330 | 0 | "Cannot hash the tombstone key!"); |
331 | 0 | return (unsigned)(hash_value(Val)); |
332 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefImEEE12getHashValueES2_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIlEEE12getHashValueES2_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir9AttributeEEEE12getHashValueES4_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefISt4pairIN4mlir10IdentifierENS3_9AttributeEEEEE12getHashValueES7_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir17FlatSymbolRefAttrEEEE12getHashValueES4_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir8LocationEEEE12getHashValueES4_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir9AffineMapEEEE12getHashValueES4_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIN4mlir4TypeEEEE12getHashValueES4_ |
333 | | |
334 | 0 | static bool isEqual(ArrayRef<T> LHS, ArrayRef<T> RHS) { |
335 | 0 | if (RHS.data() == getEmptyKey().data()) |
336 | 0 | return LHS.data() == getEmptyKey().data(); |
337 | 0 | if (RHS.data() == getTombstoneKey().data()) |
338 | 0 | return LHS.data() == getTombstoneKey().data(); |
339 | 0 | return LHS == RHS; |
340 | 0 | } Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefIlEEE7isEqualES2_S2_ Unexecuted instantiation: _ZN4llvm12DenseMapInfoINS_8ArrayRefImEEE7isEqualES2_S2_ |
341 | | }; |
342 | | |
343 | | template <> struct DenseMapInfo<hash_code> { |
344 | 0 | static inline hash_code getEmptyKey() { return hash_code(-1); } |
345 | 0 | static inline hash_code getTombstoneKey() { return hash_code(-2); } |
346 | 0 | static unsigned getHashValue(hash_code val) { return val; } |
347 | 0 | static bool isEqual(hash_code LHS, hash_code RHS) { return LHS == RHS; } |
348 | | }; |
349 | | |
350 | | } // end namespace llvm |
351 | | |
352 | | #endif // LLVM_ADT_DENSEMAPINFO_H |