LLVM 22.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"
17
18namespace llvm {
19
20class AsmPrinter;
21class MCSection;
22class MCSymbol;
23
24// Collection of strings for this unit and assorted symbols.
25// A String->Symbol mapping of strings used by indirect
26// references.
29
31 StringRef Prefix;
32 uint64_t NumBytes = 0;
33 unsigned NumIndexedStrings = 0;
34 bool ShouldCreateSymbols;
35
36 StringMapEntry<EntryTy> &getEntryImpl(AsmPrinter &Asm, StringRef Str);
37
38public:
40
42 StringRef Prefix);
43
45 MCSection *OffsetSection,
46 MCSymbol *StartSym);
47
48 LLVM_ABI_FOR_TEST void emit(AsmPrinter &Asm, MCSection *StrSection,
49 MCSection *OffsetSection = nullptr,
50 bool UseRelativeOffsets = false);
51
52 bool empty() const { return Pool.empty(); }
53
54 unsigned size() const { return Pool.size(); }
55
56 unsigned getNumIndexedStrings() const { return NumIndexedStrings; }
57
58 /// Get a reference to an entry in the string pool.
60
61 /// Same as getEntry, except that you can use EntryRef::getIndex to obtain a
62 /// unique ID of this entry (e.g., for use in indexed forms like
63 /// DW_FORM_strx).
65};
66
67} // end namespace llvm
68
69#endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFSTRINGPOOL_H
This file defines the StringMap class.
This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_ABI_FOR_TEST
Definition: Compiler.h:218
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:90
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
DwarfStringPoolEntryRef: Dwarf string pool entry reference.
LLVM_ABI_FOR_TEST EntryRef getEntry(AsmPrinter &Asm, StringRef Str)
Get a reference to an entry in the string pool.
LLVM_ABI_FOR_TEST 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....
DwarfStringPoolEntryRef EntryRef
unsigned getNumIndexedStrings() const
LLVM_ABI_FOR_TEST void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection, MCSymbol *StartSym)
unsigned size() const
LLVM_ABI_FOR_TEST void emit(AsmPrinter &Asm, MCSection *StrSection, MCSection *OffsetSection=nullptr, bool UseRelativeOffsets=false)
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:496
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
unsigned size() const
Definition: StringMap.h:109
bool empty() const
Definition: StringMap.h:108
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:133
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Data for a string pool entry.