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 {

20namespace dwarf_linker {

21namespace parallel {

22

23class TypePool;

24class CompileUnit;

25class TypeEntryBody;

26

28

29

31public:

32

35 return *Die;

36

39 }

40

41

43

44

49 return Result;

50 }

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

86 }

87

88

91 }

92

93

95 return KeyData.getKey();

96 }

97

98

103 }

104};

105

106

107

110 llvm::parallel::PerThreadBumpPtrAllocator,

111 TypeEntryInfo> {

112public:

115 llvm::parallel::PerThreadBumpPtrAllocator,

119 }

120

126 }

127

128

129

130

135 return DIE;

136

138 if (Entry->getValue().compare_exchange_weak(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

This file defines the StringMap class.

This file defines the BumpPtrAllocator interface.

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

Allocate memory in an ever growing pool, as if by bump-pointer.

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)

Create a StringMapEntry for the specified key construct the value using InitiVals.

StringRef - Represent a constant reference to a string, i.e.

This class is a simple list of T structures.

Keeps cloned data for the type DIE.

ArrayList< TypeEntry *, 5 > Children

Children for current type.

DIE & getFinalDie() const

Returns copy of type DIE which should be emitted into resulting file.

TypeEntryBody(TypeEntryBody &&RHS)=delete

bool hasOnlyDeclaration() const

Returns true if type die entry has only declaration die.

TypeEntryBody(const TypeEntryBody &RHS)=delete

TypeEntryBody(llvm::parallel::PerThreadBumpPtrAllocator &Allocator)

TypeEntryBody & operator=(const TypeEntryBody &RHS)=delete

std::atomic< bool > ParentIsDeclaration

std::atomic< DIE * > DeclarationDie

std::atomic< DIE * > Die

TypeEntryBody keeps partially cloned DIEs corresponding to this type.

static TypeEntryBody * create(llvm::parallel::PerThreadBumpPtrAllocator &Allocator)

Creates type DIE for the specified name.

TypeEntryBody & operator=(const TypeEntryBody &&RHS)=delete

static bool isEqual(const StringRef &LHS, const StringRef &RHS)

static TypeEntry * create(const StringRef &Key, llvm::parallel::PerThreadBumpPtrAllocator &Allocator)

static uint64_t getHashValue(const StringRef &Key)

static StringRef getKey(const TypeEntry &KeyData)

TypePool keeps type descriptors which contain partially cloned DIE correspinding to each type.

BumpPtrAllocator & getThreadLocalAllocator()

Return thread local allocator used by pool.

TypeEntryBody * getOrCreateTypeEntryBody(TypeEntry *Entry, TypeEntry *ParentEntry)

Create or return existing type entry body for the specified Entry.

TypeEntry * insert(StringRef Name)

TypeEntry * getRoot() const

Return root for all type entries.

std::function< bool(const TypeEntry *LHS, const TypeEntry *RHS)> TypesComparator

void sortTypes()

Sort children for each kept type entry.

StringMapEntry< std::atomic< TypeEntryBody * > > TypeEntry

PerThreadAllocator< BumpPtrAllocator > PerThreadBumpPtrAllocator

This is an optimization pass for GlobalISel generic memory operations.

uint64_t xxh3_64bits(ArrayRef< uint8_t > data)