LLVM: include/llvm/CAS/OnDiskTrieRawHashMap.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef LLVM_CAS_ONDISKTRIERAWHASHMAP_H
17#define LLVM_CAS_ONDISKTRIERAWHASHMAP_H
18
25#include
26
27namespace llvm {
28
30
31namespace cas {
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
52public:
54 void
57
58public:
59
70
71
82
83
84
85
88
89
91 return Offset.get() < (1LL << 48);
92 }
93
94public:
95
96
97
98
99
101 public:
105
107
116
118
119 protected:
126
130
131
132
134 };
135
138 public:
140
141 private:
144 using ConstOnDiskPtr::PointerImpl::PointerImpl;
145 };
146
148 public:
152
154
155 private:
157 using OnDiskPtr::PointerImpl::PointerImpl;
158 };
159
160
161
162
163
165
166
169
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
194
197 assert(Allocated.Hash == Value.Hash);
198 assert(Allocated.Data.size() == Value.Data.size());
199 llvm::copy(Value.Data, Allocated.Data.begin());
200 });
201 }
202
205
206
207
208
209
210
211
212
213
214
215
216
217
219 create(const Twine &Path, const Twine &TrieName, size_t NumHashBits,
221 std::optional<uint64_t> NewFileInitialSize,
222 std::optional<size_t> NewTableNumRootBits = std::nullopt,
223 std::optional<size_t> NewTableNumSubtrieBits = std::nullopt);
224
228
229private:
232 std::unique_ptr Impl;
233};
234
235}
236}
237
238#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
#define LLVM_ABI_FOR_TEST
This file declares interface for FileOffset that represent stored data at an offset from the beginnin...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
FileOffset is a wrapper around uint64_t to represent the offset of data from the beginning of the fil...
friend class OnDiskPtr
Definition OnDiskTrieRawHashMap.h:142
friend class OnDiskTrieRawHashMap
Definition OnDiskTrieRawHashMap.h:143
friend class OnDiskTrieRawHashMap
Definition OnDiskTrieRawHashMap.h:156
uint16_t OffsetHigh16
Definition OnDiskTrieRawHashMap.h:129
const ProxyT * operator->() const
Definition OnDiskTrieRawHashMap.h:112
FileOffset getOffset() const
Definition OnDiskTrieRawHashMap.h:102
uint32_t OffsetLow32
Definition OnDiskTrieRawHashMap.h:128
const ProxyT & operator*() const
Definition OnDiskTrieRawHashMap.h:108
ProxyT Value
Definition OnDiskTrieRawHashMap.h:127
bool IsValue
Definition OnDiskTrieRawHashMap.h:133
PointerImpl(ProxyT Value, FileOffset Offset, bool IsValue=true)
Definition OnDiskTrieRawHashMap.h:120
Expected< OnDiskPtr > insert(const ConstValueProxy &Value)
Definition OnDiskTrieRawHashMap.h:195
LLVM_ABI_FOR_TEST OnDiskTrieRawHashMap(OnDiskTrieRawHashMap &&RHS)
function_ref< void(FileOffset TentativeOffset, ValueProxy TentativeValue)> LazyInsertOnConstructCB
Definition OnDiskTrieRawHashMap.h:170
LLVM_ABI_FOR_TEST Error validate(function_ref< Error(FileOffset, ConstValueProxy)> RecordVerifier) const
Validate the trie data structure.
static LLVM_ABI_FOR_TEST Expected< OnDiskTrieRawHashMap > create(const Twine &Path, const Twine &TrieName, size_t NumHashBits, uint64_t DataSize, uint64_t MaxFileSize, std::optional< uint64_t > NewFileInitialSize, std::optional< size_t > NewTableNumRootBits=std::nullopt, std::optional< size_t > NewTableNumSubtrieBits=std::nullopt)
Gets or creates a file at Path with a hash-mapped trie named TrieName.
LLVM_ABI_FOR_TEST ConstOnDiskPtr find(ArrayRef< uint8_t > Hash) const
Find the value from hash.
LLVM_DUMP_METHOD void dump() const
LLVM_ABI_FOR_TEST size_t size() const
static bool validOffset(FileOffset Offset)
Check the valid range of file offset for OnDiskTrieRawHashMap.
Definition OnDiskTrieRawHashMap.h:90
LLVM_ABI_FOR_TEST Expected< OnDiskPtr > insertLazy(ArrayRef< uint8_t > Hash, LazyInsertOnConstructCB OnConstruct=nullptr, LazyInsertOnLeakCB OnLeak=nullptr)
Insert lazily.
LLVM_ABI_FOR_TEST size_t capacity() const
LLVM_ABI_FOR_TEST Expected< ConstOnDiskPtr > recoverFromFileOffset(FileOffset Offset) const
Helper function to recover a pointer into the trie from file offset.
LLVM_ABI_FOR_TEST OnDiskTrieRawHashMap & operator=(OnDiskTrieRawHashMap &&RHS)
void print(raw_ostream &OS, function_ref< void(ArrayRef< char >)> PrintRecordData=nullptr) const
function_ref< void(FileOffset TentativeOffset, ValueProxy TentativeValue, FileOffset FinalOffset, ValueProxy FinalValue)> LazyInsertOnLeakCB
Definition OnDiskTrieRawHashMap.h:172
LLVM_ABI_FOR_TEST ~OnDiskTrieRawHashMap()
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr uintptr_t uintptr_t DataSize
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
Const value proxy to access the records stored in TrieRawHashMap.
Definition OnDiskTrieRawHashMap.h:60
ConstValueProxy(ArrayRef< uint8_t > Hash, StringRef Data)
Definition OnDiskTrieRawHashMap.h:64
ArrayRef< uint8_t > Hash
Definition OnDiskTrieRawHashMap.h:67
ArrayRef< char > Data
Definition OnDiskTrieRawHashMap.h:68
ConstValueProxy(ArrayRef< uint8_t > Hash, ArrayRef< char > Data)
Definition OnDiskTrieRawHashMap.h:62
ConstValueProxy()=default
Value proxy to access the records stored in TrieRawHashMap.
Definition OnDiskTrieRawHashMap.h:72
ArrayRef< uint8_t > Hash
Definition OnDiskTrieRawHashMap.h:79
ValueProxy(ArrayRef< uint8_t > Hash, MutableArrayRef< char > Data)
Definition OnDiskTrieRawHashMap.h:76
MutableArrayRef< char > Data
Definition OnDiskTrieRawHashMap.h:80