

|
LLVM 23.0.0git
|
#include "BTFDebug.h"#include "BPF.h"#include "BPFCORE.h"#include "MCTargetDesc/BPFMCTargetDesc.h"#include "llvm/BinaryFormat/Dwarf.h"#include "llvm/BinaryFormat/ELF.h"#include "llvm/CodeGen/AsmPrinter.h"#include "llvm/CodeGen/MachineFrameInfo.h"#include "llvm/CodeGen/MachineModuleInfo.h"#include "llvm/CodeGen/MachineOperand.h"#include "llvm/CodeGen/TargetRegisterInfo.h"#include "llvm/CodeGen/TargetSubtargetInfo.h"#include "llvm/IR/Module.h"#include "llvm/MC/MCContext.h"#include "llvm/MC/MCObjectFileInfo.h"#include "llvm/MC/MCSectionELF.h"#include "llvm/MC/MCStreamer.h"#include "llvm/Support/Debug.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/IOSandbox.h"#include "llvm/Support/LineIterator.h"#include "llvm/Support/MemoryBuffer.h"#include "llvm/Target/TargetLoweringObjectFile.h"#include <optional>#include "BPFGenCallingConv.inc"#include "llvm/DebugInfo/BTF/BTF.def"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "btf-debug" |
| #define | GET_CC_REGISTER_LISTS |
| #define | HANDLE_BTF_KIND(ID, NAME) |
Functions | |
| static const DIType * | tryRemoveAtomicType (const DIType *Ty) |
| static const DIType * | stripDITypeAttributes (const DIType *Ty) |
| static bool | sourceArgMatchesIRType (const DIType *SourceTy, Type *IRTy) |
| static SmallVector< std::pair< uint32_t, Register >, 8 > | collectNocallEntryArgRegs (const MachineFunction &MF) |
| Collect the physical register each source argument lives in by scanning DBG_VALUE instructions in the entry block. | |
| static bool | canUseNocallOptimizedSignature (const MachineFunction &MF, DITypeArray Elements, ArrayRef< std::pair< uint32_t, Register > > AliveArgs, const TargetRegisterInfo &TRI) |
| Check whether the optimized IR signature matches the surviving source arguments precisely enough to emit a filtered BTF prototype. | |
Variables | |
| static const char * | BTFKindStr [] |
| #define DEBUG_TYPE "btf-debug" |
Definition at line 40 of file BTFDebug.cpp.
| #define GET_CC_REGISTER_LISTS |
Definition at line 42 of file BTFDebug.cpp.
| #define HANDLE_BTF_KIND | ( | ID, | |
| NAME ) |
|
static |
Check whether the optimized IR signature matches the surviving source arguments precisely enough to emit a filtered BTF prototype.
Requires exact IR/source arg count match, matching types, and correct BPF register order (R1..R5) for register args.
Definition at line 216 of file BTFDebug.cpp.
References llvm::Function::arg_begin(), llvm::Function::arg_size(), llvm::dbgs(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getName(), I, LLVM_DEBUG, N, Reg, sourceArgMatchesIRType(), and TRI.
Referenced by llvm::BTFDebug::beginFunctionImpl().
|
static |
Collect the physical register each source argument lives in by scanning DBG_VALUE instructions in the entry block.
A DBG_VALUE is only recorded when its register either (a) has not been redefined by any preceding non-debug instruction (i.e. it still holds the caller-passed value), or (b) was most recently loaded from the stack via $r11 (a stack-passed argument beyond the first five register args).
There is another case where DBG_VALUE is not emitted due to AssignmentTrackingAnalysis which determines that a variable is always stack-homed, and describes the variable via MachineFunction's VariableDbgInfo (setVariableDbgInfo with a frame index). To recover the register for those arguments, we also track stores of un-redefined physical registers to stack frame objects during the entry-block walk (using MachineMemOperands to identify the target frame index), then match them against VariableDbgInfo entries after the scan.
Definition at line 123 of file BTFDebug.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::begin(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::MachineFunction::front(), llvm::DILocalVariable::getArg(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFrameInfo::getObjectAllocation(), llvm::MachineFrameInfo::getObjectIndexEnd(), llvm::MachineOperand::getReg(), llvm::DILocalVariable::getScope(), llvm::DILocalScope::getSubprogram(), llvm::Function::getSubprogram(), llvm::MachineFunction::getVariableDbgInfo(), I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::Register::isPhysical(), llvm::MachineOperand::isReg(), MI, N, llvm::sort(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace().
Referenced by llvm::BTFDebug::beginFunctionImpl().
Definition at line 76 of file BTFDebug.cpp.
References llvm::dyn_cast(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::isFloatingPointTy(), llvm::Type::isIntegerTy(), llvm::Type::isPointerTy(), and stripDITypeAttributes().
Referenced by canUseNocallOptimizedSignature().
Definition at line 59 of file BTFDebug.cpp.
References llvm::dyn_cast_or_null().
Referenced by sourceArgMatchesIRType().
Definition at line 50 of file BTFDebug.cpp.
References llvm::dyn_cast().
Referenced by llvm::BTFTypeDerived::completeType(), llvm::BTFTypeFuncProto::completeType(), llvm::BTFTypeStruct::completeType(), and llvm::BTFTypeTypeTag::completeType().
Definition at line 45 of file BTFDebug.cpp.
Referenced by llvm::BTFTypeBase::emitType().