14 #ifndef LLVM_LIB_TARGET_BPF_BTFDEBUG_H 15 #define LLVM_LIB_TARGET_BPF_BTFDEBUG_H 20 #include <unordered_map> 30 class MachineFunction;
66 void setPointeeType(
uint32_t PointeeType);
95 std::vector<struct BTF::BTFEnum> EnumValues;
121 std::vector<struct BTF::BTFMember> Members;
137 std::unordered_map<uint32_t, StringRef> FuncArgNames;
138 std::vector<struct BTF::BTFParam> Parameters;
142 const std::unordered_map<uint32_t, StringRef> &FuncArgNames);
177 std::vector<std::tuple<uint32_t, const MCSymbol *, uint32_t>> Vars;
185 Vars.push_back(std::make_tuple(Id, Sym, Size));
199 std::map<uint32_t, uint32_t> OffsetToIdMap;
201 std::vector<std::string> Table;
206 std::vector<std::string> &
getTable() {
return Table; }
238 bool SkipInstruction;
239 bool LineInfoGenerated;
242 bool MapDefNotCollected;
244 std::vector<std::unique_ptr<BTFTypeBase>> TypeEntries;
245 std::unordered_map<const DIType *, uint32_t> DIToIdMap;
246 std::map<uint32_t, std::vector<BTFFuncInfo>> FuncInfoTable;
247 std::map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable;
248 std::map<uint32_t, std::vector<BTFFieldReloc>> FieldRelocTable;
250 std::map<std::string, std::unique_ptr<BTFKindDataSec>> DataSecEntries;
251 std::vector<BTFTypeStruct *> StructTypes;
252 std::map<std::string, uint32_t> PatchImms;
253 std::map<StringRef, std::pair<bool, std::vector<BTFTypeDerived *>>>
255 std::set<const Function *>ProtoFunctions;
260 uint32_t addType(std::unique_ptr<BTFTypeBase> TypeEntry,
const DIType *Ty);
262 uint32_t addType(std::unique_ptr<BTFTypeBase> TypeEntry);
267 void visitTypeEntry(
const DIType *Ty);
268 void visitTypeEntry(
const DIType *Ty,
uint32_t &TypeId,
bool CheckPointer,
271 void visitSubroutineType(
273 const std::unordered_map<uint32_t, StringRef> &FuncArgNames,
283 bool CheckPointer,
bool SeenPointer);
296 void processGlobals(
bool ProcessingMapDef);
299 void processFuncPrototypes(
const Function *);
306 unsigned populateStructType(
const DIType *Ty);
312 void emitCommonHeader();
315 void emitBTFSection();
318 void emitBTFExtSection();
336 return ArrayIndexTypeId;
344 assert(Ty &&
"Invalid null Type");
345 assert(DIToIdMap.find(Ty) != DIToIdMap.end() &&
346 "DIType not added in the BDIToIdMap");
347 return DIToIdMap[Ty];
356 void endModule()
override;
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface ...
uint32_t RelocKind
What to patch the instruction.
Handle struct/union type.
Represent one func and its type id.
virtual ~BTFTypeBase()=default
uint32_t ColumnNum
the column number
This class represents lattice values for constants.
uint32_t getSize()
Get the size of this BTF type entry.
uint32_t getSize()
Get the size of this BTF type entry.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
uint32_t getArrayIndexTypeId()
Get the special array index type id.
uint32_t getSize()
Get the size of this BTF type entry.
uint32_t getSize()
Get the size of this BTF type entry.
uint32_t getSize()
Get the size of this BTF type entry.
The BTF common type definition.
Handle variable instances.
virtual void emitType(MCStreamer &OS)
Emit types for this BTF type entry.
static StringRef getName(Value *V)
uint32_t roundupToBytes(uint32_t NumBits)
void setSymbolSize(const MCSymbol *Symbol, uint64_t Size) override
For symbols that have a size designated (e.g.
Represent one field relocation.
Instances of this class represent a single low-level machine instruction.
Analysis containing CSE Info
Streaming machine code generation interface.
struct BTF::CommonType BTFType
Collect and emit BTF information.
This class is intended to be used as a driving class for all asm writers.
constexpr char TypeName[]
Key for Kernel::Arg::Metadata::mTypeName.
std::vector< std::string > & getTable()
uint32_t getSize()
Get the size of this BTF type entry.
uint32_t LineNum
the line number
virtual void completeType(BTFDebug &BDebug)
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
virtual uint32_t getSize()
Get the size of this BTF type entry.
MachineOperand class - Representation of each machine instruction operand.
This file contains the layout of .BTF and .BTF.ext ELF sections.
MCSymbol * Label
MCSymbol identifying insn for the lineinfo.
uint32_t getTypeId(const DIType *Ty)
Get the type id for a particular DIType.
The base class for BTF type generation.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
BTF_KIND_ARRAY is followed by one "struct BTFArray".
Type array for a subprogram.
Representation of each machine instruction.
uint32_t OffsetNameOff
The string to traverse types.
uint32_t addString(StringRef S)
Add a string to the string table and returns its offset in the table.
uint32_t getSize()
Get the size of this BTF type entry.
Base class for debug information backends.
const MCSymbol * Label
Func MCSymbol.
uint32_t FileNameOff
file name offset in the .BTF string table
size_t addString(StringRef S)
Add string to the string table.
Handle several derived types include pointer, const, volatile, typedef and restrict.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Handle struct or union forward declaration.
StringRef - Represent a constant reference to a string, i.e.
void addVar(uint32_t Id, const MCSymbol *Sym, uint32_t Size)
const MCSymbol * Label
MCSymbol identifying insn for the reloc.
uint32_t TypeId
Type id referring to .BTF type section.
uint32_t LineOff
line offset in the .BTF string table
uint32_t getSize()
Get the size of this BTF type entry.
Basic type, like 'int' or 'float'.