LLVM: lib/DWARFLinker/Parallel/TypePool.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_DWARFLINKER_PARALLEL_TYPEPOOL_H
10#define LLVM_DWARFLINKER_PARALLEL_TYPEPOOL_H
11
17#include
18
19namespace llvm {
22
26
28
29
31public:
32
40
41
43
44
51
52
53
54
55
56
57
58
59 std::atomic<DIE *> Die = {nullptr};
60
61
63
64
66
67
69
70protected:
76
79};
80
82public:
83
87
88
92
93
95 return KeyData.getKey();
96 }
97
98
104};
105
106
107
110 llvm::parallel::PerThreadBumpPtrAllocator,
111 TypeEntryInfo> {
112public:
120
127
128
129
130
135 return DIE;
136
138 if (Entry->getValue().compare_exchange_strong(DIE, NewDIE)) {
139 ParentEntry->getValue().load()->Children.add(Entry);
140 return NewDIE;
141 }
142
143 return DIE;
144 }
145
146
148 std::function<void(TypeEntry * Entry)> SortChildrenRec =
150 Entry->getValue().load()->Children.sort(TypesComparator);
151 Entry->getValue().load()->Children.forEach(SortChildrenRec);
152 };
153
154 SortChildrenRec(getRoot());
155 }
156
157
159
160
162 return Allocator.getThreadLocalAllocator();
163 }
164
165protected:
168 return LHS->getKey() < RHS->getKey();
169 };
170
171
173
174private:
176};
177
178}
179}
180}
181
182#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
This file defines the BumpPtrAllocator interface.
ConcurrentHashTableByPtr(llvm::parallel::PerThreadBumpPtrAllocator &Allocator, uint64_t EstimatedSize=100000, size_t ThreadsNum=parallel::strategy.compute_thread_count(), size_t InitialNumberOfBuckets=128)
A structured debug information entry.
const ValueTy & getValue() const
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
static StringMapEntry * create(StringRef key, AllocatorTy &allocator, InitTy &&...initVals)
StringRef - Represent a constant reference to a string, i.e.
This class is a simple list of T structures.
Stores all information related to a compile unit, be it in its original instance of the object file o...
Keeps cloned data for the type DIE.
Definition TypePool.h:30
ArrayList< TypeEntry *, 5 > Children
Children for current type.
Definition TypePool.h:68
DIE & getFinalDie() const
Returns copy of type DIE which should be emitted into resulting file.
Definition TypePool.h:33
TypeEntryBody(TypeEntryBody &&RHS)=delete
bool hasOnlyDeclaration() const
Returns true if type die entry has only declaration die.
Definition TypePool.h:42
TypeEntryBody(const TypeEntryBody &RHS)=delete
TypeEntryBody(llvm::parallel::PerThreadBumpPtrAllocator &Allocator)
Definition TypePool.h:77
TypeEntryBody & operator=(const TypeEntryBody &RHS)=delete
std::atomic< bool > ParentIsDeclaration
Definition TypePool.h:65
std::atomic< DIE * > DeclarationDie
Definition TypePool.h:62
std::atomic< DIE * > Die
TypeEntryBody keeps partially cloned DIEs corresponding to this type.
Definition TypePool.h:59
static TypeEntryBody * create(llvm::parallel::PerThreadBumpPtrAllocator &Allocator)
Creates type DIE for the specified name.
Definition TypePool.h:46
TypeEntryBody & operator=(const TypeEntryBody &&RHS)=delete
static bool isEqual(const StringRef &LHS, const StringRef &RHS)
Definition TypePool.h:89
static TypeEntry * create(const StringRef &Key, llvm::parallel::PerThreadBumpPtrAllocator &Allocator)
Definition TypePool.h:100
static uint64_t getHashValue(const StringRef &Key)
Definition TypePool.h:84
static StringRef getKey(const TypeEntry &KeyData)
Definition TypePool.h:94
TypePool keeps type descriptors which contain partially cloned DIE correspinding to each type.
Definition TypePool.h:111
BumpPtrAllocator & getThreadLocalAllocator()
Return thread local allocator used by pool.
Definition TypePool.h:161
TypeEntry * Root
Definition TypePool.h:172
TypeEntryBody * getOrCreateTypeEntryBody(TypeEntry *Entry, TypeEntry *ParentEntry)
Create or return existing type entry body for the specified Entry.
Definition TypePool.h:131
TypePool()
Definition TypePool.h:113
TypeEntry * insert(StringRef Name)
Definition TypePool.h:121
TypeEntry * getRoot() const
Return root for all type entries.
Definition TypePool.h:158
std::function< bool(const TypeEntry *LHS, const TypeEntry *RHS)> TypesComparator
Definition TypePool.h:167
void sortTypes()
Sort children for each kept type entry.
Definition TypePool.h:147
StringMapEntry< std::atomic< TypeEntryBody * > > TypeEntry
Definition TypePool.h:27
PerThreadAllocator< BumpPtrAllocator > PerThreadBumpPtrAllocator
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI uint64_t xxh3_64bits(ArrayRef< uint8_t > data)
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.