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