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/ArrayRef.h"
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/StringMap.h"
22#include <cstdint>
23#include <map>
24#include <set>
25
26namespace llvm {
27
28class AsmPrinter;
29class BTFDebug;
30class DIType;
31class GlobalVariable;
32class MachineFunction;
33class MachineInstr;
34class MachineOperand;
35class MCInst;
36class MCStreamer;
37class MCSymbol;
38
39/// The base class for BTF type generation.
41protected:
46
47public:
49 virtual ~BTFTypeBase() = default;
50 void setId(uint32_t Id) { this->Id = Id; }
51 uint32_t getId() { return Id; }
52 uint32_t roundupToBytes(uint32_t NumBits) { return (NumBits + 7) >> 3; }
53 /// Get the size of this BTF type entry.
54 virtual uint32_t getSize() { return BTF::CommonTypeSize; }
55 /// Complete BTF type generation after all related DebugInfo types
56 /// have been visited so their BTF type id's are available
57 /// for cross referece.
58 virtual void completeType(BTFDebug &BDebug) {}
59 /// Emit types for this BTF type entry.
60 virtual void emitType(MCStreamer &OS);
61};
62
63/// Handle several derived types include pointer, const,
64/// volatile, typedef and restrict.
66 const DIDerivedType *DTy;
67 bool NeedsFixup;
68 StringRef Name;
69
70public:
71 BTFTypeDerived(const DIDerivedType *Ty, unsigned Tag, bool NeedsFixup);
72 BTFTypeDerived(unsigned NextTypeId, unsigned Tag, StringRef Name);
73 void completeType(BTFDebug &BDebug) override;
74 void emitType(MCStreamer &OS) override;
75 void setPointeeType(uint32_t PointeeType);
76};
77
78/// Handle struct or union forward declaration.
79class BTFTypeFwd : public BTFTypeBase {
80 StringRef Name;
81
82public:
83 BTFTypeFwd(StringRef Name, bool IsUnion);
84 void completeType(BTFDebug &BDebug) override;
85 void emitType(MCStreamer &OS) override;
86};
87
88/// Handle int type.
89class BTFTypeInt : public BTFTypeBase {
90 StringRef Name;
91 uint32_t IntVal; ///< Encoding, offset, bits
92
93public:
94 BTFTypeInt(uint32_t Encoding, uint32_t SizeInBits, uint32_t OffsetInBits,
95 StringRef TypeName);
96 uint32_t getSize() override { return BTFTypeBase::getSize() + sizeof(uint32_t); }
97 void completeType(BTFDebug &BDebug) override;
98 void emitType(MCStreamer &OS) override;
99};
100
101/// Handle enumerate type.
102class BTFTypeEnum : public BTFTypeBase {
103 const DICompositeType *ETy;
104 std::vector<struct BTF::BTFEnum> EnumValues;
105
106public:
107 BTFTypeEnum(const DICompositeType *ETy, uint32_t NumValues, bool IsSigned);
108 uint32_t getSize() override {
109 return BTFTypeBase::getSize() + EnumValues.size() * BTF::BTFEnumSize;
110 }
111 void completeType(BTFDebug &BDebug) override;
112 void emitType(MCStreamer &OS) override;
113};
114
115/// Handle array type.
116class BTFTypeArray : public BTFTypeBase {
117 struct BTF::BTFArray ArrayInfo;
118
119public:
120 BTFTypeArray(uint32_t ElemTypeId, uint32_t NumElems);
122 void completeType(BTFDebug &BDebug) override;
123 void emitType(MCStreamer &OS) override;
124};
125
126/// Handle struct/union type.
128 const DICompositeType *STy;
129 std::vector<const DINode *> Elements;
130 bool HasBitField;
131 std::vector<struct BTF::BTFMember> Members;
132
133public:
135 bool IsStruct, bool HasBitField, uint32_t NumMembers);
136 uint32_t getSize() override {
137 return BTFTypeBase::getSize() + Members.size() * BTF::BTFMemberSize;
138 }
139 void completeType(BTFDebug &BDebug) override;
140 void emitType(MCStreamer &OS) override;
141 std::string getName();
142};
143
144/// Handle function pointer.
146 const DISubroutineType *STy;
148 SmallVector<uint32_t, 8> AliveParamIndices;
149 bool UseFilteredParams = false;
150 std::vector<struct BTF::BTFParam> Parameters;
151 bool VoidReturn = false;
152
153public:
154 BTFTypeFuncProto(const DISubroutineType *STy, uint32_t NumParams,
155 const SmallDenseMap<uint32_t, StringRef> &FuncArgNames,
156 bool UseFilteredParams = false,
157 ArrayRef<uint32_t> AliveParamIndices = {},
158 bool VoidReturn = false);
159 uint32_t getSize() override {
160 return BTFTypeBase::getSize() + Parameters.size() * BTF::BTFParamSize;
161 }
162 void completeType(BTFDebug &BDebug) override;
163 void emitType(MCStreamer &OS) override;
164};
165
166/// Handle subprogram
167class BTFTypeFunc : public BTFTypeBase {
168 StringRef Name;
169
170public:
171 BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId, uint32_t Scope);
172 uint32_t getSize() override { return BTFTypeBase::getSize(); }
173 void completeType(BTFDebug &BDebug) override;
174 void emitType(MCStreamer &OS) override;
175};
176
177/// Handle variable instances
178class BTFKindVar : public BTFTypeBase {
179 StringRef Name;
180 uint32_t Info;
181
182public:
183 BTFKindVar(StringRef VarName, uint32_t TypeId, uint32_t VarInfo);
184 uint32_t getSize() override { return BTFTypeBase::getSize() + 4; }
185 void completeType(BTFDebug &BDebug) override;
186 void emitType(MCStreamer &OS) override;
187};
188
189/// Handle data sections
191 AsmPrinter *Asm;
192 std::string Name;
193 std::vector<std::tuple<uint32_t, const MCSymbol *, uint32_t>> Vars;
194
195public:
196 BTFKindDataSec(AsmPrinter *AsmPrt, std::string SecName);
197 uint32_t getSize() override {
198 return BTFTypeBase::getSize() + BTF::BTFDataSecVarSize * Vars.size();
199 }
201 Vars.push_back(std::make_tuple(Id, Sym, Size));
202 }
203 std::string getName() { return Name; }
204 void completeType(BTFDebug &BDebug) override;
205 void emitType(MCStreamer &OS) override;
206};
207
208/// Handle binary floating point type.
209class BTFTypeFloat : public BTFTypeBase {
210 StringRef Name;
211
212public:
213 BTFTypeFloat(uint32_t SizeInBits, StringRef TypeName);
214 void completeType(BTFDebug &BDebug) override;
215};
216
217/// Handle decl tags.
219 uint32_t Info;
220 StringRef Tag;
221
222public:
223 BTFTypeDeclTag(uint32_t BaseTypeId, int ComponentId, StringRef Tag);
224 uint32_t getSize() override { return BTFTypeBase::getSize() + 4; }
225 void completeType(BTFDebug &BDebug) override;
226 void emitType(MCStreamer &OS) override;
227};
228
229/// Handle 64-bit enumerate type.
231 const DICompositeType *ETy;
232 std::vector<struct BTF::BTFEnum64> EnumValues;
233
234public:
235 BTFTypeEnum64(const DICompositeType *ETy, uint32_t NumValues, bool IsSigned);
236 uint32_t getSize() override {
237 return BTFTypeBase::getSize() + EnumValues.size() * BTF::BTFEnum64Size;
238 }
239 void completeType(BTFDebug &BDebug) override;
240 void emitType(MCStreamer &OS) override;
241};
242
244 const DIDerivedType *DTy;
245 StringRef Tag;
246
247public:
248 BTFTypeTypeTag(uint32_t NextTypeId, StringRef Tag);
249 BTFTypeTypeTag(const DIDerivedType *DTy, StringRef Tag);
250 void completeType(BTFDebug &BDebug) override;
251};
252
253/// String table.
255 /// String table size in bytes.
256 uint32_t Size;
257 /// A mapping from string table offset to the index
258 /// of the Table. It is used to avoid putting
259 /// duplicated strings in the table.
260 std::map<uint32_t, uint32_t> OffsetToIdMap;
261 /// A vector of strings to represent the string table.
262 std::vector<std::string> Table;
263
264public:
265 BTFStringTable() : Size(0) {}
266 uint32_t getSize() { return Size; }
267 std::vector<std::string> &getTable() { return Table; }
268 /// Add a string to the string table and returns its offset
269 /// in the table.
271};
272
273/// Represent one func and its type id.
275 const MCSymbol *Label; ///< Func MCSymbol
276 uint32_t TypeId; ///< Type id referring to .BTF type section
277};
278
279/// Represent one line info.
281 MCSymbol *Label; ///< MCSymbol identifying insn for the lineinfo
282 uint32_t FileNameOff; ///< file name offset in the .BTF string table
283 uint32_t LineOff; ///< line offset in the .BTF string table
284 uint32_t LineNum; ///< the line number
285 uint32_t ColumnNum; ///< the column number
286};
287
288/// Represent one field relocation.
290 const MCSymbol *Label; ///< MCSymbol identifying insn for the reloc
291 uint32_t TypeID; ///< Type ID
292 uint32_t OffsetNameOff; ///< The string to traverse types
293 uint32_t RelocKind; ///< What to patch the instruction
294};
295
296/// Collect and emit BTF information.
298 MCStreamer &OS;
299 bool SkipInstruction;
300 bool LineInfoGenerated;
301 uint32_t SecNameOff;
302 uint32_t ArrayIndexTypeId;
303 bool MapDefNotCollected;
304 BTFStringTable StringTable;
305 std::vector<std::unique_ptr<BTFTypeBase>> TypeEntries;
307 std::map<uint32_t, std::vector<BTFFuncInfo>> FuncInfoTable;
308 std::map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable;
309 std::map<uint32_t, std::vector<BTFFieldReloc>> FieldRelocTable;
311 std::map<std::string, std::unique_ptr<BTFKindDataSec>, std::less<>>
312 DataSecEntries;
313 std::vector<BTFTypeStruct *> StructTypes;
314 std::map<const GlobalVariable *, std::pair<int64_t, uint32_t>> PatchImms;
315 std::map<const DICompositeType *,
316 std::vector<std::pair<const DIDerivedType *, BTFTypeDerived *>>>
317 FixupDerivedTypes;
318 std::set<const Function *>ProtoFunctions;
319
320 /// Add types to TypeEntries.
321 /// @{
322 /// Add types to TypeEntries and DIToIdMap.
323 uint32_t addType(std::unique_ptr<BTFTypeBase> TypeEntry, const DIType *Ty);
324 /// Add types to TypeEntries only and return type id.
325 uint32_t addType(std::unique_ptr<BTFTypeBase> TypeEntry);
326 /// @}
327
328 /// IR type visiting functions.
329 /// @{
330 void visitTypeEntry(const DIType *Ty);
331 void visitTypeEntry(const DIType *Ty, uint32_t &TypeId, bool CheckPointer,
332 bool SeenPointer);
333 void visitBasicType(const DIBasicType *BTy, uint32_t &TypeId);
334 void
335 visitSubroutineType(const DISubroutineType *STy, bool ForSubprog,
336 const SmallDenseMap<uint32_t, StringRef> &FuncArgNames,
337 uint32_t &TypeId, bool VoidReturn = false);
338 void visitFwdDeclType(const DICompositeType *CTy, bool IsUnion,
339 uint32_t &TypeId);
340 void visitCompositeType(const DICompositeType *CTy, uint32_t &TypeId);
341 void visitStructType(const DICompositeType *STy, bool IsStruct,
342 uint32_t &TypeId);
343 void visitArrayType(const DICompositeType *ATy, uint32_t &TypeId);
344 void visitEnumType(const DICompositeType *ETy, uint32_t &TypeId);
345 void visitDerivedType(const DIDerivedType *DTy, uint32_t &TypeId,
346 bool CheckPointer, bool SeenPointer);
347 void visitMapDefType(const DIType *Ty, uint32_t &TypeId);
348 /// @}
349
350 /// Check whether the type is a forward declaration candidate or not.
351 bool IsForwardDeclCandidate(const DIType *Base);
352
353 /// Get the file content for the subprogram. Certain lines of the file
354 /// later may be put into string table and referenced by line info.
355 std::string populateFileContent(const DIFile *File);
356
357 /// Construct a line info.
358 void constructLineInfo(MCSymbol *Label, const DIFile *File, uint32_t Line,
359 uint32_t Column);
360
361 /// Generate types and variables for globals.
362 void processGlobals(bool ProcessingMapDef);
363
364 /// Process global variable initializer in pursuit for function
365 /// pointers.
366 void processGlobalInitializer(const Constant *C);
367
368 /// Generate types for function prototypes.
369 void processFuncPrototypes(const Function *);
370
371 /// Generate types for decl annotations.
372 void processDeclAnnotations(DINodeArray Annotations, uint32_t BaseTypeId,
373 int ComponentId);
374
375 /// Generate types for DISubprogram and it's arguments.
376 uint32_t processDISubprogram(
377 const DISubprogram *SP, uint32_t ProtoTypeId, uint8_t Scope,
378 const SmallDenseMap<uint32_t, uint32_t> *ArgIndexMap = nullptr);
379
380 /// Generate BTF type_tag's. If BaseTypeId is nonnegative, the last
381 /// BTF type_tag in the chain points to BaseTypeId. Otherwise, it points to
382 /// the base type of DTy. Return the type id of the first BTF type_tag
383 /// in the chain. If no type_tag's are generated, a negative value
384 /// is returned.
385 int genBTFTypeTags(const DIDerivedType *DTy, int BaseTypeId);
386
387 /// Generate one field relocation record.
388 void generatePatchImmReloc(const MCSymbol *ORSym, uint32_t RootId,
389 const GlobalVariable *, bool IsAma);
390
391 /// Populating unprocessed type on demand.
392 unsigned populateType(const DIType *Ty);
393
394 /// Process global variables referenced by relocation instructions
395 /// and extern function references.
396 void processGlobalValue(const MachineOperand &MO);
397
398 /// Emit common header of .BTF and .BTF.ext sections.
399 void emitCommonHeader();
400
401 /// Emit the .BTF section.
402 void emitBTFSection();
403
404 /// Emit the .BTF.ext section.
405 void emitBTFExtSection();
406
407protected:
408 /// Gather pre-function debug information.
409 void beginFunctionImpl(const MachineFunction *MF) override;
410
411 /// Post process after all instructions in this function are processed.
412 void endFunctionImpl(const MachineFunction *MF) override;
413
414public:
415 BTFDebug(AsmPrinter *AP);
416
417 ///
418 bool InstLower(const MachineInstr *MI, MCInst &OutMI);
419
420 /// Get the special array index type id.
422 assert(ArrayIndexTypeId);
423 return ArrayIndexTypeId;
424 }
425
426 /// Add string to the string table.
427 size_t addString(StringRef S) { return StringTable.addString(S); }
428
429 /// Get the type id for a particular DIType.
431 assert(Ty && "Invalid null Type");
432 assert(DIToIdMap.find(Ty) != DIToIdMap.end() &&
433 "DIType not added in the BDIToIdMap");
434 return DIToIdMap[Ty];
435 }
436
437 /// Process beginning of an instruction.
438 void beginInstruction(const MachineInstr *MI) override;
439
440 /// Complete all the types and emit the BTF sections.
441 void endModule() override;
442};
443
444} // end namespace llvm
445
446#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.
This file defines the DenseMap class.
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:297
void endFunctionImpl(const MachineFunction *MF) override
Post process after all instructions in this function are processed.
BTFDebug(AsmPrinter *AP)
Definition BTFDebug.cpp:808
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:427
uint32_t getArrayIndexTypeId()
Get the special array index type id.
Definition BTFDebug.h:421
uint32_t getTypeId(const DIType *Ty)
Get the type id for a particular DIType.
Definition BTFDebug.h:430
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:720
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:715
void addDataSecEntry(uint32_t Id, const MCSymbol *Sym, uint32_t Size)
Definition BTFDebug.h:200
BTFKindDataSec(AsmPrinter *AsmPrt, std::string SecName)
Definition BTFDebug.cpp:708
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:197
std::string getName()
Definition BTFDebug.h:203
BTFKindVar(StringRef VarName, uint32_t TypeId, uint32_t VarInfo)
Definition BTFDebug.cpp:691
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:703
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:184
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:699
String table.
Definition BTFDebug.h:254
uint32_t getSize()
Definition BTFDebug.h:266
uint32_t addString(StringRef S)
Add a string to the string table and returns its offset in the table.
Definition BTFDebug.cpp:794
std::vector< std::string > & getTable()
Definition BTFDebug.h:267
BTFTypeArray(uint32_t ElemTypeId, uint32_t NumElems)
Definition BTFDebug.cpp:493
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:516
void completeType(BTFDebug &BDebug) override
Represent a BTF array.
Definition BTFDebug.cpp:504
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:121
void setId(uint32_t Id)
Definition BTFDebug.h:50
struct BTF::CommonType BTFType
Definition BTFDebug.h:45
virtual uint32_t getSize()
Get the size of this BTF type entry.
Definition BTFDebug.h:54
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:58
virtual ~BTFTypeBase()=default
virtual void emitType(MCStreamer &OS)
Emit types for this BTF type entry.
Definition BTFDebug.cpp:255
uint32_t getId()
Definition BTFDebug.h:51
uint32_t roundupToBytes(uint32_t NumBits)
Definition BTFDebug.h:52
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:754
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:224
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:762
BTFTypeDeclTag(uint32_t BaseTypeId, int ComponentId, StringRef Tag)
Definition BTFDebug.cpp:745
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:308
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:347
void setPointeeType(uint32_t PointeeType)
Definition BTFDebug.cpp:349
BTFTypeDerived(const DIDerivedType *Ty, unsigned Tag, bool NeedsFixup)
Definition BTFDebug.cpp:264
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:236
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:458
BTFTypeEnum64(const DICompositeType *ETy, uint32_t NumValues, bool IsSigned)
Definition BTFDebug.cpp:451
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:482
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:419
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:108
BTFTypeEnum(const DICompositeType *ETy, uint32_t NumValues, bool IsSigned)
Definition BTFDebug.cpp:412
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:443
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:737
BTFTypeFloat(uint32_t SizeInBits, StringRef TypeName)
Definition BTFDebug.cpp:730
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:159
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:614
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:626
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:665
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:689
BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId, uint32_t Scope)
Definition BTFDebug.cpp:673
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:681
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:172
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:368
BTFTypeFwd(StringRef Name, bool IsUnion)
Represent a struct/union forward declaration.
Definition BTFDebug.cpp:354
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:360
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:406
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:96
BTFTypeInt(uint32_t Encoding, uint32_t SizeInBits, uint32_t OffsetInBits, StringRef TypeName)
Definition BTFDebug.cpp:370
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:398
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition BTFDebug.cpp:597
BTFTypeStruct(const DICompositeType *STy, ArrayRef< const DINode * > Elements, bool IsStruct, bool HasBitField, uint32_t NumMembers)
Represent either a struct or a union.
Definition BTFDebug.cpp:524
uint32_t getSize() override
Get the size of this BTF type entry.
Definition BTFDebug.h:136
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:534
std::string getName()
Definition BTFDebug.cpp:607
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:780
BTFTypeTypeTag(uint32_t NextTypeId, StringRef Tag)
Definition BTFDebug.cpp:767
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:128
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:289
uint32_t RelocKind
What to patch the instruction.
Definition BTFDebug.h:293
const MCSymbol * Label
MCSymbol identifying insn for the reloc.
Definition BTFDebug.h:290
uint32_t TypeID
Type ID.
Definition BTFDebug.h:291
uint32_t OffsetNameOff
The string to traverse types.
Definition BTFDebug.h:292
Represent one func and its type id.
Definition BTFDebug.h:274
uint32_t TypeId
Type id referring to .BTF type section.
Definition BTFDebug.h:276
const MCSymbol * Label
Func MCSymbol.
Definition BTFDebug.h:275
Represent one line info.
Definition BTFDebug.h:280
uint32_t LineOff
line offset in the .BTF string table
Definition BTFDebug.h:283
MCSymbol * Label
MCSymbol identifying insn for the lineinfo.
Definition BTFDebug.h:281
uint32_t ColumnNum
the column number
Definition BTFDebug.h:285
uint32_t FileNameOff
file name offset in the .BTF string table
Definition BTFDebug.h:282
uint32_t LineNum
the line number
Definition BTFDebug.h:284
BTF_KIND_ARRAY is followed by one "struct BTFArray".
Definition BTF.h:169
The BTF common type definition.
Definition BTF.h:107