LLVM
8.0.1
|
Collect and emit BTF information. More...
#include "Target/BPF/BTFDebug.h"
Public Member Functions | |
BTFDebug (AsmPrinter *AP) | |
uint32_t | getArrayIndexTypeId () |
Get the special array index type id. More... | |
size_t | addString (StringRef S) |
Add string to the string table. More... | |
uint32_t | getTypeId (const DIType *Ty) |
Get the type id for a particular DIType. More... | |
void | setSymbolSize (const MCSymbol *Symbol, uint64_t Size) override |
For symbols that have a size designated (e.g. More... | |
void | beginInstruction (const MachineInstr *MI) override |
Process beginning of an instruction. More... | |
void | endModule () override |
Complete all the types and emit the BTF sections. More... | |
Public Member Functions inherited from llvm::DebugHandlerBase | |
void | endInstruction () override |
Process end of an instruction. More... | |
void | beginFunction (const MachineFunction *MF) override |
Gather pre-function debug information. More... | |
void | endFunction (const MachineFunction *MF) override |
Gather post-function debug information. More... | |
MCSymbol * | getLabelBeforeInsn (const MachineInstr *MI) |
Return Label preceding the instruction. More... | |
MCSymbol * | getLabelAfterInsn (const MachineInstr *MI) |
Return Label immediately following the instruction. More... | |
const MCExpr * | getFunctionLocalOffsetAfterInsn (const MachineInstr *MI) |
Return the function-local offset of an instruction. More... | |
Public Member Functions inherited from llvm::AsmPrinterHandler | |
virtual | ~AsmPrinterHandler () |
Pin vtable to this file. More... | |
virtual void | markFunctionEnd () |
virtual void | beginFragment (const MachineBasicBlock *MBB, ExceptionSymbolProvider ESP) |
virtual void | endFragment () |
virtual void | beginFunclet (const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr) |
Emit target-specific EH funclet machinery. More... | |
virtual void | endFunclet () |
Protected Member Functions | |
void | beginFunctionImpl (const MachineFunction *MF) override |
Gather pre-function debug information. More... | |
void | endFunctionImpl (const MachineFunction *MF) override |
Post process after all instructions in this function are processed. More... | |
Protected Member Functions inherited from llvm::DebugHandlerBase | |
DebugHandlerBase (AsmPrinter *A) | |
void | identifyScopeMarkers () |
Indentify instructions that are marking the beginning of or ending of a scope. More... | |
void | requestLabelBeforeInsn (const MachineInstr *MI) |
Ensure that a label will be emitted before MI. More... | |
void | requestLabelAfterInsn (const MachineInstr *MI) |
Ensure that a label will be emitted after MI. More... | |
virtual void | skippedNonDebugFunction () |
Additional Inherited Members | |
Static Public Member Functions inherited from llvm::DebugHandlerBase | |
static uint64_t | getBaseTypeSize (const DITypeRef TyRef) |
If this type is derived from a base type then return base type size. More... | |
Protected Attributes inherited from llvm::DebugHandlerBase | |
AsmPrinter * | Asm |
Target of debug info emission. More... | |
MachineModuleInfo * | MMI |
Collected machine module information. More... | |
DebugLoc | PrevInstLoc |
Previous instruction's location information. More... | |
MCSymbol * | PrevLabel = nullptr |
const MachineBasicBlock * | PrevInstBB = nullptr |
DebugLoc | PrologEndLoc |
This location indicates end of function prologue and beginning of function body. More... | |
const MachineInstr * | CurMI = nullptr |
If nonnull, stores the current machine instruction we're processing. More... | |
LexicalScopes | LScopes |
DbgValueHistoryMap | DbgValues |
History of DBG_VALUE and clobber instructions for each user variable. More... | |
DbgLabelInstrMap | DbgLabels |
Mapping of inlined labels and DBG_LABEL machine instruction. More... | |
DenseMap< const MachineInstr *, MCSymbol * > | LabelsBeforeInsn |
Maps instruction with label emitted before instruction. More... | |
DenseMap< const MachineInstr *, MCSymbol * > | LabelsAfterInsn |
Maps instruction with label emitted after instruction. More... | |
Collect and emit BTF information.
Definition at line 193 of file BTFDebug.h.
BTFDebug::BTFDebug | ( | AsmPrinter * | AP | ) |
Definition at line 320 of file BTFDebug.cpp.
References llvm::MCStreamer::AddComment(), addString(), llvm::DebugHandlerBase::Asm, llvm::BTF::BPFFuncInfoSize, llvm::BTF::BPFLineInfoSize, llvm::BTFLineInfo::ColumnNum, E, llvm::MCStreamer::EmitBytes(), llvm::MCStreamer::EmitIntValue(), llvm::AsmPrinter::EmitLabelReference(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::BTF::ExtHeaderSize, llvm::ARMBuildAttrs::File, llvm::BTFLineInfo::FileNameOff, llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::DICompositeType::getBaseType(), llvm::MCStreamer::getContext(), llvm::DICompositeType::getElements(), llvm::MCContext::getELFSection(), llvm::DIBasicType::getEncoding(), llvm::DIScope::getFile(), llvm::DIType::getName(), llvm::DIType::getOffsetInBits(), llvm::BTFStringTable::getSize(), llvm::DIType::getSizeInBits(), llvm::BTFStringTable::getTable(), llvm::DINode::getTag(), llvm::DISubroutineType::getTypeArray(), llvm::BTF::HeaderSize, llvm::DIType::isForwardDecl(), llvm::BTFLineInfo::Label, llvm::BTFLineInfo::LineNum, llvm::BTFLineInfo::LineOff, llvm_unreachable, llvm::BTF::MAGIC, llvm::BTF::MAX_VLEN, llvm::TypedDINodeRef< T >::resolve(), llvm::MDNode::resolve(), llvm::BTF::SecFuncInfoSize, llvm::BTF::SecLineInfoSize, llvm::ELF::SHT_PROGBITS, llvm::DITypeRefArray::size(), llvm::size(), llvm::Sched::Source, llvm::MCStreamer::SwitchSection(), llvm::Tag, llvm::to_string(), llvm::Twine::utohexstr(), and llvm::BTF::VERSION.
Add string to the string table.
Definition at line 264 of file BTFDebug.h.
References llvm::BTFStringTable::addString().
Referenced by beginFunctionImpl(), BTFDebug(), llvm::BTFTypeDerived::completeType(), llvm::BTFTypeFwd::completeType(), llvm::BTFTypeInt::completeType(), llvm::BTFTypeEnum::completeType(), llvm::BTFTypeArray::completeType(), llvm::BTFTypeStruct::completeType(), llvm::BTFTypeFuncProto::completeType(), and llvm::BTFTypeFunc::completeType().
|
overrideprotectedvirtual |
Gather pre-function debug information.
Implements llvm::DebugHandlerBase.
Definition at line 638 of file BTFDebug.cpp.
References addString(), Arg, llvm::DebugHandlerBase::Asm, assert(), llvm::dyn_cast(), llvm::MachineFunction::getFunction(), llvm::AsmPrinter::getFunctionBegin(), llvm::Value::getName(), llvm::DIScope::getName(), llvm::MCSymbol::getSection(), llvm::MCSectionELF::getSectionName(), llvm::Function::getSubprogram(), llvm::MCSymbol::isInSection(), llvm::BTFFuncInfo::Label, llvm::DICompileUnit::NoDebug, llvm::ARMBuildAttrs::Section, llvm::BTFFuncInfo::TypeId, and Unit.
|
overridevirtual |
Process beginning of an instruction.
Reimplemented from llvm::DebugHandlerBase.
Definition at line 694 of file BTFDebug.cpp.
References llvm::DebugHandlerBase::Asm, llvm::DebugHandlerBase::beginInstruction(), llvm::MCContext::createTempSymbol(), llvm::MCStreamer::EmitLabel(), llvm::MachineInstr::FrameSetup, llvm::DebugLoc::get(), llvm::DebugLoc::getCol(), llvm::MCStreamer::getContext(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getFlag(), llvm::MachineFunction::getFunction(), llvm::AsmPrinter::getFunctionBegin(), llvm::DebugLoc::getLine(), llvm::MachineInstr::getMF(), llvm::MachineInstr::getOperand(), llvm::Function::getSubprogram(), llvm::MachineOperand::getSymbolName(), llvm::MachineOperand::isDef(), llvm::MachineInstr::isInlineAsm(), llvm::MachineInstr::isMetaInstruction(), llvm::MachineOperand::isReg(), and llvm::DebugHandlerBase::PrevInstLoc.
|
overrideprotectedvirtual |
Post process after all instructions in this function are processed.
Implements llvm::DebugHandlerBase.
Definition at line 688 of file BTFDebug.cpp.
|
overridevirtual |
Complete all the types and emit the BTF sections.
Implements llvm::AsmPrinterHandler.
Definition at line 742 of file BTFDebug.cpp.
References llvm::Module::debug_compile_units(), llvm::MachineModuleInfo::getModule(), llvm::DIVariable::getType(), llvm::DebugHandlerBase::MMI, and llvm::TypedDINodeRef< T >::resolve().
|
inline |
Get the special array index type id.
Definition at line 258 of file BTFDebug.h.
References assert().
Referenced by llvm::BTFTypeArray::completeType().
Get the type id for a particular DIType.
Definition at line 267 of file BTFDebug.h.
References assert().
Referenced by llvm::BTFTypeDerived::completeType(), llvm::BTFTypeArray::completeType(), llvm::BTFTypeStruct::completeType(), and llvm::BTFTypeFuncProto::completeType().
For symbols that have a size designated (e.g.
common symbols), this tracks that size.
Implements llvm::AsmPrinterHandler.
Definition at line 274 of file BTFDebug.h.
References MI.