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/AsmPrinter.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 StringMap<std::pair<MCSymbol *, unsigned>, BumpPtrAllocator &> Pool;
33 DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix)
34 : Pool(A), Prefix(Prefix) {}
36 void emit(AsmPrinter &Asm, const MCSection *StrSection,
37 const MCSection *OffsetSection = nullptr);
39 /// \brief Returns an entry into the string pool with the given
41 MCSymbol *getSymbol(AsmPrinter &Asm, StringRef Str);
43 /// \brief Returns the index into the string pool with the given
45 unsigned getIndex(AsmPrinter &Asm, StringRef Str);
47 bool empty() const { return Pool.empty(); }