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