13 #ifndef LLVM_EXECUTIONENGINE_ORC_SYMBOLSTRINGPOOL_H 14 #define LLVM_EXECUTIONENGINE_ORC_SYMBOLSTRINGPOOL_H 24 class SymbolStringPtr;
42 using RefCountType = std::atomic<size_t>;
45 mutable std::mutex PoolMutex;
58 if (isRealPoolEntry(S))
63 if (isRealPoolEntry(S))
66 if (isRealPoolEntry(S))
76 if (isRealPoolEntry(S))
84 if (isRealPoolEntry(S))
92 return LHS.S == RHS.S;
102 return LHS.S < RHS.S;
110 if (isRealPoolEntry(S))
116 return ((reinterpret_cast<uintptr_t>(P) - 1) & InvalidPtrMask) !=
121 return SymbolStringPtr(reinterpret_cast<PoolEntryPtr>(EmptyBitPattern));
125 return SymbolStringPtr(reinterpret_cast<PoolEntryPtr>(TombstoneBitPattern));
128 constexpr
static uintptr_t EmptyBitPattern =
132 constexpr
static uintptr_t TombstoneBitPattern =
136 constexpr
static uintptr_t InvalidPtrMask =
146 assert(Pool.empty() &&
"Dangling references at pool destruction time");
151 std::lock_guard<std::mutex>
Lock(PoolMutex);
154 std::tie(I, Added) = Pool.try_emplace(S, 0);
159 std::lock_guard<std::mutex>
Lock(PoolMutex);
160 for (
auto I = Pool.begin(),
E = Pool.end();
I !=
E;) {
162 if (Tmp->second == 0)
168 std::lock_guard<std::mutex>
Lock(PoolMutex);
178 return orc::SymbolStringPtr::getEmptyVal();
182 return orc::SymbolStringPtr::getTombstoneVal();
191 return LHS.S == RHS.S;
197 #endif // LLVM_EXECUTIONENGINE_ORC_SYMBOLSTRINGPOOL_H void clearDeadEntries()
Remove from the pool any entries that are no longer referenced.
This class represents lattice values for constants.
String pool for symbol names used by the JIT.
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Optional< std::vector< StOtherPiece > > Other
static orc::SymbolStringPtr getEmptyKey()
~SymbolStringPool()
Destroy a SymbolStringPool.
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
static unsigned getHashValue(const orc::SymbolStringPtr &V)
Pointer to a pooled string representing a symbol name.
SymbolStringPtr intern(StringRef S)
Create a symbol string pointer from the given string.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
SymbolStringPtr(SymbolStringPtr &&Other)
friend class SymbolStringPtr
SymbolStringPtr & operator=(SymbolStringPtr &&Other)
Align max(MaybeAlign Lhs, Align Rhs)
StringRef operator*() const
static orc::SymbolStringPtr getTombstoneKey()
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static bool isEqual(const orc::SymbolStringPtr &LHS, const orc::SymbolStringPtr &RHS)
SymbolStringPtr & operator=(const SymbolStringPtr &Other)
friend bool operator<(const SymbolStringPtr &LHS, const SymbolStringPtr &RHS)
SymbolStringPtr(const SymbolStringPtr &Other)
friend bool operator!=(const SymbolStringPtr &LHS, const SymbolStringPtr &RHS)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool empty() const
Returns true if the pool is empty.
friend bool operator==(const SymbolStringPtr &LHS, const SymbolStringPtr &RHS)
const ValueTy & getValue() const
StringRef - Represent a constant reference to a string, i.e.