LLVM 23.0.0git
BTFDebug.h
Go to the documentation of this file.
1//===- BTFDebug.h -----------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file contains support for writing BTF debug info.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_BPF_BTFDEBUG_H
15#define LLVM_LIB_TARGET_BPF_BTFDEBUG_H
16
17#include "llvm/ADT/StringMap.h"
20#include <cstdint>
21#include <map>
22#include <set>
23#include <unordered_map>
24
25namespace llvm {
26
27class AsmPrinter;
28class BTFDebug;
29class DIType;
30class GlobalVariable;
31class MachineFunction;
32class MachineInstr;
33class MachineOperand;
34class MCInst;
35class MCStreamer;
36class MCSymbol;
37
38/// The base class for BTF type generation.
40protected:
45
46public:
48 virtual ~BTFTypeBase() = default;
49 void setId(uint32_t Id) { this->Id = Id; }
50 uint32_t getId() { return Id; }
51 uint32_t roundupToBytes(uint32_t NumBits) { return (NumBits + 7) >> 3; }
52 /// Get the size of this BTF type entry.
53 virtual uint32_t getSize() { return BTF::CommonTypeSize; }
54 /// Complete BTF type generation after all related DebugInfo types
55 /// have been visited so their BTF type id's are available
56 /// for cross referece.
57 virtual void completeType(BTFDebug &BDebug) {}
58 /// Emit types for this BTF type entry.
59 virtual void emitType(MCStreamer &OS);
60};
61
62/// Handle several derived types include pointer, const,
63/// volatile, typedef and restrict.
65 const DIDerivedType *DTy;
66 bool NeedsFixup;
67 StringRef Name;
68
69public:
70 BTFTypeDerived(const DIDerivedType *Ty, unsigned Tag, bool NeedsFixup);
71 BTFTypeDerived(unsigned NextTypeId, unsigned Tag, StringRef Name);
72 void completeType(BTFDebug &BDebug) override;
73 void emitType(MCStreamer &OS) override;
74 void setPointeeType(uint32_t PointeeType);
75};
76
77/// Handle struct or union forward declaration.
78class BTFTypeFwd : public BTFTypeBase {
79 StringRef Name;
80
81public:
82 BTFTypeFwd(StringRef Name, bool IsUnion);
83 void completeType(BTFDebug &BDebug) override;
84 void emitType(MCStreamer &OS) override;
85};
86
87/// Handle int type.
88class BTFTypeInt : public BTFTypeBase {
89 StringRef Name;
90 uint32_t IntVal; ///< Encoding, offset, bits
91
92public:
93 BTFTypeInt(uint32_t Encoding, uint32_t SizeInBits, uint32_t OffsetInBits,
94 StringRef TypeName);
95 uint32_t getSize() override { return BTFTypeBase::getSize() + sizeof(uint32_t); }
96 void completeType(BTFDebug &BDebug) override;
97 void emitType(MCStreamer &OS) override;
98};
99
100/// Handle enumerate type.
101class BTFTypeEnum : public BTFTypeBase {
102 const DICompositeType *ETy;
103 std::vector<struct BTF::BTFEnum> EnumValues;
104
105public:
106 BTFTypeEnum(const DICompositeType *ETy, uint32_t NumValues, bool IsSigned);
107 uint32_t getSize() override {
108 return BTFTypeBase::getSize() + EnumValues.size() * BTF::BTFEnumSize;
109 }
110 void completeType(BTFDebug &BDebug) override;
111 void emitType(MCStreamer &OS) override;
112};
113
114/// Handle array type.
115class BTFTypeArray : public BTFTypeBase {
116 struct BTF::BTFArray ArrayInfo;
117
118public:
119 BTFTypeArray(uint32_t ElemTypeId, uint32_t NumElems);
121 void completeType(BTFDebug &BDebug) override;
122 void emitType(MCStreamer &OS) override;
123};
124
125/// Handle struct/union type.
127 const DICompositeType *STy;
128 bool HasBitField;
129 std::vector<struct BTF::BTFMember> Members;
130
131public:
132 BTFTypeStruct(const DICompositeType *STy, bool IsStruct, bool HasBitField,
133 uint32_t NumMembers);
134 uint32_t getSize() override {
135 return BTFTypeBase::getSize() + Members.size() * BTF::BTFMemberSize;
136 }
137 void completeType(BTFDebug &BDebug) override;
138 void emitType(MCStreamer &OS) override;
139 std::string getName();
140};
141
142/// Handle function pointer.
144 const DISubroutineType *STy;
146 SmallVector<uint32_t, 8> AliveParamIndices;
147 bool UseFilteredParams = false;
148 std::vector<struct BTF::BTFParam> Parameters;
149 bool VoidReturn = false;
150
151public:
152 BTFTypeFuncProto(const DISubroutineType *STy, uint32_t NumParams,
153 const SmallDenseMap<uint32_t, StringRef> &FuncArgNames,
154 bool UseFilteredParams = false,
155 ArrayRef<uint32_t> AliveParamIndices = {},
156 bool VoidReturn = false);
157 uint32_t getSize() override {
158 return BTFTypeBase::getSize() + Parameters.size() * BTF::BTFParamSize;
159 }
160 void completeType(BTFDebug &BDebug) override;
161 void emitType(MCStreamer &OS) override;
162};
163
164/// Handle subprogram
165class BTFTypeFunc : public BTFTypeBase {
166 StringRef Name;
167
168public:
169 BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId, uint32_t Scope);
170 uint32_t getSize() override { return BTFTypeBase::getSize(); }
171 void completeType(BTFDebug &BDebug) override;
172 void emitType(MCStreamer &OS) override;
173};
174
175/// Handle variable instances
176class BTFKindVar : public BTFTypeBase {
177 StringRef Name;
178 uint32_t Info;
179
180public:
181 BTFKindVar(StringRef VarName, uint32_t TypeId, uint32_t VarInfo);
182 uint32_t getSize() override { return BTFTypeBase::getSize() + 4; }
183 void completeType(BTFDebug &BDebug) override;
184 void emitType(MCStreamer &OS) override;
185};
186
187/// Handle data sections
189 AsmPrinter *Asm;
190 std::string Name;
191 std::vector<std::tuple<uint32_t, const MCSymbol *, uint32_t>> Vars;
192
193public:
194 BTFKindDataSec(AsmPrinter *AsmPrt, std::string SecName);
195 uint32_t getSize() override {
196 return BTFTypeBase::getSize() + BTF::BTFDataSecVarSize * Vars.size();
197 }
199 Vars.push_back(std::make_tuple(Id, Sym, Size));
200 }
201 std::string getName() { return Name; }
202 void completeType(BTFDebug &BDebug) override;
203 void emitType(MCStreamer &OS) override;
204};
205
206/// Handle binary floating point type.
207class BTFTypeFloat : public BTFTypeBase {
208 StringRef Name;
209
210public:
211 BTFTypeFloat(uint32_t SizeInBits, StringRef TypeName);
212 void completeType(BTFDebug &BDebug) override;
213};
214
215/// Handle decl tags.
217 uint32_t Info;
218 StringRef Tag;
219
220public:
221 BTFTypeDeclTag(uint32_t BaseTypeId, int ComponentId, StringRef Tag);
222 uint32_t getSize() override { return BTFTypeBase::getSize() + 4; }
223 void completeType(BTFDebug &BDebug) override;
224 void emitType(MCStreamer &OS) override;
225};
226
227/// Handle 64-bit enumerate type.
229 const DICompositeType *ETy;
230 std::vector<struct BTF::BTFEnum64> EnumValues;
231
232public:
233 BTFTypeEnum64(const DICompositeType *ETy, uint32_t NumValues, bool IsSigned);
234 uint32_t getSize() override {
235 return BTFTypeBase::getSize() + EnumValues.size() * BTF::BTFEnum64Size;
236 }
237 void completeType(BTFDebug &BDebug) override;
238 void emitType(MCStreamer &OS) override;
239};
240
242 const DIDerivedType *DTy;
243 StringRef Tag;
244
245public:
246 BTFTypeTypeTag(uint32_t NextTypeId, StringRef Tag);
247 BTFTypeTypeTag(const DIDerivedType *DTy, StringRef Tag);
248 void completeType(BTFDebug &BDebug) override;
249};
250
251/// String table.
253 /// String table size in bytes.
254 uint32_t Size;
255 /// A mapping from string table offset to the index
256 /// of the Table. It is used to avoid putting
257 /// duplicated strings in the table.
258 std::map<uint32_t, uint32_t> OffsetToIdMap;
259 /// A vector of strings to represent the string table.
260 std::vector<std::string> Table;
261
262public:
263 BTFStringTable() : Size(0) {}
264 uint32_t getSize() { return Size; }
265 std::vector<std::string> &getTable() { return Table; }
266 /// Add a string to the string table and returns its offset
267 /// in the table.
269};
270
271/// Represent one func and its type id.
273 const MCSymbol *Label; ///< Func MCSymbol
274 uint32_t TypeId; ///< Type id referring to .BTF type section
275};
276
277/// Represent one line info.
279 MCSymbol *Label; ///< MCSymbol identifying insn for the lineinfo
280 uint32_t FileNameOff; ///< file name offset in the .BTF string table
281 uint32_t LineOff; ///< line offset in the .BTF string table
282 uint32_t LineNum; ///< the line number
283 uint32_t ColumnNum; ///< the column number
284};
285
286/// Represent one field relocation.
288 const MCSymbol *Label; ///< MCSymbol identifying insn for the reloc
289 uint32_t TypeID; ///< Type ID
290 uint32_t OffsetNameOff; ///< The string to traverse types
291 uint32_t RelocKind; ///< What to patch the instruction
292};
293
294/// Collect and emit BTF information.
296 MCStreamer &OS;
297 bool SkipInstruction;
298 bool LineInfoGenerated;
299 uint32_t SecNameOff;
300 uint32_t ArrayIndexTypeId;
301 bool MapDefNotCollected;
302 BTFStringTable StringTable;
303 std::vector<std::unique_ptr<BTFTypeBase>> TypeEntries;
304 std::unordered_map<const DIType *, uint32_t> DIToIdMap;
305 std::map<uint32_t, std::vector<BTFFuncInfo>> FuncInfoTable;
306 std::map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable;
307 std::map<uint32_t, std::vector<BTFFieldReloc>> FieldRelocTable;
309 std::map<std::string, std::unique_ptr<BTFKindDataSec>, std::less<>>
310 DataSecEntries;
311 std::vector<BTFTypeStruct *> StructTypes;
312 std::map<const GlobalVariable *, std::pair<int64_t, uint32_t>> PatchImms;
313 std::map<const DICompositeType *,
314 std::vector<std::pair<const DIDerivedType *, BTFTypeDerived *>>>
315 FixupDerivedTypes;
316 std::set<const Function *>ProtoFunctions;
317
318 /// Add types to TypeEntries.
319 /// @{
320 /// Add types to TypeEntries and DIToIdMap.
321 uint32_t addType(std::unique_ptr<BTFTypeBase> TypeEntry, const DIType *Ty);
322 /// Add types to TypeEntries only and return type id.
323 uint32_t addType(std::unique_ptr<BTFTypeBase> TypeEntry);
324 /// @}
325
326 /// IR type visiting functions.
327 /// @{
328 void visitTypeEntry(const DIType *Ty);
329 void visitTypeEntry(const DIType *Ty, uint32_t &TypeId, bool CheckPointer,
330 bool SeenPointer);
331 void visitBasicType(const DIBasicType *BTy, uint32_t &TypeId);
332 void
333 visitSubroutineType(const DISubroutineType *STy, bool ForSubprog,
334 const SmallDenseMap<uint32_t, StringRef> &FuncArgNames,
335 uint32_t &TypeId, bool VoidReturn = false);
336 void visitFwdDeclType(const DICompositeType *CTy, bool IsUnion,
337 uint32_t &TypeId);
338 void visitCompositeType(const DICompositeType *CTy, uint32_t &TypeId);
339 void visitStructType(const DICompositeType *STy, bool IsStruct,
340 uint32_t &TypeId);
341 void visitArrayType(const DICompositeType *ATy, uint32_t &TypeId);
342 void visitEnumType(const DICompositeType *ETy, uint32_t &TypeId);
343 void visitDerivedType(const DIDerivedType *DTy, uint32_t &TypeId,
344 bool CheckPointer, bool SeenPointer);
345 void visitMapDefType(const DIType *Ty, uint32_t &TypeId);
346 /// @}
347
348 /// Check whether the type is a forward declaration candidate or not.
349 bool IsForwardDeclCandidate(const DIType *Base);
350
351 /// Get the file content for the subprogram. Certain lines of the file
352 /// later may be put into string table and referenced by line info.
353 std::string populateFileContent(const DIFile *File);
354
355 /// Construct a line info.
356 void constructLineInfo(MCSymbol *Label, const DIFile *File, uint32_t Line,
357 uint32_t Column);
358
359 /// Generate types and variables for globals.
360 void processGlobals(bool ProcessingMapDef);
361
362 /// Process global variable initializer in pursuit for function
363 /// pointers.
364 void processGlobalInitializer(const Constant *C);
365
366 /// Generate types for function prototypes.
367 void processFuncPrototypes(const Function *);
368
369 /// Generate types for decl annotations.
370 void processDeclAnnotations(DINodeArray Annotations, uint32_t BaseTypeId,
371 int ComponentId);
372
373 /// Generate types for DISubprogram and it's arguments.
374 uint32_t processDISubprogram(
375 const DISubprogram *SP, uint32_t ProtoTypeId, uint8_t Scope,
376 const SmallDenseMap<uint32_t, uint32_t> *ArgIndexMap = nullptr);
377
378 /// Generate BTF type_tag's. If BaseTypeId is nonnegative, the last
379 /// BTF type_tag in the chain points to BaseTypeId. Otherwise, it points to
380 /// the base type of DTy. Return the type id of the first BTF type_tag
381 /// in the chain. If no type_tag's are generated, a negative value
382 /// is returned.
383 int genBTFTypeTags(const DIDerivedType *DTy, int BaseTypeId);
384
385 /// Generate one field relocation record.
386 void generatePatchImmReloc(const MCSymbol *ORSym, uint32_t RootId,
387 const GlobalVariable *, bool IsAma);
388
389 /// Populating unprocessed type on demand.
390 unsigned populateType(const DIType *Ty);
391
392 /// Process global variables referenced by relocation instructions
393 /// and extern function references.
394 void processGlobalValue(const MachineOperand &MO);
395
396 /// Emit common header of .BTF and .BTF.ext sections.
397 void emitCommonHeader();
398
399 /// Emit the .BTF section.
400 void emitBTFSection();
401
402 /// Emit the .BTF.ext section.
403 void emitBTFExtSection();
404
405protected:
406 /// Gather pre-function debug information.
407 void beginFunctionImpl(const MachineFunction *MF) override;
408
409 /// Post process after all instructions in this function are processed.
410 void endFunctionImpl(const MachineFunction *MF) override;
411
412public:
413 BTFDebug(AsmPrinter *AP);
414
415 ///
416 bool InstLower(const MachineInstr *MI, MCInst &OutMI);
417
418 /// Get the special array index type id.
420 assert(ArrayIndexTypeId);
421 return ArrayIndexTypeId;
422 }
423
424 /// Add string to the string table.
425 size_t addString(StringRef S) { return StringTable.addString(S); }
426
427 /// Get the type id for a particular DIType.
429 assert(Ty && "Invalid null Type");
430 assert(DIToIdMap.find(Ty) != DIToIdMap.end() &&
431 "DIType not added in the BDIToIdMap");
432 return DIToIdMap[Ty];
433 }
434
435 /// Process beginning of an instruction.
436 void beginInstruction(const MachineInstr *MI) override;
437
438 /// Complete all the types and emit the BTF sections.
439 void endModule() override;
440};
441
442} // end namespace llvm
443
444#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
This file contains the layout of .BTF and .BTF.ext ELF sections.
IRTranslator LLVM IR MI
Annotations lets you mark points and ranges inside source code, for tests:
Definition Annotations.h:67
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
This class is intended to be used as a driving class for all asm writers.
Definition AsmPrinter.h:91
Collect and emit BTF information.
Definition BTFDebug.h:295
void endFunctionImpl(const MachineFunction *MF) override
Post process after all instructions in this function are processed.
BTFDebug(AsmPrinter *AP)
Definition BTFDebug.cpp:795
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
bool InstLower(const MachineInstr *MI, MCInst &OutMI)
Emit proper patchable instructions.
size_t addString(StringRef S)
Add string to the string table.
Definition BTFDebug.h:425
uint32_t getArrayIndexTypeId()
Get the special array index type id.
Definition BTFDebug.h:419
uint32_t getTypeId(const DIType *Ty)
Get the type id for a particular DIType.
Definition BTFDebug.h:428
void endModule() override
Complete all the types and emit the BTF sections.
void beginFunctionImpl(const MachineFunction *MF) override
Gather pre-function debug information.
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:707
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:702
void addDataSecEntry(uint32_t Id, const MCSymbol *Sym, uint32_t Size)
Definition BTFDebug.h:198
BTFKindDataSec(AsmPrinter *AsmPrt, std::string SecName)
Definition BTFDebug.cpp:695
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:195
std::string getName()
Definition BTFDebug.h:201
BTFKindVar(StringRef VarName, uint32_t TypeId, uint32_t VarInfo)
Definition BTFDebug.cpp:678
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:690
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:182
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:686
String table.
Definition BTFDebug.h:252
uint32_t getSize()
Definition BTFDebug.h:264
uint32_t addString(StringRef S)
Add a string to the string table and returns its offset in the table.
Definition BTFDebug.cpp:781
std::vector< std::string > & getTable()
Definition BTFDebug.h:265
BTFTypeArray(uint32_t ElemTypeId, uint32_t NumElems)
Definition BTFDebug.cpp:481
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:504
void completeType(BTFDebug &BDebug) override
Represent a BTF array.
Definition BTFDebug.cpp:492
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:120
void setId(uint32_t Id)
Definition BTFDebug.h:49
struct BTF::CommonType BTFType
Definition BTFDebug.h:44
virtual uint32_t getSize()
Get the size of this BTF type entry.
Definition BTFDebug.h:53
virtual void completeType(BTFDebug &BDebug)
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.h:57
virtual ~BTFTypeBase()=default
virtual void emitType(MCStreamer &OS)
Emit types for this BTF type entry.
Definition BTFDebug.cpp:253
uint32_t getId()
Definition BTFDebug.h:50
uint32_t roundupToBytes(uint32_t NumBits)
Definition BTFDebug.h:51
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:741
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:222
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:749
BTFTypeDeclTag(uint32_t BaseTypeId, int ComponentId, StringRef Tag)
Definition BTFDebug.cpp:732
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:296
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:335
void setPointeeType(uint32_t PointeeType)
Definition BTFDebug.cpp:337
BTFTypeDerived(const DIDerivedType *Ty, unsigned Tag, bool NeedsFixup)
Definition BTFDebug.cpp:262
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:234
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:446
BTFTypeEnum64(const DICompositeType *ETy, uint32_t NumValues, bool IsSigned)
Definition BTFDebug.cpp:439
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:470
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:407
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:107
BTFTypeEnum(const DICompositeType *ETy, uint32_t NumValues, bool IsSigned)
Definition BTFDebug.cpp:400
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:431
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:724
BTFTypeFloat(uint32_t SizeInBits, StringRef TypeName)
Definition BTFDebug.cpp:717
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:157
BTFTypeFuncProto(const DISubroutineType *STy, uint32_t NumParams, const SmallDenseMap< uint32_t, StringRef > &FuncArgNames, bool UseFilteredParams=false, ArrayRef< uint32_t > AliveParamIndices={}, bool VoidReturn=false)
The Func kind represents both subprogram and pointee of function pointers.
Definition BTFDebug.cpp:601
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:613
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:652
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:676
BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId, uint32_t Scope)
Definition BTFDebug.cpp:660
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:668
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:170
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:356
BTFTypeFwd(StringRef Name, bool IsUnion)
Represent a struct/union forward declaration.
Definition BTFDebug.cpp:342
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:348
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:394
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:95
BTFTypeInt(uint32_t Encoding, uint32_t SizeInBits, uint32_t OffsetInBits, StringRef TypeName)
Definition BTFDebug.cpp:358
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:386
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:584
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:134
BTFTypeStruct(const DICompositeType *STy, bool IsStruct, bool HasBitField, uint32_t NumMembers)
Represent either a struct or a union.
Definition BTFDebug.cpp:512
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:520
std::string getName()
Definition BTFDebug.cpp:594
void completeType(BTFDebug &BDebug) override
Complete BTF type generation after all related DebugInfo types have been visited so their BTF type id...
Definition BTFDebug.cpp:767
BTFTypeTypeTag(uint32_t NextTypeId, StringRef Tag)
Definition BTFDebug.cpp:754
This is an important base class in LLVM.
Definition Constant.h:43
Basic type, like 'int' or 'float'.
Subprogram description. Uses SubclassData1.
Type array for a subprogram.
Base class for types.
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Streaming machine code generation interface.
Definition MCStreamer.h:222
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:136
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
@ BTFEnum64Size
Definition BTF.h:66
@ BTFArraySize
Definition BTF.h:64
@ BTFMemberSize
Definition BTF.h:67
@ BTFEnumSize
Definition BTF.h:65
@ BTFParamSize
Definition BTF.h:68
@ CommonTypeSize
Definition BTF.h:63
@ BTFDataSecVarSize
Definition BTF.h:69
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Represent one field relocation.
Definition BTFDebug.h:287
uint32_t RelocKind
What to patch the instruction.
Definition BTFDebug.h:291
const MCSymbol * Label
MCSymbol identifying insn for the reloc.
Definition BTFDebug.h:288
uint32_t TypeID
Type ID.
Definition BTFDebug.h:289
uint32_t OffsetNameOff
The string to traverse types.
Definition BTFDebug.h:290
Represent one func and its type id.
Definition BTFDebug.h:272
uint32_t TypeId
Type id referring to .BTF type section.
Definition BTFDebug.h:274
const MCSymbol * Label
Func MCSymbol.
Definition BTFDebug.h:273
Represent one line info.
Definition BTFDebug.h:278
uint32_t LineOff
line offset in the .BTF string table
Definition BTFDebug.h:281
MCSymbol * Label
MCSymbol identifying insn for the lineinfo.
Definition BTFDebug.h:279
uint32_t ColumnNum
the column number
Definition BTFDebug.h:283
uint32_t FileNameOff
file name offset in the .BTF string table
Definition BTFDebug.h:280
uint32_t LineNum
the line number
Definition BTFDebug.h:282
BTF_KIND_ARRAY is followed by one "struct BTFArray".
Definition BTF.h:169
The BTF common type definition.
Definition BTF.h:107