LLVM  16.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/None.h"
17 #include "llvm/ADT/STLExtras.h"
18 #include "llvm/ADT/SmallString.h"
21 #include "llvm/CodeGen/DIE.h"
27 #include "llvm/IR/DataLayout.h"
28 #include "llvm/IR/DebugInfo.h"
29 #include "llvm/IR/GlobalVariable.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"
38 #include <iterator>
39 #include <optional>
40 #include <string>
41 #include <utility>
42 
43 using namespace llvm;
44 
46 
47  // According to DWARF Debugging Information Format Version 5,
48  // 3.1.2 Skeleton Compilation Unit Entries:
49  // "When generating a split DWARF object file (see Section 7.3.2
50  // on page 187), the compilation unit in the .debug_info section
51  // is a "skeleton" compilation unit with the tag DW_TAG_skeleton_unit"
52  if (DW->getDwarfVersion() >= 5 && Kind == UnitKind::Skeleton)
53  return dwarf::DW_TAG_skeleton_unit;
54 
55  return dwarf::DW_TAG_compile_unit;
56 }
57 
59  AsmPrinter *A, DwarfDebug *DW,
60  DwarfFile *DWU, UnitKind Kind)
61  : DwarfUnit(GetCompileUnitType(Kind, DW), Node, A, DW, DWU), UniqueID(UID) {
62  insertDIE(Node, &getUnitDie());
63  MacroLabelBegin = Asm->createTempSymbol("cu_macro_begin");
64 }
65 
66 /// addLabelAddress - Add a dwarf label attribute data and value using
67 /// DW_FORM_addr or DW_FORM_GNU_addr_index.
69  const MCSymbol *Label) {
70  if ((Skeleton || !DD->useSplitDwarf()) && Label)
71  DD->addArangeLabel(SymbolCU(this, Label));
72 
73  // Don't use the address pool in non-fission or in the skeleton unit itself.
74  if ((!DD->useSplitDwarf() || !Skeleton) && DD->getDwarfVersion() < 5)
75  return addLocalLabelAddress(Die, Attribute, Label);
76 
77  bool UseAddrOffsetFormOrExpressions =
79 
80  const MCSymbol *Base = nullptr;
81  if (Label->isInSection() && UseAddrOffsetFormOrExpressions)
82  Base = DD->getSectionLabel(&Label->getSection());
83 
84  if (!Base || Base == Label) {
85  unsigned idx = DD->getAddressPool().getIndex(Label);
87  DD->getDwarfVersion() >= 5 ? dwarf::DW_FORM_addrx
88  : dwarf::DW_FORM_GNU_addr_index,
89  DIEInteger(idx));
90  return;
91  }
92 
93  // Could be extended to work with DWARFv4 Split DWARF if that's important for
94  // someone. In that case DW_FORM_data would be used.
95  assert(DD->getDwarfVersion() >= 5 &&
96  "Addr+offset expressions are only valuable when using debug_addr (to "
97  "reduce relocations) available in DWARFv5 or higher");
99  auto *Loc = new (DIEValueAllocator) DIEBlock();
100  addPoolOpAddress(*Loc, Label);
101  addBlock(Die, Attribute, dwarf::DW_FORM_exprloc, Loc);
102  } else
103  addAttribute(Die, Attribute, dwarf::DW_FORM_LLVM_addrx_offset,
105  DD->getAddressPool().getIndex(Base), Label, Base));
106 }
107 
110  const MCSymbol *Label) {
111  if (Label)
112  addAttribute(Die, Attribute, dwarf::DW_FORM_addr, DIELabel(Label));
113  else
114  addAttribute(Die, Attribute, dwarf::DW_FORM_addr, DIEInteger(0));
115 }
116 
118  // If we print assembly, we can't separate .file entries according to
119  // compile units. Thus all files will belong to the default compile unit.
120 
121  // FIXME: add a better feature test than hasRawTextSupport. Even better,
122  // extend .file to support this.
123  unsigned CUID = Asm->OutStreamer->hasRawTextSupport() ? 0 : getUniqueID();
124  if (!File)
125  return Asm->OutStreamer->emitDwarfFileDirective(0, "", "", None, None,
126  CUID);
127 
128  if (LastFile != File) {
129  LastFile = File;
130  LastFileID = Asm->OutStreamer->emitDwarfFileDirective(
131  0, File->getDirectory(), File->getFilename(), DD->getMD5AsBytes(File),
132  File->getSource(), CUID);
133  }
134  return LastFileID;
135 }
136 
138  const DIGlobalVariable *GV, ArrayRef<GlobalExpr> GlobalExprs) {
139  // Check for pre-existence.
140  if (DIE *Die = getDIE(GV))
141  return Die;
142 
143  assert(GV);
144 
145  auto *GVContext = GV->getScope();
146  const DIType *GTy = GV->getType();
147 
148  auto *CB = GVContext ? dyn_cast<DICommonBlock>(GVContext) : nullptr;
149  DIE *ContextDIE = CB ? getOrCreateCommonBlock(CB, GlobalExprs)
150  : getOrCreateContextDIE(GVContext);
151 
152  // Add to map.
153  DIE *VariableDIE = &createAndAddDIE(GV->getTag(), *ContextDIE, GV);
155  if (auto *SDMDecl = GV->getStaticDataMemberDeclaration()) {
156  DeclContext = SDMDecl->getScope();
157  assert(SDMDecl->isStaticMember() && "Expected static member decl");
158  assert(GV->isDefinition());
159  // We need the declaration DIE that is in the static member's class.
160  DIE *VariableSpecDIE = getOrCreateStaticMemberDIE(SDMDecl);
161  addDIEEntry(*VariableDIE, dwarf::DW_AT_specification, *VariableSpecDIE);
162  // If the global variable's type is different from the one in the class
163  // member type, assume that it's more specific and also emit it.
164  if (GTy != SDMDecl->getBaseType())
165  addType(*VariableDIE, GTy);
166  } else {
167  DeclContext = GV->getScope();
168  // Add name and type.
169  StringRef DisplayName = GV->getDisplayName();
170  if (!DisplayName.empty())
171  addString(*VariableDIE, dwarf::DW_AT_name, GV->getDisplayName());
172  if (GTy)
173  addType(*VariableDIE, GTy);
174 
175  // Add scoping info.
176  if (!GV->isLocalToUnit())
177  addFlag(*VariableDIE, dwarf::DW_AT_external);
178 
179  // Add line number info.
180  addSourceLine(*VariableDIE, GV);
181  }
182 
183  if (!GV->isDefinition())
184  addFlag(*VariableDIE, dwarf::DW_AT_declaration);
185  else
186  addGlobalName(GV->getName(), *VariableDIE, DeclContext);
187 
188  addAnnotation(*VariableDIE, GV->getAnnotations());
189 
190  if (uint32_t AlignInBytes = GV->getAlignInBytes())
191  addUInt(*VariableDIE, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
192  AlignInBytes);
193 
194  if (MDTuple *TP = GV->getTemplateParams())
195  addTemplateParams(*VariableDIE, DINodeArray(TP));
196 
197  // Add location.
198  addLocationAttribute(VariableDIE, GV, GlobalExprs);
199 
200  return VariableDIE;
201 }
202 
204  DIE *VariableDIE, const DIGlobalVariable *GV, ArrayRef<GlobalExpr> GlobalExprs) {
205  bool addToAccelTable = false;
206  DIELoc *Loc = nullptr;
207  std::optional<unsigned> NVPTXAddressSpace;
208  std::unique_ptr<DIEDwarfExpression> DwarfExpr;
209  for (const auto &GE : GlobalExprs) {
210  const GlobalVariable *Global = GE.Var;
211  const DIExpression *Expr = GE.Expr;
212 
213  // For compatibility with DWARF 3 and earlier,
214  // DW_AT_location(DW_OP_constu, X, DW_OP_stack_value) or
215  // DW_AT_location(DW_OP_consts, X, DW_OP_stack_value) becomes
216  // DW_AT_const_value(X).
217  if (GlobalExprs.size() == 1 && Expr && Expr->isConstant()) {
218  addToAccelTable = true;
220  *VariableDIE,
221  DIExpression::SignedOrUnsignedConstant::UnsignedConstant ==
222  *Expr->isConstant(),
223  Expr->getElement(1));
224  break;
225  }
226 
227  // We cannot describe the location of dllimport'd variables: the
228  // computation of their address requires loads from the IAT.
229  if (Global && Global->hasDLLImportStorageClass())
230  continue;
231 
232  // Nothing to describe without address or constant.
233  if (!Global && (!Expr || !Expr->isConstant()))
234  continue;
235 
236  if (Global && Global->isThreadLocal() &&
238  continue;
239 
240  if (!Loc) {
241  addToAccelTable = true;
242  Loc = new (DIEValueAllocator) DIELoc;
243  DwarfExpr = std::make_unique<DIEDwarfExpression>(*Asm, *this, *Loc);
244  }
245 
246  if (Expr) {
247  // According to
248  // https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf
249  // cuda-gdb requires DW_AT_address_class for all variables to be able to
250  // correctly interpret address space of the variable address.
251  // Decode DW_OP_constu <DWARF Address Space> DW_OP_swap DW_OP_xderef
252  // sequence for the NVPTX + gdb target.
253  unsigned LocalNVPTXAddressSpace;
254  if (Asm->TM.getTargetTriple().isNVPTX() && DD->tuneForGDB()) {
255  const DIExpression *NewExpr =
256  DIExpression::extractAddressClass(Expr, LocalNVPTXAddressSpace);
257  if (NewExpr != Expr) {
258  Expr = NewExpr;
259  NVPTXAddressSpace = LocalNVPTXAddressSpace;
260  }
261  }
262  DwarfExpr->addFragmentOffset(Expr);
263  }
264 
265  if (Global) {
266  const MCSymbol *Sym = Asm->getSymbol(Global);
267  // 16-bit platforms like MSP430 and AVR take this path, so sink this
268  // assert to platforms that use it.
269  auto GetPointerSizedFormAndOp = [this]() {
271  assert((PointerSize == 4 || PointerSize == 8) &&
272  "Add support for other sizes if necessary");
273  struct FormAndOp {
276  };
277  return PointerSize == 4
278  ? FormAndOp{dwarf::DW_FORM_data4, dwarf::DW_OP_const4u}
279  : FormAndOp{dwarf::DW_FORM_data8, dwarf::DW_OP_const8u};
280  };
281  if (Global->isThreadLocal()) {
282  if (Asm->TM.useEmulatedTLS()) {
283  // TODO: add debug info for emulated thread local mode.
284  } else {
285  // FIXME: Make this work with -gsplit-dwarf.
286  // Based on GCC's support for TLS:
287  if (!DD->useSplitDwarf()) {
288  auto FormAndOp = GetPointerSizedFormAndOp();
289  // 1) Start with a constNu of the appropriate pointer size
290  addUInt(*Loc, dwarf::DW_FORM_data1, FormAndOp.Op);
291  // 2) containing the (relocated) offset of the TLS variable
292  // within the module's TLS block.
293  addExpr(*Loc, FormAndOp.Form,
295  } else {
296  addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);
297  addUInt(*Loc, dwarf::DW_FORM_udata,
298  DD->getAddressPool().getIndex(Sym, /* TLS */ true));
299  }
300  // 3) followed by an OP to make the debugger do a TLS lookup.
301  addUInt(*Loc, dwarf::DW_FORM_data1,
302  DD->useGNUTLSOpcode() ? dwarf::DW_OP_GNU_push_tls_address
303  : dwarf::DW_OP_form_tls_address);
304  }
305  } else if ((Asm->TM.getRelocationModel() == Reloc::RWPI ||
308  .getKindForGlobal(Global, Asm->TM)
309  .isReadOnly()) {
310  auto FormAndOp = GetPointerSizedFormAndOp();
311  // Constant
312  addUInt(*Loc, dwarf::DW_FORM_data1, FormAndOp.Op);
313  // Relocation offset
314  addExpr(*Loc, FormAndOp.Form,
316  // Base register
318  BaseReg = Asm->TM.getMCRegisterInfo()->getDwarfRegNum(BaseReg, false);
319  addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + BaseReg);
320  // Offset from base register
321  addSInt(*Loc, dwarf::DW_FORM_sdata, 0);
322  // Operation
323  addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
324  } else {
325  DD->addArangeLabel(SymbolCU(this, Sym));
326  addOpAddress(*Loc, Sym);
327  }
328  }
329  // Global variables attached to symbols are memory locations.
330  // It would be better if this were unconditional, but malformed input that
331  // mixes non-fragments and fragments for the same variable is too expensive
332  // to detect in the verifier.
333  if (DwarfExpr->isUnknownLocation())
334  DwarfExpr->setMemoryLocationKind();
335  DwarfExpr->addExpression(Expr);
336  }
337  if (Asm->TM.getTargetTriple().isNVPTX() && DD->tuneForGDB()) {
338  // According to
339  // https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf
340  // cuda-gdb requires DW_AT_address_class for all variables to be able to
341  // correctly interpret address space of the variable address.
342  const unsigned NVPTX_ADDR_global_space = 5;
343  addUInt(*VariableDIE, dwarf::DW_AT_address_class, dwarf::DW_FORM_data1,
344  NVPTXAddressSpace.value_or(NVPTX_ADDR_global_space));
345  }
346  if (Loc)
347  addBlock(*VariableDIE, dwarf::DW_AT_location, DwarfExpr->finalize());
348 
349  if (DD->useAllLinkageNames())
350  addLinkageName(*VariableDIE, GV->getLinkageName());
351 
352  if (addToAccelTable) {
353  DD->addAccelName(*CUNode, GV->getName(), *VariableDIE);
354 
355  // If the linkage name is different than the name, go ahead and output
356  // that as well into the name table.
357  if (GV->getLinkageName() != "" && GV->getName() != GV->getLinkageName() &&
359  DD->addAccelName(*CUNode, GV->getLinkageName(), *VariableDIE);
360  }
361 }
362 
364  const DICommonBlock *CB, ArrayRef<GlobalExpr> GlobalExprs) {
365  // Check for pre-existence.
366  if (DIE *NDie = getDIE(CB))
367  return NDie;
368  DIE *ContextDIE = getOrCreateContextDIE(CB->getScope());
369  DIE &NDie = createAndAddDIE(dwarf::DW_TAG_common_block, *ContextDIE, CB);
370  StringRef Name = CB->getName().empty() ? "_BLNK_" : CB->getName();
371  addString(NDie, dwarf::DW_AT_name, Name);
372  addGlobalName(Name, NDie, CB->getScope());
373  if (CB->getFile())
374  addSourceLine(NDie, CB->getLineNo(), CB->getFile());
375  if (DIGlobalVariable *V = CB->getDecl())
376  getCU().addLocationAttribute(&NDie, V, GlobalExprs);
377  return &NDie;
378 }
379 
381  DD->insertSectionLabel(Range.Begin);
382 
383  auto *PrevCU = DD->getPrevCU();
384  bool SameAsPrevCU = this == PrevCU;
385  DD->setPrevCU(this);
386  // If we have no current ranges just add the range and return, otherwise,
387  // check the current section and CU against the previous section and CU we
388  // emitted into and the subprogram was contained within. If these are the
389  // same then extend our current range, otherwise add this as a new range.
390  if (CURanges.empty() || !SameAsPrevCU ||
391  (&CURanges.back().End->getSection() !=
392  &Range.End->getSection())) {
393  // Before a new range is added, always terminate the prior line table.
394  if (PrevCU)
395  DD->terminateLineTable(PrevCU);
396  CURanges.push_back(Range);
397  return;
398  }
399 
400  CURanges.back().End = Range.End;
401 }
402 
405  return;
406 
408  if (DD->useSectionsAsReferences()) {
409  LineTableStartSym = TLOF.getDwarfLineSection()->getBeginSymbol();
410  } else {
411  LineTableStartSym =
412  Asm->OutStreamer->getDwarfLineTableSymbol(getUniqueID());
413  }
414 
415  // DW_AT_stmt_list is a offset of line number information for this
416  // compile unit in debug_line section. For split dwarf this is
417  // left in the skeleton CU and so not included.
418  // The line table entries are not always emitted in assembly, so it
419  // is not okay to use line_table_start here.
420  addSectionLabel(getUnitDie(), dwarf::DW_AT_stmt_list, LineTableStartSym,
422 }
423 
426  addSectionLabel(D, dwarf::DW_AT_stmt_list, LineTableStartSym,
428 }
429 
431  const MCSymbol *End) {
432  assert(Begin && "Begin label should not be null!");
433  assert(End && "End label should not be null!");
434  assert(Begin->isDefined() && "Invalid starting label");
435  assert(End->isDefined() && "Invalid end label");
436 
437  addLabelAddress(D, dwarf::DW_AT_low_pc, Begin);
438  if (DD->getDwarfVersion() < 4)
439  addLabelAddress(D, dwarf::DW_AT_high_pc, End);
440  else
441  addLabelDelta(D, dwarf::DW_AT_high_pc, End, Begin);
442 }
443 
444 // Find DIE for the given subprogram and attach appropriate DW_AT_low_pc
445 // and DW_AT_high_pc attributes. If there are global variables in this
446 // scope then create and insert DIEs for these variables.
449  auto *ContextCU = static_cast<DwarfCompileUnit *>(SPDie->getUnit());
450  return ContextCU->updateSubprogramScopeDIEImpl(SP, SPDie);
451 }
452 
454  DIE *SPDie) {
456  // If basic block sections are on, ranges for each basic block section has
457  // to be emitted separately.
458  for (const auto &R : Asm->MBBSectionRanges)
459  BB_List.push_back({R.second.BeginLabel, R.second.EndLabel});
460 
461  attachRangesOrLowHighPC(*SPDie, BB_List);
462 
465  *DD->getCurrentFunction()))
466  addFlag(*SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr);
467 
468  // Only include DW_AT_frame_base in full debug info
472  TFI->getDwarfFrameBase(*Asm->MF);
473  switch (FrameBase.Kind) {
475  if (Register::isPhysicalRegister(FrameBase.Location.Reg)) {
476  MachineLocation Location(FrameBase.Location.Reg);
477  addAddress(*SPDie, dwarf::DW_AT_frame_base, Location);
478  }
479  break;
480  }
482  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
483  addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_call_frame_cfa);
484  addBlock(*SPDie, dwarf::DW_AT_frame_base, Loc);
485  break;
486  }
488  // FIXME: duplicated from Target/WebAssembly/WebAssembly.h
489  // don't want to depend on target specific headers in this code?
490  const unsigned TI_GLOBAL_RELOC = 3;
491  if (FrameBase.Location.WasmLoc.Kind == TI_GLOBAL_RELOC) {
492  // These need to be relocatable.
493  assert(FrameBase.Location.WasmLoc.Index == 0); // Only SP so far.
494  auto SPSym = cast<MCSymbolWasm>(
495  Asm->GetExternalSymbolSymbol("__stack_pointer"));
496  // FIXME: this repeats what WebAssemblyMCInstLower::
497  // GetExternalSymbolSymbol does, since if there's no code that
498  // refers to this symbol, we have to set it here.
499  SPSym->setType(wasm::WASM_SYMBOL_TYPE_GLOBAL);
500  SPSym->setGlobalType(wasm::WasmGlobalType{
501  uint8_t(Asm->getSubtargetInfo().getTargetTriple().getArch() ==
505  true});
506  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
507  addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_WASM_location);
508  addSInt(*Loc, dwarf::DW_FORM_sdata, TI_GLOBAL_RELOC);
509  if (!isDwoUnit()) {
510  addLabel(*Loc, dwarf::DW_FORM_data4, SPSym);
511  } else {
512  // FIXME: when writing dwo, we need to avoid relocations. Probably
513  // the "right" solution is to treat globals the way func and data
514  // symbols are (with entries in .debug_addr).
515  // For now, since we only ever use index 0, this should work as-is.
516  addUInt(*Loc, dwarf::DW_FORM_data4, FrameBase.Location.WasmLoc.Index);
517  }
518  addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);
519  addBlock(*SPDie, dwarf::DW_AT_frame_base, Loc);
520  } else {
521  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
522  DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
523  DIExpressionCursor Cursor({});
524  DwarfExpr.addWasmLocation(FrameBase.Location.WasmLoc.Kind,
525  FrameBase.Location.WasmLoc.Index);
526  DwarfExpr.addExpression(std::move(Cursor));
527  addBlock(*SPDie, dwarf::DW_AT_frame_base, DwarfExpr.finalize());
528  }
529  break;
530  }
531  }
532  }
533 
534  // Add name to the name table, we do this here because we're guaranteed
535  // to have concrete versions of our DW_TAG_subprogram nodes.
536  DD->addSubprogramNames(*CUNode, SP, *SPDie);
537 
538  return *SPDie;
539 }
540 
541 // Construct a DIE for this scope.
543  DIE &ParentScopeDIE) {
544  if (!Scope || !Scope->getScopeNode())
545  return;
546 
547  auto *DS = Scope->getScopeNode();
548 
549  assert((Scope->getInlinedAt() || !isa<DISubprogram>(DS)) &&
550  "Only handle inlined subprograms here, use "
551  "constructSubprogramScopeDIE for non-inlined "
552  "subprograms");
553 
554  // Emit inlined subprograms.
555  if (Scope->getParent() && isa<DISubprogram>(DS)) {
556  DIE *ScopeDIE = constructInlinedScopeDIE(Scope, ParentScopeDIE);
557  assert(ScopeDIE && "Scope DIE should not be null.");
558  createAndAddScopeChildren(Scope, *ScopeDIE);
559  return;
560  }
561 
562  // Early exit when we know the scope DIE is going to be null.
563  if (DD->isLexicalScopeDIENull(Scope))
564  return;
565 
566  // Emit lexical blocks.
567  DIE *ScopeDIE = constructLexicalScopeDIE(Scope);
568  assert(ScopeDIE && "Scope DIE should not be null.");
569 
570  ParentScopeDIE.addChild(ScopeDIE);
571  createAndAddScopeChildren(Scope, *ScopeDIE);
572 }
573 
576 
577  HasRangeLists = true;
578 
579  // Add the range list to the set of ranges to be emitted.
580  auto IndexAndList =
581  (DD->getDwarfVersion() < 5 && Skeleton ? Skeleton->DU : DU)
582  ->addRange(*(Skeleton ? Skeleton : this), std::move(Range));
583 
584  uint32_t Index = IndexAndList.first;
585  auto &List = *IndexAndList.second;
586 
587  // Under fission, ranges are specified by constant offsets relative to the
588  // CU's DW_AT_GNU_ranges_base.
589  // FIXME: For DWARF v5, do not generate the DW_AT_ranges attribute under
590  // fission until we support the forms using the .debug_addr section
591  // (DW_RLE_startx_endx etc.).
592  if (DD->getDwarfVersion() >= 5)
593  addUInt(ScopeDIE, dwarf::DW_AT_ranges, dwarf::DW_FORM_rnglistx, Index);
594  else {
596  const MCSymbol *RangeSectionSym =
598  if (isDwoUnit())
599  addSectionDelta(ScopeDIE, dwarf::DW_AT_ranges, List.Label,
600  RangeSectionSym);
601  else
602  addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges, List.Label,
603  RangeSectionSym);
604  }
605 }
606 
608  DIE &Die, SmallVector<RangeSpan, 2> Ranges) {
609  assert(!Ranges.empty());
610  if (!DD->useRangesSection() ||
611  (Ranges.size() == 1 &&
612  (!DD->alwaysUseRanges() ||
613  DD->getSectionLabel(&Ranges.front().Begin->getSection()) ==
614  Ranges.front().Begin))) {
615  const RangeSpan &Front = Ranges.front();
616  const RangeSpan &Back = Ranges.back();
617  attachLowHighPC(Die, Front.Begin, Back.End);
618  } else
619  addScopeRangeList(Die, std::move(Ranges));
620 }
621 
623  DIE &Die, const SmallVectorImpl<InsnRange> &Ranges) {
625  List.reserve(Ranges.size());
626  for (const InsnRange &R : Ranges) {
627  auto *BeginLabel = DD->getLabelBeforeInsn(R.first);
628  auto *EndLabel = DD->getLabelAfterInsn(R.second);
629 
630  const auto *BeginMBB = R.first->getParent();
631  const auto *EndMBB = R.second->getParent();
632 
633  const auto *MBB = BeginMBB;
634  // Basic block sections allows basic block subsets to be placed in unique
635  // sections. For each section, the begin and end label must be added to the
636  // list. If there is more than one range, debug ranges must be used.
637  // Otherwise, low/high PC can be used.
638  // FIXME: Debug Info Emission depends on block order and this assumes that
639  // the order of blocks will be frozen beyond this point.
640  do {
641  if (MBB->sameSection(EndMBB) || MBB->isEndSection()) {
642  auto MBBSectionRange = Asm->MBBSectionRanges[MBB->getSectionIDNum()];
643  List.push_back(
644  {MBB->sameSection(BeginMBB) ? BeginLabel
645  : MBBSectionRange.BeginLabel,
646  MBB->sameSection(EndMBB) ? EndLabel : MBBSectionRange.EndLabel});
647  }
648  if (MBB->sameSection(EndMBB))
649  break;
650  MBB = MBB->getNextNode();
651  } while (true);
652  }
654 }
655 
657  DIE &ParentScopeDIE) {
658  assert(Scope->getScopeNode());
659  auto *DS = Scope->getScopeNode();
660  auto *InlinedSP = getDISubprogram(DS);
661  // Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram
662  // was inlined from another compile unit.
663  DIE *OriginDIE = getAbstractSPDies()[InlinedSP];
664  assert(OriginDIE && "Unable to find original DIE for an inlined subprogram.");
665 
666  auto ScopeDIE = DIE::get(DIEValueAllocator, dwarf::DW_TAG_inlined_subroutine);
667  ParentScopeDIE.addChild(ScopeDIE);
668  addDIEEntry(*ScopeDIE, dwarf::DW_AT_abstract_origin, *OriginDIE);
669 
670  attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges());
671 
672  // Add the call site information to the DIE.
673  const DILocation *IA = Scope->getInlinedAt();
674  addUInt(*ScopeDIE, dwarf::DW_AT_call_file, None,
675  getOrCreateSourceID(IA->getFile()));
676  addUInt(*ScopeDIE, dwarf::DW_AT_call_line, None, IA->getLine());
677  if (IA->getColumn())
678  addUInt(*ScopeDIE, dwarf::DW_AT_call_column, None, IA->getColumn());
679  if (IA->getDiscriminator() && DD->getDwarfVersion() >= 4)
680  addUInt(*ScopeDIE, dwarf::DW_AT_GNU_discriminator, None,
681  IA->getDiscriminator());
682 
683  // Add name to the name table, we do this here because we're guaranteed
684  // to have concrete versions of our DW_TAG_inlined_subprogram nodes.
685  DD->addSubprogramNames(*CUNode, InlinedSP, *ScopeDIE);
686 
687  return ScopeDIE;
688 }
689 
690 // Construct new DW_TAG_lexical_block for this scope and attach
691 // DW_AT_low_pc/DW_AT_high_pc labels.
693  if (DD->isLexicalScopeDIENull(Scope))
694  return nullptr;
695 
696  auto ScopeDIE = DIE::get(DIEValueAllocator, dwarf::DW_TAG_lexical_block);
697  if (Scope->isAbstractScope())
698  return ScopeDIE;
699 
700  attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges());
701 
702  return ScopeDIE;
703 }
704 
705 /// constructVariableDIE - Construct a DIE for the given DbgVariable.
707  auto D = constructVariableDIEImpl(DV, Abstract);
708  DV.setDIE(*D);
709  return D;
710 }
711 
713  const LexicalScope &Scope) {
714  auto LabelDie = DIE::get(DIEValueAllocator, DL.getTag());
715  insertDIE(DL.getLabel(), LabelDie);
716  DL.setDIE(*LabelDie);
717 
718  if (Scope.isAbstractScope())
719  applyLabelAttributes(DL, *LabelDie);
720 
721  return LabelDie;
722 }
723 
724 DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,
725  bool Abstract) {
726  // Define variable debug information entry.
727  auto VariableDie = DIE::get(DIEValueAllocator, DV.getTag());
728  insertDIE(DV.getVariable(), VariableDie);
729 
730  if (Abstract) {
731  applyVariableAttributes(DV, *VariableDie);
732  return VariableDie;
733  }
734 
735  // Add variable address.
736 
737  unsigned Index = DV.getDebugLocListIndex();
738  if (Index != ~0U) {
739  addLocationList(*VariableDie, dwarf::DW_AT_location, Index);
740  auto TagOffset = DV.getDebugLocListTagOffset();
741  if (TagOffset)
742  addUInt(*VariableDie, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
743  *TagOffset);
744  return VariableDie;
745  }
746 
747  // Check if variable has a single location description.
748  if (auto *DVal = DV.getValueLoc()) {
749  if (!DVal->isVariadic()) {
750  const DbgValueLocEntry *Entry = DVal->getLocEntries().begin();
751  if (Entry->isLocation()) {
752  addVariableAddress(DV, *VariableDie, Entry->getLoc());
753  } else if (Entry->isInt()) {
754  auto *Expr = DV.getSingleExpression();
755  if (Expr && Expr->getNumElements()) {
756  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
757  DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
758  // If there is an expression, emit raw unsigned bytes.
759  DwarfExpr.addFragmentOffset(Expr);
760  DwarfExpr.addUnsignedConstant(Entry->getInt());
761  DwarfExpr.addExpression(Expr);
762  addBlock(*VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
763  if (DwarfExpr.TagOffset)
764  addUInt(*VariableDie, dwarf::DW_AT_LLVM_tag_offset,
765  dwarf::DW_FORM_data1, *DwarfExpr.TagOffset);
766  } else
767  addConstantValue(*VariableDie, Entry->getInt(), DV.getType());
768  } else if (Entry->isConstantFP()) {
769  addConstantFPValue(*VariableDie, Entry->getConstantFP());
770  } else if (Entry->isConstantInt()) {
771  addConstantValue(*VariableDie, Entry->getConstantInt(), DV.getType());
772  } else if (Entry->isTargetIndexLocation()) {
773  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
774  DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
775  const DIBasicType *BT = dyn_cast<DIBasicType>(
776  static_cast<const Metadata *>(DV.getVariable()->getType()));
777  DwarfDebug::emitDebugLocValue(*Asm, BT, *DVal, DwarfExpr);
778  addBlock(*VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
779  }
780  return VariableDie;
781  }
782  // If any of the location entries are registers with the value 0, then the
783  // location is undefined.
784  if (any_of(DVal->getLocEntries(), [](const DbgValueLocEntry &Entry) {
785  return Entry.isLocation() && !Entry.getLoc().getReg();
786  }))
787  return VariableDie;
788  const DIExpression *Expr = DV.getSingleExpression();
789  assert(Expr && "Variadic Debug Value must have an Expression.");
790  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
791  DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
792  DwarfExpr.addFragmentOffset(Expr);
793  DIExpressionCursor Cursor(Expr);
795 
796  auto AddEntry = [&](const DbgValueLocEntry &Entry,
797  DIExpressionCursor &Cursor) {
798  if (Entry.isLocation()) {
799  if (!DwarfExpr.addMachineRegExpression(TRI, Cursor,
800  Entry.getLoc().getReg()))
801  return false;
802  } else if (Entry.isInt()) {
803  // If there is an expression, emit raw unsigned bytes.
804  DwarfExpr.addUnsignedConstant(Entry.getInt());
805  } else if (Entry.isConstantFP()) {
806  // DwarfExpression does not support arguments wider than 64 bits
807  // (see PR52584).
808  // TODO: Consider chunking expressions containing overly wide
809  // arguments into separate pointer-sized fragment expressions.
810  APInt RawBytes = Entry.getConstantFP()->getValueAPF().bitcastToAPInt();
811  if (RawBytes.getBitWidth() > 64)
812  return false;
813  DwarfExpr.addUnsignedConstant(RawBytes.getZExtValue());
814  } else if (Entry.isConstantInt()) {
815  APInt RawBytes = Entry.getConstantInt()->getValue();
816  if (RawBytes.getBitWidth() > 64)
817  return false;
818  DwarfExpr.addUnsignedConstant(RawBytes.getZExtValue());
819  } else if (Entry.isTargetIndexLocation()) {
820  TargetIndexLocation Loc = Entry.getTargetIndexLocation();
821  // TODO TargetIndexLocation is a target-independent. Currently only the
822  // WebAssembly-specific encoding is supported.
824  DwarfExpr.addWasmLocation(Loc.Index, static_cast<uint64_t>(Loc.Offset));
825  } else {
826  llvm_unreachable("Unsupported Entry type.");
827  }
828  return true;
829  };
830 
831  if (!DwarfExpr.addExpression(
832  std::move(Cursor),
833  [&](unsigned Idx, DIExpressionCursor &Cursor) -> bool {
834  return AddEntry(DVal->getLocEntries()[Idx], Cursor);
835  }))
836  return VariableDie;
837 
838  // Now attach the location information to the DIE.
839  addBlock(*VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
840  if (DwarfExpr.TagOffset)
841  addUInt(*VariableDie, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
842  *DwarfExpr.TagOffset);
843 
844  return VariableDie;
845  }
846 
847  // .. else use frame index.
848  if (!DV.hasFrameIndexExprs())
849  return VariableDie;
850 
851  std::optional<unsigned> NVPTXAddressSpace;
852  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
853  DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
854  for (const auto &Fragment : DV.getFrameIndexExprs()) {
855  Register FrameReg;
856  const DIExpression *Expr = Fragment.Expr;
859  TFI->getFrameIndexReference(*Asm->MF, Fragment.FI, FrameReg);
860  DwarfExpr.addFragmentOffset(Expr);
861 
862  auto *TRI = Asm->MF->getSubtarget().getRegisterInfo();
864  TRI->getOffsetOpcodes(Offset, Ops);
865 
866  // According to
867  // https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf
868  // cuda-gdb requires DW_AT_address_class for all variables to be able to
869  // correctly interpret address space of the variable address.
870  // Decode DW_OP_constu <DWARF Address Space> DW_OP_swap DW_OP_xderef
871  // sequence for the NVPTX + gdb target.
872  unsigned LocalNVPTXAddressSpace;
873  if (Asm->TM.getTargetTriple().isNVPTX() && DD->tuneForGDB()) {
874  const DIExpression *NewExpr =
875  DIExpression::extractAddressClass(Expr, LocalNVPTXAddressSpace);
876  if (NewExpr != Expr) {
877  Expr = NewExpr;
878  NVPTXAddressSpace = LocalNVPTXAddressSpace;
879  }
880  }
881  if (Expr)
882  Ops.append(Expr->elements_begin(), Expr->elements_end());
883  DIExpressionCursor Cursor(Ops);
884  DwarfExpr.setMemoryLocationKind();
885  if (const MCSymbol *FrameSymbol = Asm->getFunctionFrameSymbol())
886  addOpAddress(*Loc, FrameSymbol);
887  else
888  DwarfExpr.addMachineRegExpression(
889  *Asm->MF->getSubtarget().getRegisterInfo(), Cursor, FrameReg);
890  DwarfExpr.addExpression(std::move(Cursor));
891  }
892  if (Asm->TM.getTargetTriple().isNVPTX() && DD->tuneForGDB()) {
893  // According to
894  // https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf
895  // cuda-gdb requires DW_AT_address_class for all variables to be able to
896  // correctly interpret address space of the variable address.
897  const unsigned NVPTX_ADDR_local_space = 6;
898  addUInt(*VariableDie, dwarf::DW_AT_address_class, dwarf::DW_FORM_data1,
899  NVPTXAddressSpace.value_or(NVPTX_ADDR_local_space));
900  }
901  addBlock(*VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
902  if (DwarfExpr.TagOffset)
903  addUInt(*VariableDie, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
904  *DwarfExpr.TagOffset);
905 
906  return VariableDie;
907 }
908 
910  const LexicalScope &Scope,
911  DIE *&ObjectPointer) {
912  auto Var = constructVariableDIE(DV, Scope.isAbstractScope());
913  if (DV.isObjectPointer())
914  ObjectPointer = Var;
915  return Var;
916 }
917 
918 /// Return all DIVariables that appear in count: expressions.
921  auto *Array = dyn_cast<DICompositeType>(Var->getType());
922  if (!Array || Array->getTag() != dwarf::DW_TAG_array_type)
923  return Result;
924  if (auto *DLVar = Array->getDataLocation())
925  Result.push_back(DLVar);
926  if (auto *AsVar = Array->getAssociated())
927  Result.push_back(AsVar);
928  if (auto *AlVar = Array->getAllocated())
929  Result.push_back(AlVar);
930  for (auto *El : Array->getElements()) {
931  if (auto *Subrange = dyn_cast<DISubrange>(El)) {
932  if (auto Count = Subrange->getCount())
933  if (auto *Dependency = Count.dyn_cast<DIVariable *>())
934  Result.push_back(Dependency);
935  if (auto LB = Subrange->getLowerBound())
936  if (auto *Dependency = LB.dyn_cast<DIVariable *>())
937  Result.push_back(Dependency);
938  if (auto UB = Subrange->getUpperBound())
939  if (auto *Dependency = UB.dyn_cast<DIVariable *>())
940  Result.push_back(Dependency);
941  if (auto ST = Subrange->getStride())
942  if (auto *Dependency = ST.dyn_cast<DIVariable *>())
943  Result.push_back(Dependency);
944  } else if (auto *GenericSubrange = dyn_cast<DIGenericSubrange>(El)) {
945  if (auto Count = GenericSubrange->getCount())
946  if (auto *Dependency = Count.dyn_cast<DIVariable *>())
947  Result.push_back(Dependency);
948  if (auto LB = GenericSubrange->getLowerBound())
949  if (auto *Dependency = LB.dyn_cast<DIVariable *>())
950  Result.push_back(Dependency);
951  if (auto UB = GenericSubrange->getUpperBound())
952  if (auto *Dependency = UB.dyn_cast<DIVariable *>())
953  Result.push_back(Dependency);
954  if (auto ST = GenericSubrange->getStride())
955  if (auto *Dependency = ST.dyn_cast<DIVariable *>())
956  Result.push_back(Dependency);
957  }
958  }
959  return Result;
960 }
961 
962 /// Sort local variables so that variables appearing inside of helper
963 /// expressions come first.
968  // Map back from a DIVariable to its containing DbgVariable.
970  // Set of DbgVariables in Result.
972  // For cycle detection.
974 
975  // Initialize the worklist and the DIVariable lookup table.
976  for (auto *Var : reverse(Input)) {
977  DbgVar.insert({Var->getVariable(), Var});
978  WorkList.push_back({Var, 0});
979  }
980 
981  // Perform a stable topological sort by doing a DFS.
982  while (!WorkList.empty()) {
983  auto Item = WorkList.back();
984  DbgVariable *Var = Item.getPointer();
985  bool visitedAllDependencies = Item.getInt();
986  WorkList.pop_back();
987 
988  assert(Var);
989 
990  // Already handled.
991  if (Visited.count(Var))
992  continue;
993 
994  // Add to Result if all dependencies are visited.
995  if (visitedAllDependencies) {
996  Visited.insert(Var);
997  Result.push_back(Var);
998  continue;
999  }
1000 
1001  // Detect cycles.
1002  auto Res = Visiting.insert(Var);
1003  if (!Res.second) {
1004  assert(false && "dependency cycle in local variables");
1005  return Result;
1006  }
1007 
1008  // Push dependencies and this node onto the worklist, so that this node is
1009  // visited again after all of its dependencies are handled.
1010  WorkList.push_back({Var, 1});
1011  for (const auto *Dependency : dependencies(Var)) {
1012  // Don't add dependency if it is in a different lexical scope or a global.
1013  if (const auto *Dep = dyn_cast<const DILocalVariable>(Dependency))
1014  if (DbgVariable *Var = DbgVar.lookup(Dep))
1015  WorkList.push_back({Var, 0});
1016  }
1017  }
1018  return Result;
1019 }
1020 
1022  LexicalScope *Scope) {
1023  DIE &ScopeDIE = updateSubprogramScopeDIE(Sub);
1024  auto *ContextCU = static_cast<DwarfCompileUnit *>(ScopeDIE.getUnit());
1025 
1026  if (Scope) {
1027  assert(!Scope->getInlinedAt());
1028  assert(!Scope->isAbstractScope());
1029  // Collect lexical scope children first.
1030  // ObjectPointer might be a local (non-argument) local variable if it's a
1031  // block's synthetic this pointer.
1032  if (DIE *ObjectPointer =
1033  ContextCU->createAndAddScopeChildren(Scope, ScopeDIE))
1034  ContextCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer,
1035  *ObjectPointer);
1036  }
1037 
1038  // If this is a variadic function, add an unspecified parameter.
1039  DITypeRefArray FnArgs = Sub->getType()->getTypeArray();
1040 
1041  // If we have a single element of null, it is a function that returns void.
1042  // If we have more than one elements and the last one is null, it is a
1043  // variadic function.
1044  if (FnArgs.size() > 1 && !FnArgs[FnArgs.size() - 1] &&
1046  ScopeDIE.addChild(
1047  DIE::get(DIEValueAllocator, dwarf::DW_TAG_unspecified_parameters));
1048 
1049  return ScopeDIE;
1050 }
1051 
1053  DIE &ScopeDIE) {
1054  DIE *ObjectPointer = nullptr;
1055 
1056  // Emit function arguments (order is significant).
1057  auto Vars = DU->getScopeVariables().lookup(Scope);
1058  for (auto &DV : Vars.Args)
1059  ScopeDIE.addChild(constructVariableDIE(*DV.second, *Scope, ObjectPointer));
1060 
1061  // Emit local variables.
1062  auto Locals = sortLocalVars(Vars.Locals);
1063  for (DbgVariable *DV : Locals)
1064  ScopeDIE.addChild(constructVariableDIE(*DV, *Scope, ObjectPointer));
1065 
1066  // Emit imported entities (skipped in gmlt-like data).
1067  if (!includeMinimalInlineScopes()) {
1068  for (const auto *IE : ImportedEntities[Scope->getScopeNode()])
1069  ScopeDIE.addChild(constructImportedEntityDIE(cast<DIImportedEntity>(IE)));
1070  }
1071 
1072  // Emit labels.
1073  for (DbgLabel *DL : DU->getScopeLabels().lookup(Scope))
1074  ScopeDIE.addChild(constructLabelDIE(*DL, *Scope));
1075 
1076  // Emit inner lexical scopes.
1077  auto needToEmitLexicalScope = [this](LexicalScope *LS) {
1078  if (isa<DISubprogram>(LS->getScopeNode()))
1079  return true;
1080  auto Vars = DU->getScopeVariables().lookup(LS);
1081  if (!Vars.Args.empty() || !Vars.Locals.empty())
1082  return true;
1083  if (!includeMinimalInlineScopes() &&
1084  !ImportedEntities[LS->getScopeNode()].empty())
1085  return true;
1086  return false;
1087  };
1088  for (LexicalScope *LS : Scope->getChildren()) {
1089  // If the lexical block doesn't have non-scope children, skip
1090  // its emission and put its children directly to the parent scope.
1091  if (needToEmitLexicalScope(LS))
1092  constructScopeDIE(LS, ScopeDIE);
1093  else
1094  createAndAddScopeChildren(LS, ScopeDIE);
1095  }
1096 
1097  return ObjectPointer;
1098 }
1099 
1101  LexicalScope *Scope) {
1102  DIE *&AbsDef = getAbstractSPDies()[Scope->getScopeNode()];
1103  if (AbsDef)
1104  return;
1105 
1106  auto *SP = cast<DISubprogram>(Scope->getScopeNode());
1107 
1108  DIE *ContextDIE;
1109  DwarfCompileUnit *ContextCU = this;
1110 
1112  ContextDIE = &getUnitDie();
1113  // Some of this is duplicated from DwarfUnit::getOrCreateSubprogramDIE, with
1114  // the important distinction that the debug node is not associated with the
1115  // DIE (since the debug node will be associated with the concrete DIE, if
1116  // any). It could be refactored to some common utility function.
1117  else if (auto *SPDecl = SP->getDeclaration()) {
1118  ContextDIE = &getUnitDie();
1119  getOrCreateSubprogramDIE(SPDecl);
1120  } else {
1121  ContextDIE = getOrCreateContextDIE(SP->getScope());
1122  // The scope may be shared with a subprogram that has already been
1123  // constructed in another CU, in which case we need to construct this
1124  // subprogram in the same CU.
1125  ContextCU = DD->lookupCU(ContextDIE->getUnitDie());
1126  }
1127 
1128  // Passing null as the associated node because the abstract definition
1129  // shouldn't be found by lookup.
1130  AbsDef = &ContextCU->createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, nullptr);
1131  ContextCU->applySubprogramAttributesToDefinition(SP, *AbsDef);
1132  ContextCU->addSInt(*AbsDef, dwarf::DW_AT_inline,
1134  : dwarf::DW_FORM_implicit_const,
1136  if (DIE *ObjectPointer = ContextCU->createAndAddScopeChildren(Scope, *AbsDef))
1137  ContextCU->addDIEEntry(*AbsDef, dwarf::DW_AT_object_pointer, *ObjectPointer);
1138 }
1139 
1141  return DD->getDwarfVersion() == 4 && !DD->tuneForLLDB();
1142 }
1143 
1146  return Tag;
1147  switch (Tag) {
1148  case dwarf::DW_TAG_call_site:
1149  return dwarf::DW_TAG_GNU_call_site;
1150  case dwarf::DW_TAG_call_site_parameter:
1151  return dwarf::DW_TAG_GNU_call_site_parameter;
1152  default:
1153  llvm_unreachable("DWARF5 tag with no GNU analog");
1154  }
1155 }
1156 
1160  return Attr;
1161  switch (Attr) {
1162  case dwarf::DW_AT_call_all_calls:
1163  return dwarf::DW_AT_GNU_all_call_sites;
1164  case dwarf::DW_AT_call_target:
1165  return dwarf::DW_AT_GNU_call_site_target;
1166  case dwarf::DW_AT_call_origin:
1167  return dwarf::DW_AT_abstract_origin;
1168  case dwarf::DW_AT_call_return_pc:
1169  return dwarf::DW_AT_low_pc;
1170  case dwarf::DW_AT_call_value:
1171  return dwarf::DW_AT_GNU_call_site_value;
1172  case dwarf::DW_AT_call_tail_call:
1173  return dwarf::DW_AT_GNU_tail_call;
1174  default:
1175  llvm_unreachable("DWARF5 attribute with no GNU analog");
1176  }
1177 }
1178 
1182  return Loc;
1183  switch (Loc) {
1184  case dwarf::DW_OP_entry_value:
1185  return dwarf::DW_OP_GNU_entry_value;
1186  default:
1187  llvm_unreachable("DWARF5 location atom with no GNU analog");
1188  }
1189 }
1190 
1192  const DISubprogram *CalleeSP,
1193  bool IsTail,
1194  const MCSymbol *PCAddr,
1195  const MCSymbol *CallAddr,
1196  unsigned CallReg) {
1197  // Insert a call site entry DIE within ScopeDIE.
1198  DIE &CallSiteDIE = createAndAddDIE(getDwarf5OrGNUTag(dwarf::DW_TAG_call_site),
1199  ScopeDIE, nullptr);
1200 
1201  if (CallReg) {
1202  // Indirect call.
1203  addAddress(CallSiteDIE, getDwarf5OrGNUAttr(dwarf::DW_AT_call_target),
1204  MachineLocation(CallReg));
1205  } else {
1206  DIE *CalleeDIE = getOrCreateSubprogramDIE(CalleeSP);
1207  assert(CalleeDIE && "Could not create DIE for call site entry origin");
1208  addDIEEntry(CallSiteDIE, getDwarf5OrGNUAttr(dwarf::DW_AT_call_origin),
1209  *CalleeDIE);
1210  }
1211 
1212  if (IsTail) {
1213  // Attach DW_AT_call_tail_call to tail calls for standards compliance.
1214  addFlag(CallSiteDIE, getDwarf5OrGNUAttr(dwarf::DW_AT_call_tail_call));
1215 
1216  // Attach the address of the branch instruction to allow the debugger to
1217  // show where the tail call occurred. This attribute has no GNU analog.
1218  //
1219  // GDB works backwards from non-standard usage of DW_AT_low_pc (in DWARF4
1220  // mode -- equivalently, in DWARF5 mode, DW_AT_call_return_pc) at tail-call
1221  // site entries to figure out the PC of tail-calling branch instructions.
1222  // This means it doesn't need the compiler to emit DW_AT_call_pc, so we
1223  // don't emit it here.
1224  //
1225  // There's no need to tie non-GDB debuggers to this non-standardness, as it
1226  // adds unnecessary complexity to the debugger. For non-GDB debuggers, emit
1227  // the standard DW_AT_call_pc info.
1229  addLabelAddress(CallSiteDIE, dwarf::DW_AT_call_pc, CallAddr);
1230  }
1231 
1232  // Attach the return PC to allow the debugger to disambiguate call paths
1233  // from one function to another.
1234  //
1235  // The return PC is only really needed when the call /isn't/ a tail call, but
1236  // GDB expects it in DWARF4 mode, even for tail calls (see the comment above
1237  // the DW_AT_call_pc emission logic for an explanation).
1238  if (!IsTail || useGNUAnalogForDwarf5Feature()) {
1239  assert(PCAddr && "Missing return PC information for a call");
1240  addLabelAddress(CallSiteDIE,
1241  getDwarf5OrGNUAttr(dwarf::DW_AT_call_return_pc), PCAddr);
1242  }
1243 
1244  return CallSiteDIE;
1245 }
1246 
1248  DIE &CallSiteDIE, SmallVector<DbgCallSiteParam, 4> &Params) {
1249  for (const auto &Param : Params) {
1250  unsigned Register = Param.getRegister();
1251  auto CallSiteDieParam =
1253  getDwarf5OrGNUTag(dwarf::DW_TAG_call_site_parameter));
1254  insertDIE(CallSiteDieParam);
1255  addAddress(*CallSiteDieParam, dwarf::DW_AT_location,
1257 
1258  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
1259  DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
1260  DwarfExpr.setCallSiteParamValueFlag();
1261 
1262  DwarfDebug::emitDebugLocValue(*Asm, nullptr, Param.getValue(), DwarfExpr);
1263 
1264  addBlock(*CallSiteDieParam, getDwarf5OrGNUAttr(dwarf::DW_AT_call_value),
1265  DwarfExpr.finalize());
1266 
1267  CallSiteDIE.addChild(CallSiteDieParam);
1268  }
1269 }
1270 
1272  const DIImportedEntity *Module) {
1273  DIE *IMDie = DIE::get(DIEValueAllocator, (dwarf::Tag)Module->getTag());
1274  insertDIE(Module, IMDie);
1275  DIE *EntityDie;
1276  auto *Entity = Module->getEntity();
1277  if (auto *NS = dyn_cast<DINamespace>(Entity))
1278  EntityDie = getOrCreateNameSpace(NS);
1279  else if (auto *M = dyn_cast<DIModule>(Entity))
1280  EntityDie = getOrCreateModule(M);
1281  else if (auto *SP = dyn_cast<DISubprogram>(Entity))
1282  EntityDie = getOrCreateSubprogramDIE(SP);
1283  else if (auto *T = dyn_cast<DIType>(Entity))
1284  EntityDie = getOrCreateTypeDIE(T);
1285  else if (auto *GV = dyn_cast<DIGlobalVariable>(Entity))
1286  EntityDie = getOrCreateGlobalVariableDIE(GV, {});
1287  else
1288  EntityDie = getDIE(Entity);
1289  assert(EntityDie);
1290  addSourceLine(*IMDie, Module->getLine(), Module->getFile());
1291  addDIEEntry(*IMDie, dwarf::DW_AT_import, *EntityDie);
1292  StringRef Name = Module->getName();
1293  if (!Name.empty())
1294  addString(*IMDie, dwarf::DW_AT_name, Name);
1295 
1296  // This is for imported module with renamed entities (such as variables and
1297  // subprograms).
1298  DINodeArray Elements = Module->getElements();
1299  for (const auto *Element : Elements) {
1300  if (!Element)
1301  continue;
1302  IMDie->addChild(
1303  constructImportedEntityDIE(cast<DIImportedEntity>(Element)));
1304  }
1305 
1306  return IMDie;
1307 }
1308 
1310  DIE *D = getDIE(SP);
1311  if (DIE *AbsSPDIE = getAbstractSPDies().lookup(SP)) {
1312  if (D)
1313  // If this subprogram has an abstract definition, reference that
1314  addDIEEntry(*D, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
1315  } else {
1317  if (D)
1318  // And attach the attributes
1320  }
1321 }
1322 
1324  DbgEntity *AbsEntity = getExistingAbstractEntity(Entity->getEntity());
1325 
1326  auto *Die = Entity->getDIE();
1327  /// Label may be used to generate DW_AT_low_pc, so put it outside
1328  /// if/else block.
1329  const DbgLabel *Label = nullptr;
1330  if (AbsEntity && AbsEntity->getDIE()) {
1331  addDIEEntry(*Die, dwarf::DW_AT_abstract_origin, *AbsEntity->getDIE());
1332  Label = dyn_cast<const DbgLabel>(Entity);
1333  } else {
1334  if (const DbgVariable *Var = dyn_cast<const DbgVariable>(Entity))
1335  applyVariableAttributes(*Var, *Die);
1336  else if ((Label = dyn_cast<const DbgLabel>(Entity)))
1337  applyLabelAttributes(*Label, *Die);
1338  else
1339  llvm_unreachable("DbgEntity must be DbgVariable or DbgLabel.");
1340  }
1341 
1342  if (Label)
1343  if (const auto *Sym = Label->getSymbol())
1344  addLabelAddress(*Die, dwarf::DW_AT_low_pc, Sym);
1345 }
1346 
1348  auto &AbstractEntities = getAbstractEntities();
1349  auto I = AbstractEntities.find(Node);
1350  if (I != AbstractEntities.end())
1351  return I->second.get();
1352  return nullptr;
1353 }
1354 
1356  LexicalScope *Scope) {
1357  assert(Scope && Scope->isAbstractScope());
1358  auto &Entity = getAbstractEntities()[Node];
1359  if (isa<const DILocalVariable>(Node)) {
1360  Entity = std::make_unique<DbgVariable>(
1361  cast<const DILocalVariable>(Node), nullptr /* IA */);;
1362  DU->addScopeVariable(Scope, cast<DbgVariable>(Entity.get()));
1363  } else if (isa<const DILabel>(Node)) {
1364  Entity = std::make_unique<DbgLabel>(
1365  cast<const DILabel>(Node), nullptr /* IA */);
1366  DU->addScopeLabel(Scope, cast<DbgLabel>(Entity.get()));
1367  }
1368 }
1369 
1370 void DwarfCompileUnit::emitHeader(bool UseOffsets) {
1371  // Don't bother labeling the .dwo unit, as its offset isn't used.
1372  if (!Skeleton && !DD->useSectionsAsReferences()) {
1373  LabelBegin = Asm->createTempSymbol("cu_begin");
1374  Asm->OutStreamer->emitLabel(LabelBegin);
1375  }
1376 
1377  dwarf::UnitType UT = Skeleton ? dwarf::DW_UT_split_compile
1378  : DD->useSplitDwarf() ? dwarf::DW_UT_skeleton
1379  : dwarf::DW_UT_compile;
1380  DwarfUnit::emitCommonHeader(UseOffsets, UT);
1381  if (DD->getDwarfVersion() >= 5 && UT != dwarf::DW_UT_compile)
1382  Asm->emitInt64(getDWOId());
1383 }
1384 
1386  switch (CUNode->getNameTableKind()) {
1388  return false;
1389  // Opting in to GNU Pubnames/types overrides the default to ensure these are
1390  // generated for things like Gold's gdb_index generation.
1392  return true;
1394  return DD->tuneForGDB() && !includeMinimalInlineScopes() &&
1397  DD->getDwarfVersion() < 5;
1398  }
1399  llvm_unreachable("Unhandled DICompileUnit::DebugNameTableKind enum");
1400 }
1401 
1402 /// addGlobalName - Add a new global name to the compile unit.
1404  const DIScope *Context) {
1405  if (!hasDwarfPubSections())
1406  return;
1407  std::string FullName = getParentContextString(Context) + Name.str();
1408  GlobalNames[FullName] = &Die;
1409 }
1410 
1412  const DIScope *Context) {
1413  if (!hasDwarfPubSections())
1414  return;
1415  std::string FullName = getParentContextString(Context) + Name.str();
1416  // Insert, allowing the entry to remain as-is if it's already present
1417  // This way the CU-level type DIE is preferred over the "can't describe this
1418  // type as a unit offset because it's not really in the CU at all, it's only
1419  // in a type unit"
1420  GlobalNames.insert(std::make_pair(std::move(FullName), &getUnitDie()));
1421 }
1422 
1423 /// Add a new global type to the unit.
1424 void DwarfCompileUnit::addGlobalType(const DIType *Ty, const DIE &Die,
1425  const DIScope *Context) {
1426  if (!hasDwarfPubSections())
1427  return;
1428  std::string FullName = getParentContextString(Context) + Ty->getName().str();
1429  GlobalTypes[FullName] = &Die;
1430 }
1431 
1433  const DIScope *Context) {
1434  if (!hasDwarfPubSections())
1435  return;
1436  std::string FullName = getParentContextString(Context) + Ty->getName().str();
1437  // Insert, allowing the entry to remain as-is if it's already present
1438  // This way the CU-level type DIE is preferred over the "can't describe this
1439  // type as a unit offset because it's not really in the CU at all, it's only
1440  // in a type unit"
1441  GlobalTypes.insert(std::make_pair(std::move(FullName), &getUnitDie()));
1442 }
1443 
1445  MachineLocation Location) {
1446  if (DV.hasComplexAddress())
1447  addComplexAddress(DV, Die, dwarf::DW_AT_location, Location);
1448  else
1449  addAddress(Die, dwarf::DW_AT_location, Location);
1450 }
1451 
1452 /// Add an address attribute to a die based on the location provided.
1454  const MachineLocation &Location) {
1455  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
1456  DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
1457  if (Location.isIndirect())
1458  DwarfExpr.setMemoryLocationKind();
1459 
1460  DIExpressionCursor Cursor({});
1462  if (!DwarfExpr.addMachineRegExpression(TRI, Cursor, Location.getReg()))
1463  return;
1464  DwarfExpr.addExpression(std::move(Cursor));
1465 
1466  // Now attach the location information to the DIE.
1467  addBlock(Die, Attribute, DwarfExpr.finalize());
1468 
1469  if (DwarfExpr.TagOffset)
1470  addUInt(Die, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
1471  *DwarfExpr.TagOffset);
1472 }
1473 
1474 /// Start with the address based on the location provided, and generate the
1475 /// DWARF information necessary to find the actual variable given the extra
1476 /// address information encoded in the DbgVariable, starting from the starting
1477 /// location. Add the DWARF information to the die.
1480  const MachineLocation &Location) {
1481  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
1482  DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
1483  const DIExpression *DIExpr = DV.getSingleExpression();
1484  DwarfExpr.addFragmentOffset(DIExpr);
1485  DwarfExpr.setLocation(Location, DIExpr);
1486 
1487  DIExpressionCursor Cursor(DIExpr);
1488 
1489  if (DIExpr->isEntryValue())
1490  DwarfExpr.beginEntryValueExpression(Cursor);
1491 
1493  if (!DwarfExpr.addMachineRegExpression(TRI, Cursor, Location.getReg()))
1494  return;
1495  DwarfExpr.addExpression(std::move(Cursor));
1496 
1497  // Now attach the location information to the DIE.
1498  addBlock(Die, Attribute, DwarfExpr.finalize());
1499 
1500  if (DwarfExpr.TagOffset)
1501  addUInt(Die, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
1502  *DwarfExpr.TagOffset);
1503 }
1504 
1505 /// Add a Dwarf loclistptr attribute data and value.
1507  unsigned Index) {
1508  dwarf::Form Form = (DD->getDwarfVersion() >= 5)
1509  ? dwarf::DW_FORM_loclistx
1512 }
1513 
1515  DIE &VariableDie) {
1516  StringRef Name = Var.getName();
1517  if (!Name.empty())
1518  addString(VariableDie, dwarf::DW_AT_name, Name);
1519  const auto *DIVar = Var.getVariable();
1520  if (DIVar) {
1521  if (uint32_t AlignInBytes = DIVar->getAlignInBytes())
1522  addUInt(VariableDie, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
1523  AlignInBytes);
1524  addAnnotation(VariableDie, DIVar->getAnnotations());
1525  }
1526 
1527  addSourceLine(VariableDie, DIVar);
1528  addType(VariableDie, Var.getType());
1529  if (Var.isArtificial())
1530  addFlag(VariableDie, dwarf::DW_AT_artificial);
1531 }
1532 
1534  DIE &LabelDie) {
1535  StringRef Name = Label.getName();
1536  if (!Name.empty())
1537  addString(LabelDie, dwarf::DW_AT_name, Name);
1538  const auto *DILabel = Label.getLabel();
1539  addSourceLine(LabelDie, DILabel);
1540 }
1541 
1542 /// Add a Dwarf expression attribute data and value.
1544  const MCExpr *Expr) {
1545  addAttribute(Die, (dwarf::Attribute)0, Form, DIEExpr(Expr));
1546 }
1547 
1549  const DISubprogram *SP, DIE &SPDie) {
1550  auto *SPDecl = SP->getDeclaration();
1551  auto *Context = SPDecl ? SPDecl->getScope() : SP->getScope();
1553  addGlobalName(SP->getName(), SPDie, Context);
1554 }
1555 
1556 bool DwarfCompileUnit::isDwoUnit() const {
1557  return DD->useSplitDwarf() && Skeleton;
1558 }
1559 
1560 void DwarfCompileUnit::finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) {
1561  constructTypeDIE(D, CTy);
1562 }
1563 
1566  (DD->useSplitDwarf() && !Skeleton);
1567 }
1568 
1571  MCSymbol *Label = DD->getAddressPool().getLabel();
1573  DD->getDwarfVersion() >= 5 ? dwarf::DW_AT_addr_base
1574  : dwarf::DW_AT_GNU_addr_base,
1575  Label, TLOF.getDwarfAddrSection()->getBeginSymbol());
1576 }
1577 
1579  addAttribute(Die, (dwarf::Attribute)0, dwarf::DW_FORM_udata,
1580  new (DIEValueAllocator) DIEBaseTypeRef(this, Idx));
1581 }
1582 
1584  // Insert the base_type DIEs directly after the CU so that their offsets will
1585  // fit in the fixed size ULEB128 used inside the location expressions.
1586  // Maintain order by iterating backwards and inserting to the front of CU
1587  // child list.
1588  for (auto &Btr : reverse(ExprRefedBaseTypes)) {
1589  DIE &Die = getUnitDie().addChildFront(
1590  DIE::get(DIEValueAllocator, dwarf::DW_TAG_base_type));
1591  SmallString<32> Str;
1592  addString(Die, dwarf::DW_AT_name,
1593  Twine(dwarf::AttributeEncodingString(Btr.Encoding) +
1594  "_" + Twine(Btr.BitSize)).toStringRef(Str));
1595  addUInt(Die, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Btr.Encoding);
1596  // Round up to smallest number of bytes that contains this number of bits.
1597  addUInt(Die, dwarf::DW_AT_byte_size, None, divideCeil(Btr.BitSize, 8));
1598 
1599  Btr.Die = &Die;
1600  }
1601 }
llvm::DwarfCompileUnit::DwarfCompileUnit
DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, UnitKind Kind=UnitKind::Full)
Definition: DwarfCompileUnit.cpp:58
llvm::DwarfUnit::getOrCreateStaticMemberDIE
DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)
Create new static data member DIE.
Definition: DwarfUnit.cpp:1708
llvm::MCObjectFileInfo::getDwarfRangesSection
MCSection * getDwarfRangesSection() const
Definition: MCObjectFileInfo.h:291
llvm::DwarfUnit::addSourceLine
void addSourceLine(DIE &Die, unsigned Line, const DIFile *File)
Add location information to specified debug information entry.
Definition: DwarfUnit.cpp:409
AsmPrinter.h
llvm::MCObjectFileInfo::getDwarfAddrSection
MCSection * getDwarfAddrSection() const
Definition: MCObjectFileInfo.h:321
llvm::DwarfCompileUnit::emitHeader
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
Definition: DwarfCompileUnit.cpp:1370
llvm::TargetFrameLowering::DwarfFrameBase::WasmFrameBase::Index
unsigned Index
Definition: TargetFrameLowering.h:62
llvm::DICompileUnit::DebugNameTableKind::GNU
@ GNU
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:1403
llvm::dwarf::AttributeEncodingString
StringRef AttributeEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:197
llvm::DwarfCompileUnit::constructSubprogramScopeDIE
DIE & constructSubprogramScopeDIE(const DISubprogram *Sub, LexicalScope *Scope)
Construct a DIE for this subprogram scope.
Definition: DwarfCompileUnit.cpp:1021
llvm::TargetFrameLowering::DwarfFrameBase::Reg
unsigned Reg
Definition: TargetFrameLowering.h:65
MachineInstr.h
llvm::MachineLocation
Definition: MachineLocation.h:22
llvm::DwarfCompileUnit::getCU
DwarfCompileUnit & getCU() override
Definition: DwarfCompileUnit.h:170
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::DIType
Base class for types.
Definition: DebugInfoMetadata.h:696
llvm::DIVariable::getAlignInBytes
uint32_t getAlignInBytes() const
Definition: DebugInfoMetadata.h:2546
llvm::DebugHandlerBase::getLabelAfterInsn
MCSymbol * getLabelAfterInsn(const MachineInstr *MI)
Return Label immediately following the instruction.
Definition: DebugHandlerBase.cpp:142
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::DwarfCompileUnit::ExprRefedBaseTypes
std::vector< BaseTypeRef > ExprRefedBaseTypes
Definition: DwarfCompileUnit.h:147
TargetFrameLowering.h
llvm::DwarfDebug::getAddressPool
AddressPool & getAddressPool()
Definition: DwarfDebug.h:789
llvm::DwarfUnit::addFlag
void addFlag(DIE &Die, dwarf::Attribute Attribute)
Add a flag that is true to the DIE.
Definition: DwarfUnit.cpp:214
llvm::TargetMachine::useEmulatedTLS
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
Definition: TargetMachine.cpp:146
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:683
llvm::TargetFrameLowering
Information about stack frame layout on the target.
Definition: TargetFrameLowering.h:43
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::DICommonBlock::getFile
DIFile * getFile() const
Definition: DebugInfoMetadata.h:3080
llvm::DeclContext
A DeclContext is a named program scope that is used for ODR uniquing of types.
Definition: DWARFLinkerDeclContext.h:78
llvm::AsmPrinter::createTempSymbol
MCSymbol * createTempSymbol(const Twine &Name) const
Definition: AsmPrinter.cpp:3535
T
llvm::Attribute
Definition: Attributes.h:66
llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, 4, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::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:197
llvm::SectionKind::isReadOnly
bool isReadOnly() const
Definition: SectionKind.h:131
llvm::DwarfUnit::getOrCreateContextDIE
DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
Definition: DwarfUnit.cpp:546
llvm::DwarfUnit::emitCommonHeader
void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT)
Emit the common part of the header for this unit.
Definition: DwarfUnit.cpp:1747
llvm::DwarfCompileUnit
Definition: DwarfCompileUnit.h:46
llvm::DwarfUnit::DU
DwarfFile * DU
Definition: DwarfUnit.h:51
llvm::TargetIndexLocation
This struct describes target specific location.
Definition: DebugLocEntry.h:24
llvm::MCSection::getBeginSymbol
MCSymbol * getBeginSymbol()
Definition: MCSection.h:129
llvm::ilist_node_with_parent::getNextNode
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
Definition: ilist_node.h:289
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1199
llvm::DwarfCompileUnit::createAndAddScopeChildren
DIE * createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE)
Definition: DwarfCompileUnit.cpp:1052
llvm::LexicalScope
LexicalScope - This class is used to track scope information.
Definition: LexicalScopes.h:44
llvm::dwarf::Form
Form
Definition: Dwarf.h:132
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::TargetMachine::getMCRegisterInfo
const MCRegisterInfo * getMCRegisterInfo() const
Definition: TargetMachine.h:206
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:68
llvm::DbgVariable::getDebugLocListIndex
unsigned getDebugLocListIndex() const
Definition: DwarfDebug.h:176
llvm::MCRegisterInfo::getDwarfRegNum
int getDwarfRegNum(MCRegister RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number.
Definition: MCRegisterInfo.cpp:68
llvm::DwarfDebug::addAccelName
void addAccelName(const DICompileUnit &CU, StringRef Name, const DIE &Die)
Definition: DwarfDebug.cpp:3485
llvm::SmallDenseSet
Implements a dense probed hash-table based set with some number of buckets stored inline.
Definition: DenseSet.h:286
llvm::GlobalVariable
Definition: GlobalVariable.h:39
llvm::SmallDenseMap
Definition: DenseMap.h:880
llvm::DwarfDebug::terminateLineTable
void terminateLineTable(const DwarfCompileUnit *CU)
Terminate the line table by adding the last range label.
Definition: DwarfDebug.cpp:2173
llvm::TargetRegisterInfo::getOffsetOpcodes
virtual void getOffsetOpcodes(const StackOffset &Offset, SmallVectorImpl< uint64_t > &Ops) const
Gets the DWARF expression opcodes for Offset.
Definition: TargetRegisterInfo.cpp:643
llvm::RangeSpan
Definition: DwarfFile.h:36
llvm::DwarfUnit::insertDIE
void insertDIE(const DINode *Desc, DIE *D)
Insert DIE into the map.
Definition: DwarfUnit.cpp:202
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::wasm::WASM_SYMBOL_TYPE_GLOBAL
@ WASM_SYMBOL_TYPE_GLOBAL
Definition: Wasm.h:385
llvm::DwarfUnit::getDIE
DIE * getDIE(const DINode *D) const
Returns the DIE map slot for the specified debug variable.
Definition: DwarfUnit.cpp:196
llvm::DIScope::getName
StringRef getName() const
Definition: DebugInfoMetadata.cpp:296
llvm::TargetSubtargetInfo::getRegisterInfo
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
Definition: TargetSubtargetInfo.h:127
llvm::DwarfUnit::getOrCreateSubprogramDIE
DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal=false)
Definition: DwarfUnit.cpp:1155
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:432
NewExpr
Definition: ItaniumDemangle.h:1935
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:237
llvm::DwarfFile::addScopeVariable
bool addScopeVariable(LexicalScope *LS, DbgVariable *Var)
Definition: DwarfFile.cpp:105
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:652
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1595
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:197
llvm::TargetLoweringObjectFile::getIndirectSymViaRWPI
virtual const MCExpr * getIndirectSymViaRWPI(const MCSymbol *Sym) const
Get the target specific RWPI relocation.
Definition: TargetLoweringObjectFile.h:228
llvm::getDISubprogram
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
Definition: DebugInfo.cpp:138
llvm::TargetMachine::getRelocationModel
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
Definition: TargetMachine.cpp:68
llvm::DwarfCompileUnit::attachRangesOrLowHighPC
void attachRangesOrLowHighPC(DIE &D, SmallVector< RangeSpan, 2 > Ranges)
Definition: DwarfCompileUnit.cpp:607
llvm::DwarfExpression::TagOffset
Optional< uint8_t > TagOffset
Definition: DwarfExpression.h:173
llvm::APInt::getBitWidth
unsigned getBitWidth() const
Return the number of bits in the APInt.
Definition: APInt.h:1431
llvm::DIEAddrOffset
A BaseTypeRef DIE.
Definition: DIE.h:350
llvm::DwarfUnit::addString
void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
Definition: DwarfUnit.cpp:247
llvm::MCSymbol::isDefined
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
Definition: MCSymbol.h:243
llvm::DIGlobalVariable::getDisplayName
StringRef getDisplayName() const
Definition: DebugInfoMetadata.h:3017
llvm::DwarfCompileUnit::createBaseTypeDIEs
void createBaseTypeDIEs()
Definition: DwarfCompileUnit.cpp:1583
llvm::DbgEntity::setDIE
void setDIE(DIE &D)
Definition: DwarfDebug.h:91
llvm::Reloc::ROPI_RWPI
@ ROPI_RWPI
Definition: CodeGen.h:22
llvm::DwarfCompileUnit::updateSubprogramScopeDIE
DIE & updateSubprogramScopeDIE(const DISubprogram *SP)
Find DIE for the given subprogram and attach appropriate DW_AT_low_pc and DW_AT_high_pc attributes.
Definition: DwarfCompileUnit.cpp:447
llvm::Optional
Definition: APInt.h:33
llvm::TargetFrameLowering::DwarfFrameBase
Definition: TargetFrameLowering.h:56
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:176
llvm::DbgVariable::getName
StringRef getName() const
Definition: DwarfDebug.h:179
llvm::DIE
A structured debug information entry.
Definition: DIE.h:739
llvm::Triple::isNVPTX
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
Definition: Triple.h:761
llvm::DwarfUnit::addSInt
void addSInt(DIEValueList &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, int64_t Integer)
Add an signed integer attribute data and value.
Definition: DwarfUnit.cpp:235
STLExtras.h
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2596
llvm::DbgLabel
This class is used to track label information.
Definition: DwarfDebug.h:232
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:105
llvm::DwarfCompileUnit::getOrCreateCommonBlock
DIE * getOrCreateCommonBlock(const DICommonBlock *CB, ArrayRef< GlobalExpr > GlobalExprs)
Definition: DwarfCompileUnit.cpp:363
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:692
llvm::DwarfUnit::constructTypeDIE
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)
Definition: DwarfUnit.cpp:877
llvm::DwarfDebug::useSectionsAsReferences
bool useSectionsAsReferences() const
Returns whether to use sections as labels rather than temp symbols.
Definition: DwarfDebug.h:714
llvm::detail::DenseSetImpl< ValueT, SmallDenseMap< ValueT, detail::DenseSetEmpty, 4, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::insert
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:206
llvm::detail::DenseSetImpl< ValueT, SmallDenseMap< ValueT, detail::DenseSetEmpty, 4, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::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:97
llvm::DwarfCompileUnit::constructLabelDIE
DIE * constructLabelDIE(DbgLabel &DL, const LexicalScope &Scope)
Construct a DIE for the given DbgLabel.
Definition: DwarfCompileUnit.cpp:712
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1628
llvm::DwarfExpression::setLocation
void setLocation(const MachineLocation &Loc, const DIExpression *DIExpr)
Set the location (Loc) and DIExpression (DIExpr) to describe.
Definition: DwarfExpression.cpp:397
llvm::dwarf::Attribute
Attribute
Attributes.
Definition: Dwarf.h:125
llvm::DbgVariable::isArtificial
bool isArtificial() const
Return true if DbgVariable is artificial.
Definition: DwarfDebug.h:196
llvm::TargetLoweringObjectFile
Definition: TargetLoweringObjectFile.h:45
llvm::TargetFrameLowering::DwarfFrameBase::WasmLoc
struct WasmFrameBase WasmLoc
Definition: TargetFrameLowering.h:66
llvm::DwarfExpression::setCallSiteParamValueFlag
void setCallSiteParamValueFlag()
Lock this down to become a call site parameter location.
Definition: DwarfExpression.h:316
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::DbgEntity::getDIE
DIE * getDIE() const
Definition: DwarfDebug.h:87
llvm::DIExpression::getElement
uint64_t getElement(unsigned I) const
Definition: DebugInfoMetadata.h:2624
llvm::DwarfDebug::insertSectionLabel
void insertSectionLabel(const MCSymbol *S)
Definition: DwarfDebug.cpp:3526
llvm::DwarfCompileUnit::getExistingAbstractEntity
DbgEntity * getExistingAbstractEntity(const DINode *Node)
Definition: DwarfCompileUnit.cpp:1347
llvm::DITypeRefArray
Definition: DebugInfoMetadata.h:71
llvm::DIE::addChild
DIE & addChild(DIE *Child)
Add a child to the DIE.
Definition: DIE.h:854
llvm::DwarfCompileUnit::constructScopeDIE
void constructScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE)
Definition: DwarfCompileUnit.cpp:542
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:533
DwarfExpression.h
llvm::DwarfDebug::useAllLinkageNames
bool useAllLinkageNames() const
Returns whether we should emit all DW_AT_[MIPS_]linkage_name.
Definition: DwarfDebug.h:679
llvm::DIEDwarfExpression::finalize
DIELoc * finalize()
Definition: DwarfExpression.h:432
TargetMachine.h
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:574
llvm::TargetFrameLowering::DwarfFrameBase::Register
@ Register
Definition: TargetFrameLowering.h:59
SmallString.h
llvm::DwarfDebug::getMD5AsBytes
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:3532
llvm::DIExpression::elements_begin
element_iterator elements_begin() const
Definition: DebugInfoMetadata.h:2646
llvm::DIGlobalVariable::isLocalToUnit
bool isLocalToUnit() const
Definition: DebugInfoMetadata.h:3015
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:1158
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::AsmPrinter::OutStreamer
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition: AsmPrinter.h:99
llvm::TargetFrameLowering::DwarfFrameBase::CFA
@ CFA
Definition: TargetFrameLowering.h:59
MCSymbolWasm.h
llvm::DwarfDebug::addSubprogramNames
void addSubprogramNames(const DICompileUnit &CU, const DISubprogram *SP, DIE &Die)
Definition: DwarfDebug.cpp:499
llvm::DwarfUnit::addAnnotation
void addAnnotation(DIE &Buffer, DINodeArray Annotations)
Add DW_TAG_LLVM_annotation.
Definition: DwarfUnit.cpp:856
llvm::DIELocList
Represents a pointer to a location list in the debug_loc section.
Definition: DIE.h:332
llvm::DIE::addChildFront
DIE & addChildFront(DIE *Child)
Definition: DIE.h:861
llvm::MCSubtargetInfo::getTargetTriple
const Triple & getTargetTriple() const
Definition: MCSubtargetInfo.h:108
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:1802
llvm::AccelTableKind::Apple
@ Apple
.apple_names, .apple_namespaces, .apple_types, .apple_objc.
llvm::DICompileUnit::LineTablesOnly
@ LineTablesOnly
Definition: DebugInfoMetadata.h:1368
llvm::DwarfDebug::getCurrentFunction
const MachineFunction * getCurrentFunction() const
Definition: DwarfDebug.h:801
llvm::DwarfDebug::alwaysUseRanges
bool alwaysUseRanges() const
Returns whether range encodings should be used for single entry range lists.
Definition: DwarfDebug.h:697
llvm::DwarfDebug::useAddrOffsetForm
bool useAddrOffsetForm() const
Definition: DwarfDebug.h:709
llvm::DwarfUnit::getParentContextString
std::string getParentContextString(const DIScope *Context) const
Get string containing language specific context for a global name.
Definition: DwarfUnit.cpp:658
llvm::Register::isPhysicalRegister
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
Definition: Register.h:65
llvm::DwarfUnit::CUNode
const DICompileUnit * CUNode
MDNode for the compile unit.
Definition: DwarfUnit.h:38
MCSymbol.h
llvm::MDTuple
Tuple of metadata.
Definition: Metadata.h:1329
llvm::DINode::getTag
dwarf::Tag getTag() const
Definition: DebugInfoMetadata.cpp:216
Param
Value * Param
Definition: NVPTXLowerArgs.cpp:165
llvm::DwarfCompileUnit::constructVariableDIE
DIE * constructVariableDIE(DbgVariable &DV, bool Abstract=false)
constructVariableDIE - Construct a DIE for the given DbgVariable.
Definition: DwarfCompileUnit.cpp:706
llvm::DIType::getName
StringRef getName() const
Definition: DebugInfoMetadata.h:742
llvm::DwarfExpression::addExpression
void addExpression(DIExpressionCursor &&Expr)
Emit all remaining operations in the DIExpressionCursor.
Definition: DwarfExpression.cpp:483
llvm::DwarfCompileUnit::addLocationList
void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index)
Add a Dwarf loclistptr attribute data and value.
Definition: DwarfCompileUnit.cpp:1506
llvm::DwarfUnit::applySubprogramAttributes
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)
Definition: DwarfUnit.cpp:1240
llvm::BitTracker
Definition: BitTracker.h:35
llvm::wasm::WasmGlobalType
Definition: Wasm.h:112
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:1796
llvm::DwarfUnit::addTemplateParams
void addTemplateParams(DIE &Buffer, DINodeArray TParams)
Add template parameters in buffer.
Definition: DwarfUnit.cpp:516
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
llvm::DbgVariable::isObjectPointer
bool isObjectPointer() const
Definition: DwarfDebug.h:204
llvm::DwarfExpression::setMemoryLocationKind
void setMemoryLocationKind()
Lock this down to become a memory location description.
Definition: DwarfExpression.h:307
llvm::DwarfExpression::addMachineRegExpression
bool addMachineRegExpression(const TargetRegisterInfo &TRI, DIExpressionCursor &Expr, llvm::Register MachineReg, unsigned FragmentOffsetInBits=0)
Emit a machine register location.
Definition: DwarfExpression.cpp:250
llvm::DwarfUnit::getCUNode
const DICompileUnit * getCUNode() const
Definition: DwarfUnit.h:99
llvm::UnitKind
UnitKind
Definition: DwarfCompileUnit.h:44
llvm::DwarfCompileUnit::addLocationAttribute
void addLocationAttribute(DIE *ToDIE, const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
Definition: DwarfCompileUnit.cpp:203
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:723
llvm::APInt::getZExtValue
uint64_t getZExtValue() const
Get zero extended value.
Definition: APInt.h:1486
llvm::DICompileUnit::getEmissionKind
static Optional< DebugEmissionKind > getEmissionKind(StringRef Str)
Definition: DebugInfoMetadata.cpp:893
llvm::DwarfCompileUnit::getDWOId
uint64_t getDWOId() const
Definition: DwarfCompileUnit.h:357
llvm::DwarfCompileUnit::addBaseTypeRef
void addBaseTypeRef(DIEValueList &Die, int64_t Idx)
Definition: DwarfCompileUnit.cpp:1578
llvm::AArch64PACKey::IA
@ IA
Definition: AArch64BaseInfo.h:819
llvm::TargetFrameLowering::DwarfFrameBase::WasmFrameBase
@ WasmFrameBase
Definition: TargetFrameLowering.h:59
llvm::DIEInteger
An integer value DIE.
Definition: DIE.h:163
llvm::DwarfUnit::addLinkageName
void addLinkageName(DIE &Die, StringRef LinkageName)
Add a linkage name, if it isn't empty.
Definition: DwarfUnit.cpp:508
llvm::DwarfCompileUnit::initStmtList
void initStmtList()
Definition: DwarfCompileUnit.cpp:403
llvm::SmallVectorImpl::append
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:687
llvm::TargetFrameLowering::DwarfFrameBase::Kind
enum llvm::TargetFrameLowering::DwarfFrameBase::FrameBaseKind Kind
llvm::DIEBlock
DIEBlock - Represents a block of values.
Definition: DIE.h:966
llvm::DwarfFile::getScopeLabels
DenseMap< LexicalScope *, LabelList > & getScopeLabels()
Definition: DwarfFile.h:161
llvm::DbgVariable
This class is used to track local variable information.
Definition: DwarfDebug.h:115
llvm::DwarfCompileUnit::applySubprogramAttributesToDefinition
void applySubprogramAttributesToDefinition(const DISubprogram *SP, DIE &SPDie)
Definition: DwarfCompileUnit.cpp:1548
llvm::DbgVariable::getTag
dwarf::Tag getTag() const
Definition: DwarfDebug.h:187
llvm::Metadata
Root of the metadata hierarchy.
Definition: Metadata.h:62
llvm::DwarfCompileUnit::attachLowHighPC
void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End)
Definition: DwarfCompileUnit.cpp:430
llvm::Triple::getArch
ArchType getArch() const
Get the parsed architecture type of this triple.
Definition: Triple.h:354
llvm::DebugHandlerBase::getLabelBeforeInsn
MCSymbol * getLabelBeforeInsn(const MachineInstr *MI)
Return Label preceding the instruction.
Definition: DebugHandlerBase.cpp:135
AddressPool.h
llvm::DwarfUnit::DIEValueAllocator
BumpPtrAllocator DIEValueAllocator
Definition: DwarfUnit.h:41
dependencies
static SmallVector< const DIVariable *, 2 > dependencies(DbgVariable *Var)
Return all DIVariables that appear in count: expressions.
Definition: DwarfCompileUnit.cpp:919
llvm::DbgVariable::hasFrameIndexExprs
bool hasFrameIndexExprs() const
Definition: DwarfDebug.h:183
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:200
llvm::TargetFrameLowering::DwarfFrameBase::WasmFrameBase::Kind
unsigned Kind
Definition: TargetFrameLowering.h:61
llvm::WebAssembly::TI_GLOBAL_RELOC
@ TI_GLOBAL_RELOC
Definition: WebAssembly.h:96
DIE.h
llvm::SmallString< 32 >
llvm::DwarfCompileUnit::constructAbstractSubprogramScopeDIE
void constructAbstractSubprogramScopeDIE(LexicalScope *Scope)
Definition: DwarfCompileUnit.cpp:1100
llvm::DwarfDebug::lookupCU
DwarfCompileUnit * lookupCU(const DIE *Die)
Find the matching DwarfCompileUnit for the given CU DIE.
Definition: DwarfDebug.h:808
llvm::MachineBasicBlock::getSectionIDNum
unsigned getSectionIDNum() const
Returns the unique section ID number of this basic block.
Definition: MachineBasicBlock.h:627
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:1180
llvm::ARM_PROC::IE
@ IE
Definition: ARMBaseInfo.h:27
llvm::DICommonBlock
Definition: DebugInfoMetadata.h:3037
llvm::TargetOptions::DisableFramePointerElim
bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
Definition: TargetOptionsImpl.cpp:23
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
llvm::DwarfCompileUnit::constructInlinedScopeDIE
DIE * constructInlinedScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE)
This scope represents an inlined body of a function.
Definition: DwarfCompileUnit.cpp:656
llvm::DwarfUnit::addPoolOpAddress
void addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label)
Definition: DwarfUnit.cpp:307
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition: MachineFunction.h:657
llvm::DwarfDebug::useAddrOffsetExpressions
bool useAddrOffsetExpressions() const
Definition: DwarfDebug.h:703
llvm::DIGlobalVariable::isDefinition
bool isDefinition() const
Definition: DebugInfoMetadata.h:3016
llvm::DwarfDebug::getDwarfSectionOffsetForm
dwarf::Form getDwarfSectionOffsetForm() const
Returns a suitable DWARF form to represent a section offset, i.e.
Definition: DwarfDebug.cpp:3511
llvm::DwarfUnit::getOrCreateModule
DIE * getOrCreateModule(const DIModule *M)
Definition: DwarfUnit.cpp:1124
llvm::AsmPrinter::emitInt64
void emitInt64(uint64_t Value) const
Emit a long long directive and value.
Definition: AsmPrinter.cpp:2789
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:1444
llvm::divideCeil
uint64_t divideCeil(uint64_t Numerator, uint64_t Denominator)
Returns the integer ceil(Numerator / Denominator).
Definition: MathExtras.h:683
llvm::Module::getName
StringRef getName() const
Get a short "name" for the module.
Definition: Module.h:245
llvm::DwarfDebug::tuneForLLDB
bool tuneForLLDB() const
Definition: DwarfDebug.h:828
llvm::dwarf::DW_INL_inlined
@ DW_INL_inlined
Definition: Dwarf.h:346
llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE
DIE * getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
Get or create global variable DIE.
Definition: DwarfCompileUnit.cpp:137
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:1472
llvm::AMDGPU::Hwreg::Offset
Offset
Definition: SIDefines.h:416
llvm::DwarfCompileUnit::hasDwarfPubSections
bool hasDwarfPubSections() const
Definition: DwarfCompileUnit.cpp:1385
llvm::DwarfDebug
Collects and handles dwarf debug information.
Definition: DwarfDebug.h:294
uint64_t
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::DwarfDebug::getAccelTableKind
AccelTableKind getAccelTableKind() const
Returns what kind (if any) of accelerator tables to emit.
Definition: DwarfDebug.h:727
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:1411
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::DIExpression::isConstant
llvm::Optional< SignedOrUnsignedConstant > isConstant() const
Determine whether this represents a constant value, if so.
Definition: DebugInfoMetadata.cpp:1756
llvm::DIEDwarfExpression
DwarfExpression implementation for singular DW_AT_location.
Definition: DwarfExpression.h:406
llvm::DIGlobalVariable
Global variables.
Definition: DebugInfoMetadata.h:2952
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::TargetIndexLocation::Index
int Index
Definition: DebugLocEntry.h:25
DebugInfo.h
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:735
llvm::DIEBaseTypeRef
A BaseTypeRef DIE.
Definition: DIE.h:235
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::DwarfCompileUnit::getOrCreateSourceID
unsigned getOrCreateSourceID(const DIFile *File) override
Look up the source ID for the given file.
Definition: DwarfCompileUnit.cpp:117
llvm::DwarfExpression::beginEntryValueExpression
void beginEntryValueExpression(DIExpressionCursor &ExprCursor)
Begin emission of an entry value dwarf operation.
Definition: DwarfExpression.cpp:406
llvm::TargetLoweringObjectFile::supportDebugThreadLocalLocation
bool supportDebugThreadLocalLocation() const
Target supports TLS offset relocation in debug section?
Definition: TargetLoweringObjectFile.h:220
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1360
llvm::DIImportedEntity
An imported module (C++ using directive or similar).
Definition: DebugInfoMetadata.h:3331
llvm::DwarfCompileUnit::finishSubprogramDefinition
void finishSubprogramDefinition(const DISubprogram *SP)
Definition: DwarfCompileUnit.cpp:1309
llvm::DIELoc
DIELoc - Represents an expression location.
Definition: DIE.h:930
llvm::DwarfDebug::tuneForGDB
bool tuneForGDB() const
Definition: DwarfDebug.h:827
llvm::dwarf::UnitType
UnitType
Constants for unit types in DWARF v5.
Definition: Dwarf.h:465
llvm::DwarfUnit::Asm
AsmPrinter * Asm
Target of Dwarf emission.
Definition: DwarfUnit.h:44
llvm::TargetMachine::Options
TargetOptions Options
Definition: TargetMachine.h:117
llvm::DwarfCompileUnit::addGlobalType
void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context) override
Add a new global type to the compile unit.
Definition: DwarfCompileUnit.cpp:1424
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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:272
llvm::AsmPrinter::getSymbol
MCSymbol * getSymbol(const GlobalValue *GV) const
Definition: AsmPrinter.cpp:656
llvm::DICompileUnit::isDebugDirectivesOnly
bool isDebugDirectivesOnly() const
Definition: DebugInfoMetadata.h:1488
llvm::DwarfCompileUnit::finishEntityDefinition
void finishEntityDefinition(const DbgEntity *Entity)
Definition: DwarfCompileUnit.cpp:1323
llvm::AsmPrinter::MF
MachineFunction * MF
The current machine function.
Definition: AsmPrinter.h:102
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:965
llvm::DICommonBlock::getName
StringRef getName() const
Definition: DebugInfoMetadata.h:3079
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::DenseMapBase::empty
bool empty() const
Definition: DenseMap.h:98
llvm::DwarfCompileUnit::constructImportedEntityDIE
DIE * constructImportedEntityDIE(const DIImportedEntity *Module)
Construct import_module DIE.
Definition: DwarfCompileUnit.cpp:1271
llvm::DIVariable::getName
StringRef getName() const
Definition: DebugInfoMetadata.h:2542
llvm::DwarfCompileUnit::addComplexAddress
void addComplexAddress(const DbgVariable &DV, 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:1478
MCSection.h
llvm::DbgVariable::getValueLoc
const DbgValueLoc * getValueLoc() const
Definition: DwarfDebug.h:180
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:802
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
TargetOptions.h
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1080
llvm::Reloc::RWPI
@ RWPI
Definition: CodeGen.h:22
llvm::DIScope::getScope
DIScope * getScope() const
Definition: DebugInfoMetadata.cpp:272
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::AsmPrinter::GetExternalSymbolSymbol
MCSymbol * GetExternalSymbolSymbol(StringRef Sym) const
Return the MCSymbol for the specified ExternalSymbol.
Definition: AsmPrinter.cpp:3596
llvm::DwarfFile::addScopeLabel
void addScopeLabel(LexicalScope *LS, DbgLabel *Label)
Definition: DwarfFile.cpp:122
llvm::AArch64CC::GE
@ GE
Definition: AArch64BaseInfo.h:265
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::DwarfUnit::getOrCreateTypeDIE
DIE * getOrCreateTypeDIE(const MDNode *TyNode)
Find existing DIE or create new DIE for the given type.
Definition: DwarfUnit.cpp:607
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::DIGlobalVariable::getLinkageName
StringRef getLinkageName() const
Definition: DebugInfoMetadata.h:3018
llvm::DwarfCompileUnit::applyLabelAttributes
void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie)
Definition: DwarfCompileUnit.cpp:1533
None.h
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:1741
DataLayout.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Dwarf.h
llvm::DIEExpr
An expression DIE.
Definition: DIE.h:201
llvm::DINode
Tagged DWARF-like metadata node.
Definition: DebugInfoMetadata.h:131
llvm::DbgEntity::getEntity
const DINode * getEntity() const
Accessors.
Definition: DwarfDebug.h:85
MachineLocation.h
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::DwarfCompileUnit::addRange
void addRange(RangeSpan Range)
addRange - Add an address range to the list of ranges for this unit.
Definition: DwarfCompileUnit.cpp:380
TargetLoweringObjectFile.h
uint32_t
llvm::StackOffset
StackOffset is a class to represent an offset with 2 dimensions, named fixed and scalable,...
Definition: TypeSize.h:134
llvm::DwarfCompileUnit::addAddrTableBase
void addAddrTableBase()
Add the DW_AT_addr_base attribute to the unit DIE.
Definition: DwarfCompileUnit.cpp:1569
TargetSubtargetInfo.h
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::DIGlobalVariable::getTemplateParams
MDTuple * getTemplateParams() const
Definition: DebugInfoMetadata.h:3029
llvm::DwarfDebug::addArangeLabel
void addArangeLabel(SymbolCU SCU)
Add a label so that arange data can be generated for it.
Definition: DwarfDebug.h:669
llvm::DIE::get
static DIE * get(BumpPtrAllocator &Alloc, dwarf::Tag Tag)
Definition: DIE.h:769
DwarfCompileUnit.h
llvm::DwarfCompileUnit::applyVariableAttributes
void applyVariableAttributes(const DbgVariable &Var, DIE &VariableDie)
Definition: DwarfCompileUnit.cpp:1514
llvm::DIVariable
Base class for variables.
Definition: DebugInfoMetadata.h:2530
llvm::TargetLoweringObjectFile::getStaticBase
virtual MCRegister getStaticBase() const
Returns the register used as static base in RWPI variants.
Definition: TargetLoweringObjectFile.h:225
llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, 4, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::insert
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition: DenseMap.h:207
llvm::DwarfUnit::EndLabel
MCSymbol * EndLabel
Emitted at the end of the CU and used to compute the CU Length field.
Definition: DwarfUnit.h:47
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::DwarfDebug::getSectionLabel
const MCSymbol * getSectionLabel(const MCSection *S)
Definition: DwarfDebug.cpp:3520
llvm::DICompileUnit::getNameTableKind
static Optional< DebugNameTableKind > getNameTableKind(StringRef Str)
Definition: DebugInfoMetadata.cpp:903
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::DwarfUnit::getOrCreateNameSpace
DIE * getOrCreateNameSpace(const DINamespace *NS)
Definition: DwarfUnit.cpp:1103
llvm::DIGlobalVariable::getStaticDataMemberDeclaration
DIDerivedType * getStaticDataMemberDeclaration() const
Definition: DebugInfoMetadata.h:3019
llvm::DbgVariable::getFrameIndexExprs
ArrayRef< FrameIndexExpr > getFrameIndexExprs() const
Get the FI entries, sorted by fragment offset.
Definition: DwarfDebug.cpp:272
llvm::wasm::WASM_TYPE_I64
@ WASM_TYPE_I64
Definition: Wasm.h:262
llvm::DwarfDebug::emitDebugLocValue
static void emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT, const DbgValueLoc &Value, DwarfExpression &DwarfExpr)
Definition: DwarfDebug.cpp:2554
llvm::DITypeRefArray::size
unsigned size() const
Definition: DebugInfoMetadata.h:86
llvm::DwarfDebug::getPrevCU
const DwarfCompileUnit * getPrevCU() const
Returns the previous CU that was being updated.
Definition: DwarfDebug.h:767
llvm::DwarfUnit::DD
DwarfDebug * DD
Definition: DwarfUnit.h:50
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
llvm::DwarfDebug::useAppleExtensionAttributes
bool useAppleExtensionAttributes() const
Definition: DwarfDebug.h:729
llvm::DIExpression::isEntryValue
bool isEntryValue() const
Check if the expression consists of exactly one entry value operand.
Definition: DebugInfoMetadata.cpp:1249
llvm::DIE::getUnit
DIEUnit * getUnit() const
Climb up the parent chain to get the compile unit or type unit that this DIE belongs to.
Definition: DIE.cpp:209
llvm::TargetSubtargetInfo::getFrameLowering
virtual const TargetFrameLowering * getFrameLowering() const
Definition: TargetSubtargetInfo.h:96
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:673
llvm::None
constexpr std::nullopt_t None
Definition: None.h:27
llvm::DwarfCompileUnit::createAbstractEntity
void createAbstractEntity(const DINode *Node, LexicalScope *Scope)
Definition: DwarfCompileUnit.cpp:1355
llvm::DwarfUnit::addAttribute
void addAttribute(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, T &&Value)
Definition: DwarfUnit.h:79
llvm::DIScope
Base class for scope-like contexts.
Definition: DebugInfoMetadata.h:509
llvm::MachineFunction::getTarget
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition: MachineFunction.h:653
llvm::MachineBasicBlock::isEndSection
bool isEndSection() const
Returns true if this block ends any section.
Definition: MachineBasicBlock.h:617
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:348
llvm::DwarfUnit::addUInt
void addUInt(DIEValueList &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, uint64_t Integer)
Add an unsigned integer attribute data and value.
Definition: DwarfUnit.cpp:221
llvm::AsmPrinter::getSubtargetInfo
const MCSubtargetInfo & getSubtargetInfo() const
Return information about subtarget.
Definition: AsmPrinter.cpp:398
llvm::DwarfCompileUnit::useGNUAnalogForDwarf5Feature
bool useGNUAnalogForDwarf5Feature() const
Whether to use the GNU analog for a DWARF5 tag, attribute, or location atom.
Definition: DwarfCompileUnit.cpp:1140
llvm::DIGlobalVariable::getAnnotations
DINodeArray getAnnotations() const
Definition: DebugInfoMetadata.h:3022
llvm::DICommonBlock::getScope
DIScope * getScope() const
Definition: DebugInfoMetadata.h:3075
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:50
GlobalVariable.h
llvm::AddressPool::getLabel
MCSymbol * getLabel()
Definition: AddressPool.h:53
llvm::wasm::WASM_TYPE_I32
@ WASM_TYPE_I32
Definition: Wasm.h:261
llvm::DbgValueLocEntry
A single location or constant within a variable location description, with either a single entry (wit...
Definition: DebugLocEntry.h:40
llvm::AArch64CC::LS
@ LS
Definition: AArch64BaseInfo.h:264
llvm::DIVariable::getScope
DIScope * getScope() const
Definition: DebugInfoMetadata.h:2541
llvm::DwarfCompileUnit::applyStmtList
void applyStmtList(DIE &D)
Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
Definition: DwarfCompileUnit.cpp:424
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:1432
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:108
llvm::DwarfUnit::addBlock
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc)
Add block data.
Definition: DwarfUnit.cpp:391
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:84
llvm::RangeSpan::Begin
const MCSymbol * Begin
Definition: DwarfFile.h:37
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::DwarfFile
Definition: DwarfFile.h:49
llvm::DICompileUnit::DebugNameTableKind::Default
@ Default
llvm::DwarfCompileUnit::includeMinimalInlineScopes
bool includeMinimalInlineScopes() const
Definition: DwarfCompileUnit.cpp:1564
llvm::DwarfFile::getScopeVariables
DenseMap< LexicalScope *, ScopeVars > & getScopeVariables()
Definition: DwarfFile.h:157
llvm::DbgVariable::getSingleExpression
const DIExpression * getSingleExpression() const
Definition: DwarfDebug.h:170
llvm::DwarfCompileUnit::constructCallSiteParmEntryDIEs
void constructCallSiteParmEntryDIEs(DIE &CallSiteDIE, SmallVector< DbgCallSiteParam, 4 > &Params)
Construct call site parameter DIEs for the CallSiteDIE.
Definition: DwarfCompileUnit.cpp:1247
llvm::AsmPrinter::MBBSectionRanges
MapVector< unsigned, MBBSectionRange > MBBSectionRanges
Definition: AsmPrinter.h:138
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::AsmPrinter::TM
TargetMachine & TM
Target machine description.
Definition: AsmPrinter.h:87
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
llvm::DIExpressionCursor
Holds a DIExpression and keeps track of how many operands have been consumed so far.
Definition: DwarfExpression.h:37
List
const NodeList & List
Definition: RDFGraph.cpp:199
llvm::AsmPrinter::getObjFileLowering
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
Definition: AsmPrinter.cpp:384
MCStreamer.h
llvm::DICompileUnit::DebugNameTableKind::None
@ None
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:1144
llvm::DbgVariable::getVariable
const DILocalVariable * getVariable() const
Definition: DwarfDebug.h:166
llvm::UnitKind::Skeleton
@ Skeleton
llvm::TargetMachine::getTargetTriple
const Triple & getTargetTriple() const
Definition: TargetMachine.h:125
llvm::DICommonBlock::getLineNo
unsigned getLineNo() const
Definition: DebugInfoMetadata.h:3081
GetCompileUnitType
static dwarf::Tag GetCompileUnitType(UnitKind Kind, DwarfDebug *DW)
Definition: DwarfCompileUnit.cpp:45
llvm::AsmPrinter::getDataLayout
const DataLayout & getDataLayout() const
Return information about data layout.
Definition: AsmPrinter.cpp:388
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1841
llvm::SmallVectorImpl< InsnRange >
llvm::reverse
auto reverse(ContainerTy &&C)
Definition: STLExtras.h:485
llvm::StringRef::str
std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:221
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:473
llvm::DwarfDebug::getDwarfVersion
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
Definition: DwarfDebug.cpp:3507
llvm::DwarfDebug::setPrevCU
void setPrevCU(const DwarfCompileUnit *PrevCU)
Definition: DwarfDebug.h:768
llvm::DILabel
Label.
Definition: DebugInfoMetadata.h:3186
llvm::DwarfUnit
This dwarf writer support class manages information associated with a source file.
Definition: DwarfUnit.h:35
llvm::TargetIndexLocation::Offset
int Offset
Definition: DebugLocEntry.h:26
llvm::DbgVariable::hasComplexAddress
bool hasComplexAddress() const
Definition: DwarfDebug.h:212
llvm::DwarfDebug::useRangesSection
bool useRangesSection() const
Returns whether ranges section should be emitted.
Definition: DwarfDebug.h:693
llvm::TargetFrameLowering::DwarfFrameBase::Location
union llvm::TargetFrameLowering::DwarfFrameBase::@232 Location
llvm::DIEValueList
A list of DIE values.
Definition: DIE.h:662
llvm::DIExpression::elements_end
element_iterator elements_end() const
Definition: DebugInfoMetadata.h:2647
MachineFunction.h
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:1191
llvm::DICommonBlock::getDecl
DIGlobalVariable * getDecl() const
Definition: DebugInfoMetadata.h:3076
llvm::Triple::isWasm
bool isWasm() const
Tests whether the target is wasm (32- and 64-bit).
Definition: Triple.h:920
llvm::DwarfUnit::addConstantFPValue
void addConstantFPValue(DIE &Die, const ConstantFP *CFP)
Add constant value entry in variable DIE.
Definition: DwarfUnit.cpp:454
llvm::Triple::wasm64
@ wasm64
Definition: Triple.h:104
llvm::MCObjectFileInfo::getDwarfLineSection
MCSection * getDwarfLineSection() const
Definition: MCObjectFileInfo.h:274
llvm::SymbolCU
Helper used to pair up a symbol and its DWARF compile unit.
Definition: DwarfDebug.h:278
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:1453
llvm::DwarfCompileUnit::getUniqueID
unsigned getUniqueID() const
Definition: DwarfCompileUnit.h:117
llvm::DIELabel
A label DIE.
Definition: DIE.h:218
llvm::DwarfCompileUnit::updateSubprogramScopeDIEImpl
DIE & updateSubprogramScopeDIEImpl(const DISubprogram *SP, DIE *SPDie)
Definition: DwarfCompileUnit.cpp:453
TargetRegisterInfo.h
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::DIVariable::getType
DIType * getType() const
Definition: DebugInfoMetadata.h:2544
llvm::DIEUnit::getUnitDie
DIE & getUnitDie()
Definition: DIE.h:919
llvm::dwarf::LocationAtom
LocationAtom
Definition: Dwarf.h:138
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:708
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
llvm::RangeSpan::End
const MCSymbol * End
Definition: DwarfFile.h:38
llvm::DIFile
File.
Definition: DebugInfoMetadata.h:563
llvm::DbgVariable::getType
const DIType * getType() const
Definition: DwarfDebug.cpp:228
llvm::DwarfUnit::addDIEEntry
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
Definition: DwarfUnit.cpp:353
llvm::DbgVariable::getDebugLocListTagOffset
Optional< uint8_t > getDebugLocListTagOffset() const
Definition: DwarfDebug.h:178
llvm::MachineBasicBlock::sameSection
bool sameSection(const MachineBasicBlock *MBB) const
Returns true if this and MBB belong to the same section.
Definition: MachineBasicBlock.h:665
llvm::DwarfCompileUnit::addExpr
void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr)
Add a Dwarf expression attribute data and value.
Definition: DwarfCompileUnit.cpp:1543