29 : RecordStorage(Storage) {
30 SeenRecords.reserve(4096);
61 return Index.toArrayIndex() < SeenRecords.size();
73 HashedRecords.clear();
79 uint8_t *Stable =
Alloc.Allocate<uint8_t>(
Data.size());
80 memcpy(Stable,
Data.data(),
Data.size());
88 "The type record size is not a multiple of 4 bytes which will cause "
89 "misalignment in the output TPI stream!");
92 auto Result = HashedRecords.try_emplace(WeakHash,
nextTypeIndex());
96 Result.first->first.RecordData = RecordData;
97 SeenRecords.push_back(RecordData);
101 TypeIndex ActualTI = Result.first->second;
115 assert(!Fragments.empty());
116 for (
auto C : Fragments)
123 assert(
Index.toArrayIndex() < SeenRecords.size() &&
124 "This function cannot be used to insert records!");
129 "The type record size is not a multiple of 4 bytes which will cause "
130 "misalignment in the output TPI stream!");
133 auto Result = HashedRecords.try_emplace(WeakHash,
Index.toArrayIndex());
134 if (!Result.second) {
135 Index = Result.first->second;
141 Result.first->first.RecordData =
Record;
This file defines the BumpPtrAllocator interface.
static ArrayRef< uint8_t > stabilize(BumpPtrAllocator &RecordStorage, ArrayRef< uint8_t > Record)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Allocate memory in an ever growing pool, as if by bump-pointer.
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.
std::vector< CVType > end(TypeIndex Index)
CVType getType(TypeIndex Index) override
ArrayRef< ArrayRef< uint8_t > > records() const
std::optional< TypeIndex > getFirst() override
MergingTypeTableBuilder(BumpPtrAllocator &Storage)
TypeIndex nextTypeIndex() const
bool contains(TypeIndex Index) override
std::optional< TypeIndex > getNext(TypeIndex Prev) override
StringRef getTypeName(TypeIndex Index) override
TypeIndex insertRecordAs(hash_code Hash, ArrayRef< uint8_t > &Record)
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
~MergingTypeTableBuilder()
TypeIndex insertRecord(ContinuationRecordBuilder &Builder)
uint32_t capacity() override
TypeIndex insertRecordBytes(ArrayRef< uint8_t > &Record)
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.
This is an optimization pass for GlobalISel generic memory operations.
hash_code hash_value(const FixedPointSemantics &Val)
A locally hashed type represents a straightforward hash code of a serialized record.