LLVM 20.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. | |
uint32_t | getArrayIndexTypeId () |
Get the special array index type id. | |
size_t | addString (StringRef S) |
Add string to the string table. | |
uint32_t | getTypeId (const DIType *Ty) |
Get the type id for a particular DIType. | |
void | beginInstruction (const MachineInstr *MI) override |
Process beginning of an instruction. | |
void | endModule () override |
Complete all the types and emit the BTF sections. | |
Public Member Functions inherited from llvm::DebugHandlerBase | |
virtual | ~DebugHandlerBase () |
virtual void | setSymbolSize (const MCSymbol *Sym, uint64_t Size) |
For symbols that have a size designated (e.g. | |
virtual void | beginModule (Module *M) |
virtual void | endModule ()=0 |
virtual void | beginInstruction (const MachineInstr *MI) |
virtual void | endInstruction () |
void | beginFunction (const MachineFunction *MF) |
void | endFunction (const MachineFunction *MF) |
void | beginBasicBlockSection (const MachineBasicBlock &MBB) |
void | endBasicBlockSection (const MachineBasicBlock &MBB) |
virtual void | beginCodeAlignment (const MachineBasicBlock &MBB) |
MCSymbol * | getLabelBeforeInsn (const MachineInstr *MI) |
Return Label preceding the instruction. | |
MCSymbol * | getLabelAfterInsn (const MachineInstr *MI) |
Return Label immediately following the instruction. | |
const InstructionOrdering & | getInstOrdering () const |
Protected Member Functions | |
void | beginFunctionImpl (const MachineFunction *MF) override |
Gather pre-function debug information. | |
void | endFunctionImpl (const MachineFunction *MF) override |
Post process after all instructions in this function are processed. | |
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. | |
void | requestLabelBeforeInsn (const MachineInstr *MI) |
Ensure that a label will be emitted before MI. | |
void | requestLabelAfterInsn (const MachineInstr *MI) |
Ensure that a label will be emitted after MI. | |
virtual void | beginFunctionImpl (const MachineFunction *MF)=0 |
virtual void | endFunctionImpl (const MachineFunction *MF)=0 |
virtual void | skippedNonDebugFunction () |
Additional Inherited Members | |
Static Public Member Functions inherited from llvm::DebugHandlerBase | |
static uint64_t | getBaseTypeSize (const DIType *Ty) |
If this type is derived from a base type then return base type size. | |
static bool | isUnsignedDIType (const DIType *Ty) |
Return true if type encoding is unsigned. | |
Protected Attributes inherited from llvm::DebugHandlerBase | |
AsmPrinter * | Asm = nullptr |
Target of debug info emission. | |
MachineModuleInfo * | MMI = nullptr |
Collected machine module information. | |
DebugLoc | PrevInstLoc |
Previous instruction's location information. | |
MCSymbol * | PrevLabel = nullptr |
const MachineBasicBlock * | PrevInstBB = nullptr |
DebugLoc | PrologEndLoc |
This location indicates end of function prologue and beginning of function body. | |
const MachineBasicBlock * | EpilogBeginBlock = nullptr |
This block includes epilogue instructions. | |
const MachineInstr * | CurMI = nullptr |
If nonnull, stores the current machine instruction we're processing. | |
LexicalScopes | LScopes |
DbgValueHistoryMap | DbgValues |
History of DBG_VALUE and clobber instructions for each user variable. | |
DbgLabelInstrMap | DbgLabels |
Mapping of inlined labels and DBG_LABEL machine instruction. | |
DenseMap< const MachineInstr *, MCSymbol * > | LabelsBeforeInsn |
Maps instruction with label emitted before instruction. | |
DenseMap< const MachineInstr *, MCSymbol * > | LabelsAfterInsn |
Maps instruction with label emitted after instruction. | |
Collect and emit BTF information.
Definition at line 289 of file BTFDebug.h.
BTFDebug::BTFDebug | ( | AsmPrinter * | AP | ) |
Definition at line 508 of file BTFDebug.cpp.
References addString().
|
inline |
Add string to the string table.
Definition at line 417 of file BTFDebug.h.
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 1164 of file BTFDebug.cpp.
References addString(), llvm::DebugHandlerBase::Asm, assert(), llvm::BTF::FUNC_GLOBAL, llvm::BTF::FUNC_STATIC, llvm::MachineFunction::getFunction(), llvm::AsmPrinter::getFunctionBegin(), llvm::MCSection::getName(), llvm::MCSymbol::getSection(), llvm::Function::getSubprogram(), llvm::MCSymbol::isInSection(), llvm::BTFFuncInfo::Label, llvm::DICompileUnit::NoDebug, and llvm::BTFFuncInfo::TypeId.
|
overridevirtual |
Process beginning of an instruction.
Reimplemented from llvm::DebugHandlerBase.
Definition at line 1312 of file BTFDebug.cpp.
References llvm::DebugHandlerBase::Asm, llvm::DebugHandlerBase::beginInstruction(), llvm::DebugHandlerBase::CurMI, DL, llvm::MachineInstr::FrameSetup, llvm::AsmPrinter::getFunctionBegin(), llvm::MachineOperand::getGlobal(), llvm::MachineOperand::getSymbolName(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isGlobal(), llvm::MachineOperand::isReg(), MI, OS, and llvm::DebugHandlerBase::PrevInstLoc.
|
overrideprotectedvirtual |
Post process after all instructions in this function are processed.
Implements llvm::DebugHandlerBase.
Definition at line 1240 of file BTFDebug.cpp.
|
overridevirtual |
Complete all the types and emit the BTF sections.
Implements llvm::DebugHandlerBase.
Definition at line 1608 of file BTFDebug.cpp.
References Fixup, llvm::DIType::getName(), llvm::StructType::getName(), llvm::DINode::getTag(), and llvm::BTFTypeDerived::setPointeeType().
|
inline |
Get the special array index type id.
Definition at line 411 of file BTFDebug.h.
References assert().
Referenced by llvm::BTFTypeArray::completeType().
Get the type id for a particular DIType.
Definition at line 420 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 1525 of file BTFDebug.cpp.
References llvm::MCInst::addOperand(), llvm::BPFCoreSharedInfo::AmaAttr, llvm::BTF::BTF_TYPE_ID_LOCAL, llvm::BTF::BTF_TYPE_ID_REMOTE, llvm::MCOperand::createImm(), llvm::MCOperand::createReg(), llvm::BTF::ENUM_VALUE, llvm::BTF::ENUM_VALUE_EXISTENCE, llvm::MachineOperand::getGlobal(), llvm::GlobalVariable::hasAttribute(), llvm::MachineOperand::isGlobal(), MI, llvm::MCInst::setOpcode(), and llvm::BPFCoreSharedInfo::TypeIdAttr.