LLVM
15.0.0git
|
Collect and emit BTF information. More...
#include "Target/BPF/BTFDebug.h"
Public Member Functions | |
BTFDebug (AsmPrinter *AP) | |
bool | InstLower (const MachineInstr *MI, MCInst &OutMI) |
Emit proper patchable instructions. More... | |
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... | |
![]() | |
void | beginModule (Module *M) override |
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... | |
void | beginBasicBlock (const MachineBasicBlock &MBB) override |
Process beginning of a basic block during basic block sections. More... | |
void | endBasicBlock (const MachineBasicBlock &MBB) override |
Process end of a basic block during basic block sections. 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 InstructionOrdering & | getInstOrdering () const |
![]() | |
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... | |
![]() | |
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 uint64_t | getBaseTypeSize (const DIType *Ty) |
If this type is derived from a base type then return base type size. More... | |
static bool | isUnsignedDIType (const DIType *Ty) |
Return true if type encoding is unsigned. More... | |
![]() | |
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 289 of file BTFDebug.h.
BTFDebug::BTFDebug | ( | AsmPrinter * | AP | ) |
Definition at line 505 of file BTFDebug.cpp.
References addString().
Add string to the string table.
Definition at line 406 of file BTFDebug.h.
References S.
Referenced by beginFunctionImpl(), BTFDebug(), llvm::BTFTypeDerived::completeType(), llvm::BTFTypeFwd::completeType(), llvm::BTFTypeInt::completeType(), llvm::BTFTypeEnum::completeType(), llvm::BTFTypeStruct::completeType(), llvm::BTFTypeFuncProto::completeType(), llvm::BTFTypeFunc::completeType(), llvm::BTFKindVar::completeType(), llvm::BTFKindDataSec::completeType(), llvm::BTFTypeFloat::completeType(), llvm::BTFTypeDeclTag::completeType(), llvm::BTFTypeEnum64::completeType(), and llvm::BTFTypeTypeTag::completeType().
|
overrideprotectedvirtual |
Gather pre-function debug information.
Implements llvm::DebugHandlerBase.
Definition at line 1125 of file BTFDebug.cpp.
References addString(), Arg, llvm::DebugHandlerBase::Asm, assert(), llvm::BTF::FUNC_GLOBAL, llvm::BTF::FUNC_STATIC, llvm::MachineFunction::getFunction(), llvm::AsmPrinter::getFunctionBegin(), llvm::MCSection::getName(), llvm::DIScope::getName(), llvm::MCSymbol::getSection(), llvm::Function::getSubprogram(), llvm::MCSymbol::isInSection(), llvm::BTFFuncInfo::Label, move, llvm::DICompileUnit::NoDebug, llvm::ARMBuildAttrs::Section, and llvm::BTFFuncInfo::TypeId.
|
overridevirtual |
Process beginning of an instruction.
Reimplemented from llvm::DebugHandlerBase.
Definition at line 1286 of file BTFDebug.cpp.
References llvm::DebugHandlerBase::Asm, llvm::DebugHandlerBase::beginInstruction(), llvm::MCContext::createTempSymbol(), llvm::DebugHandlerBase::CurMI, DL, llvm::MCStreamer::emitLabel(), llvm::MachineInstr::FrameSetup, llvm::MCStreamer::getContext(), llvm::AsmPrinter::getFunctionBegin(), llvm::MachineOperand::getGlobal(), llvm::MachineOperand::isGlobal(), isReg(), MI, llvm::DebugHandlerBase::PrevInstLoc, and S.
|
overrideprotectedvirtual |
Post process after all instructions in this function are processed.
Implements llvm::DebugHandlerBase.
Definition at line 1214 of file BTFDebug.cpp.
|
overridevirtual |
Complete all the types and emit the BTF sections.
Implements llvm::AsmPrinterHandler.
Definition at line 1557 of file BTFDebug.cpp.
References Fixup, llvm::StructType::getName(), llvm::DIType::getName(), llvm::DINode::getTag(), move, llvm::BTFTypeDerived::setPointeeType(), and llvm::AMDGPU::HSAMD::Kernel::Arg::Key::TypeName.
|
inline |
Get the special array index type id.
Definition at line 400 of file BTFDebug.h.
References assert().
Referenced by llvm::BTFTypeArray::completeType().
Get the type id for a particular DIType.
Definition at line 409 of file BTFDebug.h.
References assert().
Referenced by llvm::BTFTypeDerived::completeType(), llvm::BTFTypeStruct::completeType(), llvm::BTFTypeFuncProto::completeType(), and llvm::BTFTypeTypeTag::completeType().
bool BTFDebug::InstLower | ( | const MachineInstr * | MI, |
MCInst & | OutMI | ||
) |
Emit proper patchable instructions.
Definition at line 1467 of file BTFDebug.cpp.
References llvm::MCInst::addOperand(), llvm::BPFCoreSharedInfo::AmaAttr, llvm::BPFCoreSharedInfo::BTF_TYPE_ID_LOCAL, llvm::BPFCoreSharedInfo::BTF_TYPE_ID_REMOTE, llvm::MCOperand::createImm(), llvm::MCOperand::createReg(), llvm::BPFCoreSharedInfo::ENUM_VALUE, llvm::BPFCoreSharedInfo::ENUM_VALUE_EXISTENCE, llvm::MachineOperand::getGlobal(), llvm::GlobalVariable::hasAttribute(), llvm::RISCVMatInt::Imm, llvm::MachineOperand::isGlobal(), MI, llvm::MCInst::setOpcode(), and llvm::BPFCoreSharedInfo::TypeIdAttr.
For symbols that have a size designated (e.g.
common symbols), this tracks that size.
Implements llvm::AsmPrinterHandler.
Definition at line 416 of file BTFDebug.h.