[PATCH] D87025: [DebugInfo] Make the offset of string pool entries 64-bit (18/19).

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 06:23:11 PDT 2020


ikudrin created this revision.
ikudrin added reviewers: dblaikie, jhenderson, probinson, aprantl.
ikudrin added projects: LLVM, debug-info.
Herald added subscribers: dexonsmith, hiraditya.
ikudrin requested review of this revision.

The string pool is shared among several units in the case of LTO, and it potentially can exceed the limit of 4GiB for an extremely large application. As it is now possible to emit 64-bit debugging info, the limitation can be removed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87025

Files:
  llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
  llvm/include/llvm/CodeGen/NonRelocatableStringpool.h
  llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h


Index: llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
+++ llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
@@ -28,7 +28,7 @@
 
   StringMap<EntryTy, BumpPtrAllocator &> Pool;
   StringRef Prefix;
-  unsigned NumBytes = 0;
+  uint64_t NumBytes = 0;
   unsigned NumIndexedStrings = 0;
   bool ShouldCreateSymbols;
 
Index: llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
@@ -33,7 +33,6 @@
     Entry.Symbol = ShouldCreateSymbols ? Asm.createTempSymbol(Prefix) : nullptr;
 
     NumBytes += Str.size() + 1;
-    assert(NumBytes > Entry.Offset && "Unexpected overflow");
   }
   return *I.first;
 }
Index: llvm/include/llvm/CodeGen/NonRelocatableStringpool.h
===================================================================
--- llvm/include/llvm/CodeGen/NonRelocatableStringpool.h
+++ llvm/include/llvm/CodeGen/NonRelocatableStringpool.h
@@ -39,7 +39,7 @@
 
   /// Get the offset of string \p S in the string table. This can insert a new
   /// element or return the offset of a pre-existing one.
-  uint32_t getStringOffset(StringRef S) { return getEntry(S).getOffset(); }
+  uint64_t getStringOffset(StringRef S) { return getEntry(S).getOffset(); }
 
   /// Get permanent storage for \p S (but do not necessarily emit \p S in the
   /// output section). A latter call to getStringOffset() with the same string
@@ -57,7 +57,7 @@
 
 private:
   MapTy Strings;
-  uint32_t CurrentEndOffset = 0;
+  uint64_t CurrentEndOffset = 0;
   unsigned NumEntries = 0;
   DwarfStringPoolEntryRef EmptyString;
   std::function<StringRef(StringRef Input)> Translator;
Index: llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
===================================================================
--- llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
+++ llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
@@ -21,7 +21,7 @@
   static constexpr unsigned NotIndexed = -1;
 
   MCSymbol *Symbol;
-  unsigned Offset;
+  uint64_t Offset;
   unsigned Index;
 
   bool isIndexed() const { return Index != NotIndexed; }
@@ -47,7 +47,7 @@
     assert(getMapEntry()->second.Symbol && "No symbol available!");
     return getMapEntry()->second.Symbol;
   }
-  unsigned getOffset() const { return getMapEntry()->second.Offset; }
+  uint64_t getOffset() const { return getMapEntry()->second.Offset; }
   bool isIndexed() const { return MapEntryAndIndexed.getInt(); }
   unsigned getIndex() const {
     assert(isIndexed());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87025.289430.patch
Type: text/x-patch
Size: 2673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200902/14f2b866/attachment.bin>


More information about the llvm-commits mailing list