LLVM
8.0.1
|
Holds state from .cv_file and .cv_loc directives for later emission. More...
#include "llvm/MC/MCCodeView.h"
Public Member Functions | |
CodeViewContext () | |
~CodeViewContext () | |
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. More... | |
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. More... | |
bool | recordInlinedCallSiteId (unsigned FuncId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol) |
Records the function id of an inlined call site. More... | |
MCCVFunctionInfo * | getCVFunctionInfo (unsigned FuncId) |
Retreive the function info if this is a valid function id, or nullptr. More... | |
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. More... | |
bool | isValidCVFileNumber (unsigned FileNumber) |
void | addLineEntry (const MCCVLoc &LineEntry) |
Add a line entry. More... | |
std::vector< MCCVLoc > | getFunctionLineEntries (unsigned FuncId) |
std::pair< size_t, size_t > | getLineExtent (unsigned FuncId) |
ArrayRef< MCCVLoc > | getLinesForExtent (size_t L, size_t R) |
void | emitLineTableForFunction (MCObjectStreamer &OS, unsigned FuncId, const MCSymbol *FuncBegin, const MCSymbol *FuncEnd) |
Emits a line table substream. More... | |
void | emitInlineLineTableForFunction (MCObjectStreamer &OS, unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym) |
void | encodeInlineLineTable (MCAsmLayout &Layout, MCCVInlineLineTableFragment &F) |
Encodes the binary annotations once we have a layout. More... | |
MCFragment * | emitDefRange (MCObjectStreamer &OS, ArrayRef< std::pair< const MCSymbol *, const MCSymbol *>> Ranges, StringRef FixedSizePortion) |
void | encodeDefRange (MCAsmLayout &Layout, MCCVDefRangeFragment &F) |
void | emitStringTable (MCObjectStreamer &OS) |
Emits the string table substream. More... | |
void | emitFileChecksums (MCObjectStreamer &OS) |
Emits the file checksum substream. More... | |
void | emitFileChecksumOffset (MCObjectStreamer &OS, unsigned FileNo) |
Emits the offset into the checksum table of the given file number. More... | |
std::pair< StringRef, unsigned > | addToStringTable (StringRef S) |
Add something to the string table. More... | |
Holds state from .cv_file and .cv_loc directives for later emission.
Definition at line 138 of file MCCodeView.h.
CodeViewContext::CodeViewContext | ( | ) |
Definition at line 29 of file MCCodeView.cpp.
CodeViewContext::~CodeViewContext | ( | ) |
Definition at line 31 of file MCCodeView.cpp.
bool CodeViewContext::addFile | ( | MCStreamer & | OS, |
unsigned | FileNumber, | ||
StringRef | Filename, | ||
ArrayRef< uint8_t > | ChecksumBytes, | ||
uint8_t | ChecksumKind | ||
) |
Definition at line 47 of file MCCodeView.cpp.
References addToStringTable(), assert(), llvm::lltok::ChecksumKind, llvm::MCContext::createTempSymbol(), llvm::StringRef::empty(), and llvm::MCStreamer::getContext().
Referenced by llvm::MCStreamer::EmitCVFileDirective().
Add a line entry.
Definition at line 266 of file MCCodeView.cpp.
References llvm::MCCVLoc::getFunctionId(), and I.
Add something to the string table.
Returns the final string as well as offset into the string table.
Definition at line 148 of file MCCodeView.cpp.
References llvm::SmallVectorImpl< T >::append(), assert(), llvm::StringRef::empty(), I, llvm::MipsISD::Ret, llvm::SmallVectorBase::size(), and llvm::codeview::StringTable.
Referenced by printFPOReg().
MCFragment * CodeViewContext::emitDefRange | ( | MCObjectStreamer & | OS, |
ArrayRef< std::pair< const MCSymbol *, const MCSymbol *>> | Ranges, | ||
StringRef | FixedSizePortion | ||
) |
Definition at line 435 of file MCCodeView.cpp.
References llvm::MCStreamer::getCurrentSectionOnly().
Referenced by llvm::MCObjectStreamer::EmitCVDefRangeDirective().
void CodeViewContext::emitFileChecksumOffset | ( | MCObjectStreamer & | OS, |
unsigned | FileNo | ||
) |
Emits the offset into the checksum table of the given file number.
Definition at line 248 of file MCCodeView.cpp.
References llvm::MCSymbolRefExpr::create(), llvm::MCStreamer::EmitSymbolValue(), llvm::MCObjectStreamer::EmitValueImpl(), and llvm::MCStreamer::getContext().
Referenced by llvm::MCObjectStreamer::EmitCVFileChecksumOffsetDirective().
void CodeViewContext::emitFileChecksums | ( | MCObjectStreamer & | OS | ) |
Emits the file checksum substream.
Definition at line 193 of file MCCodeView.cpp.
References llvm::alignTo(), llvm::MCConstantExpr::create(), llvm::MCContext::createTempSymbol(), llvm::MCObjectStreamer::emitAbsoluteSymbolDiff(), llvm::MCObjectStreamer::EmitAssignment(), llvm::MCObjectStreamer::EmitBytes(), llvm::MCStreamer::EmitIntValue(), llvm::MCObjectStreamer::EmitLabel(), llvm::MCObjectStreamer::EmitValueToAlignment(), llvm::ARMBuildAttrs::File, llvm::codeview::FileChecksums, llvm::MCStreamer::getContext(), and llvm::toStringRef().
Referenced by llvm::MCObjectStreamer::EmitCVFileChecksumsDirective().
void CodeViewContext::emitInlineLineTableForFunction | ( | MCObjectStreamer & | OS, |
unsigned | PrimaryFunctionId, | ||
unsigned | SourceFileId, | ||
unsigned | SourceLineNum, | ||
const MCSymbol * | FnStartSym, | ||
const MCSymbol * | FnEndSym | ||
) |
Definition at line 422 of file MCCodeView.cpp.
References llvm::MCStreamer::getCurrentSectionOnly().
Referenced by llvm::MCObjectStreamer::EmitCVInlineLinetableDirective().
void CodeViewContext::emitLineTableForFunction | ( | MCObjectStreamer & | OS, |
unsigned | FuncId, | ||
const MCSymbol * | FuncBegin, | ||
const MCSymbol * | FuncEnd | ||
) |
Emits a line table substream.
Definition at line 327 of file MCCodeView.cpp.
References llvm::MCStreamer::AddComment(), llvm::any_of(), llvm::MCContext::createTempSymbol(), E, llvm::MCObjectStreamer::emitAbsoluteSymbolDiff(), llvm::MCStreamer::EmitCOFFSecRel32(), llvm::MCStreamer::EmitCOFFSectionIndex(), llvm::MCObjectStreamer::EmitCVFileChecksumOffsetDirective(), llvm::MCStreamer::EmitIntValue(), llvm::MCObjectStreamer::EmitLabel(), llvm::find_if(), llvm::MCCVLoc::getColumn(), llvm::MCStreamer::getContext(), llvm::MCCVLoc::getFileNum(), I, llvm::codeview::LF_HaveColumns, llvm::codeview::Lines, and llvm::codeview::LineInfo::StatementFlag.
void CodeViewContext::emitStringTable | ( | MCObjectStreamer & | OS | ) |
Emits the string table substream.
Definition at line 171 of file MCCodeView.cpp.
References llvm::MCContext::createTempSymbol(), llvm::MCObjectStreamer::emitAbsoluteSymbolDiff(), llvm::MCStreamer::EmitIntValue(), llvm::MCObjectStreamer::EmitLabel(), llvm::MCObjectStreamer::EmitValueToAlignment(), llvm::MCStreamer::getContext(), llvm::MCObjectStreamer::insert(), and llvm::codeview::StringTable.
Referenced by llvm::MCObjectStreamer::EmitCVStringTableDirective().
void CodeViewContext::encodeDefRange | ( | MCAsmLayout & | Layout, |
MCCVDefRangeFragment & | F | ||
) |
Definition at line 609 of file MCCodeView.cpp.
References assert(), llvm::SmallVectorImpl< T >::clear(), computeLabelDiff(), llvm::MCFixup::create(), llvm::MCConstantExpr::create(), llvm::MCSymbolRefExpr::create(), llvm::MCBinaryExpr::createAdd(), E, llvm::MCExpr::evaluateAsRelocatable(), llvm::FK_SecRel_2, llvm::FK_SecRel_4, llvm::MCAsmLayout::getAssembler(), llvm::MCEncodedFragmentWithContents< ContentsSize >::getContents(), llvm::MCAssembler::getContext(), llvm::MCCVDefRangeFragment::getFixedSizePortion(), llvm::MCEncodedFragmentWithFixups< ContentsSize, FixupsSize >::getFixups(), llvm::MCCVDefRangeFragment::getRanges(), I, llvm::support::little, llvm::codeview::MaxDefRange, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorBase::size(), llvm::StringRef::size(), and llvm::support::endian::Writer::write().
Referenced by llvm::MCAssembler::Finish().
void CodeViewContext::encodeInlineLineTable | ( | MCAsmLayout & | Layout, |
MCCVInlineLineTableFragment & | F | ||
) |
Encodes the binary annotations once we have a layout.
Definition at line 462 of file MCCodeView.cpp.
References assert(), llvm::codeview::ChangeCodeLength, llvm::codeview::ChangeCodeOffset, llvm::codeview::ChangeCodeOffsetAndLineOffset, llvm::codeview::ChangeFile, llvm::codeview::ChangeLineOffset, llvm::SmallVectorImpl< T >::clear(), compressAnnotation(), computeLabelDiff(), llvm::ArrayRef< T >::empty(), encodeSignedNumber(), llvm::errs(), llvm::MCCVFunctionInfo::LineInfo::File, llvm::ArrayRef< T >::front(), llvm::MCCVInlineLineTableFragment::getContents(), llvm::MCCVInlineLineTableFragment::getFnEndSym(), llvm::MCCVInlineLineTableFragment::getFnStartSym(), llvm::MCCVLoc::getLabel(), llvm::MCSymbol::getSection(), I, llvm::MCCVFunctionInfo::InlinedAtMap, llvm::MCCVFunctionInfo::LineInfo::Line, llvm_unreachable, llvm::max(), llvm::codeview::MaxRecordLength, llvm::MCCVLoc::setFileNum(), llvm::MCCVLoc::setLabel(), llvm::MCCVLoc::setLine(), and llvm::SmallVectorBase::size().
Referenced by llvm::MCAssembler::Finish().
MCCVFunctionInfo * CodeViewContext::getCVFunctionInfo | ( | unsigned | FuncId | ) |
Retreive the function info if this is a valid function id, or nullptr.
Definition at line 79 of file MCCodeView.cpp.
References FuncId.
Referenced by llvm::MCStreamer::checkCVLocSection().
Definition at line 276 of file MCCodeView.cpp.
References I.
std::pair< size_t, size_t > CodeViewContext::getLineExtent | ( | unsigned | FuncId | ) |
Definition at line 311 of file MCCodeView.cpp.
References I.
Definition at line 319 of file MCCodeView.cpp.
References llvm::makeArrayRef(), and llvm::None.
This is a valid number for use with .cv_loc if we've already seen a .cv_file for it.
Definition at line 40 of file MCCodeView.cpp.
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 131 of file MCCodeView.cpp.
Referenced by llvm::MCObjectStreamer::EmitCVLocDirective().
Records the function id of a normal function.
Returns false if the function id has already been used, and true otherwise.
Definition at line 87 of file MCCodeView.cpp.
References FuncId, and llvm::MCCVFunctionInfo::FunctionSentinel.
Referenced by llvm::MCStreamer::EmitCVFuncIdDirective().
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 100 of file MCCodeView.cpp.
References llvm::MCCVFunctionInfo::LineInfo::Col, llvm::MCCVFunctionInfo::LineInfo::File, FuncId, llvm::MCCVFunctionInfo::getParentFuncId(), Info, llvm::MCCVFunctionInfo::InlinedAt, llvm::MCCVFunctionInfo::InlinedAtMap, llvm::MCCVFunctionInfo::isInlinedCallSite(), llvm::MCCVFunctionInfo::LineInfo::Line, and llvm::MCCVFunctionInfo::ParentFuncIdPlusOne.
Referenced by llvm::MCStreamer::EmitCVInlineSiteIdDirective().