Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
DwarfDebug.h
Go to the documentation of this file.
1//===- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework --------*- 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// This file contains support for writing dwarf debug info into asm files.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
14#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
15
16#include "AddressPool.h"
17#include "DebugLocEntry.h"
18#include "DebugLocStream.h"
19#include "DwarfFile.h"
20#include "llvm/ADT/DenseMap.h"
21#include "llvm/ADT/DenseSet.h"
22#include "llvm/ADT/MapVector.h"
23#include "llvm/ADT/SetVector.h"
24#include "llvm/ADT/SmallPtrSet.h"
25#include "llvm/ADT/SmallVector.h"
26#include "llvm/ADT/StringMap.h"
27#include "llvm/ADT/StringRef.h"
28#include "llvm/BinaryFormat/Dwarf.h"
29#include "llvm/CodeGen/AccelTable.h"
30#include "llvm/CodeGen/DbgEntityHistoryCalculator.h"
31#include "llvm/CodeGen/DebugHandlerBase.h"
32#include "llvm/IR/DebugInfoMetadata.h"
33#include "llvm/IR/DebugLoc.h"
34#include "llvm/IR/Metadata.h"
35#include "llvm/MC/MCDwarf.h"
36#include "llvm/Support/Allocator.h"
37#include "llvm/Target/TargetOptions.h"
38#include <cassert>
39#include <cstdint>
40#include <limits>
41#include <memory>
42#include <utility>
43#include <variant>
44#include <vector>
45
46namespacellvm {
47
48classAsmPrinter;
49classByteStreamer;
50classDIE;
51classDwarfCompileUnit;
52classDwarfExpression;
53classDwarfTypeUnit;
54classDwarfUnit;
55classLexicalScope;
56classMachineFunction;
57classMCSection;
58classMCSymbol;
59classModule;
60
61//===----------------------------------------------------------------------===//
62/// This class is defined as the common parent of DbgVariable and DbgLabel
63/// such that it could levarage polymorphism to extract common code for
64/// DbgVariable and DbgLabel.
65classDbgEntity {
66public:
67enumDbgEntityKind {
68DbgVariableKind,
69DbgLabelKind
70 };
71
72private:
73constDINode *Entity;
74constDILocation *InlinedAt;
75DIE *TheDIE =nullptr;
76constDbgEntityKind SubclassID;
77
78public:
79DbgEntity(constDINode *N,constDILocation *IA,DbgEntityKindID)
80 : Entity(N), InlinedAt(IA), SubclassID(ID) {}
81virtual~DbgEntity() =default;
82
83 /// Accessors.
84 /// @{
85constDINode *getEntity() const{return Entity; }
86constDILocation *getInlinedAt() const{return InlinedAt; }
87DIE *getDIE() const{return TheDIE; }
88DbgEntityKindgetDbgEntityID() const{return SubclassID; }
89 /// @}
90
91voidsetDIE(DIE &D) { TheDIE = &D; }
92
93staticboolclassof(constDbgEntity *N) {
94switch (N->getDbgEntityID()) {
95caseDbgVariableKind:
96caseDbgLabelKind:
97returntrue;
98 }
99llvm_unreachable("Invalid DbgEntityKind");
100 }
101};
102
103classDbgVariable;
104
105booloperator<(conststructFrameIndexExpr &LHS,
106conststructFrameIndexExpr &RHS);
107booloperator<(conststructEntryValueInfo &LHS,
108conststructEntryValueInfo &RHS);
109
110/// Proxy for one MMI entry.
111structFrameIndexExpr {
112intFI;
113constDIExpression *Expr;
114
115 /// Operator enabling sorting based on fragment offset.
116friendbooloperator<(constFrameIndexExpr &LHS,constFrameIndexExpr &RHS);
117};
118
119/// Represents an entry-value location, or a fragment of one.
120structEntryValueInfo {
121MCRegisterReg;
122constDIExpression &Expr;
123
124 /// Operator enabling sorting based on fragment offset.
125friendbooloperator<(constEntryValueInfo &LHS,constEntryValueInfo &RHS);
126};
127
128// Namespace for alternatives of a DbgVariable.
129namespaceLoc {
130/// Single value location description.
131classSingle {
132 std::unique_ptr<DbgValueLoc> ValueLoc;
133constDIExpression *Expr;
134
135public:
136explicitSingle(DbgValueLoc ValueLoc);
137explicitSingle(constMachineInstr *DbgValue);
138constDbgValueLoc &getValueLoc() const{return *ValueLoc; }
139constDIExpression *getExpr() const{return Expr; }
140};
141/// Multi-value location description.
142classMulti {
143 /// Index of the entry list in DebugLocs.
144unsigned DebugLocListIndex;
145 /// DW_OP_LLVM_tag_offset value from DebugLocs.
146 std::optional<uint8_t> DebugLocListTagOffset;
147
148public:
149explicitMulti(unsigned DebugLocListIndex,
150 std::optional<uint8_t> DebugLocListTagOffset)
151 : DebugLocListIndex(DebugLocListIndex),
152 DebugLocListTagOffset(DebugLocListTagOffset) {}
153unsignedgetDebugLocListIndex() const{return DebugLocListIndex; }
154 std::optional<uint8_t>getDebugLocListTagOffset() const{
155return DebugLocListTagOffset;
156 }
157};
158/// Single location defined by (potentially multiple) MMI entries.
159structMMI {
160 std::set<FrameIndexExpr>FrameIndexExprs;
161
162public:
163explicitMMI(constDIExpression *E,int FI) :FrameIndexExprs({{FI,E}}) {
164assert((!E ||E->isValid()) &&"Expected valid expression");
165assert(FI != std::numeric_limits<int>::max() &&"Expected valid index");
166 }
167voidaddFrameIndexExpr(constDIExpression *Expr,int FI);
168 /// Get the FI entries, sorted by fragment offset.
169const std::set<FrameIndexExpr> &getFrameIndexExprs()const;
170};
171/// Single location defined by (potentially multiple) EntryValueInfo.
172structEntryValue {
173 std::set<EntryValueInfo>EntryValues;
174explicitEntryValue(MCRegisterReg,constDIExpression &Expr) {
175addExpr(Reg, Expr);
176 };
177// Add the pair Reg, Expr to the list of entry values describing the variable.
178// If multiple expressions are added, it is the callers responsibility to
179// ensure they are all non-overlapping fragments.
180voidaddExpr(MCRegisterReg,constDIExpression &Expr) {
181 std::optional<const DIExpression *> NonVariadicExpr =
182DIExpression::convertToNonVariadicExpression(&Expr);
183assert(NonVariadicExpr && *NonVariadicExpr);
184
185EntryValues.insert({Reg, **NonVariadicExpr});
186 }
187};
188/// Alias for the std::variant specialization base class of DbgVariable.
189usingVariant = std::variant<std::monostate,Loc::Single,Loc::Multi,Loc::MMI,
190Loc::EntryValue>;
191}// namespace Loc
192
193//===----------------------------------------------------------------------===//
194/// This class is used to track local variable information.
195///
196/// Variables that have been optimized out hold the \c monostate alternative.
197/// This is not distinguished from the case of a constructed \c DbgVariable
198/// which has not be initialized yet.
199///
200/// Variables can be created from allocas, in which case they're generated from
201/// the MMI table. Such variables hold the \c Loc::MMI alternative which can
202/// have multiple expressions and frame indices.
203///
204/// Variables can be created from the entry value of registers, in which case
205/// they're generated from the MMI table. Such variables hold the \c
206/// EntryValueLoc alternative which can either have a single expression or
207/// multiple *fragment* expressions.
208///
209/// Variables can be created from \c DBG_VALUE instructions. Those whose
210/// location changes over time hold a \c Loc::Multi alternative which uses \c
211/// DebugLocListIndex and (optionally) \c DebugLocListTagOffset, while those
212/// with a single location hold a \c Loc::Single alternative which use \c
213/// ValueLoc and (optionally) a single \c Expr.
214classDbgVariable :publicDbgEntity,publicLoc::Variant {
215
216public:
217 /// To workaround P2162R0 https://github.com/cplusplus/papers/issues/873 the
218 /// base class subobject needs to be passed directly to std::visit, so expose
219 /// it directly here.
220Loc::Variant &asVariant() {return *static_cast<Loc::Variant *>(this); }
221constLoc::Variant &asVariant() const{
222return *static_cast<constLoc::Variant *>(this);
223 }
224 /// Member shorthand for std::holds_alternative
225template <typename T>boolholds() const{
226return std::holds_alternative<T>(*this);
227 }
228 /// Asserting, noexcept member alternative to std::get
229template <typename T>auto &get() noexcept {
230assert(holds<T>());
231return *std::get_if<T>(this);
232 }
233 /// Asserting, noexcept member alternative to std::get
234template <typename T>constauto &get()const noexcept {
235assert(holds<T>());
236return *std::get_if<T>(this);
237 }
238
239 /// Construct a DbgVariable.
240 ///
241 /// Creates a variable without any DW_AT_location.
242DbgVariable(constDILocalVariable *V,constDILocation *IA)
243 :DbgEntity(V, IA,DbgVariableKind) {}
244
245// Accessors.
246constDILocalVariable *getVariable() const{
247return cast<DILocalVariable>(getEntity());
248 }
249
250StringRefgetName() const{returngetVariable()->getName(); }
251
252// Translate tag to proper Dwarf tag.
253dwarf::TaggetTag() const{
254// FIXME: Why don't we just infer this tag and store it all along?
255if (getVariable()->isParameter())
256return dwarf::DW_TAG_formal_parameter;
257
258return dwarf::DW_TAG_variable;
259 }
260
261 /// Return true if DbgVariable is artificial.
262boolisArtificial() const{
263if (getVariable()->isArtificial())
264returntrue;
265if (getType()->isArtificial())
266returntrue;
267returnfalse;
268 }
269
270boolisObjectPointer() const{
271if (getVariable()->isObjectPointer())
272returntrue;
273if (getType()->isObjectPointer())
274returntrue;
275returnfalse;
276 }
277
278constDIType *getType()const;
279
280staticboolclassof(constDbgEntity *N) {
281returnN->getDbgEntityID() ==DbgVariableKind;
282 }
283};
284
285//===----------------------------------------------------------------------===//
286/// This class is used to track label information.
287///
288/// Labels are collected from \c DBG_LABEL instructions.
289classDbgLabel :publicDbgEntity {
290constMCSymbol *Sym;/// Symbol before DBG_LABEL instruction.
291
292public:
293 /// We need MCSymbol information to generate DW_AT_low_pc.
294DbgLabel(constDILabel *L,constDILocation *IA,constMCSymbol *Sym =nullptr)
295 :DbgEntity(L, IA,DbgLabelKind),Sym(Sym) {}
296
297 /// Accessors.
298 /// @{
299constDILabel *getLabel() const{return cast<DILabel>(getEntity()); }
300constMCSymbol *getSymbol() const{returnSym; }
301
302StringRefgetName() const{returngetLabel()->getName(); }
303 /// @}
304
305 /// Translate tag to proper Dwarf tag.
306dwarf::TaggetTag() const{
307return dwarf::DW_TAG_label;
308 }
309
310staticboolclassof(constDbgEntity *N) {
311returnN->getDbgEntityID() ==DbgLabelKind;
312 }
313};
314
315/// Used for tracking debug info about call site parameters.
316classDbgCallSiteParam {
317private:
318unsignedRegister;///< Parameter register at the callee entry point.
319DbgValueLocValue;///< Corresponding location for the parameter value at
320 ///< the call site.
321public:
322DbgCallSiteParam(unsignedReg,DbgValueLoc Val)
323 :Register(Reg),Value(Val) {
324assert(Reg &&"Parameter register cannot be undef");
325 }
326
327unsignedgetRegister() const{returnRegister; }
328DbgValueLocgetValue() const{returnValue; }
329};
330
331/// Collection used for storing debug call site parameters.
332usingParamSet =SmallVector<DbgCallSiteParam, 4>;
333
334/// Helper used to pair up a symbol and its DWARF compile unit.
335structSymbolCU {
336SymbolCU(DwarfCompileUnit *CU,constMCSymbol *Sym) :Sym(Sym),CU(CU) {}
337
338constMCSymbol *Sym;
339DwarfCompileUnit *CU;
340};
341
342/// The kind of accelerator tables we should emit.
343enum classAccelTableKind {
344Default,///< Platform default.
345None,///< None.
346Apple,///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
347Dwarf,///< DWARF v5 .debug_names.
348};
349
350/// Collects and handles dwarf debug information.
351classDwarfDebug :publicDebugHandlerBase {
352 /// All DIEValues are allocated through this allocator.
353BumpPtrAllocator DIEValueAllocator;
354
355 /// Maps MDNode with its corresponding DwarfCompileUnit.
356MapVector<const MDNode *, DwarfCompileUnit *> CUMap;
357
358 /// Maps a CU DIE with its corresponding DwarfCompileUnit.
359DenseMap<const DIE *, DwarfCompileUnit *> CUDieMap;
360
361 /// List of all labels used in aranges generation.
362 std::vector<SymbolCU> ArangeLabels;
363
364 /// Size of each symbol emitted (for those symbols that have a specific size).
365DenseMap<const MCSymbol *, uint64_t> SymSize;
366
367 /// Collection of abstract variables/labels.
368SmallVector<std::unique_ptr<DbgEntity>, 64> ConcreteEntities;
369
370 /// Collection of DebugLocEntry. Stored in a linked list so that DIELocLists
371 /// can refer to them in spite of insertions into this list.
372DebugLocStream DebugLocs;
373
374 /// This is a collection of subprogram MDNodes that are processed to
375 /// create DIEs.
376SmallSetVector<const DISubprogram *, 16> ProcessedSPNodes;
377
378 /// Map function-local imported entities to their parent local scope
379 /// (either DILexicalBlock or DISubprogram) for a processed function
380 /// (including inlined subprograms).
381usingMDNodeSet =SetVector<const MDNode *, SmallVector<const MDNode *, 2>,
382SmallPtrSet<const MDNode *, 2>>;
383DenseMap<const DILocalScope *, MDNodeSet> LocalDeclsPerLS;
384
385SmallDenseSet<const MachineInstr *> ForceIsStmtInstrs;
386
387 /// If nonnull, stores the current machine function we're processing.
388constMachineFunction *CurFn =nullptr;
389
390 /// If nonnull, stores the CU in which the previous subprogram was contained.
391constDwarfCompileUnit *PrevCU =nullptr;
392
393 /// As an optimization, there is no need to emit an entry in the directory
394 /// table for the same directory as DW_AT_comp_dir.
395StringRef CompilationDir;
396
397 /// Holder for the file specific debug information.
398DwarfFile InfoHolder;
399
400 /// Holders for the various debug information flags that we might need to
401 /// have exposed. See accessor functions below for description.
402
403 /// Map from MDNodes for user-defined types to their type signatures. Also
404 /// used to keep track of which types we have emitted type units for.
405DenseMap<const MDNode *, uint64_t> TypeSignatures;
406
407DenseMap<const MCSection *, const MCSymbol *> SectionLabels;
408
409SmallVector<
410 std::pair<std::unique_ptr<DwarfTypeUnit>,constDICompositeType *>, 1>
411 TypeUnitsUnderConstruction;
412
413 /// Symbol pointing to the current function's DWARF line table entries.
414MCSymbol *FunctionLineTableLabel;
415
416 /// Used to set a uniqe ID for a Type Unit.
417 /// This counter represents number of DwarfTypeUnits created, not necessarily
418 /// number of type units that will be emitted.
419unsigned NumTypeUnitsCreated = 0;
420
421 /// Whether to use the GNU TLS opcode (instead of the standard opcode).
422bool UseGNUTLSOpcode;
423
424 /// Whether to use DWARF 2 bitfields (instead of the DWARF 4 format).
425bool UseDWARF2Bitfields;
426
427 /// Whether to emit all linkage names, or just abstract subprograms.
428bool UseAllLinkageNames;
429
430 /// Use inlined strings.
431bool UseInlineStrings =false;
432
433 /// Allow emission of .debug_ranges section.
434bool UseRangesSection =true;
435
436 /// True if the sections itself must be used as references and don't create
437 /// temp symbols inside DWARF sections.
438bool UseSectionsAsReferences =false;
439
440 /// Allow emission of .debug_aranges section
441bool UseARangesSection =false;
442
443 /// Generate DWARF v4 type units.
444bool GenerateTypeUnits;
445
446 /// Emit a .debug_macro section instead of .debug_macinfo.
447bool UseDebugMacroSection;
448
449 /// Avoid using DW_OP_convert due to consumer incompatibilities.
450bool EnableOpConvert;
451
452public:
453enum classMinimizeAddrInV5 {
454Default,
455Disabled,
456Ranges,
457Expressions,
458Form,
459 };
460
461enum classDWARF5AccelTableKind {
462CU = 0,
463TU = 1,
464 };
465
466private:
467 /// Force the use of DW_AT_ranges even for single-entry range lists.
468MinimizeAddrInV5 MinimizeAddr =MinimizeAddrInV5::Disabled;
469
470 /// DWARF5 Experimental Options
471 /// @{
472AccelTableKind TheAccelTableKind;
473bool HasAppleExtensionAttributes;
474bool HasSplitDwarf;
475
476 /// Whether to generate the DWARF v5 string offsets table.
477 /// It consists of a series of contributions, each preceded by a header.
478 /// The pre-DWARF v5 string offsets table for split dwarf is, in contrast,
479 /// a monolithic sequence of string offsets.
480bool UseSegmentedStringOffsetsTable;
481
482 /// Enable production of call site parameters needed to print the debug entry
483 /// values. Useful for testing purposes when a debugger does not support the
484 /// feature yet.
485bool EmitDebugEntryValues;
486
487 /// Separated Dwarf Variables
488 /// In general these will all be for bits that are left in the
489 /// original object file, rather than things that are meant
490 /// to be in the .dwo sections.
491
492 /// Holder for the skeleton information.
493DwarfFile SkeletonHolder;
494
495 /// Store file names for type units under fission in a line table
496 /// header that will be emitted into debug_line.dwo.
497// FIXME: replace this with a map from comp_dir to table so that we
498// can emit multiple tables during LTO each of which uses directory
499// 0, referencing the comp_dir of all the type units that use it.
500MCDwarfDwoLineTable SplitTypeUnitFileTable;
501 /// @}
502
503 /// True iff there are multiple CUs in this module.
504bool SingleCU;
505bool IsDarwin;
506
507 /// Map for tracking Fortran deferred CHARACTER lengths.
508DenseMap<const DIStringType *, unsigned> StringTypeLocMap;
509
510AddressPool AddrPool;
511
512 /// Accelerator tables.
513DWARF5AccelTable AccelDebugNames;
514DWARF5AccelTable AccelTypeUnitsDebugNames;
515 /// Used to hide which DWARF5AccelTable we are using now.
516DWARF5AccelTable *CurrentDebugNames = &AccelDebugNames;
517AccelTable<AppleAccelTableOffsetData> AccelNames;
518AccelTable<AppleAccelTableOffsetData> AccelObjC;
519AccelTable<AppleAccelTableOffsetData> AccelNamespace;
520AccelTable<AppleAccelTableTypeData> AccelTypes;
521
522 /// Identify a debugger for "tuning" the debug info.
523 ///
524 /// The "tuning" should be used to set defaults for individual feature flags
525 /// in DwarfDebug; if a given feature has a more specific command-line option,
526 /// that option should take precedence over the tuning.
527DebuggerKind DebuggerTuning =DebuggerKind::Default;
528
529MCDwarfDwoLineTable *getDwoLineTable(constDwarfCompileUnit &);
530
531constSmallVectorImpl<std::unique_ptr<DwarfCompileUnit>> &getUnits() {
532return InfoHolder.getUnits();
533 }
534
535usingInlinedEntity =DbgValueHistoryMap::InlinedEntity;
536
537void ensureAbstractEntityIsCreatedIfScoped(DwarfCompileUnit &CU,
538const DINode *Node,
539const MDNode *Scope);
540
541 DbgEntity *createConcreteEntity(DwarfCompileUnit &TheCU,
542 LexicalScope &Scope,
543const DINode *Node,
544const DILocation *Location,
545const MCSymbol *Sym =nullptr);
546
547 /// Construct a DIE for this abstract scope.
548void constructAbstractSubprogramScopeDIE(DwarfCompileUnit &SrcCU, LexicalScope *Scope);
549
550 /// Construct DIEs for call site entries describing the calls in \p MF.
551void constructCallSiteEntryDIEs(const DISubprogram &SP, DwarfCompileUnit &CU,
552 DIE &ScopeDIE,const MachineFunction &MF);
553
554template <typename DataT>
555void addAccelNameImpl(const DwarfUnit &Unit,
556constDICompileUnit::DebugNameTableKind NameTableKind,
557 AccelTable<DataT> &AppleAccel, StringRefName,
558const DIE &Die);
559
560void finishEntityDefinitions();
561
562void finishSubprogramDefinitions();
563
564 /// Finish off debug information after all functions have been
565 /// processed.
566void finalizeModuleInfo();
567
568 /// Emit the debug info section.
569void emitDebugInfo();
570
571 /// Emit the abbreviation section.
572void emitAbbreviations();
573
574 /// Emit the string offsets table header.
575void emitStringOffsetsTableHeader();
576
577 /// Emit a specified accelerator table.
578template <typename AccelTableT>
579void emitAccel(AccelTableT &Accel, MCSection *Section, StringRef TableName);
580
581 /// Emit DWARF v5 accelerator table.
582void emitAccelDebugNames();
583
584 /// Emit visible names into a hashed accelerator table section.
585void emitAccelNames();
586
587 /// Emit objective C classes and categories into a hashed
588 /// accelerator table section.
589void emitAccelObjC();
590
591 /// Emit namespace dies into a hashed accelerator table.
592void emitAccelNamespaces();
593
594 /// Emit type dies into a hashed accelerator table.
595void emitAccelTypes();
596
597 /// Emit visible names and types into debug pubnames and pubtypes sections.
598void emitDebugPubSections();
599
600void emitDebugPubSection(bool GnuStyle, StringRefName,
601 DwarfCompileUnit *TheU,
602const StringMap<const DIE *> &Globals);
603
604 /// Emit null-terminated strings into a debug str section.
605void emitDebugStr();
606
607 /// Emit variable locations into a debug loc section.
608void emitDebugLoc();
609
610 /// Emit variable locations into a debug loc dwo section.
611void emitDebugLocDWO();
612
613void emitDebugLocImpl(MCSection *Sec);
614
615 /// Emit address ranges into a debug aranges section.
616void emitDebugARanges();
617
618 /// Emit address ranges into a debug ranges section.
619void emitDebugRanges();
620void emitDebugRangesDWO();
621void emitDebugRangesImpl(const DwarfFile &Holder, MCSection *Section);
622
623 /// Emit macros into a debug macinfo section.
624void emitDebugMacinfo();
625 /// Emit macros into a debug macinfo.dwo section.
626void emitDebugMacinfoDWO();
627void emitDebugMacinfoImpl(MCSection *Section);
628void emitMacro(DIMacro &M);
629void emitMacroFile(DIMacroFile &F, DwarfCompileUnit &U);
630void emitMacroFileImpl(DIMacroFile &F, DwarfCompileUnit &U,
631unsigned StartFile,unsigned EndFile,
632 StringRef (*MacroFormToString)(unsignedForm));
633void handleMacroNodes(DIMacroNodeArray Nodes, DwarfCompileUnit &U);
634
635 /// DWARF 5 Experimental Split Dwarf Emitters
636
637 /// Initialize common features of skeleton units.
638void initSkeletonUnit(const DwarfUnit &U, DIE &Die,
639 std::unique_ptr<DwarfCompileUnit> NewU);
640
641 /// Construct the split debug info compile unit for the debug info section.
642 /// In DWARF v5, the skeleton unit DIE may have the following attributes:
643 /// DW_AT_addr_base, DW_AT_comp_dir, DW_AT_dwo_name, DW_AT_high_pc,
644 /// DW_AT_low_pc, DW_AT_ranges, DW_AT_stmt_list, and DW_AT_str_offsets_base.
645 /// Prior to DWARF v5 it may also have DW_AT_GNU_dwo_id. DW_AT_GNU_dwo_name
646 /// is used instead of DW_AT_dwo_name, Dw_AT_GNU_addr_base instead of
647 /// DW_AT_addr_base, and DW_AT_GNU_ranges_base instead of DW_AT_rnglists_base.
648 DwarfCompileUnit &constructSkeletonCU(const DwarfCompileUnit &CU);
649
650 /// Emit the debug info dwo section.
651void emitDebugInfoDWO();
652
653 /// Emit the debug abbrev dwo section.
654void emitDebugAbbrevDWO();
655
656 /// Emit the debug line dwo section.
657void emitDebugLineDWO();
658
659 /// Emit the dwo stringoffsets table header.
660void emitStringOffsetsTableHeaderDWO();
661
662 /// Emit the debug str dwo section.
663void emitDebugStrDWO();
664
665 /// Emit DWO addresses.
666void emitDebugAddr();
667
668 /// Flags to let the linker know we have emitted new style pubnames. Only
669 /// emit it here if we don't have a skeleton CU for split dwarf.
670void addGnuPubAttributes(DwarfCompileUnit &U, DIE &D)const;
671
672 /// Create new DwarfCompileUnit for the given metadata node with tag
673 /// DW_TAG_compile_unit.
674 DwarfCompileUnit &getOrCreateDwarfCompileUnit(const DICompileUnit *DIUnit);
675void finishUnitAttributes(const DICompileUnit *DIUnit,
676 DwarfCompileUnit &NewCU);
677
678 /// Register a source line with debug info. Returns the unique
679 /// label that was emitted and which provides correspondence to the
680 /// source line list.
681void recordSourceLine(unsigned Line,unsigned Col,const MDNode *Scope,
682unsigned Flags);
683
684 /// Populate LexicalScope entries with variables' info.
685void collectEntityInfo(DwarfCompileUnit &TheCU,const DISubprogram *SP,
686 DenseSet<InlinedEntity> &ProcessedVars);
687
688 /// Build the location list for all DBG_VALUEs in the
689 /// function that describe the same variable. If the resulting
690 /// list has only one entry that is valid for entire variable's
691 /// scope return true.
692bool buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
693constDbgValueHistoryMap::Entries &Entries);
694
695 /// Collect variable information from the side table maintained by MF.
696void collectVariableInfoFromMFTable(DwarfCompileUnit &TheCU,
697 DenseSet<InlinedEntity> &P);
698
699 /// Emit the reference to the section.
700void emitSectionReference(const DwarfCompileUnit &CU);
701
702void findForceIsStmtInstrs(const MachineFunction *MF);
703
704protected:
705 /// Gather pre-function debug information.
706voidbeginFunctionImpl(const MachineFunction *MF)override;
707
708 /// Gather and emit post-function debug information.
709voidendFunctionImpl(const MachineFunction *MF)override;
710
711 /// Get Dwarf compile unit ID for line table.
712unsignedgetDwarfCompileUnitIDForLineTable(const DwarfCompileUnit &CU);
713
714voidskippedNonDebugFunction()override;
715
716public:
717//===--------------------------------------------------------------------===//
718// Main entry points.
719//
720 DwarfDebug(AsmPrinter *A);
721
722~DwarfDebug()override;
723
724 /// Emit all Dwarf sections that should come prior to the
725 /// content.
726voidbeginModule(Module *M)override;
727
728 /// Emit all Dwarf sections that should come after the content.
729voidendModule()override;
730
731 /// Emits inital debug location directive. Returns instruction at which
732 /// the function prologue ends.
733constMachineInstr *emitInitialLocDirective(constMachineFunction &MF,
734unsigned CUID);
735
736 /// Process beginning of an instruction.
737voidbeginInstruction(constMachineInstr *MI)override;
738
739 /// Process beginning of code alignment.
740voidbeginCodeAlignment(constMachineBasicBlock &MBB)override;
741
742 /// Perform an MD5 checksum of \p Identifier and return the lower 64 bits.
743staticuint64_tmakeTypeSignature(StringRef Identifier);
744
745 /// Add a DIE to the set of types that we're going to pull into
746 /// type units.
747voidaddDwarfTypeUnitType(DwarfCompileUnit &CU,StringRef Identifier,
748DIE &Die,constDICompositeType *CTy);
749
750 /// Add a label so that arange data can be generated for it.
751voidaddArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
752
753 /// For symbols that have a size designated (e.g. common symbols),
754 /// this tracks that size.
755voidsetSymbolSize(constMCSymbol *Sym,uint64_tSize) override{
756 SymSize[Sym] =Size;
757 }
758
759 /// Returns whether we should emit all DW_AT_[MIPS_]linkage_name.
760 /// If not, we still might emit certain cases.
761booluseAllLinkageNames() const{return UseAllLinkageNames; }
762
763 /// Returns whether to use DW_OP_GNU_push_tls_address, instead of the
764 /// standard DW_OP_form_tls_address opcode
765booluseGNUTLSOpcode() const{return UseGNUTLSOpcode; }
766
767 /// Returns whether to use the DWARF2 format for bitfields instyead of the
768 /// DWARF4 format.
769booluseDWARF2Bitfields() const{return UseDWARF2Bitfields; }
770
771 /// Returns whether to use inline strings.
772booluseInlineStrings() const{return UseInlineStrings; }
773
774 /// Returns whether ranges section should be emitted.
775booluseRangesSection() const{return UseRangesSection; }
776
777 /// Returns whether range encodings should be used for single entry range
778 /// lists.
779boolalwaysUseRanges(constDwarfCompileUnit &)const;
780
781// Returns whether novel exprloc addrx+offset encodings should be used to
782// reduce debug_addr size.
783booluseAddrOffsetExpressions() const{
784return MinimizeAddr ==MinimizeAddrInV5::Expressions;
785 }
786
787// Returns whether addrx+offset LLVM extension form should be used to reduce
788// debug_addr size.
789booluseAddrOffsetForm() const{
790return MinimizeAddr ==MinimizeAddrInV5::Form;
791 }
792
793 /// Returns whether to use sections as labels rather than temp symbols.
794booluseSectionsAsReferences() const{
795return UseSectionsAsReferences;
796 }
797
798 /// Returns whether to generate DWARF v4 type units.
799boolgenerateTypeUnits() const{return GenerateTypeUnits; }
800
801// Experimental DWARF5 features.
802
803 /// Returns what kind (if any) of accelerator tables to emit.
804AccelTableKindgetAccelTableKind() const{return TheAccelTableKind; }
805
806 /// Seet TheAccelTableKind
807voidsetTheAccelTableKind(AccelTableKind K) { TheAccelTableKind = K; };
808
809booluseAppleExtensionAttributes() const{
810return HasAppleExtensionAttributes;
811 }
812
813 /// Returns whether or not to change the current debug info for the
814 /// split dwarf proposal support.
815booluseSplitDwarf() const{return HasSplitDwarf; }
816
817 /// Returns whether to generate a string offsets table with (possibly shared)
818 /// contributions from each CU and type unit. This implies the use of
819 /// DW_FORM_strx* indirect references with DWARF v5 and beyond. Note that
820 /// DW_FORM_GNU_str_index is also an indirect reference, but it is used with
821 /// a pre-DWARF v5 implementation of split DWARF sections, which uses a
822 /// monolithic string offsets table.
823booluseSegmentedStringOffsetsTable() const{
824return UseSegmentedStringOffsetsTable;
825 }
826
827boolemitDebugEntryValues() const{
828return EmitDebugEntryValues;
829 }
830
831booluseOpConvert() const{
832return EnableOpConvert;
833 }
834
835boolshareAcrossDWOCUs()const;
836
837 /// Returns the Dwarf Version.
838uint16_tgetDwarfVersion()const;
839
840 /// Returns a suitable DWARF form to represent a section offset, i.e.
841 /// * DW_FORM_sec_offset for DWARF version >= 4;
842 /// * DW_FORM_data8 for 64-bit DWARFv3;
843 /// * DW_FORM_data4 for 32-bit DWARFv3 and DWARFv2.
844dwarf::FormgetDwarfSectionOffsetForm()const;
845
846 /// Returns the previous CU that was being updated
847constDwarfCompileUnit *getPrevCU() const{return PrevCU; }
848voidsetPrevCU(constDwarfCompileUnit *PrevCU) { this->PrevCU = PrevCU; }
849
850 /// Terminate the line table by adding the last range label.
851voidterminateLineTable(constDwarfCompileUnit *CU);
852
853 /// Returns the entries for the .debug_loc section.
854constDebugLocStream &getDebugLocs() const{return DebugLocs; }
855
856 /// Emit an entry for the debug loc section. This can be used to
857 /// handle an entry that's going to be emitted into the debug loc section.
858voidemitDebugLocEntry(ByteStreamer &Streamer,
859constDebugLocStream::Entry &Entry,
860constDwarfCompileUnit *CU);
861
862 /// Emit the location for a debug loc entry, including the size header.
863voidemitDebugLocEntryLocation(constDebugLocStream::Entry &Entry,
864constDwarfCompileUnit *CU);
865
866voidaddSubprogramNames(constDwarfUnit &Unit,
867constDICompileUnit::DebugNameTableKind NameTableKind,
868constDISubprogram *SP,DIE &Die);
869
870AddressPool &getAddressPool() {return AddrPool; }
871
872voidaddAccelName(constDwarfUnit &Unit,
873constDICompileUnit::DebugNameTableKind NameTableKind,
874StringRefName,constDIE &Die);
875
876voidaddAccelObjC(constDwarfUnit &Unit,
877constDICompileUnit::DebugNameTableKind NameTableKind,
878StringRefName,constDIE &Die);
879
880voidaddAccelNamespace(constDwarfUnit &Unit,
881constDICompileUnit::DebugNameTableKind NameTableKind,
882StringRefName,constDIE &Die);
883
884voidaddAccelType(constDwarfUnit &Unit,
885constDICompileUnit::DebugNameTableKind NameTableKind,
886StringRefName,constDIE &Die,char Flags);
887
888constMachineFunction *getCurrentFunction() const{return CurFn; }
889
890 /// A helper function to check whether the DIE for a given Scope is
891 /// going to be null.
892boolisLexicalScopeDIENull(LexicalScope *Scope);
893
894 /// Find the matching DwarfCompileUnit for the given CU DIE.
895DwarfCompileUnit *lookupCU(constDIE *Die) {return CUDieMap.lookup(Die); }
896constDwarfCompileUnit *lookupCU(constDIE *Die) const{
897return CUDieMap.lookup(Die);
898 }
899
900unsignedgetStringTypeLoc(constDIStringType *ST) const{
901return StringTypeLocMap.lookup(ST);
902 }
903
904voidaddStringTypeLoc(constDIStringType *ST,unsigned Loc) {
905assert(ST);
906if (Loc)
907 StringTypeLocMap[ST] = Loc;
908 }
909
910 /// \defgroup DebuggerTuning Predicates to tune DWARF for a given debugger.
911 ///
912 /// Returns whether we are "tuning" for a given debugger.
913 /// @{
914booltuneForGDB() const{return DebuggerTuning ==DebuggerKind::GDB; }
915booltuneForLLDB() const{return DebuggerTuning ==DebuggerKind::LLDB; }
916booltuneForSCE() const{return DebuggerTuning ==DebuggerKind::SCE; }
917booltuneForDBX() const{return DebuggerTuning ==DebuggerKind::DBX; }
918 /// @}
919
920constMCSymbol *getSectionLabel(constMCSection *S);
921voidinsertSectionLabel(constMCSymbol *S);
922
923staticvoidemitDebugLocValue(constAsmPrinter &AP,constDIBasicType *BT,
924constDbgValueLoc &Value,
925DwarfExpression &DwarfExpr);
926
927 /// If the \p File has an MD5 checksum, return it as an MD5Result
928 /// allocated in the MCContext.
929 std::optional<MD5::MD5Result>getMD5AsBytes(constDIFile *File)const;
930
931MDNodeSet &getLocalDeclsForScope(constDILocalScope *S) {
932return LocalDeclsPerLS[S];
933 }
934
935 /// Sets the current DWARF5AccelTable to use.
936voidsetCurrentDWARF5AccelTable(constDWARF5AccelTableKind Kind) {
937switch (Kind) {
938caseDWARF5AccelTableKind::CU:
939 CurrentDebugNames = &AccelDebugNames;
940break;
941caseDWARF5AccelTableKind::TU:
942 CurrentDebugNames = &AccelTypeUnitsDebugNames;
943 }
944 }
945 /// Returns either CU or TU DWARF5AccelTable.
946DWARF5AccelTable &getCurrentDWARF5AccelTable() {return *CurrentDebugNames; }
947};
948
949}// end namespace llvm
950
951#endif// LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
const
aarch64 promote const
Definition:AArch64PromoteConstant.cpp:230
StringMap.h
This file defines the StringMap class.
MBB
MachineBasicBlock & MBB
Definition:ARMSLSHardening.cpp:71
AccelTable.h
This file contains support for writing accelerator tables.
AddressPool.h
Allocator.h
This file defines the BumpPtrAllocator interface.
A
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
DbgEntityHistoryCalculator.h
DebugHandlerBase.h
DebugInfoMetadata.h
DebugLocEntry.h
DebugLocStream.h
DebugLoc.h
DenseMap.h
This file defines the DenseMap class.
DenseSet.h
This file defines the DenseSet and SmallDenseSet classes.
DwarfFile.h
Dwarf.h
This file contains constants used for implementing Dwarf debug support.
Name
std::string Name
Definition:ELFObjHandler.cpp:77
Size
uint64_t Size
Definition:ELFObjHandler.cpp:81
Sym
Symbol * Sym
Definition:ELF_riscv.cpp:479
MI
IRTranslator LLVM IR MI
Definition:IRTranslator.cpp:112
MCDwarf.h
F
#define F(x, y, z)
Definition:MD5.cpp:55
Module
Machine Check Debug Module
Definition:MachineCheckDebugify.cpp:124
Reg
unsigned Reg
Definition:MachineSink.cpp:2028
MapVector.h
This file implements a map that provides insertion order iteration.
Metadata.h
This file contains the declarations for metadata subclasses.
P
#define P(N)
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SetVector.h
This file implements a set that has insertion order iteration characteristics.
SmallPtrSet.h
This file defines the SmallPtrSet class.
SmallVector.h
This file defines the SmallVector class.
StringRef.h
TargetOptions.h
RHS
Value * RHS
Definition:X86PartialReduction.cpp:74
LHS
Value * LHS
Definition:X86PartialReduction.cpp:73
LiveDebugValues::DbgValue
Class recording the (high level) value of a variable.
Definition:InstrRefBasedImpl.h:512
Node
Definition:ItaniumDemangle.h:163
llvm::AccelTable
This class holds an abstract representation of an Accelerator Table, consisting of a sequence of buck...
Definition:AccelTable.h:202
llvm::AddressPool
Definition:AddressPool.h:23
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition:AsmPrinter.h:87
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition:Allocator.h:66
llvm::ByteStreamer
Definition:ByteStreamer.h:24
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition:DebugInfoMetadata.h:823
llvm::DICompileUnit::DebugNameTableKind
DebugNameTableKind
Definition:DebugInfoMetadata.h:1482
llvm::DICompositeType
Composite types.
Definition:DebugInfoMetadata.h:1174
llvm::DIE
A structured debug information entry.
Definition:DIE.h:819
llvm::DIExpression
DWARF expression.
Definition:DebugInfoMetadata.h:2763
llvm::DIExpression::convertToNonVariadicExpression
static std::optional< const DIExpression * > convertToNonVariadicExpression(const DIExpression *Expr)
If Expr is a valid single-location expression, i.e.
Definition:DebugInfoMetadata.cpp:1624
llvm::DIFile
File.
Definition:DebugInfoMetadata.h:573
llvm::DILabel
Label.
Definition:DebugInfoMetadata.h:3551
llvm::DILabel::getName
StringRef getName() const
Definition:DebugInfoMetadata.h:3593
llvm::DILocalScope
A scope for locals.
Definition:DebugInfoMetadata.h:1675
llvm::DILocalVariable
Local variable.
Definition:DebugInfoMetadata.h:3460
llvm::DILocation
Debug location.
Definition:DebugInfoMetadata.h:1988
llvm::DINode
Tagged DWARF-like metadata node.
Definition:DebugInfoMetadata.h:135
llvm::DIStringType
String type, Fortran CHARACTER(n)
Definition:DebugInfoMetadata.h:905
llvm::DISubprogram
Subprogram description.
Definition:DebugInfoMetadata.h:1710
llvm::DIType
Base class for types.
Definition:DebugInfoMetadata.h:710
llvm::DIVariable::getName
StringRef getName() const
Definition:DebugInfoMetadata.h:2709
llvm::DWARF5AccelTable
Definition:AccelTable.h:400
llvm::DbgCallSiteParam
Used for tracking debug info about call site parameters.
Definition:DwarfDebug.h:316
llvm::DbgCallSiteParam::getRegister
unsigned getRegister() const
Definition:DwarfDebug.h:327
llvm::DbgCallSiteParam::DbgCallSiteParam
DbgCallSiteParam(unsigned Reg, DbgValueLoc Val)
Definition:DwarfDebug.h:322
llvm::DbgCallSiteParam::getValue
DbgValueLoc getValue() const
Definition:DwarfDebug.h:328
llvm::DbgEntity
This class is defined as the common parent of DbgVariable and DbgLabel such that it could levarage po...
Definition:DwarfDebug.h:65
llvm::DbgEntity::~DbgEntity
virtual ~DbgEntity()=default
llvm::DbgEntity::classof
static bool classof(const DbgEntity *N)
Definition:DwarfDebug.h:93
llvm::DbgEntity::DbgEntityKind
DbgEntityKind
Definition:DwarfDebug.h:67
llvm::DbgEntity::DbgVariableKind
@ DbgVariableKind
Definition:DwarfDebug.h:68
llvm::DbgEntity::DbgLabelKind
@ DbgLabelKind
Definition:DwarfDebug.h:69
llvm::DbgEntity::getEntity
const DINode * getEntity() const
Accessors.
Definition:DwarfDebug.h:85
llvm::DbgEntity::getDbgEntityID
DbgEntityKind getDbgEntityID() const
Definition:DwarfDebug.h:88
llvm::DbgEntity::setDIE
void setDIE(DIE &D)
Definition:DwarfDebug.h:91
llvm::DbgEntity::getDIE
DIE * getDIE() const
Definition:DwarfDebug.h:87
llvm::DbgEntity::DbgEntity
DbgEntity(const DINode *N, const DILocation *IA, DbgEntityKind ID)
Definition:DwarfDebug.h:79
llvm::DbgEntity::getInlinedAt
const DILocation * getInlinedAt() const
Definition:DwarfDebug.h:86
llvm::DbgLabel
This class is used to track label information.
Definition:DwarfDebug.h:289
llvm::DbgLabel::getTag
dwarf::Tag getTag() const
Translate tag to proper Dwarf tag.
Definition:DwarfDebug.h:306
llvm::DbgLabel::classof
static bool classof(const DbgEntity *N)
Definition:DwarfDebug.h:310
llvm::DbgLabel::DbgLabel
DbgLabel(const DILabel *L, const DILocation *IA, const MCSymbol *Sym=nullptr)
Symbol before DBG_LABEL instruction.
Definition:DwarfDebug.h:294
llvm::DbgLabel::getName
StringRef getName() const
Definition:DwarfDebug.h:302
llvm::DbgLabel::getSymbol
const MCSymbol * getSymbol() const
Definition:DwarfDebug.h:300
llvm::DbgLabel::getLabel
const DILabel * getLabel() const
Accessors.
Definition:DwarfDebug.h:299
llvm::DbgValueHistoryMap::Entries
SmallVector< Entry, 4 > Entries
Definition:DbgEntityHistoryCalculator.h:95
llvm::DbgValueHistoryMap::InlinedEntity
std::pair< const DINode *, const DILocation * > InlinedEntity
Definition:DbgEntityHistoryCalculator.h:96
llvm::DbgValueLoc
The location of a single variable, composed of an expression and 0 or more DbgValueLocEntries.
Definition:DebugLocEntry.h:111
llvm::DbgVariable
This class is used to track local variable information.
Definition:DwarfDebug.h:214
llvm::DbgVariable::asVariant
const Loc::Variant & asVariant() const
Definition:DwarfDebug.h:221
llvm::DbgVariable::isArtificial
bool isArtificial() const
Return true if DbgVariable is artificial.
Definition:DwarfDebug.h:262
llvm::DbgVariable::getTag
dwarf::Tag getTag() const
Definition:DwarfDebug.h:253
llvm::DbgVariable::isObjectPointer
bool isObjectPointer() const
Definition:DwarfDebug.h:270
llvm::DbgVariable::getVariable
const DILocalVariable * getVariable() const
Definition:DwarfDebug.h:246
llvm::DbgVariable::DbgVariable
DbgVariable(const DILocalVariable *V, const DILocation *IA)
Construct a DbgVariable.
Definition:DwarfDebug.h:242
llvm::DbgVariable::get
auto & get() noexcept
Asserting, noexcept member alternative to std::get.
Definition:DwarfDebug.h:229
llvm::DbgVariable::getName
StringRef getName() const
Definition:DwarfDebug.h:250
llvm::DbgVariable::getType
const DIType * getType() const
Definition:DwarfDebug.cpp:230
llvm::DbgVariable::get
const auto & get() const noexcept
Asserting, noexcept member alternative to std::get.
Definition:DwarfDebug.h:234
llvm::DbgVariable::asVariant
Loc::Variant & asVariant()
To workaround P2162R0 https://github.com/cplusplus/papers/issues/873 the base class subobject needs t...
Definition:DwarfDebug.h:220
llvm::DbgVariable::classof
static bool classof(const DbgEntity *N)
Definition:DwarfDebug.h:280
llvm::DbgVariable::holds
bool holds() const
Member shorthand for std::holds_alternative.
Definition:DwarfDebug.h:225
llvm::DebugHandlerBase
Base class for debug information backends.
Definition:DebugHandlerBase.h:53
llvm::DebugLocStream
Byte stream of .debug_loc entries.
Definition:DebugLocStream.h:30
llvm::DenseMapBase::lookup
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition:DenseMap.h:194
llvm::DenseMap
Definition:DenseMap.h:727
llvm::DwarfCompileUnit
Definition:DwarfCompileUnit.h:45
llvm::DwarfDebug
Collects and handles dwarf debug information.
Definition:DwarfDebug.h:351
llvm::DwarfDebug::useSegmentedStringOffsetsTable
bool useSegmentedStringOffsetsTable() const
Returns whether to generate a string offsets table with (possibly shared) contributions from each CU ...
Definition:DwarfDebug.h:823
llvm::DwarfDebug::DWARF5AccelTableKind
DWARF5AccelTableKind
Definition:DwarfDebug.h:461
llvm::DwarfDebug::DWARF5AccelTableKind::CU
@ CU
llvm::DwarfDebug::DWARF5AccelTableKind::TU
@ TU
llvm::DwarfDebug::getLocalDeclsForScope
MDNodeSet & getLocalDeclsForScope(const DILocalScope *S)
Definition:DwarfDebug.h:931
llvm::DwarfDebug::getMD5AsBytes
std::optional< MD5::MD5Result > getMD5AsBytes(const DIFile *File) const
If the File has an MD5 checksum, return it as an MD5Result allocated in the MCContext.
Definition:DwarfDebug.cpp:3919
llvm::DwarfDebug::useGNUTLSOpcode
bool useGNUTLSOpcode() const
Returns whether to use DW_OP_GNU_push_tls_address, instead of the standard DW_OP_form_tls_address opc...
Definition:DwarfDebug.h:765
llvm::DwarfDebug::useAddrOffsetForm
bool useAddrOffsetForm() const
Definition:DwarfDebug.h:789
llvm::DwarfDebug::getPrevCU
const DwarfCompileUnit * getPrevCU() const
Returns the previous CU that was being updated.
Definition:DwarfDebug.h:847
llvm::DwarfDebug::setSymbolSize
void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override
For symbols that have a size designated (e.g.
Definition:DwarfDebug.h:755
llvm::DwarfDebug::emitDebugEntryValues
bool emitDebugEntryValues() const
Definition:DwarfDebug.h:827
llvm::DwarfDebug::lookupCU
const DwarfCompileUnit * lookupCU(const DIE *Die) const
Definition:DwarfDebug.h:896
llvm::DwarfDebug::getDwarfVersion
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
Definition:DwarfDebug.cpp:3895
llvm::DwarfDebug::emitDebugLocEntry
void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocStream::Entry &Entry, const DwarfCompileUnit *CU)
Emit an entry for the debug loc section.
Definition:DwarfDebug.cpp:2852
llvm::DwarfDebug::addAccelNamespace
void addAccelNamespace(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die)
Definition:DwarfDebug.cpp:3881
llvm::DwarfDebug::setCurrentDWARF5AccelTable
void setCurrentDWARF5AccelTable(const DWARF5AccelTableKind Kind)
Sets the current DWARF5AccelTable to use.
Definition:DwarfDebug.h:936
llvm::DwarfDebug::alwaysUseRanges
bool alwaysUseRanges(const DwarfCompileUnit &) const
Returns whether range encodings should be used for single entry range lists.
Definition:DwarfDebug.cpp:3936
llvm::DwarfDebug::beginModule
void beginModule(Module *M) override
Emit all Dwarf sections that should come prior to the content.
Definition:DwarfDebug.cpp:1145
llvm::DwarfDebug::addSubprogramNames
void addSubprogramNames(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, const DISubprogram *SP, DIE &Die)
Definition:DwarfDebug.cpp:477
llvm::DwarfDebug::useAllLinkageNames
bool useAllLinkageNames() const
Returns whether we should emit all DW_AT_[MIPS_]linkage_name.
Definition:DwarfDebug.h:761
llvm::DwarfDebug::insertSectionLabel
void insertSectionLabel(const MCSymbol *S)
Definition:DwarfDebug.cpp:3912
llvm::DwarfDebug::addAccelObjC
void addAccelObjC(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die)
Definition:DwarfDebug.cpp:3872
llvm::DwarfDebug::getDwarfSectionOffsetForm
dwarf::Form getDwarfSectionOffsetForm() const
Returns a suitable DWARF form to represent a section offset, i.e.
Definition:DwarfDebug.cpp:3899
llvm::DwarfDebug::useAppleExtensionAttributes
bool useAppleExtensionAttributes() const
Definition:DwarfDebug.h:809
llvm::DwarfDebug::setPrevCU
void setPrevCU(const DwarfCompileUnit *PrevCU)
Definition:DwarfDebug.h:848
llvm::DwarfDebug::MinimizeAddrInV5
MinimizeAddrInV5
Definition:DwarfDebug.h:453
llvm::DwarfDebug::MinimizeAddrInV5::Default
@ Default
llvm::DwarfDebug::MinimizeAddrInV5::Ranges
@ Ranges
llvm::DwarfDebug::MinimizeAddrInV5::Disabled
@ Disabled
llvm::DwarfDebug::MinimizeAddrInV5::Form
@ Form
llvm::DwarfDebug::MinimizeAddrInV5::Expressions
@ Expressions
llvm::DwarfDebug::getCurrentFunction
const MachineFunction * getCurrentFunction() const
Definition:DwarfDebug.h:888
llvm::DwarfDebug::skippedNonDebugFunction
void skippedNonDebugFunction() override
Definition:DwarfDebug.cpp:2513
llvm::DwarfDebug::useInlineStrings
bool useInlineStrings() const
Returns whether to use inline strings.
Definition:DwarfDebug.h:772
llvm::DwarfDebug::addArangeLabel
void addArangeLabel(SymbolCU SCU)
Add a label so that arange data can be generated for it.
Definition:DwarfDebug.h:751
llvm::DwarfDebug::generateTypeUnits
bool generateTypeUnits() const
Returns whether to generate DWARF v4 type units.
Definition:DwarfDebug.h:799
llvm::DwarfDebug::beginInstruction
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
Definition:DwarfDebug.cpp:2000
llvm::DwarfDebug::getAddressPool
AddressPool & getAddressPool()
Definition:DwarfDebug.h:870
llvm::DwarfDebug::getCurrentDWARF5AccelTable
DWARF5AccelTable & getCurrentDWARF5AccelTable()
Returns either CU or TU DWARF5AccelTable.
Definition:DwarfDebug.h:946
llvm::DwarfDebug::useSectionsAsReferences
bool useSectionsAsReferences() const
Returns whether to use sections as labels rather than temp symbols.
Definition:DwarfDebug.h:794
llvm::DwarfDebug::getDebugLocs
const DebugLocStream & getDebugLocs() const
Returns the entries for the .debug_loc section.
Definition:DwarfDebug.h:854
llvm::DwarfDebug::shareAcrossDWOCUs
bool shareAcrossDWOCUs() const
Definition:DwarfDebug.cpp:538
llvm::DwarfDebug::useOpConvert
bool useOpConvert() const
Definition:DwarfDebug.h:831
llvm::DwarfDebug::terminateLineTable
void terminateLineTable(const DwarfCompileUnit *CU)
Terminate the line table by adding the last range label.
Definition:DwarfDebug.cpp:2504
llvm::DwarfDebug::~DwarfDebug
~DwarfDebug() override
llvm::DwarfDebug::endFunctionImpl
void endFunctionImpl(const MachineFunction *MF) override
Gather and emit post-function debug information.
Definition:DwarfDebug.cpp:2525
llvm::DwarfDebug::addStringTypeLoc
void addStringTypeLoc(const DIStringType *ST, unsigned Loc)
Definition:DwarfDebug.h:904
llvm::DwarfDebug::emitDebugLocEntryLocation
void emitDebugLocEntryLocation(const DebugLocStream::Entry &Entry, const DwarfCompileUnit *CU)
Emit the location for a debug loc entry, including the size header.
Definition:DwarfDebug.cpp:3021
llvm::DwarfDebug::lookupCU
DwarfCompileUnit * lookupCU(const DIE *Die)
Find the matching DwarfCompileUnit for the given CU DIE.
Definition:DwarfDebug.h:895
llvm::DwarfDebug::getSectionLabel
const MCSymbol * getSectionLabel(const MCSection *S)
Definition:DwarfDebug.cpp:3908
llvm::DwarfDebug::emitDebugLocValue
static void emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT, const DbgValueLoc &Value, DwarfExpression &DwarfExpr)
Definition:DwarfDebug.cpp:2896
llvm::DwarfDebug::useSplitDwarf
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support.
Definition:DwarfDebug.h:815
llvm::DwarfDebug::getDwarfCompileUnitIDForLineTable
unsigned getDwarfCompileUnitIDForLineTable(const DwarfCompileUnit &CU)
Get Dwarf compile unit ID for line table.
Definition:DwarfDebug.cpp:2493
llvm::DwarfDebug::emitInitialLocDirective
const MachineInstr * emitInitialLocDirective(const MachineFunction &MF, unsigned CUID)
Emits inital debug location directive.
Definition:DwarfDebug.cpp:2293
llvm::DwarfDebug::setTheAccelTableKind
void setTheAccelTableKind(AccelTableKind K)
Seet TheAccelTableKind.
Definition:DwarfDebug.h:807
llvm::DwarfDebug::useDWARF2Bitfields
bool useDWARF2Bitfields() const
Returns whether to use the DWARF2 format for bitfields instyead of the DWARF4 format.
Definition:DwarfDebug.h:769
llvm::DwarfDebug::useAddrOffsetExpressions
bool useAddrOffsetExpressions() const
Definition:DwarfDebug.h:783
llvm::DwarfDebug::useRangesSection
bool useRangesSection() const
Returns whether ranges section should be emitted.
Definition:DwarfDebug.h:775
llvm::DwarfDebug::addAccelName
void addAccelName(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die)
Definition:DwarfDebug.cpp:3865
llvm::DwarfDebug::getStringTypeLoc
unsigned getStringTypeLoc(const DIStringType *ST) const
Definition:DwarfDebug.h:900
llvm::DwarfDebug::isLexicalScopeDIENull
bool isLexicalScopeDIENull(LexicalScope *Scope)
A helper function to check whether the DIE for a given Scope is going to be null.
Definition:DwarfDebug.cpp:514
llvm::DwarfDebug::addDwarfTypeUnitType
void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier, DIE &Die, const DICompositeType *CTy)
Add a DIE to the set of types that we're going to pull into type units.
Definition:DwarfDebug.cpp:3707
llvm::DwarfDebug::endModule
void endModule() override
Emit all Dwarf sections that should come after the content.
Definition:DwarfDebug.cpp:1405
llvm::DwarfDebug::addAccelType
void addAccelType(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die, char Flags)
Definition:DwarfDebug.cpp:3888
llvm::DwarfDebug::beginCodeAlignment
void beginCodeAlignment(const MachineBasicBlock &MBB) override
Process beginning of code alignment.
Definition:DwarfDebug.cpp:3946
llvm::DwarfDebug::beginFunctionImpl
void beginFunctionImpl(const MachineFunction *MF) override
Gather pre-function debug information.
Definition:DwarfDebug.cpp:2469
llvm::DwarfDebug::getAccelTableKind
AccelTableKind getAccelTableKind() const
Returns what kind (if any) of accelerator tables to emit.
Definition:DwarfDebug.h:804
llvm::DwarfDebug::makeTypeSignature
static uint64_t makeTypeSignature(StringRef Identifier)
Perform an MD5 checksum of Identifier and return the lower 64 bits.
Definition:DwarfDebug.cpp:3696
llvm::DwarfExpression
Base class containing the logic for constructing DWARF expressions independently of whether they are ...
Definition:DwarfExpression.h:44
llvm::DwarfFile
Definition:DwarfFile.h:54
llvm::DwarfFile::getUnits
const SmallVectorImpl< std::unique_ptr< DwarfCompileUnit > > & getUnits()
Definition:DwarfFile.h:106
llvm::DwarfUnit
This dwarf writer support class manages information associated with a source file.
Definition:DwarfUnit.h:35
llvm::LexicalScope
LexicalScope - This class is used to track scope information.
Definition:LexicalScopes.h:44
llvm::Loc::Multi
Multi-value location description.
Definition:DwarfDebug.h:142
llvm::Loc::Multi::Multi
Multi(unsigned DebugLocListIndex, std::optional< uint8_t > DebugLocListTagOffset)
Definition:DwarfDebug.h:149
llvm::Loc::Multi::getDebugLocListIndex
unsigned getDebugLocListIndex() const
Definition:DwarfDebug.h:153
llvm::Loc::Multi::getDebugLocListTagOffset
std::optional< uint8_t > getDebugLocListTagOffset() const
Definition:DwarfDebug.h:154
llvm::Loc::Single
Single value location description.
Definition:DwarfDebug.h:131
llvm::Loc::Single::getValueLoc
const DbgValueLoc & getValueLoc() const
Definition:DwarfDebug.h:138
llvm::Loc::Single::getExpr
const DIExpression * getExpr() const
Definition:DwarfDebug.h:139
llvm::MCDwarfDwoLineTable
Definition:MCDwarf.h:338
llvm::MCRegister
Wrapper class representing physical registers. Should be passed by value.
Definition:MCRegister.h:33
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition:MCSection.h:36
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition:MCSymbol.h:41
llvm::MachineBasicBlock
Definition:MachineBasicBlock.h:125
llvm::MachineFunction
Definition:MachineFunction.h:267
llvm::MachineInstr
Representation of each machine instruction.
Definition:MachineInstr.h:71
llvm::MapVector
This class implements a map that also provides access to all stored values in a deterministic order.
Definition:MapVector.h:36
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition:Module.h:65
llvm::Register
Wrapper class representing virtual and physical registers.
Definition:Register.h:19
llvm::SetVector
A vector that has set insertion semantics.
Definition:SetVector.h:57
llvm::SmallDenseSet
Implements a dense probed hash-table based set with some number of buckets stored inline.
Definition:DenseSet.h:298
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition:SmallPtrSet.h:519
llvm::SmallSetVector
A SetVector that performs no allocations if smaller than a certain size.
Definition:SetVector.h:370
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::Value
LLVM Value Representation.
Definition:Value.h:74
uint16_t
uint64_t
unsigned
llvm::DwarfDebug::tuneForSCE
bool tuneForSCE() const
Definition:DwarfDebug.h:916
llvm::DwarfDebug::tuneForDBX
bool tuneForDBX() const
Definition:DwarfDebug.h:917
llvm::DwarfDebug::tuneForGDB
bool tuneForGDB() const
Definition:DwarfDebug.h:914
llvm::DwarfDebug::tuneForLLDB
bool tuneForLLDB() const
Definition:DwarfDebug.h:915
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition:ErrorHandling.h:143
CU
Definition:AArch64AsmBackend.cpp:549
llvm::ISD::MCSymbol
@ MCSymbol
Definition:ISDOpcodes.h:178
llvm::Loc::Variant
std::variant< std::monostate, Loc::Single, Loc::Multi, Loc::MMI, Loc::EntryValue > Variant
Alias for the std::variant specialization base class of DbgVariable.
Definition:DwarfDebug.h:190
llvm::dwarf::Form
Form
Definition:Dwarf.h:130
llvm::dwarf::Tag
Tag
Definition:Dwarf.h:103
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::operator<
bool operator<(int64_t V1, const APSInt &V2)
Definition:APSInt.h:361
llvm::None
@ None
Definition:CodeGenData.h:106
llvm::AccelTableKind
AccelTableKind
The kind of accelerator tables we should emit.
Definition:DwarfDebug.h:343
llvm::AccelTableKind::Apple
@ Apple
.apple_names, .apple_namespaces, .apple_types, .apple_objc.
llvm::AccelTableKind::Dwarf
@ Dwarf
DWARF v5 .debug_names.
llvm::DebuggerKind
DebuggerKind
Identify a debugger for "tuning" the debug info.
Definition:TargetOptions.h:94
llvm::DebuggerKind::SCE
@ SCE
Tune debug info for SCE targets (e.g. PS4).
llvm::DebuggerKind::DBX
@ DBX
Tune debug info for dbx.
llvm::DebuggerKind::Default
@ Default
No specific tuning requested.
llvm::DebuggerKind::GDB
@ GDB
Tune debug info for gdb.
llvm::DebuggerKind::LLDB
@ LLDB
Tune debug info for lldb.
llvm::InstructionUniformity::Default
@ Default
The result values are uniform if and only if all operands are uniform.
N
#define N
llvm::BitTracker
Definition:BitTracker.h:35
llvm::DebugLocStream::Entry
Definition:DebugLocStream.h:39
llvm::EntryValueInfo
Represents an entry-value location, or a fragment of one.
Definition:DwarfDebug.h:120
llvm::EntryValueInfo::operator<
friend bool operator<(const EntryValueInfo &LHS, const EntryValueInfo &RHS)
Operator enabling sorting based on fragment offset.
llvm::EntryValueInfo::Reg
MCRegister Reg
Definition:DwarfDebug.h:121
llvm::EntryValueInfo::Expr
const DIExpression & Expr
Definition:DwarfDebug.h:122
llvm::FrameIndexExpr
Proxy for one MMI entry.
Definition:DwarfDebug.h:111
llvm::FrameIndexExpr::Expr
const DIExpression * Expr
Definition:DwarfDebug.h:113
llvm::FrameIndexExpr::FI
int FI
Definition:DwarfDebug.h:112
llvm::FrameIndexExpr::operator<
friend bool operator<(const FrameIndexExpr &LHS, const FrameIndexExpr &RHS)
Operator enabling sorting based on fragment offset.
llvm::Loc::EntryValue
Single location defined by (potentially multiple) EntryValueInfo.
Definition:DwarfDebug.h:172
llvm::Loc::EntryValue::addExpr
void addExpr(MCRegister Reg, const DIExpression &Expr)
Definition:DwarfDebug.h:180
llvm::Loc::EntryValue::EntryValues
std::set< EntryValueInfo > EntryValues
Definition:DwarfDebug.h:173
llvm::Loc::EntryValue::EntryValue
EntryValue(MCRegister Reg, const DIExpression &Expr)
Definition:DwarfDebug.h:174
llvm::Loc::MMI
Single location defined by (potentially multiple) MMI entries.
Definition:DwarfDebug.h:159
llvm::Loc::MMI::addFrameIndexExpr
void addFrameIndexExpr(const DIExpression *Expr, int FI)
Definition:DwarfDebug.cpp:296
llvm::Loc::MMI::FrameIndexExprs
std::set< FrameIndexExpr > FrameIndexExprs
Definition:DwarfDebug.h:160
llvm::Loc::MMI::getFrameIndexExprs
const std::set< FrameIndexExpr > & getFrameIndexExprs() const
Get the FI entries, sorted by fragment offset.
Definition:DwarfDebug.cpp:292
llvm::Loc::MMI::MMI
MMI(const DIExpression *E, int FI)
Definition:DwarfDebug.h:163
llvm::SymbolCU
Helper used to pair up a symbol and its DWARF compile unit.
Definition:DwarfDebug.h:335
llvm::SymbolCU::Sym
const MCSymbol * Sym
Definition:DwarfDebug.h:338
llvm::SymbolCU::CU
DwarfCompileUnit * CU
Definition:DwarfDebug.h:339
llvm::SymbolCU::SymbolCU
SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym)
Definition:DwarfDebug.h:336

Generated on Sun Jul 20 2025 08:27:11 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp