LLVM 17.0.0git
DIBuilder.cpp
Go to the documentation of this file.
1//===--- DIBuilder.cpp - Debug Information Builder ------------------------===//
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 implements the DIBuilder.
10//
11//===----------------------------------------------------------------------===//
12
13#include "llvm/IR/DIBuilder.h"
14#include "LLVMContextImpl.h"
16#include "llvm/IR/Constants.h"
17#include "llvm/IR/DebugInfo.h"
18#include "llvm/IR/IRBuilder.h"
19#include "llvm/IR/Module.h"
21#include <optional>
22
23using namespace llvm;
24using namespace llvm::dwarf;
25
26DIBuilder::DIBuilder(Module &m, bool AllowUnresolvedNodes, DICompileUnit *CU)
27 : M(m), VMContext(M.getContext()), CUNode(CU), DeclareFn(nullptr),
28 ValueFn(nullptr), LabelFn(nullptr), AssignFn(nullptr),
29 AllowUnresolvedNodes(AllowUnresolvedNodes) {
30 if (CUNode) {
31 if (const auto &ETs = CUNode->getEnumTypes())
32 AllEnumTypes.assign(ETs.begin(), ETs.end());
33 if (const auto &RTs = CUNode->getRetainedTypes())
34 AllRetainTypes.assign(RTs.begin(), RTs.end());
35 if (const auto &GVs = CUNode->getGlobalVariables())
36 AllGVs.assign(GVs.begin(), GVs.end());
37 if (const auto &IMs = CUNode->getImportedEntities())
38 AllImportedModules.assign(IMs.begin(), IMs.end());
39 if (const auto &MNs = CUNode->getMacros())
40 AllMacrosPerParent.insert({nullptr, {MNs.begin(), MNs.end()}});
41 }
42}
43
44void DIBuilder::trackIfUnresolved(MDNode *N) {
45 if (!N)
46 return;
47 if (N->isResolved())
48 return;
49
50 assert(AllowUnresolvedNodes && "Cannot handle unresolved nodes");
51 UnresolvedNodes.emplace_back(N);
52}
53
55 MDTuple *Temp = SP->getRetainedNodes().get();
56 if (!Temp || !Temp->isTemporary())
57 return;
58
59 SmallVector<Metadata *, 16> RetainedNodes;
60
61 auto PV = PreservedVariables.find(SP);
62 if (PV != PreservedVariables.end())
63 RetainedNodes.append(PV->second.begin(), PV->second.end());
64
65 auto PL = PreservedLabels.find(SP);
66 if (PL != PreservedLabels.end())
67 RetainedNodes.append(PL->second.begin(), PL->second.end());
68
69 DINodeArray Node = getOrCreateArray(RetainedNodes);
70
71 TempMDTuple(Temp)->replaceAllUsesWith(Node.get());
72}
73
75 if (!CUNode) {
76 assert(!AllowUnresolvedNodes &&
77 "creating type nodes without a CU is not supported");
78 return;
79 }
80
81 if (!AllEnumTypes.empty())
83 VMContext, SmallVector<Metadata *, 16>(AllEnumTypes.begin(),
84 AllEnumTypes.end())));
85
86 SmallVector<Metadata *, 16> RetainValues;
87 // Declarations and definitions of the same type may be retained. Some
88 // clients RAUW these pairs, leaving duplicates in the retained types
89 // list. Use a set to remove the duplicates while we transform the
90 // TrackingVHs back into Values.
92 for (unsigned I = 0, E = AllRetainTypes.size(); I < E; I++)
93 if (RetainSet.insert(AllRetainTypes[I]).second)
94 RetainValues.push_back(AllRetainTypes[I]);
95
96 if (!RetainValues.empty())
97 CUNode->replaceRetainedTypes(MDTuple::get(VMContext, RetainValues));
98
99 for (auto *SP : AllSubprograms)
101 for (auto *N : RetainValues)
102 if (auto *SP = dyn_cast<DISubprogram>(N))
104
105 if (!AllGVs.empty())
106 CUNode->replaceGlobalVariables(MDTuple::get(VMContext, AllGVs));
107
108 if (!AllImportedModules.empty())
110 VMContext, SmallVector<Metadata *, 16>(AllImportedModules.begin(),
111 AllImportedModules.end())));
112
113 for (const auto &I : AllMacrosPerParent) {
114 // DIMacroNode's with nullptr parent are DICompileUnit direct children.
115 if (!I.first) {
116 CUNode->replaceMacros(MDTuple::get(VMContext, I.second.getArrayRef()));
117 continue;
118 }
119 // Otherwise, it must be a temporary DIMacroFile that need to be resolved.
120 auto *TMF = cast<DIMacroFile>(I.first);
122 TMF->getLine(), TMF->getFile(),
123 getOrCreateMacroArray(I.second.getArrayRef()));
124 replaceTemporary(llvm::TempDIMacroNode(TMF), MF);
125 }
126
127 // Now that all temp nodes have been replaced or deleted, resolve remaining
128 // cycles.
129 for (const auto &N : UnresolvedNodes)
130 if (N && !N->isResolved())
131 N->resolveCycles();
132 UnresolvedNodes.clear();
133
134 // Can't handle unresolved nodes anymore.
135 AllowUnresolvedNodes = false;
136}
137
138/// If N is compile unit return NULL otherwise return N.
140 if (!N || isa<DICompileUnit>(N))
141 return nullptr;
142 return cast<DIScope>(N);
143}
144
146 unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized,
147 StringRef Flags, unsigned RunTimeVer, StringRef SplitName,
149 bool SplitDebugInlining, bool DebugInfoForProfiling,
150 DICompileUnit::DebugNameTableKind NameTableKind, bool RangesBaseAddress,
151 StringRef SysRoot, StringRef SDK) {
152
153 assert(((Lang <= dwarf::DW_LANG_Ada2012 && Lang >= dwarf::DW_LANG_C89) ||
154 (Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
155 "Invalid Language tag");
156
157 assert(!CUNode && "Can only make one compile unit per DIBuilder instance");
159 VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
160 SplitName, Kind, nullptr, nullptr, nullptr, nullptr, nullptr, DWOId,
161 SplitDebugInlining, DebugInfoForProfiling, NameTableKind,
162 RangesBaseAddress, SysRoot, SDK);
163
164 // Create a named metadata so that it is easier to find cu in a module.
165 NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
166 NMD->addOperand(CUNode);
167 trackIfUnresolved(CUNode);
168 return CUNode;
169}
170
171static DIImportedEntity *
173 Metadata *NS, DIFile *File, unsigned Line, StringRef Name,
174 DINodeArray Elements,
175 SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
176 if (Line)
177 assert(File && "Source location has line number but no file");
178 unsigned EntitiesCount = C.pImpl->DIImportedEntitys.size();
179 auto *M = DIImportedEntity::get(C, Tag, Context, cast_or_null<DINode>(NS),
180 File, Line, Name, Elements);
181 if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
182 // A new Imported Entity was just added to the context.
183 // Add it to the Imported Modules list.
184 AllImportedModules.emplace_back(M);
185 return M;
186}
187
189 DINamespace *NS, DIFile *File,
190 unsigned Line,
191 DINodeArray Elements) {
192 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
193 Context, NS, File, Line, StringRef(), Elements,
194 AllImportedModules);
195}
196
199 DIFile *File, unsigned Line,
200 DINodeArray Elements) {
201 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
202 Context, NS, File, Line, StringRef(), Elements,
203 AllImportedModules);
204}
205
207 DIFile *File, unsigned Line,
208 DINodeArray Elements) {
209 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
210 Context, M, File, Line, StringRef(), Elements,
211 AllImportedModules);
212}
213
216 DIFile *File, unsigned Line,
217 StringRef Name, DINodeArray Elements) {
218 // Make sure to use the unique identifier based metadata reference for
219 // types that have one.
220 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_declaration,
221 Context, Decl, File, Line, Name, Elements,
222 AllImportedModules);
223}
224
226 std::optional<DIFile::ChecksumInfo<StringRef>> CS,
227 std::optional<StringRef> Source) {
228 return DIFile::get(VMContext, Filename, Directory, CS, Source);
229}
230
231DIMacro *DIBuilder::createMacro(DIMacroFile *Parent, unsigned LineNumber,
232 unsigned MacroType, StringRef Name,
234 assert(!Name.empty() && "Unable to create macro without name");
235 assert((MacroType == dwarf::DW_MACINFO_undef ||
236 MacroType == dwarf::DW_MACINFO_define) &&
237 "Unexpected macro type");
238 auto *M = DIMacro::get(VMContext, MacroType, LineNumber, Name, Value);
239 AllMacrosPerParent[Parent].insert(M);
240 return M;
241}
242
244 unsigned LineNumber, DIFile *File) {
246 LineNumber, File, DIMacroNodeArray())
247 .release();
248 AllMacrosPerParent[Parent].insert(MF);
249 // Add the new temporary DIMacroFile to the macro per parent map as a parent.
250 // This is needed to assure DIMacroFile with no children to have an entry in
251 // the map. Otherwise, it will not be resolved in DIBuilder::finalize().
252 AllMacrosPerParent.insert({MF, {}});
253 return MF;
254}
255
257 bool IsUnsigned) {
258 assert(!Name.empty() && "Unable to create enumerator without name");
259 return DIEnumerator::get(VMContext, APInt(64, Val, !IsUnsigned), IsUnsigned,
260 Name);
261}
262
264 assert(!Name.empty() && "Unable to create enumerator without name");
265 return DIEnumerator::get(VMContext, APInt(Value), Value.isUnsigned(), Name);
266}
267
269 assert(!Name.empty() && "Unable to create type without name");
270 return DIBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name);
271}
272
274 return createUnspecifiedType("decltype(nullptr)");
275}
276
278 unsigned Encoding,
279 DINode::DIFlags Flags) {
280 assert(!Name.empty() && "Unable to create type without name");
281 return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
282 0, Encoding, Flags);
283}
284
286 assert(!Name.empty() && "Unable to create type without name");
287 return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name,
288 SizeInBits, 0);
289}
290
292 DIVariable *StringLength,
293 DIExpression *StrLocationExp) {
294 assert(!Name.empty() && "Unable to create type without name");
295 return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name,
296 StringLength, nullptr, StrLocationExp, 0, 0, 0);
297}
298
300 DIExpression *StringLengthExp,
301 DIExpression *StrLocationExp) {
302 assert(!Name.empty() && "Unable to create type without name");
303 return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name, nullptr,
304 StringLengthExp, StrLocationExp, 0, 0, 0);
305}
306
308 return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, FromTy, 0,
309 0, 0, std::nullopt, DINode::FlagZero);
310}
311
314 uint32_t AlignInBits,
315 std::optional<unsigned> DWARFAddressSpace,
316 StringRef Name, DINodeArray Annotations) {
317 // FIXME: Why is there a name here?
318 return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
319 nullptr, 0, nullptr, PointeeTy, SizeInBits,
320 AlignInBits, 0, DWARFAddressSpace, DINode::FlagZero,
321 nullptr, Annotations);
322}
323
325 DIType *Base,
326 uint64_t SizeInBits,
327 uint32_t AlignInBits,
328 DINode::DIFlags Flags) {
329 return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
330 nullptr, 0, nullptr, PointeeTy, SizeInBits,
331 AlignInBits, 0, std::nullopt, Flags, Base);
332}
333
336 uint32_t AlignInBits,
337 std::optional<unsigned> DWARFAddressSpace) {
338 assert(RTy && "Unable to create reference type");
339 return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, RTy,
340 SizeInBits, AlignInBits, 0, DWARFAddressSpace,
341 DINode::FlagZero);
342}
343
345 DIFile *File, unsigned LineNo,
346 DIScope *Context, uint32_t AlignInBits,
347 DINode::DIFlags Flags,
348 DINodeArray Annotations) {
349 return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
350 LineNo, getNonCompileUnitScope(Context), Ty, 0,
351 AlignInBits, 0, std::nullopt, Flags, nullptr,
353}
354
356 assert(Ty && "Invalid type!");
357 assert(FriendTy && "Invalid friend type!");
358 return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0, Ty,
359 FriendTy, 0, 0, 0, std::nullopt, DINode::FlagZero);
360}
361
363 uint64_t BaseOffset,
364 uint32_t VBPtrOffset,
365 DINode::DIFlags Flags) {
366 assert(Ty && "Unable to create inheritance");
368 ConstantInt::get(IntegerType::get(VMContext, 32), VBPtrOffset));
369 return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
370 0, Ty, BaseTy, 0, 0, BaseOffset, std::nullopt,
371 Flags, ExtraData);
372}
373
375 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
376 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
377 DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations) {
378 return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
379 LineNumber, getNonCompileUnitScope(Scope), Ty,
380 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
381 Flags, nullptr, Annotations);
382}
383
385 if (C)
387 return nullptr;
388}
389
391 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
392 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
393 Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty) {
394 return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
395 LineNumber, getNonCompileUnitScope(Scope), Ty,
396 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
397 Flags, getConstantOrNull(Discriminant));
398}
399
401 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
402 uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits,
403 DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations) {
404 Flags |= DINode::FlagBitField;
405 return DIDerivedType::get(
406 VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
407 getNonCompileUnitScope(Scope), Ty, SizeInBits, /*AlignInBits=*/0,
408 OffsetInBits, std::nullopt, Flags,
410 StorageOffsetInBits)),
412}
413
416 unsigned LineNumber, DIType *Ty,
418 uint32_t AlignInBits) {
419 Flags |= DINode::FlagStaticMember;
420 return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
421 LineNumber, getNonCompileUnitScope(Scope), Ty, 0,
422 AlignInBits, 0, std::nullopt, Flags,
423 getConstantOrNull(Val));
424}
425
427DIBuilder::createObjCIVar(StringRef Name, DIFile *File, unsigned LineNumber,
428 uint64_t SizeInBits, uint32_t AlignInBits,
429 uint64_t OffsetInBits, DINode::DIFlags Flags,
430 DIType *Ty, MDNode *PropertyNode) {
431 return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
432 LineNumber, getNonCompileUnitScope(File), Ty,
433 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
434 Flags, PropertyNode);
435}
436
439 StringRef GetterName, StringRef SetterName,
440 unsigned PropertyAttributes, DIType *Ty) {
441 return DIObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
442 SetterName, PropertyAttributes, Ty);
443}
444
447 DIType *Ty, bool isDefault) {
448 assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
449 return DITemplateTypeParameter::get(VMContext, Name, Ty, isDefault);
450}
451
454 DIScope *Context, StringRef Name, DIType *Ty,
455 bool IsDefault, Metadata *MD) {
456 assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
457 return DITemplateValueParameter::get(VMContext, Tag, Name, Ty, IsDefault, MD);
458}
459
462 DIType *Ty, bool isDefault,
463 Constant *Val) {
465 VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
466 isDefault, getConstantOrNull(Val));
467}
468
471 DIType *Ty, StringRef Val,
472 bool IsDefault) {
474 VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
475 IsDefault, MDString::get(VMContext, Val));
476}
477
480 DIType *Ty, DINodeArray Val) {
482 VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
483 false, Val.get());
484}
485
487 DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
488 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
489 DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
490 DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
491 assert((!Context || isa<DIScope>(Context)) &&
492 "createClassType should be called with a valid Context");
493
494 auto *R = DICompositeType::get(
495 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
496 getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits,
497 OffsetInBits, Flags, Elements, 0, VTableHolder,
498 cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
499 trackIfUnresolved(R);
500 return R;
501}
502
504 DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
505 uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
506 DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang,
507 DIType *VTableHolder, StringRef UniqueIdentifier) {
508 auto *R = DICompositeType::get(
509 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
510 getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits, 0,
511 Flags, Elements, RunTimeLang, VTableHolder, nullptr, UniqueIdentifier);
512 trackIfUnresolved(R);
513 return R;
514}
515
517 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
518 uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
519 DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
520 auto *R = DICompositeType::get(
521 VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
522 getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
523 Elements, RunTimeLang, nullptr, nullptr, UniqueIdentifier);
524 trackIfUnresolved(R);
525 return R;
526}
527
530 unsigned LineNumber, uint64_t SizeInBits,
531 uint32_t AlignInBits, DINode::DIFlags Flags,
532 DIDerivedType *Discriminator, DINodeArray Elements,
533 StringRef UniqueIdentifier) {
534 auto *R = DICompositeType::get(
535 VMContext, dwarf::DW_TAG_variant_part, Name, File, LineNumber,
536 getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
537 Elements, 0, nullptr, nullptr, UniqueIdentifier, Discriminator);
538 trackIfUnresolved(R);
539 return R;
540}
541
543 DINode::DIFlags Flags,
544 unsigned CC) {
545 return DISubroutineType::get(VMContext, Flags, CC, ParameterTypes);
546}
547
549 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
550 uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
551 DIType *UnderlyingType, StringRef UniqueIdentifier, bool IsScoped) {
552 auto *CTy = DICompositeType::get(
553 VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
554 getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0,
555 IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0, nullptr,
556 nullptr, UniqueIdentifier);
557 AllEnumTypes.emplace_back(CTy);
558 trackIfUnresolved(CTy);
559 return CTy;
560}
561
563 DIFile *File, unsigned LineNo,
564 uint64_t SizeInBits,
565 uint32_t AlignInBits, DIType *Ty) {
566 auto *R =
567 DIDerivedType::get(VMContext, dwarf::DW_TAG_set_type, Name, File, LineNo,
568 getNonCompileUnitScope(Scope), Ty, SizeInBits,
569 AlignInBits, 0, std::nullopt, DINode::FlagZero);
570 trackIfUnresolved(R);
571 return R;
572}
573
576 DINodeArray Subscripts,
581 auto *R = DICompositeType::get(
582 VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0, nullptr, Ty, Size,
583 AlignInBits, 0, DINode::FlagZero, Subscripts, 0, nullptr, nullptr, "",
584 nullptr,
585 isa<DIExpression *>(DL) ? (Metadata *)cast<DIExpression *>(DL)
586 : (Metadata *)cast<DIVariable *>(DL),
587 isa<DIExpression *>(AS) ? (Metadata *)cast<DIExpression *>(AS)
588 : (Metadata *)cast<DIVariable *>(AS),
589 isa<DIExpression *>(AL) ? (Metadata *)cast<DIExpression *>(AL)
590 : (Metadata *)cast<DIVariable *>(AL),
591 isa<DIExpression *>(RK) ? (Metadata *)cast<DIExpression *>(RK)
592 : (Metadata *)cast<DIVariable *>(RK));
593 trackIfUnresolved(R);
594 return R;
595}
596
598 uint32_t AlignInBits, DIType *Ty,
599 DINodeArray Subscripts) {
600 auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
601 nullptr, 0, nullptr, Ty, Size, AlignInBits, 0,
602 DINode::FlagVector, Subscripts, 0, nullptr);
603 trackIfUnresolved(R);
604 return R;
605}
606
608 auto NewSP = SP->cloneWithFlags(SP->getFlags() | DINode::FlagArtificial);
609 return MDNode::replaceWithDistinct(std::move(NewSP));
610}
611
613 DINode::DIFlags FlagsToSet) {
614 auto NewTy = Ty->cloneWithFlags(Ty->getFlags() | FlagsToSet);
615 return MDNode::replaceWithUniqued(std::move(NewTy));
616}
617
619 // FIXME: Restrict this to the nodes where it's valid.
620 if (Ty->isArtificial())
621 return Ty;
622 return createTypeWithFlags(Ty, DINode::FlagArtificial);
623}
624
626 // FIXME: Restrict this to the nodes where it's valid.
627 if (Ty->isObjectPointer())
628 return Ty;
629 DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
630 return createTypeWithFlags(Ty, Flags);
631}
632
634 assert(T && "Expected non-null type");
635 assert((isa<DIType>(T) || (isa<DISubprogram>(T) &&
636 cast<DISubprogram>(T)->isDefinition() == false)) &&
637 "Expected type or subprogram declaration");
638 AllRetainTypes.emplace_back(T);
639}
640
642
645 DIFile *F, unsigned Line, unsigned RuntimeLang,
646 uint64_t SizeInBits, uint32_t AlignInBits,
647 StringRef UniqueIdentifier) {
648 // FIXME: Define in terms of createReplaceableForwardDecl() by calling
649 // replaceWithUniqued().
651 VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
652 SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang,
653 nullptr, nullptr, UniqueIdentifier);
654 trackIfUnresolved(RetTy);
655 return RetTy;
656}
657
659 unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
660 unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,
661 DINode::DIFlags Flags, StringRef UniqueIdentifier,
662 DINodeArray Annotations) {
663 auto *RetTy =
665 VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
666 SizeInBits, AlignInBits, 0, Flags, nullptr, RuntimeLang, nullptr,
667 nullptr, UniqueIdentifier, nullptr, nullptr, nullptr, nullptr,
668 nullptr, Annotations)
669 .release();
670 trackIfUnresolved(RetTy);
671 return RetTy;
672}
673
675 return MDTuple::get(VMContext, Elements);
676}
677
678DIMacroNodeArray
680 return MDTuple::get(VMContext, Elements);
681}
682
685 for (Metadata *E : Elements) {
686 if (isa_and_nonnull<MDNode>(E))
687 Elts.push_back(cast<DIType>(E));
688 else
689 Elts.push_back(E);
690 }
691 return DITypeRefArray(MDNode::get(VMContext, Elts));
692}
693
695 auto *LB = ConstantAsMetadata::get(
697 auto *CountNode = ConstantAsMetadata::get(
698 ConstantInt::getSigned(Type::getInt64Ty(VMContext), Count));
699 return DISubrange::get(VMContext, CountNode, LB, nullptr, nullptr);
700}
701
703 auto *LB = ConstantAsMetadata::get(
705 return DISubrange::get(VMContext, CountNode, LB, nullptr, nullptr);
706}
707
709 Metadata *UB, Metadata *Stride) {
710 return DISubrange::get(VMContext, CountNode, LB, UB, Stride);
711}
712
716 auto ConvToMetadata = [&](DIGenericSubrange::BoundType Bound) -> Metadata * {
717 return isa<DIExpression *>(Bound) ? (Metadata *)cast<DIExpression *>(Bound)
718 : (Metadata *)cast<DIVariable *>(Bound);
719 };
720 return DIGenericSubrange::get(VMContext, ConvToMetadata(CountNode),
721 ConvToMetadata(LB), ConvToMetadata(UB),
722 ConvToMetadata(Stride));
723}
724
725static void checkGlobalVariableScope(DIScope *Context) {
726#ifndef NDEBUG
727 if (auto *CT =
728 dyn_cast_or_null<DICompositeType>(getNonCompileUnitScope(Context)))
729 assert(CT->getIdentifier().empty() &&
730 "Context of a global variable should not be a type with identifier");
731#endif
732}
733
736 unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, bool isDefined,
737 DIExpression *Expr, MDNode *Decl, MDTuple *TemplateParams,
738 uint32_t AlignInBits, DINodeArray Annotations) {
740
742 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
743 LineNumber, Ty, IsLocalToUnit, isDefined,
744 cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
746 if (!Expr)
747 Expr = createExpression();
748 auto *N = DIGlobalVariableExpression::get(VMContext, GV, Expr);
749 AllGVs.push_back(N);
750 return N;
751}
752
755 unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, MDNode *Decl,
756 MDTuple *TemplateParams, uint32_t AlignInBits) {
758
760 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
761 LineNumber, Ty, IsLocalToUnit, false,
762 cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
763 nullptr)
764 .release();
765}
766
768 LLVMContext &VMContext,
769 DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> &PreservedVariables,
770 DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
771 unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags,
772 uint32_t AlignInBits, DINodeArray Annotations = nullptr) {
773 // FIXME: Why getNonCompileUnitScope()?
774 // FIXME: Why is "!Context" okay here?
775 // FIXME: Why doesn't this check for a subprogram or lexical block (AFAICT
776 // the only valid scopes)?
778
780 VMContext, cast_or_null<DILocalScope>(Context), Name, File, LineNo, Ty,
781 ArgNo, Flags, AlignInBits, Annotations);
782 if (AlwaysPreserve) {
783 // The optimizer may remove local variables. If there is an interest
784 // to preserve variable info in such situation then stash it in a
785 // named mdnode.
786 DISubprogram *Fn = getDISubprogram(Scope);
787 assert(Fn && "Missing subprogram for local variable");
788 PreservedVariables[Fn].emplace_back(Node);
789 }
790 return Node;
791}
792
794 DIFile *File, unsigned LineNo,
795 DIType *Ty, bool AlwaysPreserve,
796 DINode::DIFlags Flags,
797 uint32_t AlignInBits) {
798 return createLocalVariable(VMContext, PreservedVariables, Scope, Name,
799 /* ArgNo */ 0, File, LineNo, Ty, AlwaysPreserve,
800 Flags, AlignInBits);
801}
802
804 DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
805 unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags,
806 DINodeArray Annotations) {
807 assert(ArgNo && "Expected non-zero argument number for parameter");
808 return createLocalVariable(VMContext, PreservedVariables, Scope, Name, ArgNo,
809 File, LineNo, Ty, AlwaysPreserve, Flags,
810 /*AlignInBits=*/0, Annotations);
811}
812
814 unsigned LineNo, bool AlwaysPreserve) {
816
817 auto *Node = DILabel::get(VMContext, cast_or_null<DILocalScope>(Context),
818 Name, File, LineNo);
819
820 if (AlwaysPreserve) {
821 /// The optimizer may remove labels. If there is an interest
822 /// to preserve label info in such situation then append it to
823 /// the list of retained nodes of the DISubprogram.
824 DISubprogram *Fn = getDISubprogram(Scope);
825 assert(Fn && "Missing subprogram for label");
826 PreservedLabels[Fn].emplace_back(Node);
827 }
828 return Node;
829}
830
832 return DIExpression::get(VMContext, Addr);
833}
834
835template <class... Ts>
836static DISubprogram *getSubprogram(bool IsDistinct, Ts &&...Args) {
837 if (IsDistinct)
838 return DISubprogram::getDistinct(std::forward<Ts>(Args)...);
839 return DISubprogram::get(std::forward<Ts>(Args)...);
840}
841
844 unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
846 DITemplateParameterArray TParams, DISubprogram *Decl,
847 DITypeArray ThrownTypes, DINodeArray Annotations,
848 StringRef TargetFuncName) {
849 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
850 auto *Node = getSubprogram(
851 /*IsDistinct=*/IsDefinition, VMContext, getNonCompileUnitScope(Context),
852 Name, LinkageName, File, LineNo, Ty, ScopeLine, nullptr, 0, 0, Flags,
853 SPFlags, IsDefinition ? CUNode : nullptr, TParams, Decl,
854 MDTuple::getTemporary(VMContext, std::nullopt).release(), ThrownTypes,
855 Annotations, TargetFuncName);
856
857 if (IsDefinition)
858 AllSubprograms.push_back(Node);
859 trackIfUnresolved(Node);
860 return Node;
861}
862
865 unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
867 DITemplateParameterArray TParams, DISubprogram *Decl,
868 DITypeArray ThrownTypes) {
869 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
871 Name, LinkageName, File, LineNo, Ty,
872 ScopeLine, nullptr, 0, 0, Flags, SPFlags,
873 IsDefinition ? CUNode : nullptr, TParams,
874 Decl, nullptr, ThrownTypes)
875 .release();
876}
877
880 unsigned LineNo, DISubroutineType *Ty, unsigned VIndex, int ThisAdjustment,
881 DIType *VTableHolder, DINode::DIFlags Flags,
882 DISubprogram::DISPFlags SPFlags, DITemplateParameterArray TParams,
883 DITypeArray ThrownTypes) {
885 "Methods should have both a Context and a context that isn't "
886 "the compile unit.");
887 // FIXME: Do we want to use different scope/lines?
888 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
889 auto *SP = getSubprogram(
890 /*IsDistinct=*/IsDefinition, VMContext, cast<DIScope>(Context), Name,
891 LinkageName, F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
892 Flags, SPFlags, IsDefinition ? CUNode : nullptr, TParams, nullptr,
893 nullptr, ThrownTypes);
894
895 if (IsDefinition)
896 AllSubprograms.push_back(SP);
897 trackIfUnresolved(SP);
898 return SP;
899}
900
902 DIGlobalVariable *Decl,
903 StringRef Name, DIFile *File,
904 unsigned LineNo) {
905 return DICommonBlock::get(VMContext, Scope, Decl, Name, File, LineNo);
906}
907
909 bool ExportSymbols) {
910
911 // It is okay to *not* make anonymous top-level namespaces distinct, because
912 // all nodes that have an anonymous namespace as their parent scope are
913 // guaranteed to be unique and/or are linked to their containing
914 // DICompileUnit. This decision is an explicit tradeoff of link time versus
915 // memory usage versus code simplicity and may get revisited in the future.
916 return DINamespace::get(VMContext, getNonCompileUnitScope(Scope), Name,
917 ExportSymbols);
918}
919
921 StringRef ConfigurationMacros,
922 StringRef IncludePath, StringRef APINotesFile,
923 DIFile *File, unsigned LineNo, bool IsDecl) {
924 return DIModule::get(VMContext, File, getNonCompileUnitScope(Scope), Name,
925 ConfigurationMacros, IncludePath, APINotesFile, LineNo,
926 IsDecl);
927}
928
930 DIFile *File,
931 unsigned Discriminator) {
932 return DILexicalBlockFile::get(VMContext, Scope, File, Discriminator);
933}
934
936 unsigned Line, unsigned Col) {
937 // Make these distinct, to avoid merging two lexical blocks on the same
938 // file/line/column.
940 File, Line, Col);
941}
942
943Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
944 DIExpression *Expr, const DILocation *DL,
945 Instruction *InsertBefore) {
946 return insertDeclare(Storage, VarInfo, Expr, DL, InsertBefore->getParent(),
947 InsertBefore);
948}
949
950Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
951 DIExpression *Expr, const DILocation *DL,
952 BasicBlock *InsertAtEnd) {
953 // If this block already has a terminator then insert this intrinsic before
954 // the terminator. Otherwise, put it at the end of the block.
955 Instruction *InsertBefore = InsertAtEnd->getTerminator();
956 return insertDeclare(Storage, VarInfo, Expr, DL, InsertAtEnd, InsertBefore);
957}
958
961 DILocalVariable *SrcVar, DIExpression *ValExpr,
962 Value *Addr, DIExpression *AddrExpr,
963 const DILocation *DL) {
964 LLVMContext &Ctx = LinkedInstr->getContext();
965 Module *M = LinkedInstr->getModule();
966 if (!AssignFn)
967 AssignFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_assign);
968
969 auto *Link = LinkedInstr->getMetadata(LLVMContext::MD_DIAssignID);
970 assert(Link && "Linked instruction must have DIAssign metadata attached");
971
972 std::array<Value *, 6> Args = {
974 MetadataAsValue::get(Ctx, SrcVar),
975 MetadataAsValue::get(Ctx, ValExpr),
976 MetadataAsValue::get(Ctx, Link),
978 MetadataAsValue::get(Ctx, AddrExpr),
979 };
980
981 IRBuilder<> B(Ctx);
982 B.SetCurrentDebugLocation(DL);
983
984 auto *DVI = cast<DbgAssignIntrinsic>(B.CreateCall(AssignFn, Args));
985 DVI->insertAfter(LinkedInstr);
986 return DVI;
987}
988
989Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
990 Instruction *InsertBefore) {
991 return insertLabel(LabelInfo, DL,
992 InsertBefore ? InsertBefore->getParent() : nullptr,
993 InsertBefore);
994}
995
996Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
997 BasicBlock *InsertAtEnd) {
998 return insertLabel(LabelInfo, DL, InsertAtEnd, nullptr);
999}
1000
1001Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
1002 DILocalVariable *VarInfo,
1003 DIExpression *Expr,
1004 const DILocation *DL,
1005 Instruction *InsertBefore) {
1006 return insertDbgValueIntrinsic(
1007 V, VarInfo, Expr, DL, InsertBefore ? InsertBefore->getParent() : nullptr,
1008 InsertBefore);
1009}
1010
1011Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
1012 DILocalVariable *VarInfo,
1013 DIExpression *Expr,
1014 const DILocation *DL,
1015 BasicBlock *InsertAtEnd) {
1016 return insertDbgValueIntrinsic(V, VarInfo, Expr, DL, InsertAtEnd, nullptr);
1017}
1018
1019/// Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics.
1020/// This abstracts over the various ways to specify an insert position.
1021static void initIRBuilder(IRBuilder<> &Builder, const DILocation *DL,
1022 BasicBlock *InsertBB, Instruction *InsertBefore) {
1023 if (InsertBefore)
1024 Builder.SetInsertPoint(InsertBefore);
1025 else if (InsertBB)
1026 Builder.SetInsertPoint(InsertBB);
1027 Builder.SetCurrentDebugLocation(DL);
1028}
1029
1031 assert(V && "no value passed to dbg intrinsic");
1032 return MetadataAsValue::get(VMContext, ValueAsMetadata::get(V));
1033}
1034
1036 return Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
1037}
1038
1039Instruction *DIBuilder::insertDbgValueIntrinsic(
1040 llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr,
1041 const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore) {
1042 if (!ValueFn)
1043 ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
1044 return insertDbgIntrinsic(ValueFn, Val, VarInfo, Expr, DL, InsertBB,
1045 InsertBefore);
1046}
1047
1048Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
1049 DIExpression *Expr, const DILocation *DL,
1050 BasicBlock *InsertBB,
1051 Instruction *InsertBefore) {
1052 assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare");
1053 assert(DL && "Expected debug loc");
1054 assert(DL->getScope()->getSubprogram() ==
1055 VarInfo->getScope()->getSubprogram() &&
1056 "Expected matching subprograms");
1057 if (!DeclareFn)
1058 DeclareFn = getDeclareIntrin(M);
1059
1060 trackIfUnresolved(VarInfo);
1061 trackIfUnresolved(Expr);
1062 Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, Storage),
1063 MetadataAsValue::get(VMContext, VarInfo),
1064 MetadataAsValue::get(VMContext, Expr)};
1065
1066 IRBuilder<> B(DL->getContext());
1067 initIRBuilder(B, DL, InsertBB, InsertBefore);
1068 return B.CreateCall(DeclareFn, Args);
1069}
1070
1071Instruction *DIBuilder::insertDbgIntrinsic(llvm::Function *IntrinsicFn,
1072 Value *V, DILocalVariable *VarInfo,
1073 DIExpression *Expr,
1074 const DILocation *DL,
1075 BasicBlock *InsertBB,
1076 Instruction *InsertBefore) {
1077 assert(IntrinsicFn && "must pass a non-null intrinsic function");
1078 assert(V && "must pass a value to a dbg intrinsic");
1079 assert(VarInfo &&
1080 "empty or invalid DILocalVariable* passed to debug intrinsic");
1081 assert(DL && "Expected debug loc");
1082 assert(DL->getScope()->getSubprogram() ==
1083 VarInfo->getScope()->getSubprogram() &&
1084 "Expected matching subprograms");
1085
1086 trackIfUnresolved(VarInfo);
1087 trackIfUnresolved(Expr);
1088 Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, V),
1089 MetadataAsValue::get(VMContext, VarInfo),
1090 MetadataAsValue::get(VMContext, Expr)};
1091
1092 IRBuilder<> B(DL->getContext());
1093 initIRBuilder(B, DL, InsertBB, InsertBefore);
1094 return B.CreateCall(IntrinsicFn, Args);
1095}
1096
1097Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
1098 BasicBlock *InsertBB,
1099 Instruction *InsertBefore) {
1100 assert(LabelInfo && "empty or invalid DILabel* passed to dbg.label");
1101 assert(DL && "Expected debug loc");
1102 assert(DL->getScope()->getSubprogram() ==
1103 LabelInfo->getScope()->getSubprogram() &&
1104 "Expected matching subprograms");
1105 if (!LabelFn)
1106 LabelFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_label);
1107
1108 trackIfUnresolved(LabelInfo);
1109 Value *Args[] = {MetadataAsValue::get(VMContext, LabelInfo)};
1110
1111 IRBuilder<> B(DL->getContext());
1112 initIRBuilder(B, DL, InsertBB, InsertBefore);
1113 return B.CreateCall(LabelFn, Args);
1114}
1115
1117 {
1119 N->replaceVTableHolder(VTableHolder);
1120 T = N.get();
1121 }
1122
1123 // If this didn't create a self-reference, just return.
1124 if (T != VTableHolder)
1125 return;
1126
1127 // Look for unresolved operands. T will drop RAUW support, orphaning any
1128 // cycles underneath it.
1129 if (T->isResolved())
1130 for (const MDOperand &O : T->operands())
1131 if (auto *N = dyn_cast_or_null<MDNode>(O))
1132 trackIfUnresolved(N);
1133}
1134
1135void DIBuilder::replaceArrays(DICompositeType *&T, DINodeArray Elements,
1136 DINodeArray TParams) {
1137 {
1139 if (Elements)
1140 N->replaceElements(Elements);
1141 if (TParams)
1142 N->replaceTemplateParams(DITemplateParameterArray(TParams));
1143 T = N.get();
1144 }
1145
1146 // If T isn't resolved, there's no problem.
1147 if (!T->isResolved())
1148 return;
1149
1150 // If T is resolved, it may be due to a self-reference cycle. Track the
1151 // arrays explicitly if they're unresolved, or else the cycles will be
1152 // orphaned.
1153 if (Elements)
1154 trackIfUnresolved(Elements.get());
1155 if (TParams)
1156 trackIfUnresolved(TParams.get());
1157}
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
assume Assume Builder
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static Function * getDeclareIntrin(Module &M)
Definition: DIBuilder.cpp:1035
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, DIFile *File, unsigned Line, StringRef Name, DINodeArray Elements, SmallVectorImpl< TrackingMDNodeRef > &AllImportedModules)
Definition: DIBuilder.cpp:172
static DIType * createTypeWithFlags(const DIType *Ty, DINode::DIFlags FlagsToSet)
Definition: DIBuilder.cpp:612
static DIScope * getNonCompileUnitScope(DIScope *N)
If N is compile unit return NULL otherwise return N.
Definition: DIBuilder.cpp:139
static void checkGlobalVariableScope(DIScope *Context)
Definition: DIBuilder.cpp:725
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&...Args)
Definition: DIBuilder.cpp:836
static ConstantAsMetadata * getConstantOrNull(Constant *C)
Definition: DIBuilder.cpp:384
static DITemplateValueParameter * createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag, DIScope *Context, StringRef Name, DIType *Ty, bool IsDefault, Metadata *MD)
Definition: DIBuilder.cpp:453
static DILocalVariable * createLocalVariable(LLVMContext &VMContext, DenseMap< MDNode *, SmallVector< TrackingMDNodeRef, 1 > > &PreservedVariables, DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags, uint32_t AlignInBits, DINodeArray Annotations=nullptr)
Definition: DIBuilder.cpp:767
static Value * getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V)
Definition: DIBuilder.cpp:1030
static void initIRBuilder(IRBuilder<> &Builder, const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore)
Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics.
Definition: DIBuilder.cpp:1021
return RetTy
This file contains constants used for implementing Dwarf debug support.
uint64_t Addr
std::string Name
uint64_t Size
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
Module.h This file contains the declarations for the Module class.
LLVMContext & Context
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
@ Flags
Definition: TextStubV5.cpp:93
Class for arbitrary precision integers.
Definition: APInt.h:75
An arbitrary precision integer that knows its signedness.
Definition: APSInt.h:23
Annotations lets you mark points and ranges inside source code, for tests:
Definition: Annotations.h:53
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
LLVM Basic Block Representation.
Definition: BasicBlock.h:56
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Definition: BasicBlock.h:127
static ConstantAsMetadata * get(Constant *C)
Definition: Metadata.h:419
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Definition: Constants.cpp:888
static ConstantInt * getSigned(IntegerType *Ty, int64_t V)
Return a ConstantInt with the specified value for the specified type.
Definition: Constants.h:114
This is an important base class in LLVM.
Definition: Constant.h:41
Basic type, like 'int' or 'float'.
DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
Definition: DIBuilder.cpp:641
DIGlobalVariable * createTempGlobalVariableFwdDecl(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0)
Identical to createGlobalVariable except that the resulting DbgNode is temporary and meant to be RAUW...
Definition: DIBuilder.cpp:753
DITemplateValueParameter * createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val, bool IsDefault=false)
Create debugging information for a template template parameter.
Definition: DIBuilder.cpp:470
DIDerivedType * createBitFieldMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
Create debugging information entry for a bit field member.
Definition: DIBuilder.cpp:400
NodeTy * replaceTemporary(TempMDNode &&N, NodeTy *Replacement)
Replace a temporary node.
Definition: DIBuilder.h:1006
DIDerivedType * createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagZero, DINodeArray Annotations=nullptr)
Create debugging information entry for a typedef.
Definition: DIBuilder.cpp:344
void finalize()
Construct any deferred debug info descriptors.
Definition: DIBuilder.cpp:74
DbgAssignIntrinsic * insertDbgAssign(Instruction *LinkedInstr, Value *Val, DILocalVariable *SrcVar, DIExpression *ValExpr, Value *Addr, DIExpression *AddrExpr, const DILocation *DL)
Insert a new llvm.dbg.assign intrinsic call.
Definition: DIBuilder.cpp:960
DISubroutineType * createSubroutineType(DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
Definition: DIBuilder.cpp:542
DIMacro * createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType, StringRef Name, StringRef Value=StringRef())
Create debugging information entry for a macro.
Definition: DIBuilder.cpp:231
DIDerivedType * createInheritance(DIType *Ty, DIType *BaseTy, uint64_t BaseOffset, uint32_t VBPtrOffset, DINode::DIFlags Flags)
Create debugging information entry to establish inheritance relationship between two types.
Definition: DIBuilder.cpp:362
DIDerivedType * createVariantMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty)
Create debugging information entry for a variant.
Definition: DIBuilder.cpp:390
DILexicalBlockFile * createLexicalBlockFile(DIScope *Scope, DIFile *File, unsigned Discriminator=0)
This creates a descriptor for a lexical block with a new file attached.
Definition: DIBuilder.cpp:929
DIDerivedType * createStaticMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, DINode::DIFlags Flags, Constant *Val, uint32_t AlignInBits=0)
Create debugging information entry for a C++ static data member.
Definition: DIBuilder.cpp:415
void finalizeSubprogram(DISubprogram *SP)
Finalize a specific subprogram - no new variables may be added to this subprogram afterwards.
Definition: DIBuilder.cpp:54
DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
Definition: DIBuilder.cpp:307
DICompileUnit * createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized, StringRef Flags, unsigned RV, StringRef SplitName=StringRef(), DICompileUnit::DebugEmissionKind Kind=DICompileUnit::DebugEmissionKind::FullDebug, uint64_t DWOId=0, bool SplitDebugInlining=true, bool DebugInfoForProfiling=false, DICompileUnit::DebugNameTableKind NameTableKind=DICompileUnit::DebugNameTableKind::Default, bool RangesBaseAddress=false, StringRef SysRoot={}, StringRef SDK={})
A CompileUnit provides an anchor for all debugging information generated during this instance of comp...
Definition: DIBuilder.cpp:145
DISubprogram * createTempFunctionFwdDecl(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr)
Identical to createFunction, except that the resulting DbgNode is meant to be RAUWed.
Definition: DIBuilder.cpp:863
DIDerivedType * createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, MDNode *PropertyNode)
Create debugging information entry for Objective-C instance variable.
Definition: DIBuilder.cpp:427
static DIType * createArtificialType(DIType *Ty)
Create a uniqued clone of Ty with FlagArtificial set.
Definition: DIBuilder.cpp:618
DICompositeType * createStructType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang=0, DIType *VTableHolder=nullptr, StringRef UniqueIdentifier="")
Create debugging information entry for a struct.
Definition: DIBuilder.cpp:503
DICompositeType * createVectorType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
Create debugging information entry for a vector type.
Definition: DIBuilder.cpp:597
static DIType * createObjectPointerType(DIType *Ty)
Create a uniqued clone of Ty with FlagObjectPointer and FlagArtificial set.
Definition: DIBuilder.cpp:625
DILabel * createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, bool AlwaysPreserve=false)
Create a new descriptor for an label.
Definition: DIBuilder.cpp:813
DINamespace * createNameSpace(DIScope *Scope, StringRef Name, bool ExportSymbols)
This creates new descriptor for a namespace with the specified parent scope.
Definition: DIBuilder.cpp:908
DIStringType * createStringType(StringRef Name, uint64_t SizeInBits)
Create debugging information entry for a string type.
Definition: DIBuilder.cpp:285
DISubprogram * createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr, DINodeArray Annotations=nullptr, StringRef TargetFuncName="")
Create a new descriptor for the specified subprogram.
Definition: DIBuilder.cpp:842
DILexicalBlock * createLexicalBlock(DIScope *Scope, DIFile *File, unsigned Line, unsigned Col)
This creates a descriptor for a lexical block with the specified parent context.
Definition: DIBuilder.cpp:935
DICompositeType * createUnionType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DINodeArray Elements, unsigned RunTimeLang=0, StringRef UniqueIdentifier="")
Create debugging information entry for an union.
Definition: DIBuilder.cpp:516
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
Definition: DIBuilder.cpp:679
DIDerivedType * createSetType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, DIType *Ty)
Create debugging information entry for a set.
Definition: DIBuilder.cpp:562
void replaceVTableHolder(DICompositeType *&T, DIType *VTableHolder)
Replace the vtable holder in the given type.
Definition: DIBuilder.cpp:1116
DIBasicType * createNullPtrType()
Create C++11 nullptr type.
Definition: DIBuilder.cpp:273
DICommonBlock * createCommonBlock(DIScope *Scope, DIGlobalVariable *decl, StringRef Name, DIFile *File, unsigned LineNo)
Create common block entry for a Fortran common block.
Definition: DIBuilder.cpp:901
DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
Definition: DIBuilder.cpp:355
void retainType(DIScope *T)
Retain DIScope* in a module even if it is not referenced through debug info anchors.
Definition: DIBuilder.cpp:633
DIDerivedType * createPointerType(DIType *PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits=0, std::optional< unsigned > DWARFAddressSpace=std::nullopt, StringRef Name="", DINodeArray Annotations=nullptr)
Create debugging information entry for a pointer.
Definition: DIBuilder.cpp:313
DIExpression * createExpression(ArrayRef< uint64_t > Addr=std::nullopt)
Create a new descriptor for the specified variable which has a complex address expression for its add...
Definition: DIBuilder.cpp:831
DITemplateValueParameter * createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
Create debugging information for a template parameter pack.
Definition: DIBuilder.cpp:479
DIGlobalVariableExpression * createGlobalVariableExpression(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined=true, DIExpression *Expr=nullptr, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0, DINodeArray Annotations=nullptr)
Create a new descriptor for the specified variable.
Definition: DIBuilder.cpp:734
DICompositeType * createEnumerationType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier="", bool IsScoped=false)
Create debugging information entry for an enumeration.
Definition: DIBuilder.cpp:548
DISubrange * getOrCreateSubrange(int64_t Lo, int64_t Count)
Create a descriptor for a value range.
Definition: DIBuilder.cpp:694
DIDerivedType * createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits=0, uint32_t AlignInBits=0, std::optional< unsigned > DWARFAddressSpace=std::nullopt)
Create debugging information entry for a c++ style reference or rvalue reference type.
Definition: DIBuilder.cpp:335
DISubprogram * createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned VTableIndex=0, int ThisAdjustment=0, DIType *VTableHolder=nullptr, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DITypeArray ThrownTypes=nullptr)
Create a new descriptor for the specified C++ method.
Definition: DIBuilder.cpp:878
DIMacroFile * createTempMacroFile(DIMacroFile *Parent, unsigned Line, DIFile *File)
Create debugging information temporary entry for a macro file.
Definition: DIBuilder.cpp:243
DICompositeType * createArrayType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts, PointerUnion< DIExpression *, DIVariable * > DataLocation=nullptr, PointerUnion< DIExpression *, DIVariable * > Associated=nullptr, PointerUnion< DIExpression *, DIVariable * > Allocated=nullptr, PointerUnion< DIExpression *, DIVariable * > Rank=nullptr)
Create debugging information entry for an array.
Definition: DIBuilder.cpp:575
DIBasicType * createBasicType(StringRef Name, uint64_t SizeInBits, unsigned Encoding, DINode::DIFlags Flags=DINode::FlagZero)
Create debugging information entry for a basic type.
Definition: DIBuilder.cpp:277
DIDerivedType * createMemberPointerType(DIType *PointeeTy, DIType *Class, uint64_t SizeInBits, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagZero)
Create debugging information entry for a pointer to member.
Definition: DIBuilder.cpp:324
DITypeRefArray getOrCreateTypeArray(ArrayRef< Metadata * > Elements)
Get a DITypeRefArray, create one if required.
Definition: DIBuilder.cpp:683
DINodeArray getOrCreateArray(ArrayRef< Metadata * > Elements)
Get a DINodeArray, create one if required.
Definition: DIBuilder.cpp:674
DIEnumerator * createEnumerator(StringRef Name, const APSInt &Value)
Create a single enumerator value.
Definition: DIBuilder.cpp:263
DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault)
Create debugging information for template type parameter.
Definition: DIBuilder.cpp:446
DIBuilder(Module &M, bool AllowUnresolved=true, DICompileUnit *CU=nullptr)
Construct a builder for a module.
Definition: DIBuilder.cpp:26
DICompositeType * createReplaceableCompositeType(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagFwdDecl, StringRef UniqueIdentifier="", DINodeArray Annotations=nullptr)
Create a temporary forward-declared type.
Definition: DIBuilder.cpp:658
DICompositeType * createVariantPart(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIDerivedType *Discriminator, DINodeArray Elements, StringRef UniqueIdentifier="")
Create debugging information entry for a variant part.
Definition: DIBuilder.cpp:529
DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line, DINodeArray Elements=nullptr)
Create a descriptor for an imported module.
Definition: DIBuilder.cpp:188
DIDerivedType * createMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
Create debugging information entry for a member.
Definition: DIBuilder.cpp:374
DIImportedEntity * createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File, unsigned Line, StringRef Name="", DINodeArray Elements=nullptr)
Create a descriptor for an imported function.
Definition: DIBuilder.cpp:215
DILocalVariable * createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero, uint32_t AlignInBits=0)
Create a new descriptor for an auto variable.
Definition: DIBuilder.cpp:793
static DISubprogram * createArtificialSubprogram(DISubprogram *SP)
Create a distinct clone of SP with FlagArtificial set.
Definition: DIBuilder.cpp:607
DIGenericSubrange * getOrCreateGenericSubrange(DIGenericSubrange::BoundType Count, DIGenericSubrange::BoundType LowerBound, DIGenericSubrange::BoundType UpperBound, DIGenericSubrange::BoundType Stride)
Definition: DIBuilder.cpp:713
DICompositeType * createClassType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, DIType *VTableHolder=nullptr, MDNode *TemplateParms=nullptr, StringRef UniqueIdentifier="")
Create debugging information entry for a class.
Definition: DIBuilder.cpp:486
DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
Definition: DIBuilder.cpp:268
DIObjCProperty * createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, unsigned PropertyAttributes, DIType *Ty)
Create debugging information entry for Objective-C property.
Definition: DIBuilder.cpp:438
DICompositeType * createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, StringRef UniqueIdentifier="")
Create a permanent forward-declared type.
Definition: DIBuilder.cpp:644
DITemplateValueParameter * createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault, Constant *Val)
Create debugging information for template value parameter.
Definition: DIBuilder.cpp:461
DILocalVariable * createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero, DINodeArray Annotations=nullptr)
Create a new descriptor for a parameter variable.
Definition: DIBuilder.cpp:803
DIFile * createFile(StringRef Filename, StringRef Directory, std::optional< DIFile::ChecksumInfo< StringRef > > Checksum=std::nullopt, std::optional< StringRef > Source=std::nullopt)
Create a file descriptor to hold debugging information for a file.
Definition: DIBuilder.cpp:225
void replaceArrays(DICompositeType *&T, DINodeArray Elements, DINodeArray TParams=DINodeArray())
Replace arrays on a composite type.
Definition: DIBuilder.cpp:1135
DIModule * createModule(DIScope *Scope, StringRef Name, StringRef ConfigurationMacros, StringRef IncludePath, StringRef APINotesFile={}, DIFile *File=nullptr, unsigned LineNo=0, bool IsDecl=false)
This creates new descriptor for a module with the specified parent scope.
Definition: DIBuilder.cpp:920
DICompositeTypeArray getEnumTypes() const
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
DIMacroNodeArray getMacros() const
void replaceRetainedTypes(DITypeArray N)
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
void replaceMacros(DIMacroNodeArray N)
DIImportedEntityArray getImportedEntities() const
DIScopeArray getRetainedTypes() const
void replaceImportedEntities(DIImportedEntityArray N)
DIGlobalVariableExpressionArray getGlobalVariables() const
Enumeration value.
DWARF expression.
A pair of DIGlobalVariable and DIExpression.
An imported module (C++ using directive or similar).
DILocalScope * getScope() const
Get the local scope for this label.
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
DILocalScope * getScope() const
Get the local scope for this variable.
Debug location.
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Tagged DWARF-like metadata node.
DIFlags
Debug info flags.
Base class for scope-like contexts.
String type, Fortran CHARACTER(n)
Subprogram description.
DISPFlags
Debug info subprogram flags.
Array subrange.
Type array for a subprogram.
Base class for types.
TempDIType cloneWithFlags(DIFlags NewFlags) const
Returns a new temporary DIType with updated Flags.
bool isObjectPointer() const
DIFlags getFlags() const
bool isArtificial() const
Base class for variables.
This represents the llvm.dbg.assign instruction.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:2564
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
Definition: Instruction.cpp:70
const BasicBlock * getParent() const
Definition: Instruction.h:90
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
Definition: Instruction.h:275
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:339
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
Metadata node.
Definition: Metadata.h:950
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1424
bool isTemporary() const
Definition: Metadata.h:1134
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1428
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1416
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithDistinct(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a distinct one.
Definition: Metadata.h:1184
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
Definition: Metadata.h:1174
Tracking metadata reference owned by Metadata.
Definition: Metadata.h:772
static MDString * get(LLVMContext &Context, StringRef Str)
Definition: Metadata.cpp:499
Tuple of metadata.
Definition: Metadata.h:1345
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1373
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a temporary node.
Definition: Metadata.h:1393
static MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition: Metadata.cpp:102
Root of the metadata hierarchy.
Definition: Metadata.h:61
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Return the named MDNode in the module with the specified name.
Definition: Module.cpp:260
A tuple of MDNodes.
Definition: Metadata.h:1604
void addOperand(MDNode *M)
Definition: Metadata.cpp:1287
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Definition: PointerUnion.h:118
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:365
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:450
bool empty() const
Definition: SmallVector.h:94
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:577
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:941
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:687
void push_back(const T &Elt)
Definition: SmallVector.h:416
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1200
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
static IntegerType * getInt64Ty(LLVMContext &C)
Typed tracking ref.
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:394
LLVM Value Representation.
Definition: Value.h:74
LLVMContext & getContext() const
All values hold a context through their type.
Definition: Value.cpp:1069
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Definition: Function.cpp:1465
@ DW_LANG_lo_user
Definition: Dwarf.h:203
@ DW_MACINFO_undef
Definition: Dwarf.h:465
@ DW_MACINFO_start_file
Definition: Dwarf.h:466
@ DW_MACINFO_define
Definition: Dwarf.h:464
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
Definition: DebugInfo.cpp:108
#define N
A single checksum, represented by a Kind and a Value (a string).