LLVM: lib/DebugInfo/CodeView/MergingTypeTableBuilder.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
16#include
17#include
18#include
19
20using namespace llvm;
22
26
28 : RecordStorage(Storage) {
29 SeenRecords.reserve(4096);
30}
31
33
36 return std::nullopt;
37
39}
40
43 return std::nullopt;
44 return Prev;
45}
46
48 CVType Type(SeenRecords[Index.toArrayIndex()]);
50}
51
55
57 if (Index.isSimple() || Index.isNoneType())
58 return false;
59
60 return Index.toArrayIndex() < SeenRecords.size();
61}
62
64
66
68 return SeenRecords;
69}
70
72 HashedRecords.clear();
73 SeenRecords.clear();
74}
75
79 memcpy(Stable, Data.data(), Data.size());
81}
82
85 assert(Record.size() < UINT32_MAX && "Record too big");
87 "The type record size is not a multiple of 4 bytes which will cause "
88 "misalignment in the output TPI stream!");
89
91 auto Result = HashedRecords.try_emplace(WeakHash, nextTypeIndex());
92
93 if (Result.second) {
95 Result.first->first.RecordData = RecordData;
96 SeenRecords.push_back(RecordData);
97 }
98
99
100 TypeIndex ActualTI = Result.first->second;
102 return ActualTI;
103}
104
109
114 assert(!Fragments.empty());
115 for (auto C : Fragments)
117 return TI;
118}
119
121 bool Stabilize) {
122 assert(Index.toArrayIndex() < SeenRecords.size() &&
123 "This function cannot be used to insert records!");
124
126 assert(Record.size() < UINT32_MAX && "Record too big");
128 "The type record size is not a multiple of 4 bytes which will cause "
129 "misalignment in the output TPI stream!");
130
132 auto Result = HashedRecords.try_emplace(WeakHash, Index.toArrayIndex());
133 if (!Result.second) {
134 Index = Result.first->second;
135 return false;
136 }
137
138 if (Stabilize) {
140 Result.first->first.RecordData = Record;
141 }
142
143 SeenRecords[Index.toArrayIndex()] = Record;
144 return true;
145}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Prepare AGPR Alloc
This file defines the BumpPtrAllocator interface.
static ArrayRef< uint8_t > stabilize(BumpPtrAllocator &RecordStorage, ArrayRef< uint8_t > Record)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
CVType getType(TypeIndex Index) override
Definition MergingTypeTableBuilder.cpp:47
ArrayRef< ArrayRef< uint8_t > > records() const
Definition MergingTypeTableBuilder.cpp:67
std::optional< TypeIndex > getFirst() override
Definition MergingTypeTableBuilder.cpp:34
MergingTypeTableBuilder(BumpPtrAllocator &Storage)
Definition MergingTypeTableBuilder.cpp:27
TypeIndex nextTypeIndex() const
Definition MergingTypeTableBuilder.cpp:23
bool contains(TypeIndex Index) override
Definition MergingTypeTableBuilder.cpp:56
std::optional< TypeIndex > getNext(TypeIndex Prev) override
Definition MergingTypeTableBuilder.cpp:41
StringRef getTypeName(TypeIndex Index) override
Definition MergingTypeTableBuilder.cpp:52
void reset()
Definition MergingTypeTableBuilder.cpp:71
uint32_t size() override
Definition MergingTypeTableBuilder.cpp:63
TypeIndex insertRecordAs(hash_code Hash, ArrayRef< uint8_t > &Record)
Definition MergingTypeTableBuilder.cpp:83
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
Definition MergingTypeTableBuilder.cpp:120
TypeIndex insertRecord(ContinuationRecordBuilder &Builder)
Definition MergingTypeTableBuilder.cpp:111
uint32_t capacity() override
Definition MergingTypeTableBuilder.cpp:65
~MergingTypeTableBuilder() override
TypeIndex insertRecordBytes(ArrayRef< uint8_t > &Record)
Definition MergingTypeTableBuilder.cpp:106
static TypeIndex fromArrayIndex(uint32_t Index)
uint32_t toArrayIndex() const
static const uint32_t FirstNonSimpleIndex
An opaque object representing a hash code.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
CVRecord< TypeLeafKind > CVType
This is an optimization pass for GlobalISel generic memory operations.
hash_code hash_value(const FixedPointSemantics &Val)
FunctionAddr VTableAddr uintptr_t uintptr_t Data
ArrayRef(const T &OneElt) -> ArrayRef< T >
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
A locally hashed type represents a straightforward hash code of a serialized record.