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/CodeGen/DwarfStringPoolEntry.h"
15 #include "llvm/Support/Allocator.h"
25 // Collection of strings for this unit and assorted symbols.
26 // A String->Symbol mapping of strings used by indirect
28 class DwarfStringPool {
29 typedef DwarfStringPoolEntry EntryTy;
30 StringMap<EntryTy, BumpPtrAllocator &> Pool;
32 unsigned NumBytes = 0;
33 bool ShouldCreateSymbols;
36 typedef DwarfStringPoolEntryRef EntryRef;
38 DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix);
40 void emit(AsmPrinter &Asm, MCSection *StrSection,
41 MCSection *OffsetSection = nullptr);
43 bool empty() const { return Pool.empty(); }
45 /// Get a reference to an entry in the string pool.
46 EntryRef getEntry(AsmPrinter &Asm, StringRef Str);