1 //===- llvm/CodeGen/DwarfStringPool.h - Dwarf Debug Framework ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
11 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
13 #include "llvm/ADT/StringMap.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/CodeGen/DwarfStringPoolEntry.h"
16 #include "llvm/Support/Allocator.h"
24 // Collection of strings for this unit and assorted symbols.
25 // A String->Symbol mapping of strings used by indirect
27 class DwarfStringPool {
28 using EntryTy = DwarfStringPoolEntry;
30 StringMap<EntryTy, BumpPtrAllocator &> Pool;
32 unsigned NumBytes = 0;
33 bool ShouldCreateSymbols;
36 using EntryRef = DwarfStringPoolEntryRef;
38 DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix);
40 void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection,
43 void emit(AsmPrinter &Asm, MCSection *StrSection,
44 MCSection *OffsetSection = nullptr,
45 bool UseRelativeOffsets = false);
47 bool empty() const { return Pool.empty(); }
49 unsigned size() const { return Pool.size(); }
51 /// Get a reference to an entry in the string pool.
52 EntryRef getEntry(AsmPrinter &Asm, StringRef Str);
55 } // end namespace llvm
57 #endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H