|
LLVM
10.0.0
|
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... | |
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 DIType *Ty) |
| 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 236 of file BTFDebug.h.
| BTFDebug::BTFDebug | ( | AsmPrinter * | AP | ) |
Definition at line 382 of file BTFDebug.cpp.
References llvm::MCStreamer::AddComment(), addString(), llvm::DebugHandlerBase::Asm, llvm::BTF::BPFFieldRelocSize, llvm::BTF::BPFFuncInfoSize, llvm::BTF::BPFLineInfoSize, llvm::BTFLineInfo::ColumnNum, llvm::dyn_cast(), E, llvm::MCStreamer::EmitBytes(), llvm::MCStreamer::EmitIntValue(), llvm::AsmPrinter::EmitLabelReference(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::BTF::ExtHeaderSize, File, llvm::BTFLineInfo::FileNameOff, llvm::StringMap< ValueTy, AllocatorTy >::find(), Fixup, llvm::DICompositeType::getBaseType(), llvm::MCStreamer::getContext(), llvm::DISubrange::getCount(), llvm::DICompositeType::getElements(), llvm::MCContext::getELFSection(), llvm::DIBasicType::getEncoding(), llvm::MemoryBuffer::getFile(), llvm::DIScope::getFile(), llvm::MemoryBuffer::getMemBufferCopy(), llvm::DIType::getName(), llvm::DIType::getOffsetInBits(), llvm::ConstantInt::getSExtValue(), llvm::BTFStringTable::getSize(), llvm::DIType::getSizeInBits(), llvm::BTFStringTable::getTable(), llvm::DINode::getTag(), llvm::DISubroutineType::getTypeArray(), llvm::BTF::HeaderSize, I, llvm::DIType::isForwardDecl(), llvm::BTFLineInfo::Label, llvm::BTFLineInfo::LineNum, llvm::BTFLineInfo::LineOff, llvm_unreachable, llvm::BTF::MAGIC, llvm::BTF::MAX_VLEN, llvm::BTF::SecFieldRelocSize, 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 340 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::BTFTypeStruct::completeType(), llvm::BTFTypeFuncProto::completeType(), llvm::BTFTypeFunc::completeType(), llvm::BTFKindVar::completeType(), llvm::BTFKindDataSec::completeType(), and endFunctionImpl().
|
overrideprotectedvirtual |
Gather pre-function debug information.
Implements llvm::DebugHandlerBase.
Definition at line 847 of file BTFDebug.cpp.
References addString(), Arg, llvm::DebugHandlerBase::Asm, assert(), llvm::dyn_cast(), llvm::BTF::FUNC_GLOBAL, llvm::BTF::FUNC_STATIC, llvm::MachineFunction::getFunction(), llvm::AsmPrinter::getFunctionBegin(), llvm::DIScope::getName(), llvm::MCSymbol::getSection(), llvm::MCSectionELF::getSectionName(), llvm::Function::getSubprogram(), llvm::MCSymbol::isInSection(), llvm::BTFFuncInfo::Label, llvm::DICompileUnit::NoDebug, llvm::ARMBuildAttrs::Section, and llvm::BTFFuncInfo::TypeId.
|
overridevirtual |
Process beginning of an instruction.
Reimplemented from llvm::DebugHandlerBase.
Definition at line 979 of file BTFDebug.cpp.
References llvm::DebugHandlerBase::Asm, assert(), llvm::DebugHandlerBase::beginInstruction(), llvm::MCContext::createTempSymbol(), llvm::MCStreamer::EmitLabel(), llvm::StringRef::empty(), llvm::GlobalValue::ExternalLinkage, llvm::GlobalValue::ExternalWeakLinkage, 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::MachineOperand::getGlobal(), llvm::DebugLoc::getLine(), llvm::MachineInstr::getMF(), llvm::MachineModuleInfo::getModule(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::Function::getSubprogram(), llvm::AsmPrinter::getSymbol(), llvm::MachineOperand::getSymbolName(), llvm::Module::globals(), llvm::GlobalValue::InternalLinkage, llvm::MachineOperand::isDef(), llvm::MachineOperand::isGlobal(), llvm::MachineInstr::isInlineAsm(), llvm::MachineInstr::isMetaInstruction(), llvm::MachineOperand::isReg(), llvm::DebugHandlerBase::MMI, llvm::DebugHandlerBase::PrevInstLoc, Size, llvm::SmallVectorBase::size(), llvm::StringRef::startswith(), llvm::BTF::VAR_GLOBAL_ALLOCATED, llvm::BTF::VAR_GLOBAL_EXTERNAL, llvm::BTF::VAR_STATIC, and llvm::GlobalValue::WeakAnyLinkage.
|
overrideprotectedvirtual |
Post process after all instructions in this function are processed.
Implements llvm::DebugHandlerBase.
Definition at line 925 of file BTFDebug.cpp.
References addString(), llvm::BPFCoreSharedInfo::AmaAttr, llvm::MCContext::createTempSymbol(), llvm::dyn_cast(), llvm::MCStreamer::EmitLabel(), llvm::StringRef::find_first_of(), llvm::MCStreamer::getContext(), llvm::MachineOperand::getGlobal(), llvm::DIType::getName(), llvm::MachineOperand::isGlobal(), llvm::BTFFieldReloc::Label, llvm::BTFFieldReloc::OffsetNameOff, llvm::BTFFieldReloc::RelocKind, llvm::StringRef::str(), llvm::StringRef::substr(), and llvm::BTFFieldReloc::TypeID.
|
overridevirtual |
Complete all the types and emit the BTF sections.
Implements llvm::AsmPrinterHandler.
Definition at line 1196 of file BTFDebug.cpp.
References Fixup, llvm::StructType::getName(), and llvm::AMDGPU::HSAMD::Kernel::Arg::Key::TypeName.
|
inline |
Get the special array index type id.
Definition at line 334 of file BTFDebug.h.
References assert().
Referenced by llvm::BTFTypeArray::completeType().
Get the type id for a particular DIType.
Definition at line 343 of file BTFDebug.h.
References assert().
Referenced by llvm::BTFTypeDerived::completeType(), llvm::BTFTypeStruct::completeType(), and llvm::BTFTypeFuncProto::completeType().
| bool BTFDebug::InstLower | ( | const MachineInstr * | MI, |
| MCInst & | OutMI | ||
| ) |
Emit proper patchable instructions.
Definition at line 1135 of file BTFDebug.cpp.
References llvm::MCInst::addOperand(), llvm::BPFCoreSharedInfo::AmaAttr, llvm::MCOperand::createImm(), llvm::MCOperand::createReg(), llvm::dyn_cast(), F(), llvm::BTF::FUNC_EXTERN, llvm::MachineOperand::getGlobal(), llvm::MachineOperand::getImm(), llvm::DIScope::getName(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::Function::getSubprogram(), llvm::MachineOperand::isGlobal(), llvm::MachineOperand::isImm(), and llvm::MCInst::setOpcode().
For symbols that have a size designated (e.g.
common symbols), this tracks that size.
Implements llvm::AsmPrinterHandler.
Definition at line 350 of file BTFDebug.h.
1.8.13