LLVM: lib/DebugInfo/CodeView/GlobalTypeTableBuilder.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
15#include
16#include
17#include
18
19using namespace llvm;
21
25
27 : RecordStorage(Storage) {
28 SeenRecords.reserve(4096);
29}
30
32
35 return std::nullopt;
36
38}
39
42 return std::nullopt;
43 return Prev;
44}
45
47 CVType Type(SeenRecords[Index.toArrayIndex()]);
49}
50
54
56 if (Index.isSimple() || Index.isNoneType())
57 return false;
58
59 return Index.toArrayIndex() < SeenRecords.size();
60}
61
63
65
67 return SeenRecords;
68}
69
71 return SeenHashes;
72}
73
75 HashedRecords.clear();
76 SeenRecords.clear();
77}
78
82 memcpy(Stable, Data.data(), Data.size());
84}
85
91 assert(Data.size() == Record.size());
92 ::memcpy(Data.data(), Record.data(), Record.size());
93 return Data;
94 });
95}
96
101 assert(!Fragments.empty());
102 for (auto C : Fragments)
104 return TI;
105}
106
108 bool Stabilize) {
109 assert(Index.toArrayIndex() < SeenRecords.size() &&
110 "This function cannot be used to insert records!");
111
113 assert(Record.size() < UINT32_MAX && "Record too big");
115 "The type record size is not a multiple of 4 bytes which will cause "
116 "misalignment in the output TPI stream!");
117
120 auto Result = HashedRecords.try_emplace(Hash, Index.toArrayIndex());
121 if (!Result.second) {
122 Index = Result.first->second;
123 return false;
124 }
125
126 if (Stabilize)
128
129 SeenRecords[Index.toArrayIndex()] = Record;
130 SeenHashes[Index.toArrayIndex()] = Hash;
131 return true;
132}
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),...
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.
The instances of the Type class are immutable: once they are created, they are never changed.
StringRef getTypeName(TypeIndex Index) override
Definition GlobalTypeTableBuilder.cpp:51
~GlobalTypeTableBuilder() override
void reset()
Definition GlobalTypeTableBuilder.cpp:74
std::optional< TypeIndex > getNext(TypeIndex Prev) override
Definition GlobalTypeTableBuilder.cpp:40
uint32_t size() override
Definition GlobalTypeTableBuilder.cpp:62
ArrayRef< ArrayRef< uint8_t > > records() const
Definition GlobalTypeTableBuilder.cpp:66
uint32_t capacity() override
Definition GlobalTypeTableBuilder.cpp:64
bool contains(TypeIndex Index) override
Definition GlobalTypeTableBuilder.cpp:55
TypeIndex insertRecord(ContinuationRecordBuilder &Builder)
Definition GlobalTypeTableBuilder.cpp:98
CVType getType(TypeIndex Index) override
Definition GlobalTypeTableBuilder.cpp:46
TypeIndex insertRecordBytes(ArrayRef< uint8_t > Data)
Definition GlobalTypeTableBuilder.cpp:86
TypeIndex insertRecordAs(GloballyHashedType Hash, size_t RecordSize, CreateFunc Create)
TypeIndex nextTypeIndex() const
Definition GlobalTypeTableBuilder.cpp:22
GlobalTypeTableBuilder(BumpPtrAllocator &Storage)
Definition GlobalTypeTableBuilder.cpp:26
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
Definition GlobalTypeTableBuilder.cpp:107
ArrayRef< GloballyHashedType > hashes() const
Definition GlobalTypeTableBuilder.cpp:70
std::optional< TypeIndex > getFirst() override
Definition GlobalTypeTableBuilder.cpp:33
static TypeIndex fromArrayIndex(uint32_t Index)
static const uint32_t FirstNonSimpleIndex
#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.
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 globally hashed type represents a hash value that is sufficient to uniquely identify a record acros...
static LLVM_ABI GloballyHashedType hashType(ArrayRef< uint8_t > RecordData, ArrayRef< GloballyHashedType > PreviousTypes, ArrayRef< GloballyHashedType > PreviousIds)
Given a sequence of bytes representing a record, compute a global hash for this record.