13#ifndef LLVM_MC_MCCODEVIEW_H
14#define LLVM_MC_MCCODEVIEW_H
26class MCCVDefRangeFragment;
27class MCCVInlineLineTableFragment;
33class MCObjectStreamer;
50 unsigned line,
unsigned column,
bool prologueend,
bool isstmt)
51 : Label(Label),
FunctionId(functionid), FileNum(fileNum), Line(line),
52 Column(column), PrologueEnd(prologueend), IsStmt(isstmt) {}
72 bool isStmt()
const {
return IsStmt; }
82 void setLine(
unsigned line) { Line = line; }
86 assert(column <= UINT16_MAX);
165 unsigned IAFile,
unsigned IALine,
176 unsigned FileNo,
unsigned Line,
unsigned Column,
177 bool PrologueEnd,
bool IsStmt);
195 unsigned PrimaryFunctionId,
196 unsigned SourceFileId,
197 unsigned SourceLineNum,
207 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
233 bool InsertedStrTabFragment =
false;
238 unsigned getStringTableOffset(
StringRef S);
241 unsigned StringTableOffset;
245 bool Assigned =
false;
247 uint8_t ChecksumKind;
261 std::map<unsigned, std::pair<size_t, size_t>> MCCVLineStartStop;
264 std::vector<MCCVLoc> MCCVLines;
267 std::vector<MCCVFunctionInfo> Functions;
271 bool ChecksumOffsetsAssigned =
false;
This file defines the StringMap class.
This file defines the DenseMap class.
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),...
Holds state from .cv_file and .cv_loc directives for later emission.
ArrayRef< MCCVLoc > getLinesForExtent(size_t L, size_t R)
std::pair< size_t, size_t > getLineExtent(unsigned FuncId)
void encodeInlineLineTable(const MCAssembler &Asm, MCCVInlineLineTableFragment &F)
Encodes the binary annotations once we have a layout.
void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId, const MCSymbol *FuncBegin, const MCSymbol *FuncEnd)
Emits a line table substream.
void emitFileChecksums(MCObjectStreamer &OS)
Emits the file checksum substream.
void recordCVLoc(MCContext &Ctx, const MCSymbol *Label, unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt)
Saves the information from the currently parsed .cv_loc directive and sets CVLocSeen.
CodeViewContext & operator=(const CodeViewContext &other)=delete
bool addFile(MCStreamer &OS, unsigned FileNumber, StringRef Filename, ArrayRef< uint8_t > ChecksumBytes, uint8_t ChecksumKind)
CodeViewContext(MCContext *MCCtx)
MCCVFunctionInfo * getCVFunctionInfo(unsigned FuncId)
Retreive the function info if this is a valid function id, or nullptr.
bool recordFunctionId(unsigned FuncId)
Records the function id of a normal function.
void emitFileChecksumOffset(MCObjectStreamer &OS, unsigned FileNo)
Emits the offset into the checksum table of the given file number.
std::vector< MCCVLoc > getFunctionLineEntries(unsigned FuncId)
void addLineEntry(const MCCVLoc &LineEntry)
Add a line entry.
bool recordInlinedCallSiteId(unsigned FuncId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol)
Records the function id of an inlined call site.
CodeViewContext(const CodeViewContext &other)=delete
std::pair< size_t, size_t > getLineExtentIncludingInlinees(unsigned FuncId)
void emitInlineLineTableForFunction(MCObjectStreamer &OS, unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
void emitStringTable(MCObjectStreamer &OS)
Emits the string table substream.
bool isValidFileNumber(unsigned FileNumber) const
This is a valid number for use with .cv_loc if we've already seen a .cv_file for it.
void encodeDefRange(const MCAssembler &Asm, MCCVDefRangeFragment &F)
MCFragment * emitDefRange(MCObjectStreamer &OS, ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
std::pair< StringRef, unsigned > addToStringTable(StringRef S)
Add something to the string table.
Fragment representing the .cv_def_range directive.
Fragment representing the binary annotations produced by the .cv_inline_linetable directive.
Instances of this class represent the information from a .cv_loc directive.
void setFileNum(unsigned fileNum)
Set the FileNum of this MCCVLoc.
void setPrologueEnd(bool PE)
unsigned getLine() const
Get the Line of this MCCVLoc.
void setColumn(unsigned column)
Set the Column of this MCCVLoc.
unsigned getFileNum() const
Get the FileNum of this MCCVLoc.
void setFunctionId(unsigned FID)
bool isPrologueEnd() const
const MCSymbol * getLabel() const
void setLabel(const MCSymbol *L)
unsigned getColumn() const
Get the Column of this MCCVLoc.
unsigned getFunctionId() const
void setLine(unsigned line)
Set the Line of this MCCVLoc.
Context object for machine code objects.
Fragment for data and encoded instructions.
Streaming object file generation interface.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Streaming machine code generation interface.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
This class represents a function that is read from a sample profile.
This is an optimization pass for GlobalISel generic memory operations.
Information describing a function or inlined call site introduced by .cv_func_id or ....
bool isInlinedCallSite() const
Returns true if this represents an inlined call site, meaning ParentFuncIdPlusOne is neither zero nor...
MCSection * Section
The section of the first .cv_loc directive used for this function, or null if none has been seen yet.
unsigned ParentFuncIdPlusOne
If this represents an inlined call site, then ParentFuncIdPlusOne will be the parent function id plus...
unsigned getParentFuncId() const
bool isUnallocatedFunctionInfo() const
Returns true if this is function info has not yet been used in a .cv_func_id or .cv_inline_site_id di...
DenseMap< unsigned, LineInfo > InlinedAtMap
Map from inlined call site id to the inlined at location to use for that call site.