Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
DwarfCompileUnit.cpp
Go to the documentation of this file.
1//===- llvm/CodeGen/DwarfCompileUnit.cpp - Dwarf Compile Units ------------===//
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 constructing a dwarf compile unit.
10//
11//===----------------------------------------------------------------------===//
12
13#include "DwarfCompileUnit.h"
14#include "AddressPool.h"
15#include "DwarfExpression.h"
16#include "llvm/ADT/STLExtras.h"
17#include "llvm/ADT/SmallString.h"
18#include "llvm/BinaryFormat/Dwarf.h"
19#include "llvm/CodeGen/AsmPrinter.h"
20#include "llvm/CodeGen/DIE.h"
21#include "llvm/CodeGen/MachineFunction.h"
22#include "llvm/CodeGen/MachineInstr.h"
23#include "llvm/CodeGen/TargetFrameLowering.h"
24#include "llvm/CodeGen/TargetRegisterInfo.h"
25#include "llvm/CodeGen/TargetSubtargetInfo.h"
26#include "llvm/IR/DataLayout.h"
27#include "llvm/IR/DebugInfo.h"
28#include "llvm/IR/GlobalVariable.h"
29#include "llvm/MC/MCAsmInfo.h"
30#include "llvm/MC/MCSection.h"
31#include "llvm/MC/MCStreamer.h"
32#include "llvm/MC/MCSymbol.h"
33#include "llvm/MC/MCSymbolWasm.h"
34#include "llvm/MC/MachineLocation.h"
35#include "llvm/Support/CommandLine.h"
36#include "llvm/Target/TargetLoweringObjectFile.h"
37#include "llvm/Target/TargetMachine.h"
38#include "llvm/Target/TargetOptions.h"
39#include <optional>
40#include <string>
41#include <utility>
42
43using namespacellvm;
44
45/// Query value using AddLinkageNamesToDeclCallOriginsForTuning.
46cl::opt<cl::boolOrDefault>AddLinkageNamesToDeclCallOrigins(
47"add-linkage-names-to-declaration-call-origins",cl::Hidden,
48cl::desc("Add DW_AT_linkage_name to function declaration DIEs "
49"referenced by DW_AT_call_origin attributes. Enabled by default "
50"for -gsce debugger tuning."));
51
52staticcl::opt<bool>EmitFuncLineTableOffsetsOption(
53"emit-func-debug-line-table-offsets",cl::Hidden,
54cl::desc("Include line table offset in function's debug info and emit end "
55"sequence after each function's line data."),
56cl::init(false));
57
58staticboolAddLinkageNamesToDeclCallOriginsForTuning(constDwarfDebug *DD) {
59bool EnabledByDefault = DD->tuneForSCE();
60if (EnabledByDefault)
61returnAddLinkageNamesToDeclCallOrigins != cl::boolOrDefault::BOU_FALSE;
62returnAddLinkageNamesToDeclCallOrigins == cl::boolOrDefault::BOU_TRUE;
63}
64
65staticdwarf::TagGetCompileUnitType(UnitKind Kind,DwarfDebug *DW) {
66
67// According to DWARF Debugging Information Format Version 5,
68// 3.1.2 Skeleton Compilation Unit Entries:
69// "When generating a split DWARF object file (see Section 7.3.2
70// on page 187), the compilation unit in the .debug_info section
71// is a "skeleton" compilation unit with the tag DW_TAG_skeleton_unit"
72if (DW->getDwarfVersion() >= 5 && Kind == UnitKind::Skeleton)
73return dwarf::DW_TAG_skeleton_unit;
74
75return dwarf::DW_TAG_compile_unit;
76}
77
78DwarfCompileUnit::DwarfCompileUnit(unsigned UID,constDICompileUnit *Node,
79AsmPrinter *A,DwarfDebug *DW,
80DwarfFile *DWU,UnitKind Kind)
81 :DwarfUnit(GetCompileUnitType(Kind, DW), Node,A, DW, DWU, UID) {
82insertDIE(Node, &getUnitDie());
83 MacroLabelBegin =Asm->createTempSymbol("cu_macro_begin");
84}
85
86/// addLabelAddress - Add a dwarf label attribute data and value using
87/// DW_FORM_addr or DW_FORM_GNU_addr_index.
88voidDwarfCompileUnit::addLabelAddress(DIE &Die,dwarf::AttributeAttribute,
89constMCSymbol *Label) {
90if ((Skeleton || !DD->useSplitDwarf()) && Label)
91DD->addArangeLabel(SymbolCU(this, Label));
92
93// Don't use the address pool in non-fission or in the skeleton unit itself.
94if ((!DD->useSplitDwarf() || !Skeleton) &&DD->getDwarfVersion() < 5)
95returnaddLocalLabelAddress(Die,Attribute, Label);
96
97bool UseAddrOffsetFormOrExpressions =
98DD->useAddrOffsetForm() ||DD->useAddrOffsetExpressions();
99
100constMCSymbol *Base =nullptr;
101if (Label->isInSection() && UseAddrOffsetFormOrExpressions)
102Base =DD->getSectionLabel(&Label->getSection());
103
104if (!Base ||Base == Label) {
105unsigned idx =DD->getAddressPool().getIndex(Label);
106addAttribute(Die,Attribute,
107DD->getDwarfVersion() >= 5 ? dwarf::DW_FORM_addrx
108 : dwarf::DW_FORM_GNU_addr_index,
109DIEInteger(idx));
110return;
111 }
112
113// Could be extended to work with DWARFv4 Split DWARF if that's important for
114// someone. In that case DW_FORM_data would be used.
115assert(DD->getDwarfVersion() >= 5 &&
116"Addr+offset expressions are only valuable when using debug_addr (to "
117"reduce relocations) available in DWARFv5 or higher");
118if (DD->useAddrOffsetExpressions()) {
119auto *Loc =new (DIEValueAllocator)DIEBlock();
120addPoolOpAddress(*Loc, Label);
121addBlock(Die,Attribute, dwarf::DW_FORM_exprloc, Loc);
122 }else
123addAttribute(Die,Attribute, dwarf::DW_FORM_LLVM_addrx_offset,
124new (DIEValueAllocator)DIEAddrOffset(
125DD->getAddressPool().getIndex(Base), Label,Base));
126}
127
128voidDwarfCompileUnit::addLocalLabelAddress(DIE &Die,
129dwarf::AttributeAttribute,
130constMCSymbol *Label) {
131if (Label)
132addAttribute(Die,Attribute, dwarf::DW_FORM_addr,DIELabel(Label));
133else
134addAttribute(Die,Attribute, dwarf::DW_FORM_addr,DIEInteger(0));
135}
136
137unsignedDwarfCompileUnit::getOrCreateSourceID(constDIFile *File) {
138// If we print assembly, we can't separate .file entries according to
139// compile units. Thus all files will belong to the default compile unit.
140
141// FIXME: add a better feature test than hasRawTextSupport. Even better,
142// extend .file to support this.
143unsigned CUID =Asm->OutStreamer->hasRawTextSupport() ? 0 :getUniqueID();
144if (!File)
145returnAsm->OutStreamer->emitDwarfFileDirective(0,"","", std::nullopt,
146 std::nullopt, CUID);
147
148if (LastFile != File) {
149 LastFile = File;
150 LastFileID =Asm->OutStreamer->emitDwarfFileDirective(
151 0, File->getDirectory(), File->getFilename(),DD->getMD5AsBytes(File),
152 File->getSource(), CUID);
153 }
154return LastFileID;
155}
156
157DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
158constDIGlobalVariable *GV,ArrayRef<GlobalExpr> GlobalExprs) {
159// Check for pre-existence.
160if (DIE *Die =getDIE(GV))
161return Die;
162
163assert(GV);
164
165auto *GVContext = GV->getScope();
166constDIType *GTy = GV->getType();
167
168auto *CB = GVContext ? dyn_cast<DICommonBlock>(GVContext) :nullptr;
169DIE *ContextDIE = CB ?getOrCreateCommonBlock(CB, GlobalExprs)
170 :getOrCreateContextDIE(GVContext);
171
172// Add to map.
173DIE *VariableDIE = &createAndAddDIE(GV->getTag(), *ContextDIE, GV);
174DIScope *DeclContext;
175if (auto *SDMDecl = GV->getStaticDataMemberDeclaration()) {
176DeclContext = SDMDecl->getScope();
177assert(SDMDecl->isStaticMember() &&"Expected static member decl");
178assert(GV->isDefinition());
179// We need the declaration DIE that is in the static member's class.
180DIE *VariableSpecDIE =getOrCreateStaticMemberDIE(SDMDecl);
181addDIEEntry(*VariableDIE, dwarf::DW_AT_specification, *VariableSpecDIE);
182// If the global variable's type is different from the one in the class
183// member type, assume that it's more specific and also emit it.
184if (GTy != SDMDecl->getBaseType())
185addType(*VariableDIE, GTy);
186 }else {
187DeclContext = GV->getScope();
188// Add name and type.
189StringRef DisplayName = GV->getDisplayName();
190if (!DisplayName.empty())
191addString(*VariableDIE, dwarf::DW_AT_name, GV->getDisplayName());
192if (GTy)
193addType(*VariableDIE, GTy);
194
195// Add scoping info.
196if (!GV->isLocalToUnit())
197addFlag(*VariableDIE, dwarf::DW_AT_external);
198
199// Add line number info.
200addSourceLine(*VariableDIE, GV);
201 }
202
203if (!GV->isDefinition())
204addFlag(*VariableDIE, dwarf::DW_AT_declaration);
205else
206addGlobalName(GV->getName(), *VariableDIE,DeclContext);
207
208addAnnotation(*VariableDIE, GV->getAnnotations());
209
210if (uint32_t AlignInBytes = GV->getAlignInBytes())
211addUInt(*VariableDIE, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
212 AlignInBytes);
213
214if (MDTuple *TP = GV->getTemplateParams())
215addTemplateParams(*VariableDIE, DINodeArray(TP));
216
217// Add location.
218addLocationAttribute(VariableDIE, GV, GlobalExprs);
219
220return VariableDIE;
221}
222
223voidDwarfCompileUnit::addLocationAttribute(
224DIE *VariableDIE,constDIGlobalVariable *GV,ArrayRef<GlobalExpr> GlobalExprs) {
225bool addToAccelTable =false;
226DIELoc *Loc =nullptr;
227 std::optional<unsigned> NVPTXAddressSpace;
228 std::unique_ptr<DIEDwarfExpression> DwarfExpr;
229for (constauto &GE : GlobalExprs) {
230constGlobalVariable *Global = GE.Var;
231constDIExpression *Expr = GE.Expr;
232
233// For compatibility with DWARF 3 and earlier,
234// DW_AT_location(DW_OP_constu, X, DW_OP_stack_value) or
235// DW_AT_location(DW_OP_consts, X, DW_OP_stack_value) becomes
236// DW_AT_const_value(X).
237if (GlobalExprs.size() == 1 && Expr && Expr->isConstant()) {
238 addToAccelTable =true;
239addConstantValue(
240 *VariableDIE,
241DIExpression::SignedOrUnsignedConstant::UnsignedConstant ==
242 *Expr->isConstant(),
243 Expr->getElement(1));
244break;
245 }
246
247// We cannot describe the location of dllimport'd variables: the
248// computation of their address requires loads from the IAT.
249if (Global &&Global->hasDLLImportStorageClass())
250continue;
251
252// Nothing to describe without address or constant.
253if (!Global && (!Expr || !Expr->isConstant()))
254continue;
255
256if (Global &&Global->isThreadLocal() &&
257 !Asm->getObjFileLowering().supportDebugThreadLocalLocation())
258continue;
259
260if (!Loc) {
261 addToAccelTable =true;
262 Loc =new (DIEValueAllocator)DIELoc;
263 DwarfExpr = std::make_unique<DIEDwarfExpression>(*Asm, *this, *Loc);
264 }
265
266if (Expr) {
267// According to
268// https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf
269// cuda-gdb requires DW_AT_address_class for all variables to be able to
270// correctly interpret address space of the variable address.
271// Decode DW_OP_constu <DWARF Address Space> DW_OP_swap DW_OP_xderef
272// sequence for the NVPTX + gdb target.
273unsigned LocalNVPTXAddressSpace;
274if (Asm->TM.getTargetTriple().isNVPTX() &&DD->tuneForGDB()) {
275constDIExpression *NewExpr =
276DIExpression::extractAddressClass(Expr, LocalNVPTXAddressSpace);
277if (NewExpr != Expr) {
278 Expr =NewExpr;
279 NVPTXAddressSpace = LocalNVPTXAddressSpace;
280 }
281 }
282 DwarfExpr->addFragmentOffset(Expr);
283 }
284
285if (Global) {
286constMCSymbol *Sym =Asm->getSymbol(Global);
287// 16-bit platforms like MSP430 and AVR take this path, so sink this
288// assert to platforms that use it.
289auto GetPointerSizedFormAndOp = [this]() {
290unsigned PointerSize =Asm->MAI->getCodePointerSize();
291assert((PointerSize == 4 || PointerSize == 8) &&
292"Add support for other sizes if necessary");
293structFormAndOp {
294dwarf::Form Form;
295dwarf::LocationAtomOp;
296 };
297return PointerSize == 4
298 ? FormAndOp{dwarf::DW_FORM_data4, dwarf::DW_OP_const4u}
299 : FormAndOp{dwarf::DW_FORM_data8, dwarf::DW_OP_const8u};
300 };
301if (Global->isThreadLocal()) {
302if (Asm->TM.getTargetTriple().isWasm()) {
303// FIXME This is not guaranteed, but in practice, in static linking,
304// if present, __tls_base's index is 1. This doesn't hold for dynamic
305// linking, so TLS variables used in dynamic linking won't have
306// correct debug info for now. See
307// https://github.com/llvm/llvm-project/blob/19afbfe33156d211fa959dadeea46cd17b9c723c/lld/wasm/Driver.cpp#L786-L823
308 addWasmRelocBaseGlobal(Loc,"__tls_base", 1);
309addOpAddress(*Loc,Sym);
310addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
311 }elseif (Asm->TM.useEmulatedTLS()) {
312// TODO: add debug info for emulated thread local mode.
313 }else {
314// FIXME: Make this work with -gsplit-dwarf.
315// Based on GCC's support for TLS:
316if (!DD->useSplitDwarf()) {
317auto FormAndOp = GetPointerSizedFormAndOp();
318// 1) Start with a constNu of the appropriate pointer size
319addUInt(*Loc, dwarf::DW_FORM_data1, FormAndOp.Op);
320// 2) containing the (relocated) offset of the TLS variable
321// within the module's TLS block.
322addExpr(*Loc, FormAndOp.Form,
323Asm->getObjFileLowering().getDebugThreadLocalSymbol(Sym));
324 }else {
325addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);
326addUInt(*Loc, dwarf::DW_FORM_udata,
327DD->getAddressPool().getIndex(Sym,/* TLS */true));
328 }
329// 3) followed by an OP to make the debugger do a TLS lookup.
330addUInt(*Loc, dwarf::DW_FORM_data1,
331DD->useGNUTLSOpcode() ? dwarf::DW_OP_GNU_push_tls_address
332 : dwarf::DW_OP_form_tls_address);
333 }
334 }elseif (Asm->TM.getTargetTriple().isWasm() &&
335Asm->TM.getRelocationModel() ==Reloc::PIC_) {
336// FIXME This is not guaranteed, but in practice, if present,
337// __memory_base's index is 1. See
338// https://github.com/llvm/llvm-project/blob/19afbfe33156d211fa959dadeea46cd17b9c723c/lld/wasm/Driver.cpp#L786-L823
339 addWasmRelocBaseGlobal(Loc,"__memory_base", 1);
340addOpAddress(*Loc,Sym);
341addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
342 }elseif ((Asm->TM.getRelocationModel() ==Reloc::RWPI ||
343Asm->TM.getRelocationModel() ==Reloc::ROPI_RWPI) &&
344 !Asm->getObjFileLowering()
345 .getKindForGlobal(Global,Asm->TM)
346 .isReadOnly()) {
347auto FormAndOp = GetPointerSizedFormAndOp();
348// Constant
349addUInt(*Loc, dwarf::DW_FORM_data1, FormAndOp.Op);
350// Relocation offset
351addExpr(*Loc, FormAndOp.Form,
352Asm->getObjFileLowering().getIndirectSymViaRWPI(Sym));
353// Base register
354Register BaseReg =Asm->getObjFileLowering().getStaticBase();
355unsigned DwarfBaseReg =
356Asm->TM.getMCRegisterInfo()->getDwarfRegNum(BaseReg,false);
357addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + DwarfBaseReg);
358// Offset from base register
359addSInt(*Loc, dwarf::DW_FORM_sdata, 0);
360// Operation
361addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
362 }else {
363DD->addArangeLabel(SymbolCU(this,Sym));
364addOpAddress(*Loc,Sym);
365 }
366 }
367// Global variables attached to symbols are memory locations.
368// It would be better if this were unconditional, but malformed input that
369// mixes non-fragments and fragments for the same variable is too expensive
370// to detect in the verifier.
371if (DwarfExpr->isUnknownLocation())
372 DwarfExpr->setMemoryLocationKind();
373 DwarfExpr->addExpression(Expr);
374 }
375if (Asm->TM.getTargetTriple().isNVPTX() &&DD->tuneForGDB()) {
376// According to
377// https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf
378// cuda-gdb requires DW_AT_address_class for all variables to be able to
379// correctly interpret address space of the variable address.
380constunsigned NVPTX_ADDR_global_space = 5;
381addUInt(*VariableDIE, dwarf::DW_AT_address_class, dwarf::DW_FORM_data1,
382 NVPTXAddressSpace.value_or(NVPTX_ADDR_global_space));
383 }
384if (Loc)
385addBlock(*VariableDIE, dwarf::DW_AT_location, DwarfExpr->finalize());
386
387if (DD->useAllLinkageNames())
388addLinkageName(*VariableDIE, GV->getLinkageName());
389
390if (addToAccelTable) {
391DD->addAccelName(*this,CUNode->getNameTableKind(), GV->getName(),
392 *VariableDIE);
393
394// If the linkage name is different than the name, go ahead and output
395// that as well into the name table.
396if (GV->getLinkageName() !="" && GV->getName() != GV->getLinkageName() &&
397DD->useAllLinkageNames())
398DD->addAccelName(*this,CUNode->getNameTableKind(), GV->getLinkageName(),
399 *VariableDIE);
400 }
401}
402
403DIE *DwarfCompileUnit::getOrCreateCommonBlock(
404constDICommonBlock *CB,ArrayRef<GlobalExpr> GlobalExprs) {
405// Check for pre-existence.
406if (DIE *NDie =getDIE(CB))
407return NDie;
408DIE *ContextDIE =getOrCreateContextDIE(CB->getScope());
409DIE &NDie =createAndAddDIE(dwarf::DW_TAG_common_block, *ContextDIE, CB);
410StringRefName = CB->getName().empty() ?"_BLNK_" : CB->getName();
411addString(NDie, dwarf::DW_AT_name,Name);
412addGlobalName(Name, NDie, CB->getScope());
413if (CB->getFile())
414addSourceLine(NDie, CB->getLineNo(), CB->getFile());
415if (DIGlobalVariable *V = CB->getDecl())
416getCU().addLocationAttribute(&NDie, V, GlobalExprs);
417return &NDie;
418}
419
420voidDwarfCompileUnit::addRange(RangeSpanRange) {
421DD->insertSectionLabel(Range.Begin);
422
423auto *PrevCU =DD->getPrevCU();
424bool SameAsPrevCU =this == PrevCU;
425DD->setPrevCU(this);
426// If we have no current ranges just add the range and return, otherwise,
427// check the current section and CU against the previous section and CU we
428// emitted into and the subprogram was contained within. If these are the
429// same then extend our current range, otherwise add this as a new range.
430if (CURanges.empty() || !SameAsPrevCU ||
431 (&CURanges.back().End->getSection() !=
432 &Range.End->getSection())) {
433// Before a new range is added, always terminate the prior line table.
434if (PrevCU)
435DD->terminateLineTable(PrevCU);
436 CURanges.push_back(Range);
437return;
438 }
439
440 CURanges.back().End =Range.End;
441}
442
443voidDwarfCompileUnit::initStmtList() {
444if (CUNode->isDebugDirectivesOnly())
445return;
446
447constTargetLoweringObjectFile &TLOF =Asm->getObjFileLowering();
448if (DD->useSectionsAsReferences()) {
449 LineTableStartSym = TLOF.getDwarfLineSection()->getBeginSymbol();
450 }else {
451 LineTableStartSym =
452Asm->OutStreamer->getDwarfLineTableSymbol(getUniqueID());
453 }
454
455// DW_AT_stmt_list is a offset of line number information for this
456// compile unit in debug_line section. For split dwarf this is
457// left in the skeleton CU and so not included.
458// The line table entries are not always emitted in assembly, so it
459// is not okay to use line_table_start here.
460addSectionLabel(getUnitDie(), dwarf::DW_AT_stmt_list, LineTableStartSym,
461 TLOF.getDwarfLineSection()->getBeginSymbol());
462}
463
464voidDwarfCompileUnit::applyStmtList(DIE &D) {
465constTargetLoweringObjectFile &TLOF =Asm->getObjFileLowering();
466addSectionLabel(D, dwarf::DW_AT_stmt_list, LineTableStartSym,
467 TLOF.getDwarfLineSection()->getBeginSymbol());
468}
469
470voidDwarfCompileUnit::attachLowHighPC(DIE &D,constMCSymbol *Begin,
471constMCSymbol *End) {
472assert(Begin &&"Begin label should not be null!");
473assert(End &&"End label should not be null!");
474assert(Begin->isDefined() &&"Invalid starting label");
475assert(End->isDefined() &&"Invalid end label");
476
477addLabelAddress(D, dwarf::DW_AT_low_pc, Begin);
478if (DD->getDwarfVersion() < 4)
479addLabelAddress(D, dwarf::DW_AT_high_pc,End);
480else
481addLabelDelta(D, dwarf::DW_AT_high_pc,End, Begin);
482}
483
484// Add info for Wasm-global-based relocation.
485// 'GlobalIndex' is used for split dwarf, which currently relies on a few
486// assumptions that are not guaranteed in a formal way but work in practice.
487void DwarfCompileUnit::addWasmRelocBaseGlobal(DIELoc *Loc,StringRef GlobalName,
488uint64_t GlobalIndex) {
489// FIXME: duplicated from Target/WebAssembly/WebAssembly.h
490// don't want to depend on target specific headers in this code?
491constunsigned TI_GLOBAL_RELOC = 3;
492unsigned PointerSize =Asm->getDataLayout().getPointerSize();
493auto *Sym = cast<MCSymbolWasm>(Asm->GetExternalSymbolSymbol(GlobalName));
494// FIXME: this repeats what WebAssemblyMCInstLower::
495// GetExternalSymbolSymbol does, since if there's no code that
496// refers to this symbol, we have to set it here.
497Sym->setType(wasm::WASM_SYMBOL_TYPE_GLOBAL);
498Sym->setGlobalType(wasm::WasmGlobalType{
499static_cast<uint8_t>(PointerSize == 4 ?wasm::WASM_TYPE_I32
500 :wasm::WASM_TYPE_I64),
501true});
502addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_WASM_location);
503addSInt(*Loc, dwarf::DW_FORM_sdata, TI_GLOBAL_RELOC);
504if (!isDwoUnit()) {
505addLabel(*Loc, dwarf::DW_FORM_data4,Sym);
506 }else {
507// FIXME: when writing dwo, we need to avoid relocations. Probably
508// the "right" solution is to treat globals the way func and data
509// symbols are (with entries in .debug_addr).
510// For now we hardcode the indices in the callsites. Global indices are not
511// fixed, but in practice a few are fixed; for example, __stack_pointer is
512// always index 0.
513addUInt(*Loc, dwarf::DW_FORM_data4, GlobalIndex);
514 }
515}
516
517// Find DIE for the given subprogram and attach appropriate DW_AT_low_pc
518// and DW_AT_high_pc attributes. If there are global variables in this
519// scope then create and insert DIEs for these variables.
520DIE &DwarfCompileUnit::updateSubprogramScopeDIE(constDISubprogram *SP,
521MCSymbol *LineTableSym) {
522DIE *SPDie =getOrCreateSubprogramDIE(SP,includeMinimalInlineScopes());
523SmallVector<RangeSpan, 2> BB_List;
524// If basic block sections are on, ranges for each basic block section has
525// to be emitted separately.
526for (constauto &R :Asm->MBBSectionRanges)
527 BB_List.push_back({R.second.BeginLabel, R.second.EndLabel});
528
529attachRangesOrLowHighPC(*SPDie, BB_List);
530
531if (DD->useAppleExtensionAttributes() &&
532 !DD->getCurrentFunction()->getTarget().Options.DisableFramePointerElim(
533 *DD->getCurrentFunction()))
534addFlag(*SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr);
535
536if (emitFuncLineTableOffsets() && LineTableSym) {
537addSectionLabel(
538 *SPDie, dwarf::DW_AT_LLVM_stmt_sequence, LineTableSym,
539Asm->getObjFileLowering().getDwarfLineSection()->getBeginSymbol());
540 }
541
542// Only include DW_AT_frame_base in full debug info
543if (!includeMinimalInlineScopes()) {
544constTargetFrameLowering *TFI =Asm->MF->getSubtarget().getFrameLowering();
545TargetFrameLowering::DwarfFrameBase FrameBase =
546 TFI->getDwarfFrameBase(*Asm->MF);
547switch (FrameBase.Kind) {
548caseTargetFrameLowering::DwarfFrameBase::Register: {
549if (Register::isPhysicalRegister(FrameBase.Location.Reg)) {
550MachineLocation Location(FrameBase.Location.Reg);
551addAddress(*SPDie, dwarf::DW_AT_frame_base, Location);
552 }
553break;
554 }
555caseTargetFrameLowering::DwarfFrameBase::CFA: {
556DIELoc *Loc =new (DIEValueAllocator)DIELoc;
557addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_call_frame_cfa);
558if (FrameBase.Location.Offset != 0) {
559addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_consts);
560addSInt(*Loc, dwarf::DW_FORM_sdata, FrameBase.Location.Offset);
561addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
562 }
563addBlock(*SPDie, dwarf::DW_AT_frame_base, Loc);
564break;
565 }
566caseTargetFrameLowering::DwarfFrameBase::WasmFrameBase: {
567// FIXME: duplicated from Target/WebAssembly/WebAssembly.h
568constunsigned TI_GLOBAL_RELOC = 3;
569if (FrameBase.Location.WasmLoc.Kind == TI_GLOBAL_RELOC) {
570// These need to be relocatable.
571DIELoc *Loc =new (DIEValueAllocator)DIELoc;
572assert(FrameBase.Location.WasmLoc.Index == 0);// Only SP so far.
573// For now, since we only ever use index 0, this should work as-is.
574 addWasmRelocBaseGlobal(Loc,"__stack_pointer",
575 FrameBase.Location.WasmLoc.Index);
576addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);
577addBlock(*SPDie, dwarf::DW_AT_frame_base, Loc);
578 }else {
579DIELoc *Loc =new (DIEValueAllocator)DIELoc;
580DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
581DIExpressionCursor Cursor({});
582 DwarfExpr.addWasmLocation(FrameBase.Location.WasmLoc.Kind,
583 FrameBase.Location.WasmLoc.Index);
584 DwarfExpr.addExpression(std::move(Cursor));
585addBlock(*SPDie, dwarf::DW_AT_frame_base, DwarfExpr.finalize());
586 }
587break;
588 }
589 }
590 }
591
592// Add name to the name table, we do this here because we're guaranteed
593// to have concrete versions of our DW_TAG_subprogram nodes.
594DD->addSubprogramNames(*this,CUNode->getNameTableKind(), SP, *SPDie);
595
596return *SPDie;
597}
598
599// Construct a DIE for this scope.
600voidDwarfCompileUnit::constructScopeDIE(LexicalScope *Scope,
601DIE &ParentScopeDIE) {
602if (!Scope || !Scope->getScopeNode())
603return;
604
605auto *DS = Scope->getScopeNode();
606
607assert((Scope->getInlinedAt() || !isa<DISubprogram>(DS)) &&
608"Only handle inlined subprograms here, use "
609"constructSubprogramScopeDIE for non-inlined "
610"subprograms");
611
612// Emit inlined subprograms.
613if (Scope->getParent() && isa<DISubprogram>(DS)) {
614DIE *ScopeDIE =constructInlinedScopeDIE(Scope, ParentScopeDIE);
615assert(ScopeDIE &&"Scope DIE should not be null.");
616createAndAddScopeChildren(Scope, *ScopeDIE);
617return;
618 }
619
620// Early exit when we know the scope DIE is going to be null.
621if (DD->isLexicalScopeDIENull(Scope))
622return;
623
624// Emit lexical blocks.
625DIE *ScopeDIE =constructLexicalScopeDIE(Scope);
626assert(ScopeDIE &&"Scope DIE should not be null.");
627
628 ParentScopeDIE.addChild(ScopeDIE);
629createAndAddScopeChildren(Scope, *ScopeDIE);
630}
631
632voidDwarfCompileUnit::addScopeRangeList(DIE &ScopeDIE,
633SmallVector<RangeSpan, 2>Range) {
634
635 HasRangeLists =true;
636
637// Add the range list to the set of ranges to be emitted.
638auto IndexAndList =
639 (DD->getDwarfVersion() < 5 && Skeleton ? Skeleton->DU :DU)
640 ->addRange(*(Skeleton ? Skeleton :this), std::move(Range));
641
642uint32_t Index = IndexAndList.first;
643auto &List = *IndexAndList.second;
644
645// Under fission, ranges are specified by constant offsets relative to the
646// CU's DW_AT_GNU_ranges_base.
647// FIXME: For DWARF v5, do not generate the DW_AT_ranges attribute under
648// fission until we support the forms using the .debug_addr section
649// (DW_RLE_startx_endx etc.).
650if (DD->getDwarfVersion() >= 5)
651addUInt(ScopeDIE, dwarf::DW_AT_ranges, dwarf::DW_FORM_rnglistx, Index);
652else {
653constTargetLoweringObjectFile &TLOF =Asm->getObjFileLowering();
654constMCSymbol *RangeSectionSym =
655 TLOF.getDwarfRangesSection()->getBeginSymbol();
656if (isDwoUnit())
657addSectionDelta(ScopeDIE, dwarf::DW_AT_ranges,List.Label,
658 RangeSectionSym);
659else
660addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges,List.Label,
661 RangeSectionSym);
662 }
663}
664
665voidDwarfCompileUnit::attachRangesOrLowHighPC(
666DIE &Die,SmallVector<RangeSpan, 2> Ranges) {
667assert(!Ranges.empty());
668if (!DD->useRangesSection() ||
669 (Ranges.size() == 1 &&
670 (!DD->alwaysUseRanges(*this) ||
671DD->getSectionLabel(&Ranges.front().Begin->getSection()) ==
672 Ranges.front().Begin))) {
673constRangeSpan &Front = Ranges.front();
674constRangeSpan &Back = Ranges.back();
675attachLowHighPC(Die, Front.Begin, Back.End);
676 }else
677addScopeRangeList(Die, std::move(Ranges));
678}
679
680voidDwarfCompileUnit::attachRangesOrLowHighPC(
681DIE &Die,constSmallVectorImpl<InsnRange> &Ranges) {
682SmallVector<RangeSpan, 2>List;
683List.reserve(Ranges.size());
684for (constInsnRange &R : Ranges) {
685auto *BeginLabel =DD->getLabelBeforeInsn(R.first);
686auto *EndLabel =DD->getLabelAfterInsn(R.second);
687
688constauto *BeginMBB = R.first->getParent();
689constauto *EndMBB = R.second->getParent();
690
691constauto *MBB = BeginMBB;
692// Basic block sections allows basic block subsets to be placed in unique
693// sections. For each section, the begin and end label must be added to the
694// list. If there is more than one range, debug ranges must be used.
695// Otherwise, low/high PC can be used.
696// FIXME: Debug Info Emission depends on block order and this assumes that
697// the order of blocks will be frozen beyond this point.
698do {
699if (MBB->sameSection(EndMBB) ||MBB->isEndSection()) {
700auto MBBSectionRange =Asm->MBBSectionRanges[MBB->getSectionID()];
701List.push_back(
702 {MBB->sameSection(BeginMBB) ? BeginLabel
703 : MBBSectionRange.BeginLabel,
704MBB->sameSection(EndMBB) ?EndLabel : MBBSectionRange.EndLabel});
705 }
706if (MBB->sameSection(EndMBB))
707break;
708MBB =MBB->getNextNode();
709 }while (true);
710 }
711attachRangesOrLowHighPC(Die, std::move(List));
712}
713
714DIE *DwarfCompileUnit::constructInlinedScopeDIE(LexicalScope *Scope,
715DIE &ParentScopeDIE) {
716assert(Scope->getScopeNode());
717auto *DS = Scope->getScopeNode();
718auto *InlinedSP =getDISubprogram(DS);
719// Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram
720// was inlined from another compile unit.
721DIE *OriginDIE = getAbstractScopeDIEs()[InlinedSP];
722assert(OriginDIE &&"Unable to find original DIE for an inlined subprogram.");
723
724auto ScopeDIE =DIE::get(DIEValueAllocator, dwarf::DW_TAG_inlined_subroutine);
725 ParentScopeDIE.addChild(ScopeDIE);
726addDIEEntry(*ScopeDIE, dwarf::DW_AT_abstract_origin, *OriginDIE);
727
728attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges());
729
730// Add the call site information to the DIE.
731constDILocation *IA = Scope->getInlinedAt();
732addUInt(*ScopeDIE, dwarf::DW_AT_call_file, std::nullopt,
733getOrCreateSourceID(IA->getFile()));
734addUInt(*ScopeDIE, dwarf::DW_AT_call_line, std::nullopt, IA->getLine());
735if (IA->getColumn())
736addUInt(*ScopeDIE, dwarf::DW_AT_call_column, std::nullopt, IA->getColumn());
737if (IA->getDiscriminator() &&DD->getDwarfVersion() >= 4)
738addUInt(*ScopeDIE, dwarf::DW_AT_GNU_discriminator, std::nullopt,
739 IA->getDiscriminator());
740
741// Add name to the name table, we do this here because we're guaranteed
742// to have concrete versions of our DW_TAG_inlined_subprogram nodes.
743DD->addSubprogramNames(*this,CUNode->getNameTableKind(), InlinedSP,
744 *ScopeDIE);
745
746return ScopeDIE;
747}
748
749// Construct new DW_TAG_lexical_block for this scope and attach
750// DW_AT_low_pc/DW_AT_high_pc labels.
751DIE *DwarfCompileUnit::constructLexicalScopeDIE(LexicalScope *Scope) {
752if (DD->isLexicalScopeDIENull(Scope))
753returnnullptr;
754constauto *DS = Scope->getScopeNode();
755
756auto ScopeDIE =DIE::get(DIEValueAllocator, dwarf::DW_TAG_lexical_block);
757if (Scope->isAbstractScope()) {
758assert(!getAbstractScopeDIEs().count(DS) &&
759"Abstract DIE for this scope exists!");
760 getAbstractScopeDIEs()[DS] = ScopeDIE;
761return ScopeDIE;
762 }
763if (!Scope->getInlinedAt()) {
764assert(!LexicalBlockDIEs.count(DS) &&
765"Concrete out-of-line DIE for this scope exists!");
766 LexicalBlockDIEs[DS] = ScopeDIE;
767 }
768
769attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges());
770
771return ScopeDIE;
772}
773
774DIE *DwarfCompileUnit::constructVariableDIE(DbgVariable &DV,bool Abstract) {
775auto *VariableDie =DIE::get(DIEValueAllocator, DV.getTag());
776insertDIE(DV.getVariable(), VariableDie);
777 DV.setDIE(*VariableDie);
778// Abstract variables don't get common attributes later, so apply them now.
779if (Abstract) {
780applyCommonDbgVariableAttributes(DV, *VariableDie);
781 }else {
782 std::visit(
783 [&](constauto &V) {
784 applyConcreteDbgVariableAttributes(V, DV, *VariableDie);
785 },
786 DV.asVariant());
787 }
788return VariableDie;
789}
790
791void DwarfCompileUnit::applyConcreteDbgVariableAttributes(
792constLoc::Single &Single,constDbgVariable &DV,DIE &VariableDie) {
793constDbgValueLoc *DVal = &Single.getValueLoc();
794if (Asm->TM.getTargetTriple().isNVPTX() &&DD->tuneForGDB() &&
795 !Single.getExpr()) {
796// Lack of expression means it is a register. Registers for PTX need to
797// be marked with DW_AT_address_class = 2. See
798// https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf
799addUInt(VariableDie, dwarf::DW_AT_address_class, dwarf::DW_FORM_data1, 2);
800 }
801if (!DVal->isVariadic()) {
802constDbgValueLocEntry *Entry = DVal->getLocEntries().begin();
803if (Entry->isLocation()) {
804addVariableAddress(DV, VariableDie, Entry->getLoc());
805 }elseif (Entry->isInt()) {
806auto *Expr =Single.getExpr();
807if (Expr && Expr->getNumElements()) {
808DIELoc *Loc =new (DIEValueAllocator)DIELoc;
809DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
810// If there is an expression, emit raw unsigned bytes.
811 DwarfExpr.addFragmentOffset(Expr);
812 DwarfExpr.addUnsignedConstant(Entry->getInt());
813 DwarfExpr.addExpression(Expr);
814addBlock(VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
815if (DwarfExpr.TagOffset)
816addUInt(VariableDie, dwarf::DW_AT_LLVM_tag_offset,
817 dwarf::DW_FORM_data1, *DwarfExpr.TagOffset);
818 }else
819addConstantValue(VariableDie,Entry->getInt(), DV.getType());
820 }elseif (Entry->isConstantFP()) {
821addConstantFPValue(VariableDie,Entry->getConstantFP());
822 }elseif (Entry->isConstantInt()) {
823addConstantValue(VariableDie,Entry->getConstantInt(), DV.getType());
824 }elseif (Entry->isTargetIndexLocation()) {
825DIELoc *Loc =new (DIEValueAllocator)DIELoc;
826DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
827constDIBasicType *BT = dyn_cast<DIBasicType>(
828static_cast<constMetadata *>(DV.getVariable()->getType()));
829DwarfDebug::emitDebugLocValue(*Asm,BT, *DVal, DwarfExpr);
830addBlock(VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
831 }
832return;
833 }
834// If any of the location entries are registers with the value 0,
835// then the location is undefined.
836if (any_of(DVal->getLocEntries(), [](constDbgValueLocEntry &Entry) {
837 return Entry.isLocation() && !Entry.getLoc().getReg();
838 }))
839return;
840constDIExpression *Expr =Single.getExpr();
841assert(Expr &&"Variadic Debug Value must have an Expression.");
842DIELoc *Loc =new (DIEValueAllocator)DIELoc;
843DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
844 DwarfExpr.addFragmentOffset(Expr);
845DIExpressionCursor Cursor(Expr);
846constTargetRegisterInfo &TRI = *Asm->MF->getSubtarget().getRegisterInfo();
847
848auto AddEntry = [&](constDbgValueLocEntry &Entry,
849DIExpressionCursor &Cursor) {
850if (Entry.isLocation()) {
851if (!DwarfExpr.addMachineRegExpression(TRI, Cursor,
852Entry.getLoc().getReg()))
853returnfalse;
854 }elseif (Entry.isInt()) {
855// If there is an expression, emit raw unsigned bytes.
856 DwarfExpr.addUnsignedConstant(Entry.getInt());
857 }elseif (Entry.isConstantFP()) {
858// DwarfExpression does not support arguments wider than 64 bits
859// (see PR52584).
860// TODO: Consider chunking expressions containing overly wide
861// arguments into separate pointer-sized fragment expressions.
862APInt RawBytes =Entry.getConstantFP()->getValueAPF().bitcastToAPInt();
863if (RawBytes.getBitWidth() > 64)
864returnfalse;
865 DwarfExpr.addUnsignedConstant(RawBytes.getZExtValue());
866 }elseif (Entry.isConstantInt()) {
867APInt RawBytes =Entry.getConstantInt()->getValue();
868if (RawBytes.getBitWidth() > 64)
869returnfalse;
870 DwarfExpr.addUnsignedConstant(RawBytes.getZExtValue());
871 }elseif (Entry.isTargetIndexLocation()) {
872TargetIndexLocation Loc =Entry.getTargetIndexLocation();
873// TODO TargetIndexLocation is a target-independent. Currently
874// only the WebAssembly-specific encoding is supported.
875assert(Asm->TM.getTargetTriple().isWasm());
876 DwarfExpr.addWasmLocation(Loc.Index,static_cast<uint64_t>(Loc.Offset));
877 }else {
878llvm_unreachable("Unsupported Entry type.");
879 }
880returntrue;
881 };
882
883if (!DwarfExpr.addExpression(
884 std::move(Cursor),
885 [&](unsignedIdx,DIExpressionCursor &Cursor) ->bool {
886 return AddEntry(DVal->getLocEntries()[Idx], Cursor);
887 }))
888return;
889
890// Now attach the location information to the DIE.
891addBlock(VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
892if (DwarfExpr.TagOffset)
893addUInt(VariableDie, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
894 *DwarfExpr.TagOffset);
895}
896
897void DwarfCompileUnit::applyConcreteDbgVariableAttributes(
898constLoc::Multi &Multi,constDbgVariable &DV,DIE &VariableDie) {
899addLocationList(VariableDie, dwarf::DW_AT_location,
900 Multi.getDebugLocListIndex());
901auto TagOffset = Multi.getDebugLocListTagOffset();
902if (TagOffset)
903addUInt(VariableDie, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
904 *TagOffset);
905}
906
907void DwarfCompileUnit::applyConcreteDbgVariableAttributes(constLoc::MMI &MMI,
908constDbgVariable &DV,
909DIE &VariableDie) {
910 std::optional<unsigned> NVPTXAddressSpace;
911DIELoc *Loc =new (DIEValueAllocator)DIELoc;
912DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
913for (constauto &Fragment : MMI.getFrameIndexExprs()) {
914Register FrameReg;
915constDIExpression *Expr = Fragment.Expr;
916constTargetFrameLowering *TFI =Asm->MF->getSubtarget().getFrameLowering();
917StackOffsetOffset =
918 TFI->getFrameIndexReference(*Asm->MF, Fragment.FI, FrameReg);
919 DwarfExpr.addFragmentOffset(Expr);
920
921auto *TRI =Asm->MF->getSubtarget().getRegisterInfo();
922SmallVector<uint64_t, 8> Ops;
923TRI->getOffsetOpcodes(Offset, Ops);
924
925// According to
926// https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf
927// cuda-gdb requires DW_AT_address_class for all variables to be
928// able to correctly interpret address space of the variable
929// address. Decode DW_OP_constu <DWARF Address Space> DW_OP_swap
930// DW_OP_xderef sequence for the NVPTX + gdb target.
931unsigned LocalNVPTXAddressSpace;
932if (Asm->TM.getTargetTriple().isNVPTX() &&DD->tuneForGDB()) {
933constDIExpression *NewExpr =
934DIExpression::extractAddressClass(Expr, LocalNVPTXAddressSpace);
935if (NewExpr != Expr) {
936 Expr =NewExpr;
937 NVPTXAddressSpace = LocalNVPTXAddressSpace;
938 }
939 }
940if (Expr)
941 Ops.append(Expr->elements_begin(), Expr->elements_end());
942DIExpressionCursor Cursor(Ops);
943 DwarfExpr.setMemoryLocationKind();
944if (constMCSymbol *FrameSymbol =Asm->getFunctionFrameSymbol())
945addOpAddress(*Loc, FrameSymbol);
946else
947 DwarfExpr.addMachineRegExpression(
948 *Asm->MF->getSubtarget().getRegisterInfo(), Cursor, FrameReg);
949 DwarfExpr.addExpression(std::move(Cursor));
950 }
951if (Asm->TM.getTargetTriple().isNVPTX() &&DD->tuneForGDB()) {
952// According to
953// https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf
954// cuda-gdb requires DW_AT_address_class for all variables to be
955// able to correctly interpret address space of the variable
956// address.
957constunsigned NVPTX_ADDR_local_space = 6;
958addUInt(VariableDie, dwarf::DW_AT_address_class, dwarf::DW_FORM_data1,
959 NVPTXAddressSpace.value_or(NVPTX_ADDR_local_space));
960 }
961addBlock(VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
962if (DwarfExpr.TagOffset)
963addUInt(VariableDie, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
964 *DwarfExpr.TagOffset);
965}
966
967void DwarfCompileUnit::applyConcreteDbgVariableAttributes(
968constLoc::EntryValue &EntryValue,constDbgVariable &DV,
969DIE &VariableDie) {
970DIELoc *Loc =new (DIEValueAllocator)DIELoc;
971DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
972// Emit each expression as: EntryValue(Register) <other ops> <Fragment>.
973for (auto [Register, Expr] : EntryValue.EntryValues) {
974 DwarfExpr.addFragmentOffset(&Expr);
975DIExpressionCursor Cursor(Expr.getElements());
976 DwarfExpr.beginEntryValueExpression(Cursor);
977 DwarfExpr.addMachineRegExpression(
978 *Asm->MF->getSubtarget().getRegisterInfo(), Cursor,Register);
979 DwarfExpr.addExpression(std::move(Cursor));
980 }
981addBlock(VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
982}
983
984void DwarfCompileUnit::applyConcreteDbgVariableAttributes(
985const std::monostate &,constDbgVariable &DV,DIE &VariableDie) {}
986
987DIE *DwarfCompileUnit::constructVariableDIE(DbgVariable &DV,
988constLexicalScope &Scope,
989DIE *&ObjectPointer) {
990auto Var =constructVariableDIE(DV, Scope.isAbstractScope());
991if (DV.isObjectPointer())
992 ObjectPointer = Var;
993return Var;
994}
995
996DIE *DwarfCompileUnit::constructLabelDIE(DbgLabel &DL,
997constLexicalScope &Scope) {
998auto LabelDie =DIE::get(DIEValueAllocator,DL.getTag());
999insertDIE(DL.getLabel(), LabelDie);
1000DL.setDIE(*LabelDie);
1001
1002if (Scope.isAbstractScope())
1003applyLabelAttributes(DL, *LabelDie);
1004
1005return LabelDie;
1006}
1007
1008/// Return all DIVariables that appear in count: expressions.
1009staticSmallVector<const DIVariable *, 2>dependencies(DbgVariable *Var) {
1010SmallVector<const DIVariable *, 2> Result;
1011auto *Array = dyn_cast<DICompositeType>(Var->getType());
1012if (!Array || Array->getTag() != dwarf::DW_TAG_array_type)
1013return Result;
1014if (auto *DLVar = Array->getDataLocation())
1015 Result.push_back(DLVar);
1016if (auto *AsVar = Array->getAssociated())
1017 Result.push_back(AsVar);
1018if (auto *AlVar = Array->getAllocated())
1019 Result.push_back(AlVar);
1020for (auto *El : Array->getElements()) {
1021if (auto *Subrange = dyn_cast<DISubrange>(El)) {
1022if (auto Count = Subrange->getCount())
1023if (auto *Dependency = dyn_cast_if_present<DIVariable *>(Count))
1024 Result.push_back(Dependency);
1025if (auto LB = Subrange->getLowerBound())
1026if (auto *Dependency = dyn_cast_if_present<DIVariable *>(LB))
1027 Result.push_back(Dependency);
1028if (auto UB = Subrange->getUpperBound())
1029if (auto *Dependency = dyn_cast_if_present<DIVariable *>(UB))
1030 Result.push_back(Dependency);
1031if (auto ST = Subrange->getStride())
1032if (auto *Dependency = dyn_cast_if_present<DIVariable *>(ST))
1033 Result.push_back(Dependency);
1034 }elseif (auto *GenericSubrange = dyn_cast<DIGenericSubrange>(El)) {
1035if (auto Count = GenericSubrange->getCount())
1036if (auto *Dependency = dyn_cast_if_present<DIVariable *>(Count))
1037 Result.push_back(Dependency);
1038if (auto LB = GenericSubrange->getLowerBound())
1039if (auto *Dependency = dyn_cast_if_present<DIVariable *>(LB))
1040 Result.push_back(Dependency);
1041if (auto UB = GenericSubrange->getUpperBound())
1042if (auto *Dependency = dyn_cast_if_present<DIVariable *>(UB))
1043 Result.push_back(Dependency);
1044if (auto ST = GenericSubrange->getStride())
1045if (auto *Dependency = dyn_cast_if_present<DIVariable *>(ST))
1046 Result.push_back(Dependency);
1047 }
1048 }
1049return Result;
1050}
1051
1052/// Sort local variables so that variables appearing inside of helper
1053/// expressions come first.
1054staticSmallVector<DbgVariable *, 8>
1055sortLocalVars(SmallVectorImpl<DbgVariable *> &Input) {
1056SmallVector<DbgVariable *, 8> Result;
1057SmallVector<PointerIntPair<DbgVariable *, 1>, 8> WorkList;
1058// Map back from a DIVariable to its containing DbgVariable.
1059SmallDenseMap<const DILocalVariable *, DbgVariable *> DbgVar;
1060// Set of DbgVariables in Result.
1061SmallDenseSet<DbgVariable *, 8> Visited;
1062// For cycle detection.
1063SmallDenseSet<DbgVariable *, 8> Visiting;
1064
1065// Initialize the worklist and the DIVariable lookup table.
1066for (auto *Var :reverse(Input)) {
1067 DbgVar.insert({Var->getVariable(), Var});
1068 WorkList.push_back({Var, 0});
1069 }
1070
1071// Perform a stable topological sort by doing a DFS.
1072while (!WorkList.empty()) {
1073auto Item = WorkList.back();
1074DbgVariable *Var = Item.getPointer();
1075bool visitedAllDependencies = Item.getInt();
1076 WorkList.pop_back();
1077
1078assert(Var);
1079
1080// Already handled.
1081if (Visited.count(Var))
1082continue;
1083
1084// Add to Result if all dependencies are visited.
1085if (visitedAllDependencies) {
1086 Visited.insert(Var);
1087 Result.push_back(Var);
1088continue;
1089 }
1090
1091// Detect cycles.
1092auto Res = Visiting.insert(Var);
1093if (!Res.second) {
1094assert(false &&"dependency cycle in local variables");
1095return Result;
1096 }
1097
1098// Push dependencies and this node onto the worklist, so that this node is
1099// visited again after all of its dependencies are handled.
1100 WorkList.push_back({Var, 1});
1101for (constauto *Dependency :dependencies(Var)) {
1102// Don't add dependency if it is in a different lexical scope or a global.
1103if (constauto *Dep = dyn_cast<const DILocalVariable>(Dependency))
1104if (DbgVariable *Var = DbgVar.lookup(Dep))
1105 WorkList.push_back({Var, 0});
1106 }
1107 }
1108return Result;
1109}
1110
1111DIE &DwarfCompileUnit::constructSubprogramScopeDIE(constDISubprogram *Sub,
1112LexicalScope *Scope,
1113MCSymbol *LineTableSym) {
1114DIE &ScopeDIE =updateSubprogramScopeDIE(Sub, LineTableSym);
1115
1116if (Scope) {
1117assert(!Scope->getInlinedAt());
1118assert(!Scope->isAbstractScope());
1119// Collect lexical scope children first.
1120// ObjectPointer might be a local (non-argument) local variable if it's a
1121// block's synthetic this pointer.
1122if (DIE *ObjectPointer =createAndAddScopeChildren(Scope, ScopeDIE))
1123addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
1124 }
1125
1126// If this is a variadic function, add an unspecified parameter.
1127DITypeRefArray FnArgs = Sub->getType()->getTypeArray();
1128
1129// If we have a single element of null, it is a function that returns void.
1130// If we have more than one elements and the last one is null, it is a
1131// variadic function.
1132if (FnArgs.size() > 1 && !FnArgs[FnArgs.size() - 1] &&
1133 !includeMinimalInlineScopes())
1134 ScopeDIE.addChild(
1135DIE::get(DIEValueAllocator, dwarf::DW_TAG_unspecified_parameters));
1136
1137return ScopeDIE;
1138}
1139
1140DIE *DwarfCompileUnit::createAndAddScopeChildren(LexicalScope *Scope,
1141DIE &ScopeDIE) {
1142DIE *ObjectPointer =nullptr;
1143
1144// Emit function arguments (order is significant).
1145auto Vars =DU->getScopeVariables().lookup(Scope);
1146for (auto &DV : Vars.Args)
1147 ScopeDIE.addChild(constructVariableDIE(*DV.second, *Scope, ObjectPointer));
1148
1149// Emit local variables.
1150auto Locals =sortLocalVars(Vars.Locals);
1151for (DbgVariable *DV : Locals)
1152 ScopeDIE.addChild(constructVariableDIE(*DV, *Scope, ObjectPointer));
1153
1154// Emit labels.
1155for (DbgLabel *DL :DU->getScopeLabels().lookup(Scope))
1156 ScopeDIE.addChild(constructLabelDIE(*DL, *Scope));
1157
1158// Track other local entities (skipped in gmlt-like data).
1159// This creates mapping between CU and a set of local declarations that
1160// should be emitted for subprograms in this CU.
1161if (!includeMinimalInlineScopes() && !Scope->getInlinedAt()) {
1162auto &LocalDecls =DD->getLocalDeclsForScope(Scope->getScopeNode());
1163 DeferredLocalDecls.insert(LocalDecls.begin(), LocalDecls.end());
1164 }
1165
1166// Emit inner lexical scopes.
1167auto skipLexicalScope = [this](LexicalScope *S) ->bool {
1168if (isa<DISubprogram>(S->getScopeNode()))
1169returnfalse;
1170auto Vars =DU->getScopeVariables().lookup(S);
1171if (!Vars.Args.empty() || !Vars.Locals.empty())
1172returnfalse;
1173returnincludeMinimalInlineScopes() ||
1174DD->getLocalDeclsForScope(S->getScopeNode()).empty();
1175 };
1176for (LexicalScope *LS : Scope->getChildren()) {
1177// If the lexical block doesn't have non-scope children, skip
1178// its emission and put its children directly to the parent scope.
1179if (skipLexicalScope(LS))
1180createAndAddScopeChildren(LS, ScopeDIE);
1181else
1182constructScopeDIE(LS, ScopeDIE);
1183 }
1184
1185return ObjectPointer;
1186}
1187
1188voidDwarfCompileUnit::constructAbstractSubprogramScopeDIE(
1189LexicalScope *Scope) {
1190auto *SP = cast<DISubprogram>(Scope->getScopeNode());
1191if (getAbstractScopeDIEs().count(SP))
1192return;
1193
1194DIE *ContextDIE;
1195DwarfCompileUnit *ContextCU =this;
1196
1197if (includeMinimalInlineScopes())
1198 ContextDIE = &getUnitDie();
1199// Some of this is duplicated from DwarfUnit::getOrCreateSubprogramDIE, with
1200// the important distinction that the debug node is not associated with the
1201// DIE (since the debug node will be associated with the concrete DIE, if
1202// any). It could be refactored to some common utility function.
1203elseif (auto *SPDecl = SP->getDeclaration()) {
1204 ContextDIE = &getUnitDie();
1205getOrCreateSubprogramDIE(SPDecl);
1206 }else {
1207 ContextDIE =getOrCreateContextDIE(SP->getScope());
1208// The scope may be shared with a subprogram that has already been
1209// constructed in another CU, in which case we need to construct this
1210// subprogram in the same CU.
1211 ContextCU =DD->lookupCU(ContextDIE->getUnitDie());
1212 }
1213
1214// Passing null as the associated node because the abstract definition
1215// shouldn't be found by lookup.
1216DIE &AbsDef = ContextCU->createAndAddDIE(dwarf::DW_TAG_subprogram,
1217 *ContextDIE,nullptr);
1218
1219// Store the DIE before creating children.
1220 ContextCU->getAbstractScopeDIEs()[SP] = &AbsDef;
1221
1222 ContextCU->applySubprogramAttributesToDefinition(SP, AbsDef);
1223 ContextCU->addSInt(AbsDef, dwarf::DW_AT_inline,
1224DD->getDwarfVersion() <= 4 ? std::optional<dwarf::Form>()
1225 : dwarf::DW_FORM_implicit_const,
1226dwarf::DW_INL_inlined);
1227if (DIE *ObjectPointer = ContextCU->createAndAddScopeChildren(Scope, AbsDef))
1228 ContextCU->addDIEEntry(AbsDef, dwarf::DW_AT_object_pointer, *ObjectPointer);
1229}
1230
1231boolDwarfCompileUnit::useGNUAnalogForDwarf5Feature() const{
1232returnDD->getDwarfVersion() <= 4 && !DD->tuneForLLDB();
1233}
1234
1235dwarf::TagDwarfCompileUnit::getDwarf5OrGNUTag(dwarf::TagTag) const{
1236if (!useGNUAnalogForDwarf5Feature())
1237returnTag;
1238switch (Tag) {
1239case dwarf::DW_TAG_call_site:
1240return dwarf::DW_TAG_GNU_call_site;
1241case dwarf::DW_TAG_call_site_parameter:
1242return dwarf::DW_TAG_GNU_call_site_parameter;
1243default:
1244llvm_unreachable("DWARF5 tag with no GNU analog");
1245 }
1246}
1247
1248dwarf::Attribute
1249DwarfCompileUnit::getDwarf5OrGNUAttr(dwarf::Attribute Attr) const{
1250if (!useGNUAnalogForDwarf5Feature())
1251return Attr;
1252switch (Attr) {
1253case dwarf::DW_AT_call_all_calls:
1254return dwarf::DW_AT_GNU_all_call_sites;
1255case dwarf::DW_AT_call_target:
1256return dwarf::DW_AT_GNU_call_site_target;
1257case dwarf::DW_AT_call_origin:
1258return dwarf::DW_AT_abstract_origin;
1259case dwarf::DW_AT_call_return_pc:
1260return dwarf::DW_AT_low_pc;
1261case dwarf::DW_AT_call_value:
1262return dwarf::DW_AT_GNU_call_site_value;
1263case dwarf::DW_AT_call_tail_call:
1264return dwarf::DW_AT_GNU_tail_call;
1265default:
1266llvm_unreachable("DWARF5 attribute with no GNU analog");
1267 }
1268}
1269
1270dwarf::LocationAtom
1271DwarfCompileUnit::getDwarf5OrGNULocationAtom(dwarf::LocationAtom Loc) const{
1272if (!useGNUAnalogForDwarf5Feature())
1273return Loc;
1274switch (Loc) {
1275case dwarf::DW_OP_entry_value:
1276return dwarf::DW_OP_GNU_entry_value;
1277default:
1278llvm_unreachable("DWARF5 location atom with no GNU analog");
1279 }
1280}
1281
1282DIE &DwarfCompileUnit::constructCallSiteEntryDIE(DIE &ScopeDIE,
1283constDISubprogram *CalleeSP,
1284bool IsTail,
1285constMCSymbol *PCAddr,
1286constMCSymbol *CallAddr,
1287unsigned CallReg) {
1288// Insert a call site entry DIE within ScopeDIE.
1289DIE &CallSiteDIE =createAndAddDIE(getDwarf5OrGNUTag(dwarf::DW_TAG_call_site),
1290 ScopeDIE,nullptr);
1291
1292if (CallReg) {
1293// Indirect call.
1294addAddress(CallSiteDIE,getDwarf5OrGNUAttr(dwarf::DW_AT_call_target),
1295MachineLocation(CallReg));
1296 }else {
1297DIE *CalleeDIE =getOrCreateSubprogramDIE(CalleeSP);
1298assert(CalleeDIE &&"Could not create DIE for call site entry origin");
1299if (AddLinkageNamesToDeclCallOriginsForTuning(DD) &&
1300 !CalleeSP->isDefinition() &&
1301 !CalleeDIE->findAttribute(dwarf::DW_AT_linkage_name)) {
1302addLinkageName(*CalleeDIE, CalleeSP->getLinkageName());
1303 }
1304
1305addDIEEntry(CallSiteDIE,getDwarf5OrGNUAttr(dwarf::DW_AT_call_origin),
1306 *CalleeDIE);
1307 }
1308
1309if (IsTail) {
1310// Attach DW_AT_call_tail_call to tail calls for standards compliance.
1311addFlag(CallSiteDIE,getDwarf5OrGNUAttr(dwarf::DW_AT_call_tail_call));
1312
1313// Attach the address of the branch instruction to allow the debugger to
1314// show where the tail call occurred. This attribute has no GNU analog.
1315//
1316// GDB works backwards from non-standard usage of DW_AT_low_pc (in DWARF4
1317// mode -- equivalently, in DWARF5 mode, DW_AT_call_return_pc) at tail-call
1318// site entries to figure out the PC of tail-calling branch instructions.
1319// This means it doesn't need the compiler to emit DW_AT_call_pc, so we
1320// don't emit it here.
1321//
1322// There's no need to tie non-GDB debuggers to this non-standardness, as it
1323// adds unnecessary complexity to the debugger. For non-GDB debuggers, emit
1324// the standard DW_AT_call_pc info.
1325if (!useGNUAnalogForDwarf5Feature())
1326addLabelAddress(CallSiteDIE, dwarf::DW_AT_call_pc, CallAddr);
1327 }
1328
1329// Attach the return PC to allow the debugger to disambiguate call paths
1330// from one function to another.
1331//
1332// The return PC is only really needed when the call /isn't/ a tail call, but
1333// GDB expects it in DWARF4 mode, even for tail calls (see the comment above
1334// the DW_AT_call_pc emission logic for an explanation).
1335if (!IsTail ||useGNUAnalogForDwarf5Feature()) {
1336assert(PCAddr &&"Missing return PC information for a call");
1337addLabelAddress(CallSiteDIE,
1338getDwarf5OrGNUAttr(dwarf::DW_AT_call_return_pc), PCAddr);
1339 }
1340
1341return CallSiteDIE;
1342}
1343
1344voidDwarfCompileUnit::constructCallSiteParmEntryDIEs(
1345DIE &CallSiteDIE,SmallVector<DbgCallSiteParam, 4> &Params) {
1346for (constauto &Param : Params) {
1347unsignedRegister = Param.getRegister();
1348auto CallSiteDieParam =
1349DIE::get(DIEValueAllocator,
1350getDwarf5OrGNUTag(dwarf::DW_TAG_call_site_parameter));
1351insertDIE(CallSiteDieParam);
1352addAddress(*CallSiteDieParam, dwarf::DW_AT_location,
1353MachineLocation(Register));
1354
1355DIELoc *Loc =new (DIEValueAllocator)DIELoc;
1356DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
1357 DwarfExpr.setCallSiteParamValueFlag();
1358
1359DwarfDebug::emitDebugLocValue(*Asm,nullptr, Param.getValue(), DwarfExpr);
1360
1361addBlock(*CallSiteDieParam,getDwarf5OrGNUAttr(dwarf::DW_AT_call_value),
1362 DwarfExpr.finalize());
1363
1364 CallSiteDIE.addChild(CallSiteDieParam);
1365 }
1366}
1367
1368DIE *DwarfCompileUnit::constructImportedEntityDIE(
1369constDIImportedEntity *Module) {
1370DIE *IMDie =DIE::get(DIEValueAllocator, (dwarf::Tag)Module->getTag());
1371insertDIE(Module, IMDie);
1372DIE *EntityDie;
1373auto *Entity =Module->getEntity();
1374if (auto *NS = dyn_cast<DINamespace>(Entity))
1375 EntityDie =getOrCreateNameSpace(NS);
1376elseif (auto *M = dyn_cast<DIModule>(Entity))
1377 EntityDie =getOrCreateModule(M);
1378elseif (auto *SP = dyn_cast<DISubprogram>(Entity)) {
1379// If there is an abstract subprogram, refer to it. Note that this assumes
1380// that all the abstract subprograms have been already created (which is
1381// correct until imported entities get emitted in DwarfDebug::endModule()).
1382if (auto *AbsSPDie = getAbstractScopeDIEs().lookup(SP))
1383 EntityDie = AbsSPDie;
1384else
1385 EntityDie =getOrCreateSubprogramDIE(SP);
1386 }elseif (auto *T = dyn_cast<DIType>(Entity))
1387 EntityDie =getOrCreateTypeDIE(T);
1388elseif (auto *GV = dyn_cast<DIGlobalVariable>(Entity))
1389 EntityDie =getOrCreateGlobalVariableDIE(GV, {});
1390elseif (auto *IE = dyn_cast<DIImportedEntity>(Entity))
1391 EntityDie =getOrCreateImportedEntityDIE(IE);
1392else
1393 EntityDie =getDIE(Entity);
1394assert(EntityDie);
1395addSourceLine(*IMDie,Module->getLine(),Module->getFile());
1396addDIEEntry(*IMDie, dwarf::DW_AT_import, *EntityDie);
1397StringRefName =Module->getName();
1398if (!Name.empty()) {
1399addString(*IMDie, dwarf::DW_AT_name,Name);
1400
1401// FIXME: if consumers ever start caring about handling
1402// unnamed import declarations such as `using ::nullptr_t`
1403// or `using namespace std::ranges`, we could add the
1404// import declaration into the accelerator table with the
1405// name being the one of the entity being imported.
1406DD->addAccelNamespace(*this,CUNode->getNameTableKind(),Name, *IMDie);
1407 }
1408
1409// This is for imported module with renamed entities (such as variables and
1410// subprograms).
1411 DINodeArray Elements =Module->getElements();
1412for (constauto *Element : Elements) {
1413if (!Element)
1414continue;
1415 IMDie->addChild(
1416constructImportedEntityDIE(cast<DIImportedEntity>(Element)));
1417 }
1418
1419return IMDie;
1420}
1421
1422DIE *DwarfCompileUnit::getOrCreateImportedEntityDIE(
1423constDIImportedEntity *IE) {
1424
1425// Check for pre-existence.
1426if (DIE *Die =getDIE(IE))
1427return Die;
1428
1429DIE *ContextDIE =getOrCreateContextDIE(IE->getScope());
1430assert(ContextDIE &&"Empty scope for the imported entity!");
1431
1432DIE *IMDie =constructImportedEntityDIE(IE);
1433 ContextDIE->addChild(IMDie);
1434return IMDie;
1435}
1436
1437voidDwarfCompileUnit::finishSubprogramDefinition(constDISubprogram *SP) {
1438DIE *D =getDIE(SP);
1439if (DIE *AbsSPDIE = getAbstractScopeDIEs().lookup(SP)) {
1440if (D)
1441// If this subprogram has an abstract definition, reference that
1442addDIEEntry(*D, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
1443 }else {
1444assert(D ||includeMinimalInlineScopes());
1445if (D)
1446// And attach the attributes
1447applySubprogramAttributesToDefinition(SP, *D);
1448 }
1449}
1450
1451voidDwarfCompileUnit::finishEntityDefinition(constDbgEntity *Entity) {
1452DbgEntity *AbsEntity =getExistingAbstractEntity(Entity->getEntity());
1453
1454auto *Die = Entity->getDIE();
1455 /// Label may be used to generate DW_AT_low_pc, so put it outside
1456 /// if/else block.
1457constDbgLabel *Label =nullptr;
1458if (AbsEntity && AbsEntity->getDIE()) {
1459addDIEEntry(*Die, dwarf::DW_AT_abstract_origin, *AbsEntity->getDIE());
1460 Label = dyn_cast<const DbgLabel>(Entity);
1461 }else {
1462if (constDbgVariable *Var = dyn_cast<const DbgVariable>(Entity))
1463applyCommonDbgVariableAttributes(*Var, *Die);
1464elseif ((Label = dyn_cast<const DbgLabel>(Entity)))
1465applyLabelAttributes(*Label, *Die);
1466else
1467llvm_unreachable("DbgEntity must be DbgVariable or DbgLabel.");
1468 }
1469
1470if (!Label)
1471return;
1472
1473constauto *Sym = Label->getSymbol();
1474if (!Sym)
1475return;
1476
1477addLabelAddress(*Die, dwarf::DW_AT_low_pc,Sym);
1478
1479// A TAG_label with a name and an AT_low_pc must be placed in debug_names.
1480if (StringRefName = Label->getName(); !Name.empty())
1481getDwarfDebug().addAccelName(*this,CUNode->getNameTableKind(),Name, *Die);
1482}
1483
1484DbgEntity *DwarfCompileUnit::getExistingAbstractEntity(constDINode *Node) {
1485auto &AbstractEntities = getAbstractEntities();
1486autoI = AbstractEntities.find(Node);
1487if (I != AbstractEntities.end())
1488returnI->second.get();
1489returnnullptr;
1490}
1491
1492voidDwarfCompileUnit::createAbstractEntity(constDINode *Node,
1493LexicalScope *Scope) {
1494assert(Scope && Scope->isAbstractScope());
1495auto &Entity = getAbstractEntities()[Node];
1496if (isa<const DILocalVariable>(Node)) {
1497 Entity = std::make_unique<DbgVariable>(cast<const DILocalVariable>(Node),
1498nullptr/* IA */);
1499DU->addScopeVariable(Scope, cast<DbgVariable>(Entity.get()));
1500 }elseif (isa<const DILabel>(Node)) {
1501 Entity = std::make_unique<DbgLabel>(
1502 cast<const DILabel>(Node),nullptr/* IA */);
1503DU->addScopeLabel(Scope, cast<DbgLabel>(Entity.get()));
1504 }
1505}
1506
1507voidDwarfCompileUnit::emitHeader(bool UseOffsets) {
1508// Don't bother labeling the .dwo unit, as its offset isn't used.
1509if (!Skeleton && !DD->useSectionsAsReferences()) {
1510LabelBegin =Asm->createTempSymbol("cu_begin");
1511Asm->OutStreamer->emitLabel(LabelBegin);
1512 }
1513
1514dwarf::UnitType UT = Skeleton ? dwarf::DW_UT_split_compile
1515 :DD->useSplitDwarf() ? dwarf::DW_UT_skeleton
1516 : dwarf::DW_UT_compile;
1517DwarfUnit::emitCommonHeader(UseOffsets, UT);
1518if (DD->getDwarfVersion() >= 5 && UT != dwarf::DW_UT_compile)
1519Asm->emitInt64(getDWOId());
1520}
1521
1522boolDwarfCompileUnit::hasDwarfPubSections() const{
1523switch (CUNode->getNameTableKind()) {
1524caseDICompileUnit::DebugNameTableKind::None:
1525returnfalse;
1526// Opting in to GNU Pubnames/types overrides the default to ensure these are
1527// generated for things like Gold's gdb_index generation.
1528caseDICompileUnit::DebugNameTableKind::GNU:
1529returntrue;
1530caseDICompileUnit::DebugNameTableKind::Apple:
1531returnfalse;
1532caseDICompileUnit::DebugNameTableKind::Default:
1533returnDD->tuneForGDB() && !includeMinimalInlineScopes() &&
1534 !CUNode->isDebugDirectivesOnly() &&
1535DD->getAccelTableKind() !=AccelTableKind::Apple &&
1536DD->getDwarfVersion() < 5;
1537 }
1538llvm_unreachable("Unhandled DICompileUnit::DebugNameTableKind enum");
1539}
1540
1541/// addGlobalName - Add a new global name to the compile unit.
1542voidDwarfCompileUnit::addGlobalName(StringRefName,constDIE &Die,
1543constDIScope *Context) {
1544if (!hasDwarfPubSections())
1545return;
1546 std::string FullName =getParentContextString(Context) +Name.str();
1547 GlobalNames[FullName] = &Die;
1548}
1549
1550voidDwarfCompileUnit::addGlobalNameForTypeUnit(StringRefName,
1551constDIScope *Context) {
1552if (!hasDwarfPubSections())
1553return;
1554 std::string FullName =getParentContextString(Context) +Name.str();
1555// Insert, allowing the entry to remain as-is if it's already present
1556// This way the CU-level type DIE is preferred over the "can't describe this
1557// type as a unit offset because it's not really in the CU at all, it's only
1558// in a type unit"
1559 GlobalNames.insert(std::make_pair(std::move(FullName), &getUnitDie()));
1560}
1561
1562/// Add a new global type to the unit.
1563voidDwarfCompileUnit::addGlobalTypeImpl(constDIType *Ty,constDIE &Die,
1564constDIScope *Context) {
1565if (!hasDwarfPubSections())
1566return;
1567 std::string FullName =getParentContextString(Context) + Ty->getName().str();
1568 GlobalTypes[FullName] = &Die;
1569}
1570
1571voidDwarfCompileUnit::addGlobalTypeUnitType(constDIType *Ty,
1572constDIScope *Context) {
1573if (!hasDwarfPubSections())
1574return;
1575 std::string FullName =getParentContextString(Context) + Ty->getName().str();
1576// Insert, allowing the entry to remain as-is if it's already present
1577// This way the CU-level type DIE is preferred over the "can't describe this
1578// type as a unit offset because it's not really in the CU at all, it's only
1579// in a type unit"
1580 GlobalTypes.insert(std::make_pair(std::move(FullName), &getUnitDie()));
1581}
1582
1583voidDwarfCompileUnit::addVariableAddress(constDbgVariable &DV,DIE &Die,
1584MachineLocation Location) {
1585auto *Single = std::get_if<Loc::Single>(&DV);
1586if (Single && Single->getExpr())
1587addComplexAddress(Single->getExpr(), Die, dwarf::DW_AT_location, Location);
1588else
1589addAddress(Die, dwarf::DW_AT_location, Location);
1590}
1591
1592/// Add an address attribute to a die based on the location provided.
1593voidDwarfCompileUnit::addAddress(DIE &Die,dwarf::AttributeAttribute,
1594constMachineLocation &Location) {
1595DIELoc *Loc =new (DIEValueAllocator)DIELoc;
1596DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
1597if (Location.isIndirect())
1598 DwarfExpr.setMemoryLocationKind();
1599
1600DIExpressionCursor Cursor({});
1601constTargetRegisterInfo &TRI = *Asm->MF->getSubtarget().getRegisterInfo();
1602if (!DwarfExpr.addMachineRegExpression(TRI, Cursor, Location.getReg()))
1603return;
1604 DwarfExpr.addExpression(std::move(Cursor));
1605
1606// Now attach the location information to the DIE.
1607addBlock(Die,Attribute, DwarfExpr.finalize());
1608
1609if (DwarfExpr.TagOffset)
1610addUInt(Die, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
1611 *DwarfExpr.TagOffset);
1612}
1613
1614/// Start with the address based on the location provided, and generate the
1615/// DWARF information necessary to find the actual variable given the extra
1616/// address information encoded in the DbgVariable, starting from the starting
1617/// location. Add the DWARF information to the die.
1618voidDwarfCompileUnit::addComplexAddress(constDIExpression *DIExpr,DIE &Die,
1619dwarf::AttributeAttribute,
1620constMachineLocation &Location) {
1621DIELoc *Loc =new (DIEValueAllocator)DIELoc;
1622DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
1623 DwarfExpr.addFragmentOffset(DIExpr);
1624 DwarfExpr.setLocation(Location, DIExpr);
1625
1626DIExpressionCursor Cursor(DIExpr);
1627
1628if (DIExpr->isEntryValue())
1629 DwarfExpr.beginEntryValueExpression(Cursor);
1630
1631constTargetRegisterInfo &TRI = *Asm->MF->getSubtarget().getRegisterInfo();
1632if (!DwarfExpr.addMachineRegExpression(TRI, Cursor, Location.getReg()))
1633return;
1634 DwarfExpr.addExpression(std::move(Cursor));
1635
1636// Now attach the location information to the DIE.
1637addBlock(Die,Attribute, DwarfExpr.finalize());
1638
1639if (DwarfExpr.TagOffset)
1640addUInt(Die, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
1641 *DwarfExpr.TagOffset);
1642}
1643
1644/// Add a Dwarf loclistptr attribute data and value.
1645voidDwarfCompileUnit::addLocationList(DIE &Die,dwarf::AttributeAttribute,
1646unsigned Index) {
1647dwarf::Form Form = (DD->getDwarfVersion() >= 5)
1648 ? dwarf::DW_FORM_loclistx
1649 :DD->getDwarfSectionOffsetForm();
1650addAttribute(Die,Attribute, Form,DIELocList(Index));
1651}
1652
1653voidDwarfCompileUnit::applyCommonDbgVariableAttributes(constDbgVariable &Var,
1654DIE &VariableDie) {
1655StringRefName = Var.getName();
1656if (!Name.empty())
1657addString(VariableDie, dwarf::DW_AT_name,Name);
1658constauto *DIVar = Var.getVariable();
1659if (DIVar) {
1660if (uint32_t AlignInBytes = DIVar->getAlignInBytes())
1661addUInt(VariableDie, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
1662 AlignInBytes);
1663addAnnotation(VariableDie, DIVar->getAnnotations());
1664 }
1665
1666addSourceLine(VariableDie, DIVar);
1667addType(VariableDie, Var.getType());
1668if (Var.isArtificial())
1669addFlag(VariableDie, dwarf::DW_AT_artificial);
1670}
1671
1672voidDwarfCompileUnit::applyLabelAttributes(constDbgLabel &Label,
1673DIE &LabelDie) {
1674StringRefName = Label.getName();
1675if (!Name.empty())
1676addString(LabelDie, dwarf::DW_AT_name,Name);
1677constauto *DILabel = Label.getLabel();
1678addSourceLine(LabelDie,DILabel);
1679}
1680
1681/// Add a Dwarf expression attribute data and value.
1682voidDwarfCompileUnit::addExpr(DIELoc &Die,dwarf::Form Form,
1683constMCExpr *Expr) {
1684addAttribute(Die, (dwarf::Attribute)0, Form,DIEExpr(Expr));
1685}
1686
1687voidDwarfCompileUnit::applySubprogramAttributesToDefinition(
1688constDISubprogram *SP,DIE &SPDie) {
1689auto *SPDecl = SP->getDeclaration();
1690auto *Context = SPDecl ? SPDecl->getScope() : SP->getScope();
1691applySubprogramAttributes(SP, SPDie,includeMinimalInlineScopes());
1692addGlobalName(SP->getName(), SPDie, Context);
1693}
1694
1695bool DwarfCompileUnit::isDwoUnit() const{
1696returnDD->useSplitDwarf() && Skeleton;
1697}
1698
1699void DwarfCompileUnit::finishNonUnitTypeDIE(DIE&D,constDICompositeType *CTy) {
1700constructTypeDIE(D, CTy);
1701}
1702
1703boolDwarfCompileUnit::includeMinimalInlineScopes() const{
1704returngetCUNode()->getEmissionKind() ==DICompileUnit::LineTablesOnly ||
1705 (DD->useSplitDwarf() && !Skeleton);
1706}
1707
1708boolDwarfCompileUnit::emitFuncLineTableOffsets() const{
1709returnEmitFuncLineTableOffsetsOption;
1710}
1711
1712voidDwarfCompileUnit::addAddrTableBase() {
1713constTargetLoweringObjectFile &TLOF =Asm->getObjFileLowering();
1714MCSymbol *Label =DD->getAddressPool().getLabel();
1715addSectionLabel(getUnitDie(),
1716DD->getDwarfVersion() >= 5 ? dwarf::DW_AT_addr_base
1717 : dwarf::DW_AT_GNU_addr_base,
1718 Label, TLOF.getDwarfAddrSection()->getBeginSymbol());
1719}
1720
1721voidDwarfCompileUnit::addBaseTypeRef(DIEValueList &Die, int64_tIdx) {
1722addAttribute(Die, (dwarf::Attribute)0, dwarf::DW_FORM_udata,
1723new (DIEValueAllocator)DIEBaseTypeRef(this,Idx));
1724}
1725
1726voidDwarfCompileUnit::createBaseTypeDIEs() {
1727// Insert the base_type DIEs directly after the CU so that their offsets will
1728// fit in the fixed size ULEB128 used inside the location expressions.
1729// Maintain order by iterating backwards and inserting to the front of CU
1730// child list.
1731for (auto &Btr :reverse(ExprRefedBaseTypes)) {
1732DIE &Die =getUnitDie().addChildFront(
1733DIE::get(DIEValueAllocator, dwarf::DW_TAG_base_type));
1734SmallString<32> Str;
1735addString(Die, dwarf::DW_AT_name,
1736Twine(dwarf::AttributeEncodingString(Btr.Encoding) +
1737"_" +Twine(Btr.BitSize)).toStringRef(Str));
1738addUInt(Die, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Btr.Encoding);
1739// Round up to smallest number of bytes that contains this number of bits.
1740addUInt(Die, dwarf::DW_AT_byte_size, std::nullopt,
1741divideCeil(Btr.BitSize, 8));
1742
1743 Btr.Die = &Die;
1744 }
1745}
1746
1747DIE *DwarfCompileUnit::getLexicalBlockDIE(constDILexicalBlock *LB) {
1748// Assume if there is an abstract tree all the DIEs are already emitted.
1749bool isAbstract = getAbstractScopeDIEs().count(LB->getSubprogram());
1750if (isAbstract && getAbstractScopeDIEs().count(LB))
1751return getAbstractScopeDIEs()[LB];
1752assert(!isAbstract &&"Missed lexical block DIE in abstract tree!");
1753
1754// Return a concrete DIE if it exists or nullptr otherwise.
1755return LexicalBlockDIEs.lookup(LB);
1756}
1757
1758DIE *DwarfCompileUnit::getOrCreateContextDIE(constDIScope *Context) {
1759if (isa_and_nonnull<DILocalScope>(Context)) {
1760if (auto *LFScope = dyn_cast<DILexicalBlockFile>(Context))
1761 Context = LFScope->getNonLexicalBlockFileScope();
1762if (auto *LScope = dyn_cast<DILexicalBlock>(Context))
1763returngetLexicalBlockDIE(LScope);
1764
1765// Otherwise the context must be a DISubprogram.
1766auto *SPScope = cast<DISubprogram>(Context);
1767if (getAbstractScopeDIEs().count(SPScope))
1768return getAbstractScopeDIEs()[SPScope];
1769 }
1770returnDwarfUnit::getOrCreateContextDIE(Context);
1771}
MBB
MachineBasicBlock & MBB
Definition:ARMSLSHardening.cpp:71
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition:ARMSLSHardening.cpp:73
AddressPool.h
AsmPrinter.h
A
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
CommandLine.h
DIE.h
DataLayout.h
Idx
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Definition:DeadArgumentElimination.cpp:353
sortLocalVars
static SmallVector< DbgVariable *, 8 > sortLocalVars(SmallVectorImpl< DbgVariable * > &Input)
Sort local variables so that variables appearing inside of helper expressions come first.
Definition:DwarfCompileUnit.cpp:1055
dependencies
static SmallVector< const DIVariable *, 2 > dependencies(DbgVariable *Var)
Return all DIVariables that appear in count: expressions.
Definition:DwarfCompileUnit.cpp:1009
EmitFuncLineTableOffsetsOption
static cl::opt< bool > EmitFuncLineTableOffsetsOption("emit-func-debug-line-table-offsets", cl::Hidden, cl::desc("Include line table offset in function's debug info and emit end " "sequence after each function's line data."), cl::init(false))
AddLinkageNamesToDeclCallOriginsForTuning
static bool AddLinkageNamesToDeclCallOriginsForTuning(const DwarfDebug *DD)
Definition:DwarfCompileUnit.cpp:58
GetCompileUnitType
static dwarf::Tag GetCompileUnitType(UnitKind Kind, DwarfDebug *DW)
Definition:DwarfCompileUnit.cpp:65
AddLinkageNamesToDeclCallOrigins
cl::opt< cl::boolOrDefault > AddLinkageNamesToDeclCallOrigins("add-linkage-names-to-declaration-call-origins", cl::Hidden, cl::desc("Add DW_AT_linkage_name to function declaration DIEs " "referenced by DW_AT_call_origin attributes. Enabled by default " "for -gsce debugger tuning."))
Query value using AddLinkageNamesToDeclCallOriginsForTuning.
DwarfCompileUnit.h
DwarfExpression.h
Dwarf.h
This file contains constants used for implementing Dwarf debug support.
Name
std::string Name
Definition:ELFObjHandler.cpp:77
End
bool End
Definition:ELF_riscv.cpp:480
Sym
Symbol * Sym
Definition:ELF_riscv.cpp:479
GlobalVariable.h
lookup
static bool lookup(const GsymReader &GR, DataExtractor &Data, uint64_t &Offset, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs, llvm::Error &Err)
A Lookup helper functions.
Definition:InlineInfo.cpp:108
MCAsmInfo.h
MCSection.h
MCStreamer.h
MCSymbolWasm.h
MCSymbol.h
I
#define I(x, y, z)
Definition:MD5.cpp:58
MachineFunction.h
MachineInstr.h
MachineLocation.h
TRI
unsigned const TargetRegisterInfo * TRI
Definition:MachineSink.cpp:2029
Range
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
STLExtras.h
This file contains some templates that are useful if you are working with the STL at all.
SmallString.h
This file defines the SmallString class.
TargetFrameLowering.h
TargetLoweringObjectFile.h
TargetOptions.h
TargetRegisterInfo.h
TargetSubtargetInfo.h
NewExpr
Definition:ItaniumDemangle.h:2103
T
llvm::APInt
Class for arbitrary precision integers.
Definition:APInt.h:78
llvm::APInt::getZExtValue
uint64_t getZExtValue() const
Get zero extended value.
Definition:APInt.h:1520
llvm::APInt::getBitWidth
unsigned getBitWidth() const
Return the number of bits in the APInt.
Definition:APInt.h:1468
llvm::AddressPool::getIndex
unsigned getIndex(const MCSymbol *Sym, bool TLS=false)
Returns the index into the address pool with the given label/symbol.
Definition:AddressPool.cpp:19
llvm::AddressPool::getLabel
MCSymbol * getLabel()
Definition:AddressPool.h:53
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition:ArrayRef.h:168
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition:AsmPrinter.h:87
llvm::AsmPrinter::getObjFileLowering
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
Definition:AsmPrinter.cpp:408
llvm::AsmPrinter::getSymbol
MCSymbol * getSymbol(const GlobalValue *GV) const
Definition:AsmPrinter.cpp:697
llvm::AsmPrinter::MBBSectionRanges
MapVector< MBBSectionID, MBBSectionRange > MBBSectionRanges
Definition:AsmPrinter.h:141
llvm::AsmPrinter::TM
TargetMachine & TM
Target machine description.
Definition:AsmPrinter.h:90
llvm::AsmPrinter::MAI
const MCAsmInfo * MAI
Target Asm Printer information.
Definition:AsmPrinter.h:93
llvm::AsmPrinter::MF
MachineFunction * MF
The current machine function.
Definition:AsmPrinter.h:105
llvm::AsmPrinter::getFunctionFrameSymbol
virtual const MCSymbol * getFunctionFrameSymbol() const
Return symbol for the function pseudo stack if the stack frame is not a register based.
Definition:AsmPrinter.h:267
llvm::AsmPrinter::createTempSymbol
MCSymbol * createTempSymbol(const Twine &Name) const
Definition:AsmPrinter.cpp:4075
llvm::AsmPrinter::GetExternalSymbolSymbol
MCSymbol * GetExternalSymbolSymbol(Twine Sym) const
Return the MCSymbol for the specified ExternalSymbol.
Definition:AsmPrinter.cpp:4140
llvm::AsmPrinter::OutStreamer
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition:AsmPrinter.h:102
llvm::AsmPrinter::getDataLayout
const DataLayout & getDataLayout() const
Return information about data layout.
Definition:AsmPrinter.cpp:412
llvm::AsmPrinter::emitInt64
void emitInt64(uint64_t Value) const
Emit a long long directive and value.
Definition:AsmPrinter.cpp:3292
llvm::Attribute
Definition:Attributes.h:67
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition:DebugInfoMetadata.h:823
llvm::DICommonBlock
Debug common block.
Definition:DebugInfoMetadata.h:3403
llvm::DICommonBlock::getFile
DIFile * getFile() const
Definition:DebugInfoMetadata.h:3444
llvm::DICommonBlock::getLineNo
unsigned getLineNo() const
Definition:DebugInfoMetadata.h:3445
llvm::DICommonBlock::getName
StringRef getName() const
Definition:DebugInfoMetadata.h:3443
llvm::DICommonBlock::getScope
DIScope * getScope() const
Definition:DebugInfoMetadata.h:3439
llvm::DICommonBlock::getDecl
DIGlobalVariable * getDecl() const
Definition:DebugInfoMetadata.h:3440
llvm::DICompileUnit
Compile unit.
Definition:DebugInfoMetadata.h:1469
llvm::DICompileUnit::isDebugDirectivesOnly
bool isDebugDirectivesOnly() const
Definition:DebugInfoMetadata.h:1598
llvm::DICompileUnit::DebugNameTableKind::None
@ None
llvm::DICompileUnit::DebugNameTableKind::Default
@ Default
llvm::DICompileUnit::DebugNameTableKind::Apple
@ Apple
llvm::DICompileUnit::DebugNameTableKind::GNU
@ GNU
llvm::DICompileUnit::getNameTableKind
static std::optional< DebugNameTableKind > getNameTableKind(StringRef Str)
Definition:DebugInfoMetadata.cpp:990
llvm::DICompileUnit::LineTablesOnly
@ LineTablesOnly
Definition:DebugInfoMetadata.h:1477
llvm::DICompileUnit::getEmissionKind
static std::optional< DebugEmissionKind > getEmissionKind(StringRef Str)
Definition:DebugInfoMetadata.cpp:980
llvm::DICompositeType
Composite types.
Definition:DebugInfoMetadata.h:1174
llvm::DIEAddrOffset
A BaseTypeRef DIE.
Definition:DIE.h:355
llvm::DIEBaseTypeRef
A BaseTypeRef DIE.
Definition:DIE.h:240
llvm::DIEBlock
DIEBlock - Represents a block of values.
Definition:DIE.h:1046
llvm::DIEDwarfExpression
DwarfExpression implementation for singular DW_AT_location.
Definition:DwarfExpression.h:344
llvm::DIEDwarfExpression::finalize
DIELoc * finalize()
Definition:DwarfExpression.h:370
llvm::DIEExpr
An expression DIE.
Definition:DIE.h:206
llvm::DIEInteger
An integer value DIE.
Definition:DIE.h:168
llvm::DIELabel
A label DIE.
Definition:DIE.h:223
llvm::DIELocList
Represents a pointer to a location list in the debug_loc section.
Definition:DIE.h:337
llvm::DIELoc
DIELoc - Represents an expression location.
Definition:DIE.h:1010
llvm::DIEUnit::getUnitDie
DIE & getUnitDie()
Definition:DIE.h:999
llvm::DIEValueList
A list of DIE values.
Definition:DIE.h:689
llvm::DIE
A structured debug information entry.
Definition:DIE.h:819
llvm::DIE::findAttribute
DIEValue findAttribute(dwarf::Attribute Attribute) const
Find a value in the DIE with the attribute given.
Definition:DIE.cpp:210
llvm::DIE::addChild
DIE & addChild(DIE *Child)
Add a child to the DIE.
Definition:DIE.h:934
llvm::DIE::addChildFront
DIE & addChildFront(DIE *Child)
Definition:DIE.h:941
llvm::DIE::get
static DIE * get(BumpPtrAllocator &Alloc, dwarf::Tag Tag)
Definition:DIE.h:849
llvm::DIE::getUnitDie
const DIE * getUnitDie() const
Climb up the parent chain to get the compile unit or type unit DIE that this DIE belongs to.
Definition:DIE.cpp:191
llvm::DIExpressionCursor
Holds a DIExpression and keeps track of how many operands have been consumed so far.
Definition:DebugInfoMetadata.h:3236
llvm::DIExpression
DWARF expression.
Definition:DebugInfoMetadata.h:2763
llvm::DIExpression::elements_end
element_iterator elements_end() const
Definition:DebugInfoMetadata.h:2814
llvm::DIExpression::isEntryValue
bool isEntryValue() const
Check if the expression consists of exactly one entry value operand.
Definition:DebugInfoMetadata.cpp:1375
llvm::DIExpression::UnsignedConstant
@ UnsignedConstant
Definition:DebugInfoMetadata.h:2796
llvm::DIExpression::elements_begin
element_iterator elements_begin() const
Definition:DebugInfoMetadata.h:2813
llvm::DIExpression::getElements
ArrayRef< uint64_t > getElements() const
Definition:DebugInfoMetadata.h:2787
llvm::DIExpression::getElement
uint64_t getElement(unsigned I) const
Definition:DebugInfoMetadata.h:2791
llvm::DIExpression::isConstant
std::optional< SignedOrUnsignedConstant > isConstant() const
Determine whether this represents a constant value, if so.
Definition:DebugInfoMetadata.cpp:2217
llvm::DIExpression::extractAddressClass
static const DIExpression * extractAddressClass(const DIExpression *Expr, unsigned &AddrClass)
Checks if the last 4 elements of the expression are DW_OP_constu <DWARF Address Space> DW_OP_swap DW_...
Definition:DebugInfoMetadata.cpp:1817
llvm::DIFile
File.
Definition:DebugInfoMetadata.h:573
llvm::DIGlobalVariable
Global variables.
Definition:DebugInfoMetadata.h:3315
llvm::DIGlobalVariable::getStaticDataMemberDeclaration
DIDerivedType * getStaticDataMemberDeclaration() const
Definition:DebugInfoMetadata.h:3382
llvm::DIGlobalVariable::getTemplateParams
MDTuple * getTemplateParams() const
Definition:DebugInfoMetadata.h:3392
llvm::DIGlobalVariable::isLocalToUnit
bool isLocalToUnit() const
Definition:DebugInfoMetadata.h:3378
llvm::DIGlobalVariable::getLinkageName
StringRef getLinkageName() const
Definition:DebugInfoMetadata.h:3381
llvm::DIGlobalVariable::getDisplayName
StringRef getDisplayName() const
Definition:DebugInfoMetadata.h:3380
llvm::DIGlobalVariable::isDefinition
bool isDefinition() const
Definition:DebugInfoMetadata.h:3379
llvm::DIGlobalVariable::getAnnotations
DINodeArray getAnnotations() const
Definition:DebugInfoMetadata.h:3385
llvm::DIImportedEntity
An imported module (C++ using directive or similar).
Definition:DebugInfoMetadata.h:3696
llvm::DILabel
Label.
Definition:DebugInfoMetadata.h:3551
llvm::DILexicalBlock
Debug lexical block.
Definition:DebugInfoMetadata.h:2283
llvm::DILocalScope::getSubprogram
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
Definition:DebugInfoMetadata.cpp:1051
llvm::DILocation
Debug location.
Definition:DebugInfoMetadata.h:1988
llvm::DINode
Tagged DWARF-like metadata node.
Definition:DebugInfoMetadata.h:135
llvm::DINode::getTag
dwarf::Tag getTag() const
Definition:DebugInfoMetadata.cpp:288
llvm::DIScope
Base class for scope-like contexts.
Definition:DebugInfoMetadata.h:519
llvm::DIScope::getName
StringRef getName() const
Definition:DebugInfoMetadata.cpp:368
llvm::DIScope::getScope
DIScope * getScope() const
Definition:DebugInfoMetadata.cpp:344
llvm::DISubprogram
Subprogram description.
Definition:DebugInfoMetadata.h:1710
llvm::DITypeRefArray
Definition:DebugInfoMetadata.h:73
llvm::DITypeRefArray::size
unsigned size() const
Definition:DebugInfoMetadata.h:88
llvm::DIType
Base class for types.
Definition:DebugInfoMetadata.h:710
llvm::DIType::getName
StringRef getName() const
Definition:DebugInfoMetadata.h:763
llvm::DIVariable::getAlignInBytes
uint32_t getAlignInBytes() const
Definition:DebugInfoMetadata.h:2713
llvm::DIVariable::getScope
DIScope * getScope() const
Definition:DebugInfoMetadata.h:2708
llvm::DIVariable::getType
DIType * getType() const
Definition:DebugInfoMetadata.h:2711
llvm::DIVariable::getName
StringRef getName() const
Definition:DebugInfoMetadata.h:2709
llvm::DataLayout::getPointerSize
unsigned getPointerSize(unsigned AS=0) const
Layout pointer size in bytes, rounded up to a whole number of bytes.
Definition:DataLayout.cpp:739
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::getEntity
const DINode * getEntity() const
Accessors.
Definition:DwarfDebug.h:85
llvm::DbgEntity::setDIE
void setDIE(DIE &D)
Definition:DwarfDebug.h:91
llvm::DbgEntity::getDIE
DIE * getDIE() const
Definition:DwarfDebug.h:87
llvm::DbgLabel
This class is used to track label information.
Definition:DwarfDebug.h:289
llvm::DbgValueLocEntry
A single location or constant within a variable location description, with either a single entry (wit...
Definition:DebugLocEntry.h:40
llvm::DbgValueLoc
The location of a single variable, composed of an expression and 0 or more DbgValueLocEntries.
Definition:DebugLocEntry.h:111
llvm::DbgValueLoc::getLocEntries
ArrayRef< DbgValueLocEntry > getLocEntries() const
Definition:DebugLocEntry.h:168
llvm::DbgValueLoc::isVariadic
bool isVariadic() const
Definition:DebugLocEntry.h:143
llvm::DbgVariable
This class is used to track local variable information.
Definition:DwarfDebug.h:214
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::getName
StringRef getName() const
Definition:DwarfDebug.h:250
llvm::DbgVariable::getType
const DIType * getType() const
Definition:DwarfDebug.cpp:230
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::DebugHandlerBase::getLabelBeforeInsn
MCSymbol * getLabelBeforeInsn(const MachineInstr *MI)
Return Label preceding the instruction.
Definition:DebugHandlerBase.cpp:137
llvm::DebugHandlerBase::getLabelAfterInsn
MCSymbol * getLabelAfterInsn(const MachineInstr *MI)
Return Label immediately following the instruction.
Definition:DebugHandlerBase.cpp:144
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::DenseMapBase::insert
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition:DenseMap.h:211
llvm::DwarfCompileUnit
Definition:DwarfCompileUnit.h:45
llvm::DwarfCompileUnit::useGNUAnalogForDwarf5Feature
bool useGNUAnalogForDwarf5Feature() const
Whether to use the GNU analog for a DWARF5 tag, attribute, or location atom.
Definition:DwarfCompileUnit.cpp:1231
llvm::DwarfCompileUnit::constructCallSiteParmEntryDIEs
void constructCallSiteParmEntryDIEs(DIE &CallSiteDIE, SmallVector< DbgCallSiteParam, 4 > &Params)
Construct call site parameter DIEs for the CallSiteDIE.
Definition:DwarfCompileUnit.cpp:1344
llvm::DwarfCompileUnit::attachLowHighPC
void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End)
Definition:DwarfCompileUnit.cpp:470
llvm::DwarfCompileUnit::emitHeader
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
Definition:DwarfCompileUnit.cpp:1507
llvm::DwarfCompileUnit::getDwarf5OrGNUTag
dwarf::Tag getDwarf5OrGNUTag(dwarf::Tag Tag) const
This takes a DWARF 5 tag and returns it or a GNU analog.
Definition:DwarfCompileUnit.cpp:1235
llvm::DwarfCompileUnit::updateSubprogramScopeDIE
DIE & updateSubprogramScopeDIE(const DISubprogram *SP, MCSymbol *LineTableSym)
Find DIE for the given subprogram and attach appropriate DW_AT_low_pc, DW_AT_high_pc and DW_AT_LLVM_s...
Definition:DwarfCompileUnit.cpp:520
llvm::DwarfCompileUnit::constructAbstractSubprogramScopeDIE
void constructAbstractSubprogramScopeDIE(LexicalScope *Scope)
Definition:DwarfCompileUnit.cpp:1188
llvm::DwarfCompileUnit::includeMinimalInlineScopes
bool includeMinimalInlineScopes() const
Definition:DwarfCompileUnit.cpp:1703
llvm::DwarfCompileUnit::getOrCreateImportedEntityDIE
DIE * getOrCreateImportedEntityDIE(const DIImportedEntity *IE)
Get or create a DIE for an imported entity.
Definition:DwarfCompileUnit.cpp:1422
llvm::DwarfCompileUnit::addBaseTypeRef
void addBaseTypeRef(DIEValueList &Die, int64_t Idx)
Definition:DwarfCompileUnit.cpp:1721
llvm::DwarfCompileUnit::addGlobalNameForTypeUnit
void addGlobalNameForTypeUnit(StringRef Name, const DIScope *Context)
Add a new global name present in a type unit to this compile unit.
Definition:DwarfCompileUnit.cpp:1550
llvm::DwarfCompileUnit::finishEntityDefinition
void finishEntityDefinition(const DbgEntity *Entity)
Definition:DwarfCompileUnit.cpp:1451
llvm::DwarfCompileUnit::addRange
void addRange(RangeSpan Range)
addRange - Add an address range to the list of ranges for this unit.
Definition:DwarfCompileUnit.cpp:420
llvm::DwarfCompileUnit::addAddrTableBase
void addAddrTableBase()
Add the DW_AT_addr_base attribute to the unit DIE.
Definition:DwarfCompileUnit.cpp:1712
llvm::DwarfCompileUnit::constructCallSiteEntryDIE
DIE & constructCallSiteEntryDIE(DIE &ScopeDIE, const DISubprogram *CalleeSP, bool IsTail, const MCSymbol *PCAddr, const MCSymbol *CallAddr, unsigned CallReg)
Construct a call site entry DIE describing a call within Scope to a callee described by CalleeSP.
Definition:DwarfCompileUnit.cpp:1282
llvm::DwarfCompileUnit::ExprRefedBaseTypes
std::vector< BaseTypeRef > ExprRefedBaseTypes
Definition:DwarfCompileUnit.h:179
llvm::DwarfCompileUnit::constructInlinedScopeDIE
DIE * constructInlinedScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE)
This scope represents an inlined body of a function.
Definition:DwarfCompileUnit.cpp:714
llvm::DwarfCompileUnit::createBaseTypeDIEs
void createBaseTypeDIEs()
Definition:DwarfCompileUnit.cpp:1726
llvm::DwarfCompileUnit::addScopeRangeList
void addScopeRangeList(DIE &ScopeDIE, SmallVector< RangeSpan, 2 > Range)
A helper function to construct a RangeSpanList for a given lexical scope.
Definition:DwarfCompileUnit.cpp:632
llvm::DwarfCompileUnit::getDWOId
uint64_t getDWOId() const
Definition:DwarfCompileUnit.h:388
llvm::DwarfCompileUnit::getOrCreateCommonBlock
DIE * getOrCreateCommonBlock(const DICommonBlock *CB, ArrayRef< GlobalExpr > GlobalExprs)
Definition:DwarfCompileUnit.cpp:403
llvm::DwarfCompileUnit::addVariableAddress
void addVariableAddress(const DbgVariable &DV, DIE &Die, MachineLocation Location)
Add DW_AT_location attribute for a DbgVariable based on provided MachineLocation.
Definition:DwarfCompileUnit.cpp:1583
llvm::DwarfCompileUnit::initStmtList
void initStmtList()
Definition:DwarfCompileUnit.cpp:443
llvm::DwarfCompileUnit::getLexicalBlockDIE
DIE * getLexicalBlockDIE(const DILexicalBlock *LB)
Get a DIE for the given DILexicalBlock.
Definition:DwarfCompileUnit.cpp:1747
llvm::DwarfCompileUnit::addGlobalName
void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context) override
Add a new global name to the compile unit.
Definition:DwarfCompileUnit.cpp:1542
llvm::DwarfCompileUnit::createAbstractEntity
void createAbstractEntity(const DINode *Node, LexicalScope *Scope)
Definition:DwarfCompileUnit.cpp:1492
llvm::DwarfCompileUnit::applyStmtList
void applyStmtList(DIE &D)
Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
Definition:DwarfCompileUnit.cpp:464
llvm::DwarfCompileUnit::getOrCreateContextDIE
DIE * getOrCreateContextDIE(const DIScope *Ty) override
Construct a DIE for a given scope.
Definition:DwarfCompileUnit.cpp:1758
llvm::DwarfCompileUnit::applyCommonDbgVariableAttributes
void applyCommonDbgVariableAttributes(const DbgVariable &Var, DIE &VariableDie)
Add attributes to Var which reflect the common attributes of VariableDie, namely those which are not ...
Definition:DwarfCompileUnit.cpp:1653
llvm::DwarfCompileUnit::constructSubprogramScopeDIE
DIE & constructSubprogramScopeDIE(const DISubprogram *Sub, LexicalScope *Scope, MCSymbol *LineTableSym)
Construct a DIE for this subprogram scope.
Definition:DwarfCompileUnit.cpp:1111
llvm::DwarfCompileUnit::constructVariableDIE
DIE * constructVariableDIE(DbgVariable &DV, bool Abstract=false)
Construct a DIE for the given DbgVariable.
Definition:DwarfCompileUnit.cpp:774
llvm::DwarfCompileUnit::getDwarf5OrGNULocationAtom
dwarf::LocationAtom getDwarf5OrGNULocationAtom(dwarf::LocationAtom Loc) const
This takes a DWARF 5 location atom and either returns it or a GNU analog.
Definition:DwarfCompileUnit.cpp:1271
llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE
DIE * getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
Get or create global variable DIE.
Definition:DwarfCompileUnit.cpp:157
llvm::DwarfCompileUnit::addLocationAttribute
void addLocationAttribute(DIE *ToDIE, const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
Definition:DwarfCompileUnit.cpp:223
llvm::DwarfCompileUnit::applySubprogramAttributesToDefinition
void applySubprogramAttributesToDefinition(const DISubprogram *SP, DIE &SPDie)
Definition:DwarfCompileUnit.cpp:1687
llvm::DwarfCompileUnit::createAndAddScopeChildren
DIE * createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE)
Definition:DwarfCompileUnit.cpp:1140
llvm::DwarfCompileUnit::addExpr
void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr)
Add a Dwarf expression attribute data and value.
Definition:DwarfCompileUnit.cpp:1682
llvm::DwarfCompileUnit::getDwarf5OrGNUAttr
dwarf::Attribute getDwarf5OrGNUAttr(dwarf::Attribute Attr) const
This takes a DWARF 5 attribute and returns it or a GNU analog.
Definition:DwarfCompileUnit.cpp:1249
llvm::DwarfCompileUnit::addAddress
void addAddress(DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Add an address attribute to a die based on the location provided.
Definition:DwarfCompileUnit.cpp:1593
llvm::DwarfCompileUnit::applyLabelAttributes
void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie)
Definition:DwarfCompileUnit.cpp:1672
llvm::DwarfCompileUnit::addLocalLabelAddress
void addLocalLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label)
addLocalLabelAddress - Add a dwarf label attribute data and value using DW_FORM_addr only.
Definition:DwarfCompileUnit.cpp:128
llvm::DwarfCompileUnit::constructLexicalScopeDIE
DIE * constructLexicalScopeDIE(LexicalScope *Scope)
Construct new DW_TAG_lexical_block for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.
Definition:DwarfCompileUnit.cpp:751
llvm::DwarfCompileUnit::addGlobalTypeImpl
void addGlobalTypeImpl(const DIType *Ty, const DIE &Die, const DIScope *Context) override
Add a new global type to the compile unit.
Definition:DwarfCompileUnit.cpp:1563
llvm::DwarfCompileUnit::getOrCreateSourceID
unsigned getOrCreateSourceID(const DIFile *File) override
Look up the source ID for the given file.
Definition:DwarfCompileUnit.cpp:137
llvm::DwarfCompileUnit::constructScopeDIE
void constructScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE)
Definition:DwarfCompileUnit.cpp:600
llvm::DwarfCompileUnit::DwarfCompileUnit
DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, UnitKind Kind=UnitKind::Full)
Definition:DwarfCompileUnit.cpp:78
llvm::DwarfCompileUnit::constructLabelDIE
DIE * constructLabelDIE(DbgLabel &DL, const LexicalScope &Scope)
Construct a DIE for the given DbgLabel.
Definition:DwarfCompileUnit.cpp:996
llvm::DwarfCompileUnit::addGlobalTypeUnitType
void addGlobalTypeUnitType(const DIType *Ty, const DIScope *Context)
Add a new global type present in a type unit to this compile unit.
Definition:DwarfCompileUnit.cpp:1571
llvm::DwarfCompileUnit::getExistingAbstractEntity
DbgEntity * getExistingAbstractEntity(const DINode *Node)
Definition:DwarfCompileUnit.cpp:1484
llvm::DwarfCompileUnit::hasDwarfPubSections
bool hasDwarfPubSections() const
Definition:DwarfCompileUnit.cpp:1522
llvm::DwarfCompileUnit::addLabelAddress
void addLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label)
addLabelAddress - Add a dwarf label attribute data and value using either DW_FORM_addr or DW_FORM_GNU...
Definition:DwarfCompileUnit.cpp:88
llvm::DwarfCompileUnit::addLocationList
void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index)
Add a Dwarf loclistptr attribute data and value.
Definition:DwarfCompileUnit.cpp:1645
llvm::DwarfCompileUnit::emitFuncLineTableOffsets
bool emitFuncLineTableOffsets() const
Definition:DwarfCompileUnit.cpp:1708
llvm::DwarfCompileUnit::addComplexAddress
void addComplexAddress(const DIExpression *DIExpr, DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Start with the address based on the location provided, and generate the DWARF information necessary t...
Definition:DwarfCompileUnit.cpp:1618
llvm::DwarfCompileUnit::constructImportedEntityDIE
DIE * constructImportedEntityDIE(const DIImportedEntity *IE)
Definition:DwarfCompileUnit.cpp:1368
llvm::DwarfCompileUnit::getCU
DwarfCompileUnit & getCU() override
Definition:DwarfCompileUnit.h:202
llvm::DwarfCompileUnit::attachRangesOrLowHighPC
void attachRangesOrLowHighPC(DIE &D, SmallVector< RangeSpan, 2 > Ranges)
Definition:DwarfCompileUnit.cpp:665
llvm::DwarfCompileUnit::finishSubprogramDefinition
void finishSubprogramDefinition(const DISubprogram *SP)
Definition:DwarfCompileUnit.cpp:1437
llvm::DwarfDebug
Collects and handles dwarf debug information.
Definition:DwarfDebug.h:351
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::getDwarfVersion
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
Definition:DwarfDebug.cpp:3895
llvm::DwarfDebug::addAccelNamespace
void addAccelNamespace(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die)
Definition:DwarfDebug.cpp:3881
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::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::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::getCurrentFunction
const MachineFunction * getCurrentFunction() const
Definition:DwarfDebug.h:888
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::getAddressPool
AddressPool & getAddressPool()
Definition:DwarfDebug.h:870
llvm::DwarfDebug::useSectionsAsReferences
bool useSectionsAsReferences() const
Returns whether to use sections as labels rather than temp symbols.
Definition:DwarfDebug.h:794
llvm::DwarfDebug::terminateLineTable
void terminateLineTable(const DwarfCompileUnit *CU)
Terminate the line table by adding the last range label.
Definition:DwarfDebug.cpp:2504
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::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::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::getAccelTableKind
AccelTableKind getAccelTableKind() const
Returns what kind (if any) of accelerator tables to emit.
Definition:DwarfDebug.h:804
llvm::DwarfExpression::setLocation
void setLocation(const MachineLocation &Loc, const DIExpression *DIExpr)
Set the location (Loc) and DIExpression (DIExpr) to describe.
Definition:DwarfExpression.cpp:404
llvm::DwarfExpression::addFragmentOffset
void addFragmentOffset(const DIExpression *Expr)
If applicable, emit an empty DW_OP_piece / DW_OP_bit_piece to advance to the fragment described by Ex...
Definition:DwarfExpression.cpp:722
llvm::DwarfExpression::setMemoryLocationKind
void setMemoryLocationKind()
Lock this down to become a memory location description.
Definition:DwarfExpression.h:245
llvm::DwarfExpression::TagOffset
std::optional< uint8_t > TagOffset
Definition:DwarfExpression.h:111
llvm::DwarfExpression::setCallSiteParamValueFlag
void setCallSiteParamValueFlag()
Lock this down to become a call site parameter location.
Definition:DwarfExpression.h:254
llvm::DwarfExpression::addMachineRegExpression
bool addMachineRegExpression(const TargetRegisterInfo &TRI, DIExpressionCursor &Expr, llvm::Register MachineReg, unsigned FragmentOffsetInBits=0)
Emit a machine register location.
Definition:DwarfExpression.cpp:257
llvm::DwarfExpression::addExpression
void addExpression(DIExpressionCursor &&Expr)
Emit all remaining operations in the DIExpressionCursor.
Definition:DwarfExpression.cpp:491
llvm::DwarfExpression::addWasmLocation
void addWasmLocation(unsigned Index, uint64_t Offset)
Emit location information expressed via WebAssembly location + offset The Index is an identifier for ...
Definition:DwarfExpression.cpp:772
llvm::DwarfExpression::beginEntryValueExpression
void beginEntryValueExpression(DIExpressionCursor &ExprCursor)
Begin emission of an entry value dwarf operation.
Definition:DwarfExpression.cpp:413
llvm::DwarfFile
Definition:DwarfFile.h:54
llvm::DwarfFile::addScopeLabel
void addScopeLabel(LexicalScope *LS, DbgLabel *Label)
Definition:DwarfFile.cpp:117
llvm::DwarfFile::getScopeVariables
DenseMap< LexicalScope *, ScopeVars > & getScopeVariables()
Definition:DwarfFile.h:161
llvm::DwarfFile::getScopeLabels
DenseMap< LexicalScope *, LabelList > & getScopeLabels()
Definition:DwarfFile.h:165
llvm::DwarfFile::addScopeVariable
void addScopeVariable(LexicalScope *LS, DbgVariable *Var)
Definition:DwarfFile.cpp:105
llvm::DwarfUnit
This dwarf writer support class manages information associated with a source file.
Definition:DwarfUnit.h:35
llvm::DwarfUnit::getOrCreateTypeDIE
virtual DIE * getOrCreateTypeDIE(const MDNode *TyNode)
Find existing DIE or create new DIE for the given type.
Definition:DwarfUnit.cpp:612
llvm::DwarfUnit::getDwarfDebug
DwarfDebug & getDwarfDebug() const
Definition:DwarfUnit.h:112
llvm::DwarfUnit::addAnnotation
void addAnnotation(DIE &Buffer, DINodeArray Annotations)
Add DW_TAG_LLVM_annotation.
Definition:DwarfUnit.cpp:905
llvm::DwarfUnit::addBlock
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc)
Add block data.
Definition:DwarfUnit.cpp:391
llvm::DwarfUnit::addTemplateParams
void addTemplateParams(DIE &Buffer, DINodeArray TParams)
Add template parameters in buffer.
Definition:DwarfUnit.cpp:516
llvm::DwarfUnit::getOrCreateContextDIE
virtual DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
Definition:DwarfUnit.cpp:546
llvm::DwarfUnit::addAttribute
void addAttribute(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, T &&Value)
Definition:DwarfUnit.h:84
llvm::DwarfUnit::addOpAddress
void addOpAddress(DIELoc &Die, const MCSymbol *Sym)
Add a dwarf op address data and value using the form given and an op of either DW_FORM_addr or DW_FOR...
Definition:DwarfUnit.cpp:332
llvm::DwarfUnit::addUInt
void addUInt(DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, uint64_t Integer)
Add an unsigned integer attribute data and value.
Definition:DwarfUnit.cpp:221
llvm::DwarfUnit::addString
void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
Definition:DwarfUnit.cpp:247
llvm::DwarfUnit::addConstantValue
void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty)
Add constant value entry in variable DIE.
Definition:DwarfUnit.cpp:459
llvm::DwarfUnit::getOrCreateNameSpace
DIE * getOrCreateNameSpace(const DINamespace *NS)
Definition:DwarfUnit.cpp:1167
llvm::DwarfUnit::insertDIE
void insertDIE(const DINode *Desc, DIE *D)
Insert DIE into the map.
Definition:DwarfUnit.cpp:202
llvm::DwarfUnit::addSectionDelta
void addSectionDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
addSectionDelta - Add a label delta attribute data and value.
Definition:DwarfUnit.cpp:1874
llvm::DwarfUnit::DD
DwarfDebug * DD
Definition:DwarfUnit.h:55
llvm::DwarfUnit::CUNode
const DICompileUnit * CUNode
MDNode for the compile unit.
Definition:DwarfUnit.h:40
llvm::DwarfUnit::getDIE
DIE * getDIE(const DINode *D) const
Returns the DIE map slot for the specified debug variable.
Definition:DwarfUnit.cpp:196
llvm::DwarfUnit::LabelBegin
MCSymbol * LabelBegin
The start of the unit within its section.
Definition:DwarfUnit.h:49
llvm::DwarfUnit::addSInt
void addSInt(DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, int64_t Integer)
Add an signed integer attribute data and value.
Definition:DwarfUnit.cpp:235
llvm::DwarfUnit::addLabelDelta
void addLabelDelta(DIEValueList &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
Add a label delta attribute data and value.
Definition:DwarfUnit.cpp:347
llvm::DwarfUnit::addLinkageName
void addLinkageName(DIE &Die, StringRef LinkageName)
Add a linkage name, if it isn't empty.
Definition:DwarfUnit.cpp:508
llvm::DwarfUnit::getParentContextString
std::string getParentContextString(const DIScope *Context) const
Get string containing language specific context for a global name.
Definition:DwarfUnit.cpp:681
llvm::DwarfUnit::addSourceLine
void addSourceLine(DIE &Die, unsigned Line, const DIFile *File)
Add location information to specified debug information entry.
Definition:DwarfUnit.cpp:409
llvm::DwarfUnit::emitCommonHeader
void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT)
Emit the common part of the header for this unit.
Definition:DwarfUnit.cpp:1821
llvm::DwarfUnit::DIEValueAllocator
BumpPtrAllocator DIEValueAllocator
Definition:DwarfUnit.h:43
llvm::DwarfUnit::getOrCreateModule
DIE * getOrCreateModule(const DIModule *M)
Definition:DwarfUnit.cpp:1188
llvm::DwarfUnit::getCUNode
const DICompileUnit * getCUNode() const
Definition:DwarfUnit.h:111
llvm::DwarfUnit::createAndAddDIE
DIE & createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N=nullptr)
Create a DIE with the given Tag, add the DIE to its parent, and call insertDIE if MD is not null.
Definition:DwarfUnit.cpp:384
llvm::DwarfUnit::DU
DwarfFile * DU
Definition:DwarfUnit.h:56
llvm::DwarfUnit::getOrCreateStaticMemberDIE
DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)
Create new static data member DIE.
Definition:DwarfUnit.cpp:1778
llvm::DwarfUnit::addLabel
void addLabel(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)
Add a Dwarf label attribute data and value.
Definition:DwarfUnit.cpp:280
llvm::DwarfUnit::addConstantFPValue
void addConstantFPValue(DIE &Die, const ConstantFP *CFP)
Add constant value entry in variable DIE.
Definition:DwarfUnit.cpp:454
llvm::DwarfUnit::getOrCreateSubprogramDIE
DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal=false)
Definition:DwarfUnit.cpp:1219
llvm::DwarfUnit::addSectionLabel
void addSectionLabel(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label, const MCSymbol *Sec)
Add a Dwarf section label attribute data and value.
Definition:DwarfUnit.cpp:1880
llvm::DwarfUnit::addPoolOpAddress
void addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label)
Definition:DwarfUnit.cpp:307
llvm::DwarfUnit::constructTypeDIE
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)
Definition:DwarfUnit.cpp:926
llvm::DwarfUnit::EndLabel
MCSymbol * EndLabel
Emitted at the end of the CU and used to compute the CU Length field.
Definition:DwarfUnit.h:52
llvm::DwarfUnit::addFlag
void addFlag(DIE &Die, dwarf::Attribute Attribute)
Add a flag that is true to the DIE.
Definition:DwarfUnit.cpp:214
llvm::DwarfUnit::Asm
AsmPrinter * Asm
Target of Dwarf emission.
Definition:DwarfUnit.h:46
llvm::DwarfUnit::getUniqueID
unsigned getUniqueID() const
Gets Unique ID for this unit.
Definition:DwarfUnit.h:101
llvm::DwarfUnit::addType
void addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)
Add a new type attribute to the specified entity.
Definition:DwarfUnit.cpp:675
llvm::DwarfUnit::applySubprogramAttributes
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)
Definition:DwarfUnit.cpp:1304
llvm::DwarfUnit::addDIEEntry
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
Definition:DwarfUnit.cpp:353
llvm::GlobalVariable
Definition:GlobalVariable.h:39
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::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::MCAsmInfo::getCodePointerSize
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition:MCAsmInfo.h:449
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition:MCExpr.h:34
llvm::MCObjectFileInfo::getDwarfRangesSection
MCSection * getDwarfRangesSection() const
Definition:MCObjectFileInfo.h:300
llvm::MCObjectFileInfo::getDwarfAddrSection
MCSection * getDwarfAddrSection() const
Definition:MCObjectFileInfo.h:330
llvm::MCObjectFileInfo::getDwarfLineSection
MCSection * getDwarfLineSection() const
Definition:MCObjectFileInfo.h:283
llvm::MCRegisterInfo::getDwarfRegNum
virtual int64_t getDwarfRegNum(MCRegister RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number.
Definition:MCRegisterInfo.cpp:144
llvm::MCSection::getBeginSymbol
MCSymbol * getBeginSymbol()
Definition:MCSection.h:135
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition:MCSymbol.h:41
llvm::MCSymbol::isDefined
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
Definition:MCSymbol.h:250
llvm::MDTuple
Tuple of metadata.
Definition:Metadata.h:1479
llvm::MachineBasicBlock::sameSection
bool sameSection(const MachineBasicBlock *MBB) const
Returns true if this and MBB belong to the same section.
Definition:MachineBasicBlock.h:725
llvm::MachineBasicBlock::getSectionID
MBBSectionID getSectionID() const
Returns the section ID of this basic block.
Definition:MachineBasicBlock.h:684
llvm::MachineBasicBlock::isEndSection
bool isEndSection() const
Returns true if this block ends any section.
Definition:MachineBasicBlock.h:675
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition:MachineFunction.h:733
llvm::MachineFunction::getTarget
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition:MachineFunction.h:729
llvm::MachineLocation
Definition:MachineLocation.h:22
llvm::Metadata
Root of the metadata hierarchy.
Definition:Metadata.h:62
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition:Module.h:65
llvm::Module::getName
StringRef getName() const
Get a short "name" for the module.
Definition:Module.h:285
llvm::Register
Wrapper class representing virtual and physical registers.
Definition:Register.h:19
llvm::Register::isPhysicalRegister
static constexpr bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
Definition:Register.h:65
llvm::SectionKind::isReadOnly
bool isReadOnly() const
Definition:SectionKind.h:131
llvm::SetVector::empty
bool empty() const
Determine if the SetVector is empty or not.
Definition:SetVector.h:93
llvm::SetVector::insert
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition:SetVector.h:162
llvm::SmallDenseMap
Definition:DenseMap.h:883
llvm::SmallDenseSet
Implements a dense probed hash-table based set with some number of buckets stored inline.
Definition:DenseSet.h:298
llvm::SmallString
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition:SmallString.h:26
llvm::SmallVectorBase::empty
bool empty() const
Definition:SmallVector.h:81
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::SmallVectorImpl::append
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition:SmallVector.h:683
llvm::SmallVectorTemplateBase::pop_back
void pop_back()
Definition:SmallVector.h:425
llvm::SmallVectorTemplateBase::push_back
void push_back(const T &Elt)
Definition:SmallVector.h:413
llvm::SmallVectorTemplateCommon::back
reference back()
Definition:SmallVector.h:308
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::StackOffset
StackOffset holds a fixed and a scalable offset in bytes.
Definition:TypeSize.h:33
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::StringRef::str
std::string str() const
str - Get the contents as an std::string.
Definition:StringRef.h:229
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition:StringRef.h:147
llvm::TargetFrameLowering
Information about stack frame layout on the target.
Definition:TargetFrameLowering.h:45
llvm::TargetFrameLowering::getDwarfFrameBase
virtual DwarfFrameBase getDwarfFrameBase(const MachineFunction &MF) const
Return the frame base information to be encoded in the DWARF subprogram debug info.
Definition:TargetFrameLoweringImpl.cpp:181
llvm::TargetFrameLowering::getFrameIndexReference
virtual StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const
getFrameIndexReference - This method should return the base register and offset used to reference a f...
Definition:TargetFrameLoweringImpl.cpp:48
llvm::TargetLoweringObjectFile
Definition:TargetLoweringObjectFile.h:45
llvm::TargetLoweringObjectFile::getStaticBase
virtual MCRegister getStaticBase() const
Returns the register used as static base in RWPI variants.
Definition:TargetLoweringObjectFile.h:229
llvm::TargetLoweringObjectFile::getKindForGlobal
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
Definition:TargetLoweringObjectFile.cpp:199
llvm::TargetLoweringObjectFile::supportDebugThreadLocalLocation
bool supportDebugThreadLocalLocation() const
Target supports TLS offset relocation in debug section?
Definition:TargetLoweringObjectFile.h:224
llvm::TargetLoweringObjectFile::getIndirectSymViaRWPI
virtual const MCExpr * getIndirectSymViaRWPI(const MCSymbol *Sym) const
Get the target specific RWPI relocation.
Definition:TargetLoweringObjectFile.h:232
llvm::TargetLoweringObjectFile::getDebugThreadLocalSymbol
virtual const MCExpr * getDebugThreadLocalSymbol(const MCSymbol *Sym) const
Create a symbol reference to describe the given TLS variable when emitting the address in debug info.
Definition:TargetLoweringObjectFile.cpp:426
llvm::TargetMachine::getTargetTriple
const Triple & getTargetTriple() const
Definition:TargetMachine.h:126
llvm::TargetMachine::useEmulatedTLS
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
Definition:TargetMachine.cpp:235
llvm::TargetMachine::getRelocationModel
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
Definition:TargetMachine.cpp:144
llvm::TargetMachine::Options
TargetOptions Options
Definition:TargetMachine.h:118
llvm::TargetMachine::getMCRegisterInfo
const MCRegisterInfo * getMCRegisterInfo() const
Definition:TargetMachine.h:214
llvm::TargetOptions::DisableFramePointerElim
bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
Definition:TargetOptionsImpl.cpp:24
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition:TargetRegisterInfo.h:235
llvm::TargetSubtargetInfo::getRegisterInfo
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
Definition:TargetSubtargetInfo.h:129
llvm::TargetSubtargetInfo::getFrameLowering
virtual const TargetFrameLowering * getFrameLowering() const
Definition:TargetSubtargetInfo.h:98
llvm::Triple::isNVPTX
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
Definition:Triple.h:878
llvm::Triple::isWasm
bool isWasm() const
Tests whether the target is wasm (32- and 64-bit).
Definition:Triple.h:1061
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition:Twine.h:81
llvm::Twine::toStringRef
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
Definition:Twine.h:492
llvm::cl::opt
Definition:CommandLine.h:1423
llvm::detail::DenseSetImpl::insert
std::pair< iterator, bool > insert(const ValueT &V)
Definition:DenseSet.h:213
llvm::detail::DenseSetImpl::count
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
Definition:DenseSet.h:95
llvm::dwarf_linker::classic::DeclContext
A DeclContext is a named program scope that is used for ODR uniquing of types.
Definition:DWARFLinkerDeclContext.h:80
llvm::ilist_node_with_parent::getNextNode
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
Definition:ilist_node.h:353
uint32_t
uint64_t
uint8_t
llvm::DwarfDebug::tuneForSCE
bool tuneForSCE() const
Definition:DwarfDebug.h:916
llvm::DwarfDebug::tuneForGDB
bool tuneForGDB() const
Definition:DwarfDebug.h:914
llvm::DwarfDebug::tuneForLLDB
bool tuneForLLDB() const
Definition:DwarfDebug.h:915
llvm::dwarf::AttributeEncodingString
StringRef AttributeEncodingString(unsigned Encoding)
Definition:Dwarf.cpp:263
DebugInfo.h
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition:ErrorHandling.h:143
TargetMachine.h
llvm::AMDGPU::Hwreg::Offset
Offset
Definition:SIDefines.h:553
llvm::COFF::Entry
@ Entry
Definition:COFF.h:844
llvm::Reloc::RWPI
@ RWPI
Definition:CodeGen.h:25
llvm::Reloc::ROPI_RWPI
@ ROPI_RWPI
Definition:CodeGen.h:25
llvm::Reloc::PIC_
@ PIC_
Definition:CodeGen.h:25
llvm::cl::Hidden
@ Hidden
Definition:CommandLine.h:137
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition:CommandLine.h:443
llvm::dwarf::DW_INL_inlined
@ DW_INL_inlined
Definition:Dwarf.h:756
llvm::dwarf::Attribute
Attribute
Attributes.
Definition:Dwarf.h:123
llvm::dwarf::UnitType
UnitType
Constants for unit types in DWARF v5.
Definition:Dwarf.h:875
llvm::dwarf::Form
Form
Definition:Dwarf.h:130
llvm::dwarf::LocationAtom
LocationAtom
Definition:Dwarf.h:136
llvm::dwarf::Tag
Tag
Definition:Dwarf.h:103
llvm::pdb::Single
@ Single
Definition:PDBTypes.h:401
llvm::sampleprof::Base
@ Base
Definition:Discriminator.h:58
llvm::wasm::WASM_TYPE_I64
@ WASM_TYPE_I64
Definition:Wasm.h:55
llvm::wasm::WASM_TYPE_I32
@ WASM_TYPE_I32
Definition:Wasm.h:54
llvm::wasm::WASM_SYMBOL_TYPE_GLOBAL
@ WASM_SYMBOL_TYPE_GLOBAL
Definition:Wasm.h:218
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::any_of
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1746
llvm::reverse
auto reverse(ContainerTy &&C)
Definition:STLExtras.h:420
llvm::AccelTableKind::Apple
@ Apple
.apple_names, .apple_namespaces, .apple_types, .apple_objc.
llvm::AsanDtorKind::Global
@ Global
Append to llvm.global_dtors.
llvm::divideCeil
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
Definition:MathExtras.h:404
llvm::count
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
Definition:STLExtras.h:1938
llvm::Op
DWARFExpression::Operation Op
Definition:DWARFExpression.cpp:22
llvm::HighlightColor::Tag
@ Tag
llvm::BasicBlockSection::List
@ List
llvm::UnitKind
UnitKind
Definition:DwarfCompileUnit.h:43
llvm::InsnRange
std::pair< const MachineInstr *, const MachineInstr * > InsnRange
InsnRange - This is used to track range of instructions with identical lexical scope.
Definition:LexicalScopes.h:39
llvm::getDISubprogram
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
Definition:DebugInfo.cpp:169
llvm::BitTracker
Definition:BitTracker.h:35
llvm::Loc::EntryValue
Single location defined by (potentially multiple) EntryValueInfo.
Definition:DwarfDebug.h:172
llvm::Loc::EntryValue::EntryValues
std::set< EntryValueInfo > EntryValues
Definition:DwarfDebug.h:173
llvm::Loc::MMI
Single location defined by (potentially multiple) MMI entries.
Definition:DwarfDebug.h:159
llvm::Loc::MMI::getFrameIndexExprs
const std::set< FrameIndexExpr > & getFrameIndexExprs() const
Get the FI entries, sorted by fragment offset.
Definition:DwarfDebug.cpp:292
llvm::RangeSpan
Definition:DwarfFile.h:37
llvm::RangeSpan::End
const MCSymbol * End
Definition:DwarfFile.h:39
llvm::RangeSpan::Begin
const MCSymbol * Begin
Definition:DwarfFile.h:38
llvm::SymbolCU
Helper used to pair up a symbol and its DWARF compile unit.
Definition:DwarfDebug.h:335
llvm::TargetFrameLowering::DwarfFrameBase::WasmFrameBase
Definition:TargetFrameLowering.h:62
llvm::TargetFrameLowering::DwarfFrameBase::WasmFrameBase::Index
unsigned Index
Definition:TargetFrameLowering.h:64
llvm::TargetFrameLowering::DwarfFrameBase::WasmFrameBase::Kind
unsigned Kind
Definition:TargetFrameLowering.h:63
llvm::TargetFrameLowering::DwarfFrameBase
Definition:TargetFrameLowering.h:58
llvm::TargetFrameLowering::DwarfFrameBase::Offset
int64_t Offset
Definition:TargetFrameLowering.h:70
llvm::TargetFrameLowering::DwarfFrameBase::CFA
@ CFA
Definition:TargetFrameLowering.h:61
llvm::TargetFrameLowering::DwarfFrameBase::Register
@ Register
Definition:TargetFrameLowering.h:61
llvm::TargetFrameLowering::DwarfFrameBase::Location
union llvm::TargetFrameLowering::DwarfFrameBase::@248 Location
llvm::TargetFrameLowering::DwarfFrameBase::Reg
unsigned Reg
Definition:TargetFrameLowering.h:68
llvm::TargetFrameLowering::DwarfFrameBase::Kind
enum llvm::TargetFrameLowering::DwarfFrameBase::FrameBaseKind Kind
llvm::TargetFrameLowering::DwarfFrameBase::WasmLoc
struct WasmFrameBase WasmLoc
Definition:TargetFrameLowering.h:71
llvm::TargetIndexLocation
This struct describes target specific location.
Definition:DebugLocEntry.h:24
llvm::TargetIndexLocation::Index
int Index
Definition:DebugLocEntry.h:25
llvm::TargetIndexLocation::Offset
int Offset
Definition:DebugLocEntry.h:26
llvm::cl::desc
Definition:CommandLine.h:409
llvm::wasm::WasmGlobalType
Definition:Wasm.h:353

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

©2009-2025 Movatter.jp