]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/blob - lib/CodeGen/AsmPrinter/DwarfStringPool.h
Updates to sync with changes in upstream.
[opencl/llvm.git] / lib / CodeGen / AsmPrinter / DwarfStringPool.h
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 //===----------------------------------------------------------------------===//
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"
16 #include <utility>
18 namespace llvm {
20 class MCSymbol;
21 class MCSection;
22 class StringRef;
24 // Collection of strings for this unit and assorted symbols.
25 // A String->Symbol mapping of strings used by indirect
26 // references.
27 class DwarfStringPool {
28   StringMap<std::pair<MCSymbol *, unsigned>, BumpPtrAllocator &> Pool;
29   StringRef Prefix;
31 public:
32   DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix)
33       : Pool(A), Prefix(Prefix) {}
35   void emit(AsmPrinter &Asm, const MCSection *StrSection,
36             const MCSection *OffsetSection = nullptr);
38   /// \brief Returns an entry into the string pool with the given
39   /// string text.
40   MCSymbol *getSymbol(AsmPrinter &Asm, StringRef Str);
42   /// \brief Returns the index into the string pool with the given
43   /// string text.
44   unsigned getIndex(AsmPrinter &Asm, StringRef Str);
46   bool empty() const { return Pool.empty(); }
47 };
48 }
49 #endif