24 : Pool(A), Prefix(Prefix),
25 ShouldCreateSymbols(Asm.MAI->doesDwarfUseRelocationsAcrossSections()) {}
29 auto I = Pool.insert(std::make_pair(Str,
EntryTy()));
30 auto &Entry =
I.first->second;
33 Entry.Offset = NumBytes;
36 NumBytes += Str.
size() + 1;
37 assert(NumBytes > Entry.Offset &&
"Unexpected overflow");
44 auto &MapEntry = getEntryImpl(Asm, Str);
50 auto &MapEntry = getEntryImpl(Asm, Str);
51 if (!MapEntry.getValue().isIndexed())
52 MapEntry.getValue().Index = NumIndexedStrings++;
62 unsigned EntrySize = 4;
79 MCSection *OffsetSection,
bool UseRelativeOffsets) {
90 for (
const auto &
E : Pool)
98 for (
const auto &Entry : Entries) {
99 assert(ShouldCreateSymbols == static_cast<bool>(Entry->getValue().Symbol) &&
100 "Mismatch between setting and entry");
103 if (ShouldCreateSymbols)
104 Asm.
OutStreamer->EmitLabel(Entry->getValue().Symbol);
108 Twine(Entry->getValue().Offset));
110 StringRef(Entry->getKeyData(), Entry->getKeyLength() + 1));
117 Entries.resize(NumIndexedStrings);
118 for (
const auto &Entry : Pool) {
119 if (Entry.getValue().isIndexed())
120 Entries[Entry.getValue().Index] = &Entry;
125 for (
const auto &Entry : Entries)
126 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
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
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...
const ValueTy & getValue() const
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...
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())
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.