9#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DEBUGLOCSTREAM_H
10#define LLVM_LIB_CODEGEN_ASMPRINTER_DEBUGLOCSTREAM_H
20class DwarfCompileUnit;
51 std::vector<std::string> Comments;
56 bool GenerateComments;
59 DebugLocStream(
bool GenerateComments) : GenerateComments(GenerateComments) { }
81 size_t LI = Lists.
size();
92 bool finalizeList(AsmPrinter &Asm);
98 void startEntry(
const MCSymbol *BeginSym,
const MCSymbol *EndSym) {
99 Entries.push_back({BeginSym, EndSym, DWARFBytes.
size(), Comments.size()});
103 void finalizeEntry();
111 size_t LI = getIndex(L);
112 return ArrayRef(Entries).
slice(Lists[LI].EntryOffset, getNumEntries(LI));
116 size_t EI = getIndex(
E);
121 size_t EI = getIndex(
E);
127 size_t getIndex(
const List &L)
const {
129 "Expected valid list");
130 return &L - &Lists.
front();
132 size_t getIndex(
const Entry &
E)
const {
133 assert(&Entries.front() <= &
E && &
E <= &Entries.back() &&
134 "Expected valid entry");
135 return &
E - &Entries.front();
137 size_t getNumEntries(
size_t LI)
const {
138 if (LI + 1 == Lists.
size())
139 return Entries.size() - Lists[LI].EntryOffset;
140 return Lists[LI + 1].EntryOffset - Lists[LI].EntryOffset;
143 if (EI + 1 == Entries.size())
144 return DWARFBytes.
size() - Entries[EI].ByteOffset;
145 return Entries[EI + 1].ByteOffset - Entries[EI].ByteOffset;
147 size_t getNumComments(
size_t EI)
const {
148 if (EI + 1 == Entries.size())
149 return Comments.size() - Entries[EI].CommentOffset;
150 return Entries[EI + 1].CommentOffset - Entries[EI].CommentOffset;
160 std::optional<uint8_t> TagOffset;
165 : Locs(Locs), Asm(Asm), V(V), ListIndex(Locs.startList(&
CU)),
166 TagOffset(
std::nullopt) {}
187 : Locs(
List.getLocs()) {
188 Locs.startEntry(Begin,
End);
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static const SCEV * getNumBytes(const SCEV *BECount, Type *IntPtr, const SCEV *StoreSizeSCEV, Loop *CurLoop, const DataLayout *DL, ScalarEvolution *SE)
Compute the number of bytes as a SCEV from the backedge taken count.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
This class is intended to be used as a driving class for all asm writers.
This class is used to track local variable information.
Builder for DebugLocStream entries.
EntryBuilder(ListBuilder &List, const MCSymbol *Begin, const MCSymbol *End)
BufferByteStreamer getStreamer()
~EntryBuilder()
Finalize the entry, deleting it if it's empty.
Builder for DebugLocStream lists.
DebugLocStream & getLocs()
ListBuilder(DebugLocStream &Locs, DwarfCompileUnit &CU, AsmPrinter &Asm, DbgVariable &V)
void setTagOffset(uint8_t TO)
~ListBuilder()
Finalize the list.
Byte stream of .debug_loc entries.
const List & getList(size_t LI) const
ArrayRef< std::string > getComments(const Entry &E) const
BufferByteStreamer getStreamer()
ArrayRef< Entry > getEntries(const List &L) const
ArrayRef< char > getBytes(const Entry &E) const
MCSymbol * getSym() const
DebugLocStream(bool GenerateComments)
size_t getNumLists() const
void setSym(MCSymbol *Sym)
ArrayRef< List > getLists() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
reference emplace_back(ArgTypes &&... Args)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
Implement std::hash so that hash_code can be used in STL containers.
List(DwarfCompileUnit *CU, size_t EntryOffset)