diff options
Diffstat (limited to 'include/llvm/MC/StringTableBuilder.h')
-rw-r--r-- | include/llvm/MC/StringTableBuilder.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/include/llvm/MC/StringTableBuilder.h b/include/llvm/MC/StringTableBuilder.h index adde86b455830..f2b8ecd2d9978 100644 --- a/include/llvm/MC/StringTableBuilder.h +++ b/include/llvm/MC/StringTableBuilder.h @@ -23,12 +23,15 @@ public: private: SmallString<256> StringTable; - DenseMap<StringRef, size_t> StringIndexMap; + DenseMap<CachedHash<StringRef>, size_t> StringIndexMap; size_t Size = 0; Kind K; + unsigned Alignment; + + void finalizeStringTable(bool Optimize); public: - StringTableBuilder(Kind K); + StringTableBuilder(Kind K, unsigned Alignment = 1); /// \brief Add a string to the builder. Returns the position of S in the /// table. The position will be changed if finalize is used. @@ -39,6 +42,10 @@ public: /// be added after this point. void finalize(); + /// Finalize the string table without reording it. In this mode, offsets + /// returned by add will still be valid. + void finalizeInOrder(); + /// \brief Retrieve the string table data. Can only be used after the table /// is finalized. StringRef data() const { @@ -50,7 +57,10 @@ public: /// after the table is finalized. size_t getOffset(StringRef S) const; - const DenseMap<StringRef, size_t> &getMap() const { return StringIndexMap; } + const DenseMap<CachedHash<StringRef>, size_t> &getMap() const { + return StringIndexMap; + } + size_t getSize() const { return Size; } void clear(); |