13#ifndef LLVM_MC_MCCODEVIEW_H
14#define LLVM_MC_MCCODEVIEW_H
49 MCCVLoc(
const MCSymbol *Label,
unsigned functionid,
unsigned fileNum,
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);
166 unsigned IAFile,
unsigned IALine,
177 unsigned FunctionId,
unsigned FileNo,
unsigned Line,
178 unsigned Column,
bool PrologueEnd,
bool IsStmt);
197 unsigned PrimaryFunctionId,
198 unsigned SourceFileId,
199 unsigned SourceLineNum,
209 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
238 unsigned getStringTableOffset(
StringRef S);
241 unsigned StringTableOffset;
245 bool Assigned =
false;
257 SmallVector<FileInfo, 4> Files;
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;
274 std::deque<SmallVector<std::pair<const MCSymbol *, const MCSymbol *>, 0>>
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
This file defines the DenseMap class.
static constexpr StringLiteral Filename
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM_ABI ArrayRef< MCCVLoc > getLinesForExtent(size_t L, size_t R)
LLVM_ABI std::pair< size_t, size_t > getLineExtent(unsigned FuncId)
LLVM_ABI void encodeInlineLineTable(const MCAssembler &Asm, MCCVInlineLineTableFragment &F)
Encodes the binary annotations once we have a layout.
LLVM_ABI void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId, const MCSymbol *FuncBegin, const MCSymbol *FuncEnd)
Emits a line table substream.
LLVM_ABI void emitFileChecksums(MCObjectStreamer &OS)
Emits the file checksum substream.
LLVM_ABI 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.
LLVM_ABI void emitDefRange(MCObjectStreamer &OS, ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
CodeViewContext & operator=(const CodeViewContext &other)=delete
LLVM_ABI bool addFile(MCStreamer &OS, unsigned FileNumber, StringRef Filename, ArrayRef< uint8_t > ChecksumBytes, uint8_t ChecksumKind)
CodeViewContext(MCContext *MCCtx)
LLVM_ABI MCCVFunctionInfo * getCVFunctionInfo(unsigned FuncId)
Retreive the function info if this is a valid function id, or nullptr.
LLVM_ABI bool recordFunctionId(unsigned FuncId)
Records the function id of a normal function.
LLVM_ABI void emitFileChecksumOffset(MCObjectStreamer &OS, unsigned FileNo)
Emits the offset into the checksum table of the given file number.
LLVM_ABI std::vector< MCCVLoc > getFunctionLineEntries(unsigned FuncId)
LLVM_ABI void addLineEntry(const MCCVLoc &LineEntry)
Add a line entry.
LLVM_ABI 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
LLVM_ABI std::pair< size_t, size_t > getLineExtentIncludingInlinees(unsigned FuncId)
LLVM_ABI void emitInlineLineTableForFunction(MCObjectStreamer &OS, unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
LLVM_ABI void emitStringTable(MCObjectStreamer &OS)
Emits the string table substream.
LLVM_ABI 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.
LLVM_ABI void encodeDefRange(const MCAssembler &Asm, MCCVDefRangeFragment &F)
LLVM_ABI 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.
friend class CodeViewContext
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.
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",...
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.