LLVM  14.0.0git
DwarfStringPool.h
Go to the documentation of this file.
1 //===- llvm/CodeGen/DwarfStringPool.h - Dwarf Debug Framework ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
10 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
11 
12 #include "llvm/ADT/StringMap.h"
13 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Support/Allocator.h"
16 
17 namespace llvm {
18 
19 class AsmPrinter;
20 class MCSection;
21 class MCSymbol;
22 
23 // Collection of strings for this unit and assorted symbols.
24 // A String->Symbol mapping of strings used by indirect
25 // references.
28 
30  StringRef Prefix;
31  uint64_t NumBytes = 0;
32  unsigned NumIndexedStrings = 0;
33  bool ShouldCreateSymbols;
34 
35  StringMapEntry<EntryTy> &getEntryImpl(AsmPrinter &Asm, StringRef Str);
36 
37 public:
39 
41 
43  MCSymbol *StartSym);
44 
45  void emit(AsmPrinter &Asm, MCSection *StrSection,
46  MCSection *OffsetSection = nullptr,
47  bool UseRelativeOffsets = false);
48 
49  bool empty() const { return Pool.empty(); }
50 
51  unsigned size() const { return Pool.size(); }
52 
53  unsigned getNumIndexedStrings() const { return NumIndexedStrings; }
54 
55  /// Get a reference to an entry in the string pool.
57 
58  /// Same as getEntry, except that you can use EntryRef::getIndex to obtain a
59  /// unique ID of this entry (e.g., for use in indexed forms like
60  /// DW_FORM_strx).
62 };
63 
64 } // end namespace llvm
65 
66 #endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
llvm::DwarfStringPool::getEntry
EntryRef getEntry(AsmPrinter &Asm, StringRef Str)
Get a reference to an entry in the string pool.
Definition: DwarfStringPool.cpp:39
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::StringMapEntry
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Definition: StringMapEntry.h:98
StringRef.h
Allocator.h
llvm::DwarfStringPool::EntryRef
DwarfStringPoolEntryRef EntryRef
Definition: DwarfStringPool.h:38
llvm::DwarfStringPool::getIndexedEntry
EntryRef getIndexedEntry(AsmPrinter &Asm, StringRef Str)
Same as getEntry, except that you can use EntryRef::getIndex to obtain a unique ID of this entry (e....
Definition: DwarfStringPool.cpp:45
llvm::DwarfStringPoolEntryRef
String pool entry reference.
Definition: DwarfStringPoolEntry.h:31
llvm::DwarfStringPool
Definition: DwarfStringPool.h:26
DwarfStringPoolEntry.h
llvm::DwarfStringPool::size
unsigned size() const
Definition: DwarfStringPool.h:51
StringMap.h
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::DwarfStringPool::emitStringOffsetsTableHeader
void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection, MCSymbol *StartSym)
Definition: DwarfStringPool.cpp:53
llvm::DwarfStringPoolEntry
Data for a string pool entry.
Definition: DwarfStringPoolEntry.h:20
uint64_t
llvm::DwarfStringPool::empty
bool empty() const
Definition: DwarfStringPool.h:49
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
llvm::DwarfStringPool::getNumIndexedStrings
unsigned getNumIndexedStrings() const
Definition: DwarfStringPool.h:53
llvm::StringMapImpl::size
unsigned size() const
Definition: StringMap.h:93
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::DwarfStringPool::emit
void emit(AsmPrinter &Asm, MCSection *StrSection, MCSection *OffsetSection=nullptr, bool UseRelativeOffsets=false)
Definition: DwarfStringPool.cpp:75
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
llvm::DwarfStringPool::DwarfStringPool
DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix)
Definition: DwarfStringPool.cpp:20
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:82
llvm::StringMapImpl::empty
bool empty() const
Definition: StringMap.h:92
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:172