27 : RecordStorage(Storage) {
28 SeenRecords.reserve(4096);
47 CVType Type(SeenRecords[Index.toArrayIndex()]);
56 if (Index.isSimple() || Index.isNoneType())
59 return Index.toArrayIndex() < SeenRecords.size();
75 HashedRecords.clear();
82 memcpy(Stable,
Data.data(),
Data.size());
91 assert(Data.size() == Record.size());
92 ::memcpy(Data.data(), Record.data(), Record.size());
101 assert(!Fragments.empty());
102 for (
auto C : Fragments)
109 assert(Index.toArrayIndex() < SeenRecords.size() &&
110 "This function cannot be used to insert records!");
115 "The type record size is not a multiple of 4 bytes which will cause "
116 "misalignment in the output TPI stream!");
120 auto Result = HashedRecords.try_emplace(Hash, Index.toArrayIndex());
121 if (!Result.second) {
122 Index = Result.first->second;
129 SeenRecords[Index.toArrayIndex()] =
Record;
130 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.