28 : RecordStorage(Storage) {
29 SeenRecords.reserve(4096);
60 return Index.toArrayIndex() < SeenRecords.size();
76 HashedRecords.clear();
82 uint8_t *Stable =
Alloc.Allocate<uint8_t>(
Data.size());
83 memcpy(Stable,
Data.data(),
Data.size());
92 assert(Data.size() == Record.size());
93 ::memcpy(Data.data(), Record.data(), Record.size());
102 assert(!Fragments.empty());
103 for (
auto C : Fragments)
110 assert(
Index.toArrayIndex() < SeenRecords.size() &&
111 "This function cannot be used to insert records!");
116 "The type record size is not a multiple of 4 bytes which will cause "
117 "misalignment in the output TPI stream!");
121 auto Result = HashedRecords.try_emplace(Hash,
Index.toArrayIndex());
122 if (!Result.second) {
123 Index = Result.first->second;
131 SeenHashes[
Index.toArrayIndex()] = Hash;
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.
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.
std::vector< CVType > end(TypeIndex Index)
StringRef getTypeName(TypeIndex Index) override
std::optional< TypeIndex > getNext(TypeIndex Prev) override
ArrayRef< ArrayRef< uint8_t > > records() const
uint32_t capacity() override
bool contains(TypeIndex Index) override
TypeIndex insertRecord(ContinuationRecordBuilder &Builder)
CVType getType(TypeIndex Index) override
TypeIndex insertRecordBytes(ArrayRef< uint8_t > Data)
TypeIndex insertRecordAs(GloballyHashedType Hash, size_t RecordSize, CreateFunc Create)
~GlobalTypeTableBuilder()
TypeIndex nextTypeIndex() const
GlobalTypeTableBuilder(BumpPtrAllocator &Storage)
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
ArrayRef< GloballyHashedType > hashes() const
std::optional< TypeIndex > getFirst() override
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.
This is an optimization pass for GlobalISel generic memory operations.
A globally hashed type represents a hash value that is sufficient to uniquely identify a record acros...
static 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.