#include "BTFDebug.h"
#include "BPF.h"
#include "BPFCORE.h"
#include "MCTargetDesc/BPFMCTargetDesc.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineOperand.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/LineIterator.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include <optional>
usingnamespacellvm;
static const char *BTFKindStr[] = …;
static const DIType *tryRemoveAtomicType(const DIType *Ty) { … }
void BTFTypeBase::emitType(MCStreamer &OS) { … }
BTFTypeDerived::BTFTypeDerived(const DIDerivedType *DTy, unsigned Tag,
bool NeedsFixup)
: … { … }
BTFTypeDerived::BTFTypeDerived(unsigned NextTypeId, unsigned Tag,
StringRef Name)
: … { … }
void BTFTypeDerived::completeType(BTFDebug &BDebug) { … }
void BTFTypeDerived::emitType(MCStreamer &OS) { … }
void BTFTypeDerived::setPointeeType(uint32_t PointeeType) { … }
BTFTypeFwd::BTFTypeFwd(StringRef Name, bool IsUnion) : … { … }
void BTFTypeFwd::completeType(BTFDebug &BDebug) { … }
void BTFTypeFwd::emitType(MCStreamer &OS) { … }
BTFTypeInt::BTFTypeInt(uint32_t Encoding, uint32_t SizeInBits,
uint32_t OffsetInBits, StringRef TypeName)
: … { … }
void BTFTypeInt::completeType(BTFDebug &BDebug) { … }
void BTFTypeInt::emitType(MCStreamer &OS) { … }
BTFTypeEnum::BTFTypeEnum(const DICompositeType *ETy, uint32_t VLen,
bool IsSigned) : … { … }
void BTFTypeEnum::completeType(BTFDebug &BDebug) { … }
void BTFTypeEnum::emitType(MCStreamer &OS) { … }
BTFTypeEnum64::BTFTypeEnum64(const DICompositeType *ETy, uint32_t VLen,
bool IsSigned) : … { … }
void BTFTypeEnum64::completeType(BTFDebug &BDebug) { … }
void BTFTypeEnum64::emitType(MCStreamer &OS) { … }
BTFTypeArray::BTFTypeArray(uint32_t ElemTypeId, uint32_t NumElems) { … }
void BTFTypeArray::completeType(BTFDebug &BDebug) { … }
void BTFTypeArray::emitType(MCStreamer &OS) { … }
BTFTypeStruct::BTFTypeStruct(const DICompositeType *STy, bool IsStruct,
bool HasBitField, uint32_t Vlen)
: … { … }
void BTFTypeStruct::completeType(BTFDebug &BDebug) { … }
void BTFTypeStruct::emitType(MCStreamer &OS) { … }
std::string BTFTypeStruct::getName() { … }
BTFTypeFuncProto::BTFTypeFuncProto(
const DISubroutineType *STy, uint32_t VLen,
const std::unordered_map<uint32_t, StringRef> &FuncArgNames)
: … { … }
void BTFTypeFuncProto::completeType(BTFDebug &BDebug) { … }
void BTFTypeFuncProto::emitType(MCStreamer &OS) { … }
BTFTypeFunc::BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId,
uint32_t Scope)
: … { … }
void BTFTypeFunc::completeType(BTFDebug &BDebug) { … }
void BTFTypeFunc::emitType(MCStreamer &OS) { … }
BTFKindVar::BTFKindVar(StringRef VarName, uint32_t TypeId, uint32_t VarInfo)
: … { … }
void BTFKindVar::completeType(BTFDebug &BDebug) { … }
void BTFKindVar::emitType(MCStreamer &OS) { … }
BTFKindDataSec::BTFKindDataSec(AsmPrinter *AsmPrt, std::string SecName)
: … { … }
void BTFKindDataSec::completeType(BTFDebug &BDebug) { … }
void BTFKindDataSec::emitType(MCStreamer &OS) { … }
BTFTypeFloat::BTFTypeFloat(uint32_t SizeInBits, StringRef TypeName)
: … { … }
void BTFTypeFloat::completeType(BTFDebug &BDebug) { … }
BTFTypeDeclTag::BTFTypeDeclTag(uint32_t BaseTypeId, int ComponentIdx,
StringRef Tag)
: … { … }
void BTFTypeDeclTag::completeType(BTFDebug &BDebug) { … }
void BTFTypeDeclTag::emitType(MCStreamer &OS) { … }
BTFTypeTypeTag::BTFTypeTypeTag(uint32_t NextTypeId, StringRef Tag)
: … { … }
BTFTypeTypeTag::BTFTypeTypeTag(const DIDerivedType *DTy, StringRef Tag)
: … { … }
void BTFTypeTypeTag::completeType(BTFDebug &BDebug) { … }
uint32_t BTFStringTable::addString(StringRef S) { … }
BTFDebug::BTFDebug(AsmPrinter *AP)
: … { … }
uint32_t BTFDebug::addType(std::unique_ptr<BTFTypeBase> TypeEntry,
const DIType *Ty) { … }
uint32_t BTFDebug::addType(std::unique_ptr<BTFTypeBase> TypeEntry) { … }
void BTFDebug::visitBasicType(const DIBasicType *BTy, uint32_t &TypeId) { … }
void BTFDebug::visitSubroutineType(
const DISubroutineType *STy, bool ForSubprog,
const std::unordered_map<uint32_t, StringRef> &FuncArgNames,
uint32_t &TypeId) { … }
void BTFDebug::processDeclAnnotations(DINodeArray Annotations,
uint32_t BaseTypeId,
int ComponentIdx) { … }
uint32_t BTFDebug::processDISubprogram(const DISubprogram *SP,
uint32_t ProtoTypeId, uint8_t Scope) { … }
int BTFDebug::genBTFTypeTags(const DIDerivedType *DTy, int BaseTypeId) { … }
void BTFDebug::visitStructType(const DICompositeType *CTy, bool IsStruct,
uint32_t &TypeId) { … }
void BTFDebug::visitArrayType(const DICompositeType *CTy, uint32_t &TypeId) { … }
void BTFDebug::visitEnumType(const DICompositeType *CTy, uint32_t &TypeId) { … }
void BTFDebug::visitFwdDeclType(const DICompositeType *CTy, bool IsUnion,
uint32_t &TypeId) { … }
void BTFDebug::visitCompositeType(const DICompositeType *CTy,
uint32_t &TypeId) { … }
bool BTFDebug::IsForwardDeclCandidate(const DIType *Base) { … }
void BTFDebug::visitDerivedType(const DIDerivedType *DTy, uint32_t &TypeId,
bool CheckPointer, bool SeenPointer) { … }
void BTFDebug::visitTypeEntry(const DIType *Ty, uint32_t &TypeId,
bool CheckPointer, bool SeenPointer) { … }
void BTFDebug::visitTypeEntry(const DIType *Ty) { … }
void BTFDebug::visitMapDefType(const DIType *Ty, uint32_t &TypeId) { … }
std::string BTFDebug::populateFileContent(const DIFile *File) { … }
void BTFDebug::constructLineInfo(MCSymbol *Label, const DIFile *File,
uint32_t Line, uint32_t Column) { … }
void BTFDebug::emitCommonHeader() { … }
void BTFDebug::emitBTFSection() { … }
void BTFDebug::emitBTFExtSection() { … }
void BTFDebug::beginFunctionImpl(const MachineFunction *MF) { … }
void BTFDebug::endFunctionImpl(const MachineFunction *MF) { … }
unsigned BTFDebug::populateType(const DIType *Ty) { … }
void BTFDebug::generatePatchImmReloc(const MCSymbol *ORSym, uint32_t RootId,
const GlobalVariable *GVar, bool IsAma) { … }
void BTFDebug::processGlobalValue(const MachineOperand &MO) { … }
void BTFDebug::beginInstruction(const MachineInstr *MI) { … }
void BTFDebug::processGlobals(bool ProcessingMapDef) { … }
void BTFDebug::processGlobalInitializer(const Constant *C) { … }
bool BTFDebug::InstLower(const MachineInstr *MI, MCInst &OutMI) { … }
void BTFDebug::processFuncPrototypes(const Function *F) { … }
void BTFDebug::endModule() { … }