LLVM 20.0.0git
Classes | Public Member Functions | List of all members
llvm::CodeViewContext Class Reference

Holds state from .cv_file and .cv_loc directives for later emission. More...

#include "llvm/MC/MCCodeView.h"

Public Member Functions

 CodeViewContext (MCContext *MCCtx)
 
 ~CodeViewContext ()
 
CodeViewContextoperator= (const CodeViewContext &other)=delete
 
 CodeViewContext (const CodeViewContext &other)=delete
 
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.
 
bool addFile (MCStreamer &OS, unsigned FileNumber, StringRef Filename, ArrayRef< uint8_t > ChecksumBytes, uint8_t ChecksumKind)
 
bool recordFunctionId (unsigned FuncId)
 Records the function id of a normal function.
 
bool recordInlinedCallSiteId (unsigned FuncId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol)
 Records the function id of an inlined call site.
 
MCCVFunctionInfogetCVFunctionInfo (unsigned FuncId)
 Retreive the function info if this is a valid function id, or nullptr.
 
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.
 
void addLineEntry (const MCCVLoc &LineEntry)
 Add a line entry.
 
std::vector< MCCVLocgetFunctionLineEntries (unsigned FuncId)
 
std::pair< size_t, size_t > getLineExtent (unsigned FuncId)
 
std::pair< size_t, size_t > getLineExtentIncludingInlinees (unsigned FuncId)
 
ArrayRef< MCCVLocgetLinesForExtent (size_t L, size_t R)
 
void emitLineTableForFunction (MCObjectStreamer &OS, unsigned FuncId, const MCSymbol *FuncBegin, const MCSymbol *FuncEnd)
 Emits a line table substream.
 
void emitInlineLineTableForFunction (MCObjectStreamer &OS, unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
 
void encodeInlineLineTable (const MCAssembler &Asm, MCCVInlineLineTableFragment &F)
 Encodes the binary annotations once we have a layout.
 
MCFragmentemitDefRange (MCObjectStreamer &OS, ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
 
void encodeDefRange (const MCAssembler &Asm, MCCVDefRangeFragment &F)
 
void emitStringTable (MCObjectStreamer &OS)
 Emits the string table substream.
 
void emitFileChecksums (MCObjectStreamer &OS)
 Emits the file checksum substream.
 
void emitFileChecksumOffset (MCObjectStreamer &OS, unsigned FileNo)
 Emits the offset into the checksum table of the given file number.
 
std::pair< StringRef, unsignedaddToStringTable (StringRef S)
 Add something to the string table.
 

Detailed Description

Holds state from .cv_file and .cv_loc directives for later emission.

Definition at line 144 of file MCCodeView.h.

Constructor & Destructor Documentation

◆ CodeViewContext() [1/2]

llvm::CodeViewContext::CodeViewContext ( MCContext MCCtx)
inline

Definition at line 146 of file MCCodeView.h.

◆ ~CodeViewContext()

CodeViewContext::~CodeViewContext ( )

Definition at line 28 of file MCCodeView.cpp.

References llvm::MCFragment::destroy().

◆ CodeViewContext() [2/2]

llvm::CodeViewContext::CodeViewContext ( const CodeViewContext other)
delete

Member Function Documentation

◆ addFile()

bool CodeViewContext::addFile ( MCStreamer OS,
unsigned  FileNumber,
StringRef  Filename,
ArrayRef< uint8_t >  ChecksumBytes,
uint8_t  ChecksumKind 
)

◆ addLineEntry()

void CodeViewContext::addLineEntry ( const MCCVLoc LineEntry)

Add a line entry.

Definition at line 263 of file MCCodeView.cpp.

References llvm::MCCVLoc::getFunctionId(), I, and llvm::Offset.

Referenced by recordCVLoc().

◆ addToStringTable()

std::pair< StringRef, unsigned > CodeViewContext::addToStringTable ( StringRef  S)

Add something to the string table.

Returns the final string as well as offset into the string table.

Definition at line 145 of file MCCodeView.cpp.

References llvm::SmallVectorImpl< T >::append(), llvm::MCEncodedFragmentWithFixups< ContentsSize, FixupsSize >::getContents(), llvm::StringMap< ValueTy, AllocatorTy >::insert(), and llvm::SmallVectorBase< Size_T >::size().

Referenced by addFile().

◆ emitDefRange()

MCFragment * CodeViewContext::emitDefRange ( MCObjectStreamer OS,
ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > >  Ranges,
StringRef  FixedSizePortion 
)

Definition at line 455 of file MCCodeView.cpp.

References llvm::MCContext::allocFragment(), F, and OS.

Referenced by llvm::MCObjectStreamer::emitCVDefRangeDirective().

◆ emitFileChecksumOffset()

void CodeViewContext::emitFileChecksumOffset ( MCObjectStreamer OS,
unsigned  FileNo 
)

Emits the offset into the checksum table of the given file number.

Definition at line 245 of file MCCodeView.cpp.

References llvm::MCSymbolRefExpr::create(), Idx, OS, llvm::SmallVectorImpl< T >::resize(), and llvm::SmallVectorBase< Size_T >::size().

Referenced by llvm::MCObjectStreamer::emitCVFileChecksumOffsetDirective().

◆ emitFileChecksums()

void CodeViewContext::emitFileChecksums ( MCObjectStreamer OS)

◆ emitInlineLineTableForFunction()

void CodeViewContext::emitInlineLineTableForFunction ( MCObjectStreamer OS,
unsigned  PrimaryFunctionId,
unsigned  SourceFileId,
unsigned  SourceLineNum,
const MCSymbol FnStartSym,
const MCSymbol FnEndSym 
)

◆ emitLineTableForFunction()

void CodeViewContext::emitLineTableForFunction ( MCObjectStreamer OS,
unsigned  FuncId,
const MCSymbol FuncBegin,
const MCSymbol FuncEnd 
)

◆ emitStringTable()

void CodeViewContext::emitStringTable ( MCObjectStreamer OS)

Emits the string table substream.

Definition at line 168 of file MCCodeView.cpp.

References llvm::MCContext::createTempSymbol(), and OS.

Referenced by llvm::MCObjectStreamer::emitCVStringTableDirective().

◆ encodeDefRange()

void CodeViewContext::encodeDefRange ( const MCAssembler Asm,
MCCVDefRangeFragment F 
)

◆ encodeInlineLineTable()

void CodeViewContext::encodeInlineLineTable ( const MCAssembler Asm,
MCCVInlineLineTableFragment F 
)

◆ getCVFunctionInfo()

MCCVFunctionInfo * CodeViewContext::getCVFunctionInfo ( unsigned  FuncId)

Retreive the function info if this is a valid function id, or nullptr.

Definition at line 76 of file MCCodeView.cpp.

References FuncId.

Referenced by llvm::MCStreamer::checkCVLocSection(), encodeInlineLineTable(), getFunctionLineEntries(), getLineExtentIncludingInlinees(), and recordInlinedCallSiteId().

◆ getFunctionLineEntries()

std::vector< MCCVLoc > CodeViewContext::getFunctionLineEntries ( unsigned  FuncId)

◆ getLineExtent()

std::pair< size_t, size_t > CodeViewContext::getLineExtent ( unsigned  FuncId)

Definition at line 311 of file MCCodeView.cpp.

References FuncId, and I.

Referenced by getLineExtentIncludingInlinees().

◆ getLineExtentIncludingInlinees()

std::pair< size_t, size_t > CodeViewContext::getLineExtentIncludingInlinees ( unsigned  FuncId)

◆ getLinesForExtent()

ArrayRef< MCCVLoc > CodeViewContext::getLinesForExtent ( size_t  L,
size_t  R 
)

Definition at line 339 of file MCCodeView.cpp.

Referenced by encodeInlineLineTable().

◆ isValidFileNumber()

bool CodeViewContext::isValidFileNumber ( unsigned  FileNumber) const

This is a valid number for use with .cv_loc if we've already seen a .cv_file for it.

Definition at line 37 of file MCCodeView.cpp.

References Idx, and llvm::SmallVectorBase< Size_T >::size().

◆ operator=()

CodeViewContext & llvm::CodeViewContext::operator= ( const CodeViewContext other)
delete

◆ recordCVLoc()

void CodeViewContext::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.

When the next instruction is assembled an entry in the line number table with this information and the address of the instruction will be created.

Definition at line 128 of file MCCodeView.cpp.

References addLineEntry().

Referenced by llvm::MCObjectStreamer::emitCVLocDirective().

◆ recordFunctionId()

bool CodeViewContext::recordFunctionId ( unsigned  FuncId)

Records the function id of a normal function.

Returns false if the function id has already been used, and true otherwise.

Definition at line 84 of file MCCodeView.cpp.

References FuncId, and llvm::MCCVFunctionInfo::FunctionSentinel.

Referenced by llvm::MCStreamer::emitCVFuncIdDirective().

◆ recordInlinedCallSiteId()

bool CodeViewContext::recordInlinedCallSiteId ( unsigned  FuncId,
unsigned  IAFunc,
unsigned  IAFile,
unsigned  IALine,
unsigned  IACol 
)

Records the function id of an inlined call site.

Records the "inlined at" location info of the call site, including what function or inlined call site it was inlined into. Returns false if the function id has already been used, and true otherwise.

Definition at line 97 of file MCCodeView.cpp.

References llvm::MCCVFunctionInfo::LineInfo::Col, llvm::MCCVFunctionInfo::LineInfo::File, FuncId, getCVFunctionInfo(), Info, and llvm::MCCVFunctionInfo::LineInfo::Line.

Referenced by llvm::MCStreamer::emitCVInlineSiteIdDirective().


The documentation for this class was generated from the following files: