23 : Pool(A), Prefix(Prefix),
24 ShouldCreateSymbols(Asm.MAI->doesDwarfUseRelocationsAcrossSections()) {}
28 auto I = Pool.insert(std::make_pair(Str,
EntryTy()));
29 auto &
Entry =
I.first->second;
32 Entry.Offset = NumBytes;
35 NumBytes += Str.
size() + 1;
36 assert(NumBytes >
Entry.Offset &&
"Unexpected overflow");
43 auto &MapEntry = getEntryImpl(Asm, Str);
49 auto &MapEntry = getEntryImpl(Asm, Str);
50 if (!MapEntry.getValue().isIndexed())
51 MapEntry.getValue().Index = NumIndexedStrings++;
61 unsigned EntrySize = 4;
78 MCSection *OffsetSection,
bool UseRelativeOffsets) {
89 for (
const auto &
E : Pool)
97 for (
const auto &
Entry : Entries) {
98 assert(ShouldCreateSymbols == static_cast<bool>(
Entry->getValue().Symbol) &&
99 "Mismatch between setting and entry");
102 if (ShouldCreateSymbols)
116 Entries.resize(NumIndexedStrings);
117 for (
const auto &
Entry : Pool) {
118 if (
Entry.getValue().isIndexed())
124 for (
const auto &
Entry : Entries)
125 if (UseRelativeOffsets)
Instances of this class represent a uniqued identifier for a section in the current translation unit...
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
This class represents lattice values for constants.
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
unsigned getNumIndexedStrings() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void push_back(const T &Elt)
uint16_t getDwarfVersion() const
void reserve(size_type N)
void emit(AsmPrinter &Asm, MCSection *StrSection, MCSection *OffsetSection=nullptr, bool UseRelativeOffsets=false)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static constexpr unsigned NotIndexed
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...
LLVM_NODISCARD size_t size() const
size - Get the string size.
Data for a string pool entry.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Allocate memory in an ever growing pool, as if by bump-pointer.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This class is intended to be used as a driving class for all asm writers.
void sort(IteratorTy Start, IteratorTy End)
void emitDwarfStringOffset(DwarfStringPoolEntry S) const
Emit the 4-byte offset of a string from the start of its section.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void emitInt32(int Value) const
Emit a long directive and value.
DwarfStringPoolEntryRef EntryRef
String pool entry reference.
void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection, MCSymbol *StartSym)
EntryRef getEntry(AsmPrinter &Asm, StringRef Str)
Get a reference to an entry in the string pool.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const ValueTy & getValue() const
StringRef - Represent a constant reference to a string, i.e.
MCSymbol * createTempSymbol(const Twine &Name) const
DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix)
void emitInt16(int Value) const
Emit a short directive and value.