LLVM  14.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"
19 #include <cstdint>
20 #include <map>
21 #include <set>
22 #include <unordered_map>
23 #include "BTF.h"
24 
25 namespace llvm {
26 
27 class AsmPrinter;
28 class BTFDebug;
29 class DIType;
30 class GlobalVariable;
31 class MachineFunction;
32 class MachineInstr;
33 class MachineOperand;
34 class MCInst;
35 class MCStreamer;
36 class MCSymbol;
37 
38 /// The base class for BTF type generation.
39 class BTFTypeBase {
40 protected:
41  uint8_t Kind;
45 
46 public:
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.
64 class BTFTypeDerived : public BTFTypeBase {
65  const DIDerivedType *DTy;
66  bool NeedsFixup;
67  StringRef Name;
68 
69 public:
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.
78 class BTFTypeFwd : public BTFTypeBase {
79  StringRef Name;
80 
81 public:
82  BTFTypeFwd(StringRef Name, bool IsUnion);
83  void completeType(BTFDebug &BDebug) override;
84  void emitType(MCStreamer &OS) override;
85 };
86 
87 /// Handle int type.
88 class BTFTypeInt : public BTFTypeBase {
89  StringRef Name;
90  uint32_t IntVal; ///< Encoding, offset, bits
91 
92 public:
93  BTFTypeInt(uint32_t Encoding, uint32_t SizeInBits, uint32_t OffsetInBits,
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.
101 class BTFTypeEnum : public BTFTypeBase {
102  const DICompositeType *ETy;
103  std::vector<struct BTF::BTFEnum> EnumValues;
104 
105 public:
106  BTFTypeEnum(const DICompositeType *ETy, uint32_t NumValues);
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.
115 class BTFTypeArray : public BTFTypeBase {
116  struct BTF::BTFArray ArrayInfo;
117 
118 public:
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.
126 class BTFTypeStruct : public BTFTypeBase {
127  const DICompositeType *STy;
128  bool HasBitField;
129  std::vector<struct BTF::BTFMember> Members;
130 
131 public:
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;
145  std::unordered_map<uint32_t, StringRef> FuncArgNames;
146  std::vector<struct BTF::BTFParam> Parameters;
147 
148 public:
149  BTFTypeFuncProto(const DISubroutineType *STy, uint32_t NumParams,
150  const std::unordered_map<uint32_t, StringRef> &FuncArgNames);
151  uint32_t getSize() override {
152  return BTFTypeBase::getSize() + Parameters.size() * BTF::BTFParamSize;
153  }
154  void completeType(BTFDebug &BDebug) override;
155  void emitType(MCStreamer &OS) override;
156 };
157 
158 /// Handle subprogram
159 class BTFTypeFunc : public BTFTypeBase {
160  StringRef Name;
161 
162 public:
163  BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId, uint32_t Scope);
164  uint32_t getSize() override { return BTFTypeBase::getSize(); }
165  void completeType(BTFDebug &BDebug) override;
166  void emitType(MCStreamer &OS) override;
167 };
168 
169 /// Handle variable instances
170 class BTFKindVar : public BTFTypeBase {
171  StringRef Name;
172  uint32_t Info;
173 
174 public:
175  BTFKindVar(StringRef VarName, uint32_t TypeId, uint32_t VarInfo);
176  uint32_t getSize() override { return BTFTypeBase::getSize() + 4; }
177  void completeType(BTFDebug &BDebug) override;
178  void emitType(MCStreamer &OS) override;
179 };
180 
181 /// Handle data sections
182 class BTFKindDataSec : public BTFTypeBase {
183  AsmPrinter *Asm;
184  std::string Name;
185  std::vector<std::tuple<uint32_t, const MCSymbol *, uint32_t>> Vars;
186 
187 public:
188  BTFKindDataSec(AsmPrinter *AsmPrt, std::string SecName);
189  uint32_t getSize() override {
190  return BTFTypeBase::getSize() + BTF::BTFDataSecVarSize * Vars.size();
191  }
193  Vars.push_back(std::make_tuple(Id, Sym, Size));
194  }
195  std::string getName() { return Name; }
196  void completeType(BTFDebug &BDebug) override;
197  void emitType(MCStreamer &OS) override;
198 };
199 
200 /// Handle binary floating point type.
201 class BTFTypeFloat : public BTFTypeBase {
202  StringRef Name;
203 
204 public:
206  void completeType(BTFDebug &BDebug) override;
207 };
208 
209 /// Handle decl tags.
210 class BTFTypeDeclTag : public BTFTypeBase {
211  uint32_t Info;
212  StringRef Tag;
213 
214 public:
215  BTFTypeDeclTag(uint32_t BaseTypeId, int ComponentId, StringRef Tag);
216  uint32_t getSize() override { return BTFTypeBase::getSize() + 4; }
217  void completeType(BTFDebug &BDebug) override;
218  void emitType(MCStreamer &OS) override;
219 };
220 
221 class BTFTypeTypeTag : public BTFTypeBase {
222  const DIDerivedType *DTy;
223  StringRef Tag;
224 
225 public:
226  BTFTypeTypeTag(uint32_t NextTypeId, StringRef Tag);
227  BTFTypeTypeTag(const DIDerivedType *DTy, StringRef Tag);
228  void completeType(BTFDebug &BDebug) override;
229 };
230 
231 /// String table.
233  /// String table size in bytes.
234  uint32_t Size;
235  /// A mapping from string table offset to the index
236  /// of the Table. It is used to avoid putting
237  /// duplicated strings in the table.
238  std::map<uint32_t, uint32_t> OffsetToIdMap;
239  /// A vector of strings to represent the string table.
240  std::vector<std::string> Table;
241 
242 public:
243  BTFStringTable() : Size(0) {}
244  uint32_t getSize() { return Size; }
245  std::vector<std::string> &getTable() { return Table; }
246  /// Add a string to the string table and returns its offset
247  /// in the table.
249 };
250 
251 /// Represent one func and its type id.
252 struct BTFFuncInfo {
253  const MCSymbol *Label; ///< Func MCSymbol
254  uint32_t TypeId; ///< Type id referring to .BTF type section
255 };
256 
257 /// Represent one line info.
258 struct BTFLineInfo {
259  MCSymbol *Label; ///< MCSymbol identifying insn for the lineinfo
260  uint32_t FileNameOff; ///< file name offset in the .BTF string table
261  uint32_t LineOff; ///< line offset in the .BTF string table
262  uint32_t LineNum; ///< the line number
263  uint32_t ColumnNum; ///< the column number
264 };
265 
266 /// Represent one field relocation.
268  const MCSymbol *Label; ///< MCSymbol identifying insn for the reloc
269  uint32_t TypeID; ///< Type ID
270  uint32_t OffsetNameOff; ///< The string to traverse types
271  uint32_t RelocKind; ///< What to patch the instruction
272 };
273 
274 /// Collect and emit BTF information.
275 class BTFDebug : public DebugHandlerBase {
276  MCStreamer &OS;
277  bool SkipInstruction;
278  bool LineInfoGenerated;
279  uint32_t SecNameOff;
280  uint32_t ArrayIndexTypeId;
281  bool MapDefNotCollected;
282  BTFStringTable StringTable;
283  std::vector<std::unique_ptr<BTFTypeBase>> TypeEntries;
284  std::unordered_map<const DIType *, uint32_t> DIToIdMap;
285  std::map<uint32_t, std::vector<BTFFuncInfo>> FuncInfoTable;
286  std::map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable;
287  std::map<uint32_t, std::vector<BTFFieldReloc>> FieldRelocTable;
289  std::map<std::string, std::unique_ptr<BTFKindDataSec>> DataSecEntries;
290  std::vector<BTFTypeStruct *> StructTypes;
291  std::map<const GlobalVariable *, std::pair<int64_t, uint32_t>> PatchImms;
292  std::map<StringRef, std::pair<bool, std::vector<BTFTypeDerived *>>>
293  FixupDerivedTypes;
294  std::set<const Function *>ProtoFunctions;
295 
296  /// Add types to TypeEntries.
297  /// @{
298  /// Add types to TypeEntries and DIToIdMap.
299  uint32_t addType(std::unique_ptr<BTFTypeBase> TypeEntry, const DIType *Ty);
300  /// Add types to TypeEntries only and return type id.
301  uint32_t addType(std::unique_ptr<BTFTypeBase> TypeEntry);
302  /// @}
303 
304  /// IR type visiting functions.
305  /// @{
306  void visitTypeEntry(const DIType *Ty);
307  void visitTypeEntry(const DIType *Ty, uint32_t &TypeId, bool CheckPointer,
308  bool SeenPointer);
309  void visitBasicType(const DIBasicType *BTy, uint32_t &TypeId);
310  void visitSubroutineType(
311  const DISubroutineType *STy, bool ForSubprog,
312  const std::unordered_map<uint32_t, StringRef> &FuncArgNames,
313  uint32_t &TypeId);
314  void visitFwdDeclType(const DICompositeType *CTy, bool IsUnion,
315  uint32_t &TypeId);
316  void visitCompositeType(const DICompositeType *CTy, uint32_t &TypeId);
317  void visitStructType(const DICompositeType *STy, bool IsStruct,
318  uint32_t &TypeId);
319  void visitArrayType(const DICompositeType *ATy, uint32_t &TypeId);
320  void visitEnumType(const DICompositeType *ETy, uint32_t &TypeId);
321  void visitDerivedType(const DIDerivedType *DTy, uint32_t &TypeId,
322  bool CheckPointer, bool SeenPointer);
323  void visitMapDefType(const DIType *Ty, uint32_t &TypeId);
324  /// @}
325 
326  /// Get the file content for the subprogram. Certain lines of the file
327  /// later may be put into string table and referenced by line info.
328  std::string populateFileContent(const DISubprogram *SP);
329 
330  /// Construct a line info.
331  void constructLineInfo(const DISubprogram *SP, MCSymbol *Label, uint32_t Line,
332  uint32_t Column);
333 
334  /// Generate types and variables for globals.
335  void processGlobals(bool ProcessingMapDef);
336 
337  /// Generate types for function prototypes.
338  void processFuncPrototypes(const Function *);
339 
340  /// Generate types for decl annotations.
341  void processDeclAnnotations(DINodeArray Annotations, uint32_t BaseTypeId,
342  int ComponentId);
343 
344  /// Generate one field relocation record.
345  void generatePatchImmReloc(const MCSymbol *ORSym, uint32_t RootId,
346  const GlobalVariable *, bool IsAma);
347 
348  /// Populating unprocessed type on demand.
349  unsigned populateType(const DIType *Ty);
350 
351  /// Process global variables referenced by relocation instructions
352  /// and extern function references.
353  void processGlobalValue(const MachineOperand &MO);
354 
355  /// Emit common header of .BTF and .BTF.ext sections.
356  void emitCommonHeader();
357 
358  /// Emit the .BTF section.
359  void emitBTFSection();
360 
361  /// Emit the .BTF.ext section.
362  void emitBTFExtSection();
363 
364 protected:
365  /// Gather pre-function debug information.
366  void beginFunctionImpl(const MachineFunction *MF) override;
367 
368  /// Post process after all instructions in this function are processed.
369  void endFunctionImpl(const MachineFunction *MF) override;
370 
371 public:
372  BTFDebug(AsmPrinter *AP);
373 
374  ///
375  bool InstLower(const MachineInstr *MI, MCInst &OutMI);
376 
377  /// Get the special array index type id.
379  assert(ArrayIndexTypeId);
380  return ArrayIndexTypeId;
381  }
382 
383  /// Add string to the string table.
384  size_t addString(StringRef S) { return StringTable.addString(S); }
385 
386  /// Get the type id for a particular DIType.
387  uint32_t getTypeId(const DIType *Ty) {
388  assert(Ty && "Invalid null Type");
389  assert(DIToIdMap.find(Ty) != DIToIdMap.end() &&
390  "DIType not added in the BDIToIdMap");
391  return DIToIdMap[Ty];
392  }
393 
394  void setSymbolSize(const MCSymbol *Symbol, uint64_t Size) override {}
395 
396  /// Process beginning of an instruction.
397  void beginInstruction(const MachineInstr *MI) override;
398 
399  /// Complete all the types and emit the BTF sections.
400  void endModule() override;
401 };
402 
403 } // end namespace llvm
404 
405 #endif
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::BTFTypeFloat::completeType
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:390
llvm::BTFFieldReloc::OffsetNameOff
uint32_t OffsetNameOff
The string to traverse types.
Definition: BTFDebug.h:270
llvm::BTFTypeFloat
Handle binary floating point type.
Definition: BTFDebug.h:201
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:105
llvm::BTFTypeDerived::setPointeeType
void setPointeeType(uint32_t PointeeType)
Definition: BTFDebug.cpp:102
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::DIType
Base class for types.
Definition: DebugInfoMetadata.h:665
llvm::BTFTypeDeclTag::completeType
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
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::BTFTypeTypeTag
Definition: BTFDebug.h:221
llvm::BTFFuncInfo::Label
const MCSymbol * Label
Func MCSymbol.
Definition: BTFDebug.h:253
llvm::BTFTypeFwd
Handle struct or union forward declaration.
Definition: BTFDebug.h:78
llvm::BTF::CommonTypeSize
@ CommonTypeSize
Definition: BTF.h:60
llvm::BTFLineInfo
Represent one line info.
Definition: BTFDebug.h:258
llvm::BTFDebug::InstLower
bool InstLower(const MachineInstr *MI, MCInst &OutMI)
Emit proper patchable instructions.
Definition: BTFDebug.cpp:1377
llvm::Function
Definition: Function.h:62
llvm::BTFTypeDeclTag
Handle decl tags.
Definition: BTFDebug.h:210
llvm::BTFKindDataSec::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:373
llvm::BTFLineInfo::FileNameOff
uint32_t FileNameOff
file name offset in the .BTF string table
Definition: BTFDebug.h:260
llvm::BTFTypeBase::Kind
uint8_t Kind
Definition: BTFDebug.h:41
llvm::BTFTypeEnum::completeType
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:170
llvm::BTFFieldReloc::Label
const MCSymbol * Label
MCSymbol identifying insn for the reloc.
Definition: BTFDebug.h:268
llvm::BTFFieldReloc::TypeID
uint32_t TypeID
Type ID.
Definition: BTFDebug.h:269
llvm::GlobalVariable
Definition: GlobalVariable.h:39
llvm::BTFKindVar::completeType
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:352
llvm::BTF::BTFParamSize
@ BTFParamSize
Definition: BTF.h:64
llvm::tgtok::VarName
@ VarName
Definition: TGLexer.h:71
llvm::BTF::BTFEnumSize
@ BTFEnumSize
Definition: BTF.h:62
llvm::BTFTypeBase::BTFTypeBase
BTFTypeBase()
Definition: BTFDebug.h:47
llvm::BTFKindDataSec::getName
std::string getName()
Definition: BTFDebug.h:195
llvm::BTFKindDataSec::BTFKindDataSec
BTFKindDataSec(AsmPrinter *AsmPrt, std::string SecName)
Definition: BTFDebug.cpp:361
llvm::BTFTypeStruct::getSize
uint32_t getSize() override
Get the size of this BTF type entry.
Definition: BTFDebug.h:134
llvm::BTFStringTable::getTable
std::vector< std::string > & getTable()
Definition: BTFDebug.h:245
llvm::BTFTypeBase::setId
void setId(uint32_t Id)
Definition: BTFDebug.h:49
llvm::BTFDebug::BTFDebug
BTFDebug(AsmPrinter *AP)
Definition: BTFDebug.cpp:461
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::BTFTypeDerived::completeType
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:78
llvm::BTFTypeArray::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:225
llvm::BTFTypeFunc
Handle subprogram.
Definition: BTFDebug.h:159
llvm::BTFTypeFuncProto::completeType
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:292
llvm::BTFDebug::getTypeId
uint32_t getTypeId(const DIType *Ty)
Get the type id for a particular DIType.
Definition: BTFDebug.h:387
llvm::Annotations
Annotations lets you mark points and ranges inside source code, for tests:
Definition: Annotations.h:46
llvm::BTFKindVar
Handle variable instances.
Definition: BTFDebug.h:170
llvm::BTFTypeFloat::BTFTypeFloat
BTFTypeFloat(uint32_t SizeInBits, StringRef TypeName)
Definition: BTFDebug.cpp:383
llvm::BTFTypeDerived::BTFTypeDerived
BTFTypeDerived(const DIDerivedType *Ty, unsigned Tag, bool NeedsFixup)
Definition: BTFDebug.cpp:44
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:199
llvm::BTFLineInfo::ColumnNum
uint32_t ColumnNum
the column number
Definition: BTFDebug.h:263
llvm::BTFTypeFuncProto
Handle function pointer.
Definition: BTFDebug.h:143
llvm::BTFTypeTypeTag::BTFTypeTypeTag
BTFTypeTypeTag(uint32_t NextTypeId, StringRef Tag)
Definition: BTFDebug.cpp:420
llvm::BTFStringTable::addString
uint32_t addString(StringRef S)
Add a string to the string table and returns its offset in the table.
Definition: BTFDebug.cpp:447
llvm::BTFTypeBase::getSize
virtual uint32_t getSize()
Get the size of this BTF type entry.
Definition: BTFDebug.h:53
llvm::BTFTypeStruct::completeType
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:241
DebugHandlerBase.h
llvm::BTFTypeBase::~BTFTypeBase
virtual ~BTFTypeBase()=default
false
Definition: StackSlotColoring.cpp:142
llvm::BTFTypeBase::BTFType
struct BTF::CommonType BTFType
Definition: BTFDebug.h:44
llvm::MachineOperand
MachineOperand class - Representation of each machine instruction operand.
Definition: MachineOperand.h:49
llvm::BTFTypeDerived
Handle several derived types include pointer, const, volatile, typedef and restrict.
Definition: BTFDebug.h:64
llvm::BTFTypeBase::getId
uint32_t getId()
Definition: BTFDebug.h:50
llvm::BTFTypeArray
Handle array type.
Definition: BTFDebug.h:115
llvm::BTFTypeInt::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:158
llvm::BTFTypeEnum
Handle enumerate type.
Definition: BTFDebug.h:101
StringMap.h
llvm::BTFDebug::addString
size_t addString(StringRef S)
Add string to the string table.
Definition: BTFDebug.h:384
llvm::BTFTypeFwd::BTFTypeFwd
BTFTypeFwd(StringRef Name, bool IsUnion)
Represent a struct/union forward declaration.
Definition: BTFDebug.cpp:107
llvm::BTF::BTFArraySize
@ BTFArraySize
Definition: BTF.h:61
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::BTFDebug
Collect and emit BTF information.
Definition: BTFDebug.h:275
llvm::BTFTypeFunc::completeType
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:334
llvm::BTFFuncInfo
Represent one func and its type id.
Definition: BTFDebug.h:252
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
uint64_t
llvm::BTFLineInfo::LineNum
uint32_t LineNum
the line number
Definition: BTFDebug.h:262
llvm::BTFKindDataSec::getSize
uint32_t getSize() override
Get the size of this BTF type entry.
Definition: BTFDebug.h:189
llvm::BTFKindDataSec::addDataSecEntry
void addDataSecEntry(uint32_t Id, const MCSymbol *Sym, uint32_t Size)
Definition: BTFDebug.h:192
llvm::BTFTypeArray::getSize
uint32_t getSize() override
Get the size of this BTF type entry.
Definition: BTFDebug.h:120
llvm::BTFTypeTypeTag::completeType
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:433
llvm::BTFStringTable::getSize
uint32_t getSize()
Definition: BTFDebug.h:244
llvm::BTFTypeFuncProto::getSize
uint32_t getSize() override
Get the size of this BTF type entry.
Definition: BTFDebug.h:151
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
BTF.h
llvm::BTFLineInfo::Label
MCSymbol * Label
MCSymbol identifying insn for the lineinfo.
Definition: BTFDebug.h:259
llvm::BTFTypeEnum::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:194
llvm::BTFTypeStruct::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:267
llvm::BTFTypeFuncProto::BTFTypeFuncProto
BTFTypeFuncProto(const DISubroutineType *STy, uint32_t NumParams, const std::unordered_map< uint32_t, StringRef > &FuncArgNames)
The Func kind represents both subprogram and pointee of function pointers.
Definition: BTFDebug.cpp:284
llvm::BTFTypeStruct::BTFTypeStruct
BTFTypeStruct(const DICompositeType *STy, bool IsStruct, bool HasBitField, uint32_t NumMembers)
Represent either a struct or a union.
Definition: BTFDebug.cpp:233
llvm::BTFDebug::endFunctionImpl
void endFunctionImpl(const MachineFunction *MF) override
Post process after all instructions in this function are processed.
Definition: BTFDebug.cpp:1124
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:771
llvm::MachineFunction
Definition: MachineFunction.h:241
llvm::BTFTypeInt::BTFTypeInt
BTFTypeInt(uint32_t Encoding, uint32_t SizeInBits, uint32_t OffsetInBits, StringRef TypeName)
Definition: BTFDebug.cpp:123
llvm::DISubroutineType
Type array for a subprogram.
Definition: DebugInfoMetadata.h:1283
llvm::BTF::CommonType
The BTF common type definition.
Definition: BTF.h:99
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1060
llvm::BTFFieldReloc
Represent one field relocation.
Definition: BTFDebug.h:267
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::BTFTypeFuncProto::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:318
llvm::BTF::BTFMemberSize
@ BTFMemberSize
Definition: BTF.h:63
uint32_t
llvm::BTFDebug::getArrayIndexTypeId
uint32_t getArrayIndexTypeId()
Get the special array index type id.
Definition: BTFDebug.h:378
llvm::BTFTypeInt
Handle int type.
Definition: BTFDebug.h:88
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::BTFKindVar::getSize
uint32_t getSize() override
Get the size of this BTF type entry.
Definition: BTFDebug.h:176
llvm::BTF::BTFDataSecVarSize
@ BTFDataSecVarSize
Definition: BTF.h:65
llvm::BTFTypeStruct::getName
std::string getName()
Definition: BTFDebug.cpp:277
llvm::BTFFuncInfo::TypeId
uint32_t TypeId
Type id referring to .BTF type section.
Definition: BTFDebug.h:254
llvm::BTFDebug::beginFunctionImpl
void beginFunctionImpl(const MachineFunction *MF) override
Gather pre-function debug information.
Definition: BTFDebug.cpp:1035
llvm::BTFTypeBase::Id
uint32_t Id
Definition: BTFDebug.h:43
llvm::AMDGPU::HSAMD::Kernel::Arg::Key::TypeName
constexpr char TypeName[]
Key for Kernel::Arg::Metadata::mTypeName.
Definition: AMDGPUMetadata.h:170
llvm::BTFTypeArray::completeType
void completeType(BTFDebug &BDebug) override
Represent a BTF array.
Definition: BTFDebug.cpp:213
llvm::BTFTypeBase::emitType
virtual void emitType(MCStreamer &OS)
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:35
llvm::BTFTypeEnum::getSize
uint32_t getSize() override
Get the size of this BTF type entry.
Definition: BTFDebug.h:107
llvm::BTFKindVar::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:356
llvm::BTFTypeFunc::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:342
llvm::BTFKindDataSec
Handle data sections.
Definition: BTFDebug.h:182
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:82
llvm::BTFTypeDeclTag::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:415
llvm::BTFTypeInt::getSize
uint32_t getSize() override
Get the size of this BTF type entry.
Definition: BTFDebug.h:95
llvm::DIDerivedType
Derived types.
Definition: DebugInfoMetadata.h:919
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:83
llvm::BTFTypeEnum::BTFTypeEnum
BTFTypeEnum(const DICompositeType *ETy, uint32_t NumValues)
Definition: BTFDebug.cpp:164
llvm::BTFFieldReloc::RelocKind
uint32_t RelocKind
What to patch the instruction.
Definition: BTFDebug.h:271
llvm::BTFTypeStruct
Handle struct/union type.
Definition: BTFDebug.h:126
llvm::BTFStringTable
String table.
Definition: BTFDebug.h:232
llvm::BTFDebug::setSymbolSize
void setSymbolSize(const MCSymbol *Symbol, uint64_t Size) override
For symbols that have a size designated (e.g.
Definition: BTFDebug.h:394
llvm::BTFStringTable::BTFStringTable
BTFStringTable()
Definition: BTFDebug.h:243
llvm::BTFTypeFunc::BTFTypeFunc
BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId, uint32_t Scope)
Definition: BTFDebug.cpp:326
llvm::DebugHandlerBase
Base class for debug information backends.
Definition: DebugHandlerBase.h:53
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1826
llvm::BTFTypeDeclTag::BTFTypeDeclTag
BTFTypeDeclTag(uint32_t BaseTypeId, int ComponentId, StringRef Tag)
Definition: BTFDebug.cpp:398
llvm::BTFLineInfo::LineOff
uint32_t LineOff
line offset in the .BTF string table
Definition: BTFDebug.h:261
llvm::BTFTypeInt::completeType
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:150
llvm::BTFTypeFunc::getSize
uint32_t getSize() override
Get the size of this BTF type entry.
Definition: BTFDebug.h:164
llvm::BTFTypeBase::IsCompleted
bool IsCompleted
Definition: BTFDebug.h:42
llvm::BTFTypeDeclTag::getSize
uint32_t getSize() override
Get the size of this BTF type entry.
Definition: BTFDebug.h:216
llvm::BTFTypeArray::BTFTypeArray
BTFTypeArray(uint32_t ElemTypeId, uint32_t NumElems)
Definition: BTFDebug.cpp:202
llvm::BTFTypeBase::completeType
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
llvm::BTFKindDataSec::completeType
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:368
llvm::BTFTypeFwd::completeType
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:113
llvm::BTFDebug::endModule
void endModule() override
Complete all the types and emit the BTF sections.
Definition: BTFDebug.cpp:1468
llvm::BTFKindVar::BTFKindVar
BTFKindVar(StringRef VarName, uint32_t TypeId, uint32_t VarInfo)
Definition: BTFDebug.cpp:344
llvm::BTFTypeDerived::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:100
llvm::BTFDebug::beginInstruction
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
Definition: BTFDebug.cpp:1196
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:172
llvm::BTFTypeFwd::emitType
void emitType(MCStreamer &OS) override
Emit types for this BTF type entry.
Definition: BTFDebug.cpp:121
llvm::BTFTypeBase
The base class for BTF type generation.
Definition: BTFDebug.h:39
llvm::BTF::BTFArray
BTF_KIND_ARRAY is followed by one "struct BTFArray".
Definition: BTF.h:149
llvm::BTFTypeBase::roundupToBytes
uint32_t roundupToBytes(uint32_t NumBits)
Definition: BTFDebug.h:51