LLVM: include/llvm/ProfileData/HashKeyMap.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef LLVM_PROFILEDATA_HASHKEYMAP_H
16#define LLVM_PROFILEDATA_HASHKEYMAP_H
17
19#include
20
21namespace llvm {
22
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49template <template <typename, typename, typename...> typename MapT,
50 typename KeyT, typename ValueT, typename... MapTArgs>
52 public MapT<decltype(hash_value(KeyT())), ValueT, MapTArgs...> {
53public:
58 using value_type = typename base_type::value_type;
59
60 using iterator = typename base_type::iterator;
62
63 template <typename... Ts>
66 Ts &&...Args) {
68 return base_type::try_emplace(Hash, std::forward(Args)...);
69 }
70
71 template <typename... Ts>
76
77 template <typename... Ts> std::pair<iterator, bool> emplace(Ts &&...Args) {
78 return try_emplace(std::forward(Args)...);
79 }
80
84
87 if (It != base_type::end())
88 return It;
89 return base_type::end();
90 }
91
94 if (It != base_type::end())
95 return It;
96 return base_type::end();
97 }
98
101 if (It != base_type::end())
102 return It->second;
104 }
105
109
111 auto It = find(Ctx);
112 if (It != base_type::end()) {
113 base_type::erase(It);
114 return 1;
115 }
116 return 0;
117 }
118
120 return base_type::erase(It);
121 }
122};
123
124}
125
126}
127
128#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This class is a wrapper to associative container MapT<KeyT, ValueT> using the hash value of the origi...
Definition HashKeyMap.h:52
MapT< decltype(hash_value(KeyT())), ValueT, MapTArgs... > base_type
Definition HashKeyMap.h:54
ValueT mapped_type
Definition HashKeyMap.h:57
std::pair< iterator, bool > emplace(Ts &&...Args)
Definition HashKeyMap.h:77
std::pair< iterator, bool > try_emplace(const key_type &Hash, const original_key_type &Key, Ts &&...Args)
Definition HashKeyMap.h:64
typename base_type::iterator iterator
Definition HashKeyMap.h:60
const_iterator find(const original_key_type &Key) const
Definition HashKeyMap.h:92
typename base_type::value_type value_type
Definition HashKeyMap.h:58
std::pair< iterator, bool > try_emplace(const original_key_type &Key, Ts &&...Args)
Definition HashKeyMap.h:72
decltype(hash_value(KeyT())) key_type
Definition HashKeyMap.h:55
size_t erase(const original_key_type &Ctx)
Definition HashKeyMap.h:110
mapped_type & operator[](const original_key_type &Key)
Definition HashKeyMap.h:81
KeyT original_key_type
Definition HashKeyMap.h:56
size_t count(const original_key_type &Key) const
Definition HashKeyMap.h:106
iterator find(const original_key_type &Key)
Definition HashKeyMap.h:85
mapped_type lookup(const original_key_type &Key) const
Definition HashKeyMap.h:99
typename base_type::const_iterator const_iterator
Definition HashKeyMap.h:61
iterator erase(const_iterator It)
Definition HashKeyMap.h:119
uint64_t hash_value(const FunctionId &Obj)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key