28 : RecordStorage(Storage) {
29 SeenRecords.reserve(4096);
48 CVType Type(SeenRecords[Index.toArrayIndex()]);
57 if (Index.isSimple() || Index.isNoneType())
60 return Index.toArrayIndex() < SeenRecords.size();
72 HashedRecords.clear();
79 memcpy(Stable,
Data.data(),
Data.size());
87 "The type record size is not a multiple of 4 bytes which will cause "
88 "misalignment in the output TPI stream!");
91 auto Result = HashedRecords.try_emplace(WeakHash,
nextTypeIndex());
95 Result.first->first.RecordData = RecordData;
96 SeenRecords.push_back(RecordData);
100 TypeIndex ActualTI = Result.first->second;
114 assert(!Fragments.empty());
115 for (
auto C : Fragments)
122 assert(Index.toArrayIndex() < SeenRecords.size() &&
123 "This function cannot be used to insert records!");
128 "The type record size is not a multiple of 4 bytes which will cause "
129 "misalignment in the output TPI stream!");
132 auto Result = HashedRecords.try_emplace(WeakHash, Index.toArrayIndex());
133 if (!Result.second) {
134 Index = Result.first->second;
140 Result.first->first.RecordData =
Record;
143 SeenRecords[Index.toArrayIndex()] =
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.