9#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DEBUGLOCSTREAM_H
10#define LLVM_LIB_CODEGEN_ASMPRINTER_DEBUGLOCSTREAM_H
20class DwarfCompileUnit;
50 std::vector<std::string> Comments;
55 bool GenerateComments;
58 DebugLocStream(
bool GenerateComments) : GenerateComments(GenerateComments) { }
80 size_t LI = Lists.
size();
91 bool finalizeList(AsmPrinter &Asm);
97 void startEntry(
const MCSymbol *BeginSym,
const MCSymbol *EndSym) {
98 Entries.push_back({BeginSym, EndSym, DWARFBytes.
size(), Comments.size()});
102 void finalizeEntry();
110 size_t LI = getIndex(L);
111 return ArrayRef(Entries).
slice(Lists[LI].EntryOffset, getNumEntries(LI));
115 size_t EI = getIndex(
E);
120 size_t EI = getIndex(
E);
126 size_t getIndex(
const List &L)
const {
128 "Expected valid list");
129 return &L - &Lists.
front();
131 size_t getIndex(
const Entry &
E)
const {
132 assert(&Entries.front() <= &
E && &
E <= &Entries.back() &&
133 "Expected valid entry");
134 return &
E - &Entries.front();
136 size_t getNumEntries(
size_t LI)
const {
137 if (LI + 1 == Lists.
size())
138 return Entries.size() - Lists[LI].EntryOffset;
139 return Lists[LI + 1].EntryOffset - Lists[LI].EntryOffset;
142 if (EI + 1 == Entries.size())
143 return DWARFBytes.
size() - Entries[EI].ByteOffset;
144 return Entries[EI + 1].ByteOffset - Entries[EI].ByteOffset;
146 size_t getNumComments(
size_t EI)
const {
147 if (EI + 1 == Entries.size())
148 return Comments.size() - Entries[EI].CommentOffset;
149 return Entries[EI + 1].CommentOffset - Entries[EI].CommentOffset;
159 std::optional<uint8_t> TagOffset;
164 : Locs(Locs), Asm(Asm), V(V), ListIndex(Locs.startList(&
CU)),
165 TagOffset(
std::nullopt) {}
186 : Locs(
List.getLocs()) {
187 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)