47 return Strings.insert(S);
51 return Strings.getIdForString(S);
55 return Strings.getStringForId(Id);
74 static std::map<uint32_t, uint32_t> StringsToBuckets = {
115 {13453488, 26906975},
116 {20180232, 40360463},
117 {30270348, 60540695},
118 {45405522, 90811043},
119 {68108283, 136216565},
120 {102162424, 204324848},
121 {153243637, 306487273},
122 {229865455, 459730910},
123 {344798183, 689596366},
124 {517197275, 1034394550},
125 {775795913, 1551591826},
126 {1163693870, 2327387740}};
127 auto Entry = StringsToBuckets.lower_bound(NumStrings);
129 return Entry->second;
132 uint32_t PDBStringTableBuilder::calculateHashTableSize()
const {
142 Size += Strings.calculateSerializedSize();
143 Size += calculateHashTableSize();
150 this->Strings = Strings;
158 H.
ByteSize = Strings.calculateSerializedSize();
166 if (
auto EC = Strings.commit(Writer))
178 std::vector<ulittle32_t> Buckets(BucketCount);
180 for (
auto &Pair : Strings) {
187 if (Buckets[Slot] != 0)
212 if (
auto EC = writeHeader(SectionWriter))
215 std::tie(SectionWriter, Writer) =
216 Writer.
split(Strings.calculateSerializedSize());
217 if (
auto EC = writeStrings(SectionWriter))
220 std::tie(SectionWriter, Writer) = Writer.
split(calculateHashTableSize());
221 if (
auto EC = writeHashTable(SectionWriter))
224 std::tie(SectionWriter, Writer) = Writer.
split(
sizeof(
uint32_t));
225 if (
auto EC = writeEpilogue(SectionWriter))
Error writeObject(const T &Obj)
Writes the object Obj to the underlying stream, as if by using memcpy.
uint32_t lookupKeyToStorageKey(StringRef S)
StringRef getStringForId(uint32_t Id) const
uint32_t getIdForString(StringRef S) const
This class represents lattice values for constants.
Error commit(BinaryStreamWriter &Writer) const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Error writeArray(ArrayRef< T > Array)
Writes an array of objects of type T to the underlying stream, as if by using memcpy.
uint32_t hashLookupKey(StringRef S) const
uint32_t calculateSerializedSize() const
void setStrings(const codeview::DebugStringTableSubsection &Strings)
static uint32_t computeBucketCount(uint32_t NumStrings)
uint32_t hashStringV1(StringRef Str)
uint32_t insert(StringRef S)
Provides write only access to a subclass of WritableBinaryStream.
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
uint32_t bytesRemaining() const
static ErrorSuccess success()
Create a success value.
Represents a read-write view of a CodeView string table.
std::pair< BinaryStreamWriter, BinaryStreamWriter > split(uint32_t Off) const
Splits the Writer into two Writers at a given offset.
PDBStringTableBuilder * Table
Adapter to write values to a stream in a particular byte order.
const uint32_t PDBStringTableSignature
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef storageKeyToLookupKey(uint32_t Offset) const
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.