DwarfStringPool.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //===-- llvm/CodeGen/DwarfStringPool.h - Dwarf Debug Framework -*- C++ -*--===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
  10. #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
  11. #include "llvm/ADT/StringMap.h"
  12. #include "llvm/CodeGen/DwarfStringPoolEntry.h"
  13. #include "llvm/Support/Allocator.h"
  14. #include <utility>
  15. namespace llvm {
  16. class AsmPrinter;
  17. class MCSymbol;
  18. class MCSection;
  19. class StringRef;
  20. // Collection of strings for this unit and assorted symbols.
  21. // A String->Symbol mapping of strings used by indirect
  22. // references.
  23. class DwarfStringPool {
  24. typedef DwarfStringPoolEntry EntryTy;
  25. StringMap<EntryTy, BumpPtrAllocator &> Pool;
  26. StringRef Prefix;
  27. unsigned NumBytes = 0;
  28. bool ShouldCreateSymbols;
  29. public:
  30. typedef DwarfStringPoolEntryRef EntryRef;
  31. DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix);
  32. void emit(AsmPrinter &Asm, MCSection *StrSection,
  33. MCSection *OffsetSection = nullptr);
  34. bool empty() const { return Pool.empty(); }
  35. /// Get a reference to an entry in the string pool.
  36. EntryRef getEntry(AsmPrinter &Asm, StringRef Str);
  37. };
  38. }
  39. #endif