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 DISubprogramArray SPs = MDTuple::get(VMContext, AllSubprograms);
100 for (auto *SP : SPs)
102 for (auto *N : RetainValues)
103 if (auto *SP = dyn_cast<DISubprogram>(N))
105
106 if (!AllGVs.empty())
107 CUNode->replaceGlobalVariables(MDTuple::get(VMContext, AllGVs));
108
109 if (!AllImportedModules.empty())
111 VMContext, SmallVector<Metadata *, 16>(AllImportedModules.begin(),
112 AllImportedModules.end())));
113
114 for (const auto &I : AllMacrosPerParent) {
115 // DIMacroNode's with nullptr parent are DICompileUnit direct children.
116 if (!I.first) {
117 CUNode->replaceMacros(MDTuple::get(VMContext, I.second.getArrayRef()));
118 continue;
119 }
120 // Otherwise, it must be a temporary DIMacroFile that need to be resolved.
121 auto *TMF = cast<DIMacroFile>(I.first);
123 TMF->getLine(), TMF->getFile(),
124 getOrCreateMacroArray(I.second.getArrayRef()));
125 replaceTemporary(llvm::TempDIMacroNode(TMF), MF);
126 }
127
128 // Now that all temp nodes have been replaced or deleted, resolve remaining
129 // cycles.
130 for (const auto &N : UnresolvedNodes)
131 if (N && !N->isResolved())
132 N->resolveCycles();
133 UnresolvedNodes.clear();
134
135 // Can't handle unresolved nodes anymore.
136 AllowUnresolvedNodes = false;
137}
138
139/// If N is compile unit return NULL otherwise return N.
141 if (!N || isa<DICompileUnit>(N))
142 return nullptr;
143 return cast<DIScope>(N);
144}
145
147 unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized,
148 StringRef Flags, unsigned RunTimeVer, StringRef SplitName,
150 bool SplitDebugInlining, bool DebugInfoForProfiling,
151 DICompileUnit::DebugNameTableKind NameTableKind, bool RangesBaseAddress,
152 StringRef SysRoot, StringRef SDK) {
153
154 assert(((Lang <= dwarf::DW_LANG_Ada2012 && Lang >= dwarf::DW_LANG_C89) ||
155 (Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
156 "Invalid Language tag");
157
158 assert(!CUNode && "Can only make one compile unit per DIBuilder instance");
160 VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
161 SplitName, Kind, nullptr, nullptr, nullptr, nullptr, nullptr, DWOId,
162 SplitDebugInlining, DebugInfoForProfiling, NameTableKind,
163 RangesBaseAddress, SysRoot, SDK);
164
165 // Create a named metadata so that it is easier to find cu in a module.
166 NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
167 NMD->addOperand(CUNode);
168 trackIfUnresolved(CUNode);
169 return CUNode;
170}
171
172static DIImportedEntity *
174 Metadata *NS, DIFile *File, unsigned Line, StringRef Name,
175 DINodeArray Elements,
176 SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
177 if (Line)
178 assert(File && "Source location has line number but no file");
179 unsigned EntitiesCount = C.pImpl->DIImportedEntitys.size();
180 auto *M = DIImportedEntity::get(C, Tag, Context, cast_or_null<DINode>(NS),
181 File, Line, Name, Elements);
182 if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
183 // A new Imported Entity was just added to the context.
184 // Add it to the Imported Modules list.
185 AllImportedModules.emplace_back(M);
186 return M;
187}
188
190 DINamespace *NS, DIFile *File,
191 unsigned Line,
192 DINodeArray Elements) {
193 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
194 Context, NS, File, Line, StringRef(), Elements,
195 AllImportedModules);
196}
197
200 DIFile *File, unsigned Line,
201 DINodeArray Elements) {
202 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
203 Context, NS, File, Line, StringRef(), Elements,
204 AllImportedModules);
205}
206
208 DIFile *File, unsigned Line,
209 DINodeArray Elements) {
210 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
211 Context, M, File, Line, StringRef(), Elements,
212 AllImportedModules);
213}
214
217 DIFile *File, unsigned Line,
218 StringRef Name, DINodeArray Elements) {
219 // Make sure to use the unique identifier based metadata reference for
220 // types that have one.
221 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_declaration,
222 Context, Decl, File, Line, Name, Elements,
223 AllImportedModules);
224}
225
227 std::optional<DIFile::ChecksumInfo<StringRef>> CS,
228 std::optional<StringRef> Source) {
229 return DIFile::get(VMContext, Filename, Directory, CS, Source);
230}
231
232DIMacro *DIBuilder::createMacro(DIMacroFile *Parent, unsigned LineNumber,
233 unsigned MacroType, StringRef Name,
235 assert(!Name.empty() && "Unable to create macro without name");
236 assert((MacroType == dwarf::DW_MACINFO_undef ||
237 MacroType == dwarf::DW_MACINFO_define) &&
238 "Unexpected macro type");
239 auto *M = DIMacro::get(VMContext, MacroType, LineNumber, Name, Value);
240 AllMacrosPerParent[Parent].insert(M);
241 return M;
242}
243
245 unsigned LineNumber, DIFile *File) {
247 LineNumber, File, DIMacroNodeArray())
248 .release();
249 AllMacrosPerParent[Parent].insert(MF);
250 // Add the new temporary DIMacroFile to the macro per parent map as a parent.
251 // This is needed to assure DIMacroFile with no children to have an entry in
252 // the map. Otherwise, it will not be resolved in DIBuilder::finalize().
253 AllMacrosPerParent.insert({MF, {}});
254 return MF;
255}
256
258 bool IsUnsigned) {
259 assert(!Name.empty() && "Unable to create enumerator without name");
260 return DIEnumerator::get(VMContext, APInt(64, Val, !IsUnsigned), IsUnsigned,
261 Name);
262}
263
265 assert(!Name.empty() && "Unable to create enumerator without name");
266 return DIEnumerator::get(VMContext, APInt(Value), Value.isUnsigned(), Name);
267}
268
270 assert(!Name.empty() && "Unable to create type without name");
271 return DIBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name);
272}
273
275 return createUnspecifiedType("decltype(nullptr)");
276}
277
279 unsigned Encoding,
280 DINode::DIFlags Flags) {
281 assert(!Name.empty() && "Unable to create type without name");
282 return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
283 0, Encoding, Flags);
284}
285
287 assert(!Name.empty() && "Unable to create type without name");
288 return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name,
289 SizeInBits, 0);
290}
291
293 DIVariable *StringLength,
294 DIExpression *StrLocationExp) {
295 assert(!Name.empty() && "Unable to create type without name");
296 return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name,
297 StringLength, nullptr, StrLocationExp, 0, 0, 0);
298}
299
301 DIExpression *StringLengthExp,
302 DIExpression *StrLocationExp) {
303 assert(!Name.empty() && "Unable to create type without name");
304 return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name, nullptr,
305 StringLengthExp, StrLocationExp, 0, 0, 0);
306}
307
309 return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, FromTy, 0,
310 0, 0, std::nullopt, DINode::FlagZero);
311}
312
315 uint32_t AlignInBits,
316 std::optional<unsigned> DWARFAddressSpace,
317 StringRef Name, DINodeArray Annotations) {
318 // FIXME: Why is there a name here?
319 return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
320 nullptr, 0, nullptr, PointeeTy, SizeInBits,
321 AlignInBits, 0, DWARFAddressSpace, DINode::FlagZero,
322 nullptr, Annotations);
323}
324
326 DIType *Base,
327 uint64_t SizeInBits,
328 uint32_t AlignInBits,
329 DINode::DIFlags Flags) {
330 return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
331 nullptr, 0, nullptr, PointeeTy, SizeInBits,
332 AlignInBits, 0, std::nullopt, Flags, Base);
333}
334
337 uint32_t AlignInBits,
338 std::optional<unsigned> DWARFAddressSpace) {
339 assert(RTy && "Unable to create reference type");
340 return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, RTy,
341 SizeInBits, AlignInBits, 0, DWARFAddressSpace,
342 DINode::FlagZero);
343}
344
346 DIFile *File, unsigned LineNo,
347 DIScope *Context, uint32_t AlignInBits,
348 DINode::DIFlags Flags,
349 DINodeArray Annotations) {
350 return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
351 LineNo, getNonCompileUnitScope(Context), Ty, 0,
352 AlignInBits, 0, std::nullopt, Flags, nullptr,
354}
355
357 assert(Ty && "Invalid type!");
358 assert(FriendTy && "Invalid friend type!");
359 return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0, Ty,
360 FriendTy, 0, 0, 0, std::nullopt, DINode::FlagZero);
361}
362
364 uint64_t BaseOffset,
365 uint32_t VBPtrOffset,
366 DINode::DIFlags Flags) {
367 assert(Ty && "Unable to create inheritance");
369 ConstantInt::get(IntegerType::get(VMContext, 32), VBPtrOffset));
370 return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
371 0, Ty, BaseTy, 0, 0, BaseOffset, std::nullopt,
372 Flags, ExtraData);
373}
374
376 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
377 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
378 DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations) {
379 return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
380 LineNumber, getNonCompileUnitScope(Scope), Ty,
381 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
382 Flags, nullptr, Annotations);
383}
384
386 if (C)
388 return nullptr;
389}
390
392 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
393 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
394 Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty) {
395 return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
396 LineNumber, getNonCompileUnitScope(Scope), Ty,
397 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
398 Flags, getConstantOrNull(Discriminant));
399}
400
402 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
403 uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits,
404 DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations) {
405 Flags |= DINode::FlagBitField;
406 return DIDerivedType::get(
407 VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
408 getNonCompileUnitScope(Scope), Ty, SizeInBits, /*AlignInBits=*/0,
409 OffsetInBits, std::nullopt, Flags,
411 StorageOffsetInBits)),
413}
414
417 unsigned LineNumber, DIType *Ty,
419 uint32_t AlignInBits) {
420 Flags |= DINode::FlagStaticMember;
421 return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
422 LineNumber, getNonCompileUnitScope(Scope), Ty, 0,
423 AlignInBits, 0, std::nullopt, Flags,
424 getConstantOrNull(Val));
425}
426
428DIBuilder::createObjCIVar(StringRef Name, DIFile *File, unsigned LineNumber,
429 uint64_t SizeInBits, uint32_t AlignInBits,
430 uint64_t OffsetInBits, DINode::DIFlags Flags,
431 DIType *Ty, MDNode *PropertyNode) {
432 return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
433 LineNumber, getNonCompileUnitScope(File), Ty,
434 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
435 Flags, PropertyNode);
436}
437
440 StringRef GetterName, StringRef SetterName,
441 unsigned PropertyAttributes, DIType *Ty) {
442 return DIObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
443 SetterName, PropertyAttributes, Ty);
444}
445
448 DIType *Ty, bool isDefault) {
449 assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
450 return DITemplateTypeParameter::get(VMContext, Name, Ty, isDefault);
451}
452
455 DIScope *Context, StringRef Name, DIType *Ty,
456 bool IsDefault, Metadata *MD) {
457 assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
458 return DITemplateValueParameter::get(VMContext, Tag, Name, Ty, IsDefault, MD);
459}
460
463 DIType *Ty, bool isDefault,
464 Constant *Val) {
466 VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
467 isDefault, getConstantOrNull(Val));
468}
469
472 DIType *Ty, StringRef Val,
473 bool IsDefault) {
475 VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
476 IsDefault, MDString::get(VMContext, Val));
477}
478
481 DIType *Ty, DINodeArray Val) {
483 VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
484 false, Val.get());
485}
486
488 DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
489 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
490 DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
491 DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
492 assert((!Context || isa<DIScope>(Context)) &&
493 "createClassType should be called with a valid Context");
494
495 auto *R = DICompositeType::get(
496 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
497 getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits,
498 OffsetInBits, Flags, Elements, 0, VTableHolder,
499 cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
500 trackIfUnresolved(R);
501 return R;
502}
503
505 DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
506 uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
507 DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang,
508 DIType *VTableHolder, StringRef UniqueIdentifier) {
509 auto *R = DICompositeType::get(
510 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
511 getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits, 0,
512 Flags, Elements, RunTimeLang, VTableHolder, nullptr, UniqueIdentifier);
513 trackIfUnresolved(R);
514 return R;
515}
516
518 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
519 uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
520 DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
521 auto *R = DICompositeType::get(
522 VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
523 getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
524 Elements, RunTimeLang, nullptr, nullptr, UniqueIdentifier);
525 trackIfUnresolved(R);
526 return R;
527}
528
531 unsigned LineNumber, uint64_t SizeInBits,
532 uint32_t AlignInBits, DINode::DIFlags Flags,
533 DIDerivedType *Discriminator, DINodeArray Elements,
534 StringRef UniqueIdentifier) {
535 auto *R = DICompositeType::get(
536 VMContext, dwarf::DW_TAG_variant_part, Name, File, LineNumber,
537 getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
538 Elements, 0, nullptr, nullptr, UniqueIdentifier, Discriminator);
539 trackIfUnresolved(R);
540 return R;
541}
542
544 DINode::DIFlags Flags,
545 unsigned CC) {
546 return DISubroutineType::get(VMContext, Flags, CC, ParameterTypes);
547}
548
550 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
551 uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
552 DIType *UnderlyingType, StringRef UniqueIdentifier, bool IsScoped) {
553 auto *CTy = DICompositeType::get(
554 VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
555 getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0,
556 IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0, nullptr,
557 nullptr, UniqueIdentifier);
558 AllEnumTypes.emplace_back(CTy);
559 trackIfUnresolved(CTy);
560 return CTy;
561}
562
564 DIFile *File, unsigned LineNo,
565 uint64_t SizeInBits,
566 uint32_t AlignInBits, DIType *Ty) {
567 auto *R =
568 DIDerivedType::get(VMContext, dwarf::DW_TAG_set_type, Name, File, LineNo,
569 getNonCompileUnitScope(Scope), Ty, SizeInBits,
570 AlignInBits, 0, std::nullopt, DINode::FlagZero);
571 trackIfUnresolved(R);
572 return R;
573}
574
577 DINodeArray Subscripts,
582 auto *R = DICompositeType::get(
583 VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0, nullptr, Ty, Size,
584 AlignInBits, 0, DINode::FlagZero, Subscripts, 0, nullptr, nullptr, "",
585 nullptr,
586 DL.is<DIExpression *>() ? (Metadata *)DL.get<DIExpression *>()
587 : (Metadata *)DL.get<DIVariable *>(),
588 AS.is<DIExpression *>() ? (Metadata *)AS.get<DIExpression *>()
589 : (Metadata *)AS.get<DIVariable *>(),
590 AL.is<DIExpression *>() ? (Metadata *)AL.get<DIExpression *>()
591 : (Metadata *)AL.get<DIVariable *>(),
592 RK.is<DIExpression *>() ? (Metadata *)RK.get<DIExpression *>()
593 : (Metadata *)RK.get<DIVariable *>());
594 trackIfUnresolved(R);
595 return R;
596}
597
599 uint32_t AlignInBits, DIType *Ty,
600 DINodeArray Subscripts) {
601 auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
602 nullptr, 0, nullptr, Ty, Size, AlignInBits, 0,
603 DINode::FlagVector, Subscripts, 0, nullptr);
604 trackIfUnresolved(R);
605 return R;
606}
607
609 auto NewSP = SP->cloneWithFlags(SP->getFlags() | DINode::FlagArtificial);
610 return MDNode::replaceWithDistinct(std::move(NewSP));
611}
612
614 DINode::DIFlags FlagsToSet) {
615 auto NewTy = Ty->cloneWithFlags(Ty->getFlags() | FlagsToSet);
616 return MDNode::replaceWithUniqued(std::move(NewTy));
617}
618
620 // FIXME: Restrict this to the nodes where it's valid.
621 if (Ty->isArtificial())
622 return Ty;
623 return createTypeWithFlags(Ty, DINode::FlagArtificial);
624}
625
627 // FIXME: Restrict this to the nodes where it's valid.
628 if (Ty->isObjectPointer())
629 return Ty;
630 DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
631 return createTypeWithFlags(Ty, Flags);
632}
633
635 assert(T && "Expected non-null type");
636 assert((isa<DIType>(T) || (isa<DISubprogram>(T) &&
637 cast<DISubprogram>(T)->isDefinition() == false)) &&
638 "Expected type or subprogram declaration");
639 AllRetainTypes.emplace_back(T);
640}
641
643
646 DIFile *F, unsigned Line, unsigned RuntimeLang,
647 uint64_t SizeInBits, uint32_t AlignInBits,
648 StringRef UniqueIdentifier) {
649 // FIXME: Define in terms of createReplaceableForwardDecl() by calling
650 // replaceWithUniqued().
652 VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
653 SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang,
654 nullptr, nullptr, UniqueIdentifier);
655 trackIfUnresolved(RetTy);
656 return RetTy;
657}
658
660 unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
661 unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,
662 DINode::DIFlags Flags, StringRef UniqueIdentifier,
663 DINodeArray Annotations) {
664 auto *RetTy =
666 VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
667 SizeInBits, AlignInBits, 0, Flags, nullptr, RuntimeLang, nullptr,
668 nullptr, UniqueIdentifier, nullptr, nullptr, nullptr, nullptr,
669 nullptr, Annotations)
670 .release();
671 trackIfUnresolved(RetTy);
672 return RetTy;
673}
674
676 return MDTuple::get(VMContext, Elements);
677}
678
679DIMacroNodeArray
681 return MDTuple::get(VMContext, Elements);
682}
683
686 for (Metadata *E : Elements) {
687 if (isa_and_nonnull<MDNode>(E))
688 Elts.push_back(cast<DIType>(E));
689 else
690 Elts.push_back(E);
691 }
692 return DITypeRefArray(MDNode::get(VMContext, Elts));
693}
694
696 auto *LB = ConstantAsMetadata::get(
698 auto *CountNode = ConstantAsMetadata::get(
699 ConstantInt::getSigned(Type::getInt64Ty(VMContext), Count));
700 return DISubrange::get(VMContext, CountNode, LB, nullptr, nullptr);
701}
702
704 auto *LB = ConstantAsMetadata::get(
706 return DISubrange::get(VMContext, CountNode, LB, nullptr, nullptr);
707}
708
710 Metadata *UB, Metadata *Stride) {
711 return DISubrange::get(VMContext, CountNode, LB, UB, Stride);
712}
713
717 auto ConvToMetadata = [&](DIGenericSubrange::BoundType Bound) -> Metadata * {
718 return Bound.is<DIExpression *>() ? (Metadata *)Bound.get<DIExpression *>()
719 : (Metadata *)Bound.get<DIVariable *>();
720 };
721 return DIGenericSubrange::get(VMContext, ConvToMetadata(CountNode),
722 ConvToMetadata(LB), ConvToMetadata(UB),
723 ConvToMetadata(Stride));
724}
725
726static void checkGlobalVariableScope(DIScope *Context) {
727#ifndef NDEBUG
728 if (auto *CT =
729 dyn_cast_or_null<DICompositeType>(getNonCompileUnitScope(Context)))
730 assert(CT->getIdentifier().empty() &&
731 "Context of a global variable should not be a type with identifier");
732#endif
733}
734
737 unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, bool isDefined,
738 DIExpression *Expr, MDNode *Decl, MDTuple *TemplateParams,
739 uint32_t AlignInBits, DINodeArray Annotations) {
741
743 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
744 LineNumber, Ty, IsLocalToUnit, isDefined,
745 cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
747 if (!Expr)
748 Expr = createExpression();
749 auto *N = DIGlobalVariableExpression::get(VMContext, GV, Expr);
750 AllGVs.push_back(N);
751 return N;
752}
753
756 unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, MDNode *Decl,
757 MDTuple *TemplateParams, uint32_t AlignInBits) {
759
761 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
762 LineNumber, Ty, IsLocalToUnit, false,
763 cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
764 nullptr)
765 .release();
766}
767
769 LLVMContext &VMContext,
770 DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> &PreservedVariables,
771 DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
772 unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags,
773 uint32_t AlignInBits, DINodeArray Annotations = nullptr) {
774 // FIXME: Why getNonCompileUnitScope()?
775 // FIXME: Why is "!Context" okay here?
776 // FIXME: Why doesn't this check for a subprogram or lexical block (AFAICT
777 // the only valid scopes)?
779
781 VMContext, cast_or_null<DILocalScope>(Context), Name, File, LineNo, Ty,
782 ArgNo, Flags, AlignInBits, Annotations);
783 if (AlwaysPreserve) {
784 // The optimizer may remove local variables. If there is an interest
785 // to preserve variable info in such situation then stash it in a
786 // named mdnode.
787 DISubprogram *Fn = getDISubprogram(Scope);
788 assert(Fn && "Missing subprogram for local variable");
789 PreservedVariables[Fn].emplace_back(Node);
790 }
791 return Node;
792}
793
795 DIFile *File, unsigned LineNo,
796 DIType *Ty, bool AlwaysPreserve,
797 DINode::DIFlags Flags,
798 uint32_t AlignInBits) {
799 return createLocalVariable(VMContext, PreservedVariables, Scope, Name,
800 /* ArgNo */ 0, File, LineNo, Ty, AlwaysPreserve,
801 Flags, AlignInBits);
802}
803
805 DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
806 unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags,
807 DINodeArray Annotations) {
808 assert(ArgNo && "Expected non-zero argument number for parameter");
809 return createLocalVariable(VMContext, PreservedVariables, Scope, Name, ArgNo,
810 File, LineNo, Ty, AlwaysPreserve, Flags,
811 /*AlignInBits=*/0, Annotations);
812}
813
815 unsigned LineNo, bool AlwaysPreserve) {
817
818 auto *Node = DILabel::get(VMContext, cast_or_null<DILocalScope>(Context),
819 Name, File, LineNo);
820
821 if (AlwaysPreserve) {
822 /// The optimizer may remove labels. If there is an interest
823 /// to preserve label info in such situation then append it to
824 /// the list of retained nodes of the DISubprogram.
825 DISubprogram *Fn = getDISubprogram(Scope);
826 assert(Fn && "Missing subprogram for label");
827 PreservedLabels[Fn].emplace_back(Node);
828 }
829 return Node;
830}
831
833 return DIExpression::get(VMContext, Addr);
834}
835
836template <class... Ts>
837static DISubprogram *getSubprogram(bool IsDistinct, Ts &&...Args) {
838 if (IsDistinct)
839 return DISubprogram::getDistinct(std::forward<Ts>(Args)...);
840 return DISubprogram::get(std::forward<Ts>(Args)...);
841}
842
845 unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
847 DITemplateParameterArray TParams, DISubprogram *Decl,
848 DITypeArray ThrownTypes, DINodeArray Annotations,
849 StringRef TargetFuncName) {
850 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
851 auto *Node = getSubprogram(
852 /*IsDistinct=*/IsDefinition, VMContext, getNonCompileUnitScope(Context),
853 Name, LinkageName, File, LineNo, Ty, ScopeLine, nullptr, 0, 0, Flags,
854 SPFlags, IsDefinition ? CUNode : nullptr, TParams, Decl,
855 MDTuple::getTemporary(VMContext, std::nullopt).release(), ThrownTypes,
856 Annotations, TargetFuncName);
857
858 if (IsDefinition)
859 AllSubprograms.push_back(Node);
860 trackIfUnresolved(Node);
861 return Node;
862}
863
866 unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
868 DITemplateParameterArray TParams, DISubprogram *Decl,
869 DITypeArray ThrownTypes) {
870 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
872 Name, LinkageName, File, LineNo, Ty,
873 ScopeLine, nullptr, 0, 0, Flags, SPFlags,
874 IsDefinition ? CUNode : nullptr, TParams,
875 Decl, nullptr, ThrownTypes)
876 .release();
877}
878
881 unsigned LineNo, DISubroutineType *Ty, unsigned VIndex, int ThisAdjustment,
882 DIType *VTableHolder, DINode::DIFlags Flags,
883 DISubprogram::DISPFlags SPFlags, DITemplateParameterArray TParams,
884 DITypeArray ThrownTypes) {
886 "Methods should have both a Context and a context that isn't "
887 "the compile unit.");
888 // FIXME: Do we want to use different scope/lines?
889 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
890 auto *SP = getSubprogram(
891 /*IsDistinct=*/IsDefinition, VMContext, cast<DIScope>(Context), Name,
892 LinkageName, F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
893 Flags, SPFlags, IsDefinition ? CUNode : nullptr, TParams, nullptr,
894 nullptr, ThrownTypes);
895
896 if (IsDefinition)
897 AllSubprograms.push_back(SP);
898 trackIfUnresolved(SP);
899 return SP;
900}
901
903 DIGlobalVariable *Decl,
904 StringRef Name, DIFile *File,
905 unsigned LineNo) {
906 return DICommonBlock::get(VMContext, Scope, Decl, Name, File, LineNo);
907}
908
910 bool ExportSymbols) {
911
912 // It is okay to *not* make anonymous top-level namespaces distinct, because
913 // all nodes that have an anonymous namespace as their parent scope are
914 // guaranteed to be unique and/or are linked to their containing
915 // DICompileUnit. This decision is an explicit tradeoff of link time versus
916 // memory usage versus code simplicity and may get revisited in the future.
917 return DINamespace::get(VMContext, getNonCompileUnitScope(Scope), Name,
918 ExportSymbols);
919}
920
922 StringRef ConfigurationMacros,
923 StringRef IncludePath, StringRef APINotesFile,
924 DIFile *File, unsigned LineNo, bool IsDecl) {
925 return DIModule::get(VMContext, File, getNonCompileUnitScope(Scope), Name,
926 ConfigurationMacros, IncludePath, APINotesFile, LineNo,
927 IsDecl);
928}
929
931 DIFile *File,
932 unsigned Discriminator) {
933 return DILexicalBlockFile::get(VMContext, Scope, File, Discriminator);
934}
935
937 unsigned Line, unsigned Col) {
938 // Make these distinct, to avoid merging two lexical blocks on the same
939 // file/line/column.
941 File, Line, Col);
942}
943
944Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
945 DIExpression *Expr, const DILocation *DL,
946 Instruction *InsertBefore) {
947 return insertDeclare(Storage, VarInfo, Expr, DL, InsertBefore->getParent(),
948 InsertBefore);
949}
950
951Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
952 DIExpression *Expr, const DILocation *DL,
953 BasicBlock *InsertAtEnd) {
954 // If this block already has a terminator then insert this intrinsic before
955 // the terminator. Otherwise, put it at the end of the block.
956 Instruction *InsertBefore = InsertAtEnd->getTerminator();
957 return insertDeclare(Storage, VarInfo, Expr, DL, InsertAtEnd, InsertBefore);
958}
959
962 DILocalVariable *SrcVar, DIExpression *ValExpr,
963 Value *Addr, DIExpression *AddrExpr,
964 const DILocation *DL) {
965 LLVMContext &Ctx = LinkedInstr->getContext();
966 Module *M = LinkedInstr->getModule();
967 if (!AssignFn)
968 AssignFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_assign);
969
970 auto *Link = LinkedInstr->getMetadata(LLVMContext::MD_DIAssignID);
971 assert(Link && "Linked instruction must have DIAssign metadata attached");
972
973 std::array<Value *, 6> Args = {
975 MetadataAsValue::get(Ctx, SrcVar),
976 MetadataAsValue::get(Ctx, ValExpr),
977 MetadataAsValue::get(Ctx, Link),
979 MetadataAsValue::get(Ctx, AddrExpr),
980 };
981
982 IRBuilder<> B(Ctx);
983 B.SetCurrentDebugLocation(DL);
984
985 auto *DVI = cast<DbgAssignIntrinsic>(B.CreateCall(AssignFn, Args));
986 DVI->insertAfter(LinkedInstr);
987 return DVI;
988}
989
990Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
991 Instruction *InsertBefore) {
992 return insertLabel(LabelInfo, DL,
993 InsertBefore ? InsertBefore->getParent() : nullptr,
994 InsertBefore);
995}
996
997Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
998 BasicBlock *InsertAtEnd) {
999 return insertLabel(LabelInfo, DL, InsertAtEnd, nullptr);
1000}
1001
1002Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
1003 DILocalVariable *VarInfo,
1004 DIExpression *Expr,
1005 const DILocation *DL,
1006 Instruction *InsertBefore) {
1007 return insertDbgValueIntrinsic(
1008 V, VarInfo, Expr, DL, InsertBefore ? InsertBefore->getParent() : nullptr,
1009 InsertBefore);
1010}
1011
1012Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
1013 DILocalVariable *VarInfo,
1014 DIExpression *Expr,
1015 const DILocation *DL,
1016 BasicBlock *InsertAtEnd) {
1017 return insertDbgValueIntrinsic(V, VarInfo, Expr, DL, InsertAtEnd, nullptr);
1018}
1019
1020/// Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics.
1021/// This abstracts over the various ways to specify an insert position.
1022static void initIRBuilder(IRBuilder<> &Builder, const DILocation *DL,
1023 BasicBlock *InsertBB, Instruction *InsertBefore) {
1024 if (InsertBefore)
1025 Builder.SetInsertPoint(InsertBefore);
1026 else if (InsertBB)
1027 Builder.SetInsertPoint(InsertBB);
1028 Builder.SetCurrentDebugLocation(DL);
1029}
1030
1032 assert(V && "no value passed to dbg intrinsic");
1033 return MetadataAsValue::get(VMContext, ValueAsMetadata::get(V));
1034}
1035
1037 return Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
1038}
1039
1040Instruction *DIBuilder::insertDbgValueIntrinsic(
1041 llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr,
1042 const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore) {
1043 if (!ValueFn)
1044 ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
1045 return insertDbgIntrinsic(ValueFn, Val, VarInfo, Expr, DL, InsertBB,
1046 InsertBefore);
1047}
1048
1049Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
1050 DIExpression *Expr, const DILocation *DL,
1051 BasicBlock *InsertBB,
1052 Instruction *InsertBefore) {
1053 assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare");
1054 assert(DL && "Expected debug loc");
1055 assert(DL->getScope()->getSubprogram() ==
1056 VarInfo->getScope()->getSubprogram() &&
1057 "Expected matching subprograms");
1058 if (!DeclareFn)
1059 DeclareFn = getDeclareIntrin(M);
1060
1061 trackIfUnresolved(VarInfo);
1062 trackIfUnresolved(Expr);
1063 Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, Storage),
1064 MetadataAsValue::get(VMContext, VarInfo),
1065 MetadataAsValue::get(VMContext, Expr)};
1066
1067 IRBuilder<> B(DL->getContext());
1068 initIRBuilder(B, DL, InsertBB, InsertBefore);
1069 return B.CreateCall(DeclareFn, Args);
1070}
1071
1072Instruction *DIBuilder::insertDbgIntrinsic(llvm::Function *IntrinsicFn,
1073 Value *V, DILocalVariable *VarInfo,
1074 DIExpression *Expr,
1075 const DILocation *DL,
1076 BasicBlock *InsertBB,
1077 Instruction *InsertBefore) {
1078 assert(IntrinsicFn && "must pass a non-null intrinsic function");
1079 assert(V && "must pass a value to a dbg intrinsic");
1080 assert(VarInfo &&
1081 "empty or invalid DILocalVariable* passed to debug intrinsic");
1082 assert(DL && "Expected debug loc");
1083 assert(DL->getScope()->getSubprogram() ==
1084 VarInfo->getScope()->getSubprogram() &&
1085 "Expected matching subprograms");
1086
1087 trackIfUnresolved(VarInfo);
1088 trackIfUnresolved(Expr);
1089 Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, V),
1090 MetadataAsValue::get(VMContext, VarInfo),
1091 MetadataAsValue::get(VMContext, Expr)};
1092
1093 IRBuilder<> B(DL->getContext());
1094 initIRBuilder(B, DL, InsertBB, InsertBefore);
1095 return B.CreateCall(IntrinsicFn, Args);
1096}
1097
1098Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
1099 BasicBlock *InsertBB,
1100 Instruction *InsertBefore) {
1101 assert(LabelInfo && "empty or invalid DILabel* passed to dbg.label");
1102 assert(DL && "Expected debug loc");
1103 assert(DL->getScope()->getSubprogram() ==
1104 LabelInfo->getScope()->getSubprogram() &&
1105 "Expected matching subprograms");
1106 if (!LabelFn)
1107 LabelFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_label);
1108
1109 trackIfUnresolved(LabelInfo);
1110 Value *Args[] = {MetadataAsValue::get(VMContext, LabelInfo)};
1111
1112 IRBuilder<> B(DL->getContext());
1113 initIRBuilder(B, DL, InsertBB, InsertBefore);
1114 return B.CreateCall(LabelFn, Args);
1115}
1116
1118 {
1120 N->replaceVTableHolder(VTableHolder);
1121 T = N.get();
1122 }
1123
1124 // If this didn't create a self-reference, just return.
1125 if (T != VTableHolder)
1126 return;
1127
1128 // Look for unresolved operands. T will drop RAUW support, orphaning any
1129 // cycles underneath it.
1130 if (T->isResolved())
1131 for (const MDOperand &O : T->operands())
1132 if (auto *N = dyn_cast_or_null<MDNode>(O))
1133 trackIfUnresolved(N);
1134}
1135
1136void DIBuilder::replaceArrays(DICompositeType *&T, DINodeArray Elements,
1137 DINodeArray TParams) {
1138 {
1140 if (Elements)
1141 N->replaceElements(Elements);
1142 if (TParams)
1143 N->replaceTemplateParams(DITemplateParameterArray(TParams));
1144 T = N.get();
1145 }
1146
1147 // If T isn't resolved, there's no problem.
1148 if (!T->isResolved())
1149 return;
1150
1151 // If T is resolved, it may be due to a self-reference cycle. Track the
1152 // arrays explicitly if they're unresolved, or else the cycles will be
1153 // orphaned.
1154 if (Elements)
1155 trackIfUnresolved(Elements.get());
1156 if (TParams)
1157 trackIfUnresolved(TParams.get());
1158}
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:1036
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:173
static DIType * createTypeWithFlags(const DIType *Ty, DINode::DIFlags FlagsToSet)
Definition: DIBuilder.cpp:613
static DIScope * getNonCompileUnitScope(DIScope *N)
If N is compile unit return NULL otherwise return N.
Definition: DIBuilder.cpp:140
static void checkGlobalVariableScope(DIScope *Context)
Definition: DIBuilder.cpp:726
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&...Args)
Definition: DIBuilder.cpp:837
static ConstantAsMetadata * getConstantOrNull(Constant *C)
Definition: DIBuilder.cpp:385
static DITemplateValueParameter * createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag, DIScope *Context, StringRef Name, DIType *Ty, bool IsDefault, Metadata *MD)
Definition: DIBuilder.cpp:454
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:768
static Value * getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V)
Definition: DIBuilder.cpp:1031
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:1022
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.cpp:902
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:642
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:754
DITemplateValueParameter * createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val, bool IsDefault=false)
Create debugging information for a template template parameter.
Definition: DIBuilder.cpp:471
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:401
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:345
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:961
DISubroutineType * createSubroutineType(DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
Definition: DIBuilder.cpp:543
DIMacro * createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType, StringRef Name, StringRef Value=StringRef())
Create debugging information entry for a macro.
Definition: DIBuilder.cpp:232
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:363
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:391
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:930
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:416
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:308
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:146
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:864
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:428
static DIType * createArtificialType(DIType *Ty)
Create a uniqued clone of Ty with FlagArtificial set.
Definition: DIBuilder.cpp:619
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:504
DICompositeType * createVectorType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
Create debugging information entry for a vector type.
Definition: DIBuilder.cpp:598
static DIType * createObjectPointerType(DIType *Ty)
Create a uniqued clone of Ty with FlagObjectPointer and FlagArtificial set.
Definition: DIBuilder.cpp:626
DILabel * createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, bool AlwaysPreserve=false)
Create a new descriptor for an label.
Definition: DIBuilder.cpp:814
DINamespace * createNameSpace(DIScope *Scope, StringRef Name, bool ExportSymbols)
This creates new descriptor for a namespace with the specified parent scope.
Definition: DIBuilder.cpp:909
DIStringType * createStringType(StringRef Name, uint64_t SizeInBits)
Create debugging information entry for a string type.
Definition: DIBuilder.cpp:286
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:843
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:936
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:517
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
Definition: DIBuilder.cpp:680
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:563
void replaceVTableHolder(DICompositeType *&T, DIType *VTableHolder)
Replace the vtable holder in the given type.
Definition: DIBuilder.cpp:1117
DIBasicType * createNullPtrType()
Create C++11 nullptr type.
Definition: DIBuilder.cpp:274
DICommonBlock * createCommonBlock(DIScope *Scope, DIGlobalVariable *decl, StringRef Name, DIFile *File, unsigned LineNo)
Create common block entry for a Fortran common block.
Definition: DIBuilder.cpp:902
DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
Definition: DIBuilder.cpp:356
void retainType(DIScope *T)
Retain DIScope* in a module even if it is not referenced through debug info anchors.
Definition: DIBuilder.cpp:634
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:314
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:832
DITemplateValueParameter * createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
Create debugging information for a template parameter pack.
Definition: DIBuilder.cpp:480
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:735
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:549
DISubrange * getOrCreateSubrange(int64_t Lo, int64_t Count)
Create a descriptor for a value range.
Definition: DIBuilder.cpp:695
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:336
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:879
DIMacroFile * createTempMacroFile(DIMacroFile *Parent, unsigned Line, DIFile *File)
Create debugging information temporary entry for a macro file.
Definition: DIBuilder.cpp:244
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:576
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:278
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:325
DITypeRefArray getOrCreateTypeArray(ArrayRef< Metadata * > Elements)
Get a DITypeRefArray, create one if required.
Definition: DIBuilder.cpp:684
DINodeArray getOrCreateArray(ArrayRef< Metadata * > Elements)
Get a DINodeArray, create one if required.
Definition: DIBuilder.cpp:675
DIEnumerator * createEnumerator(StringRef Name, const APSInt &Value)
Create a single enumerator value.
Definition: DIBuilder.cpp:264
DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault)
Create debugging information for template type parameter.
Definition: DIBuilder.cpp:447
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:659
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:530
DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line, DINodeArray Elements=nullptr)
Create a descriptor for an imported module.
Definition: DIBuilder.cpp:189
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:375
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:216
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:794
static DISubprogram * createArtificialSubprogram(DISubprogram *SP)
Create a distinct clone of SP with FlagArtificial set.
Definition: DIBuilder.cpp:608
DIGenericSubrange * getOrCreateGenericSubrange(DIGenericSubrange::BoundType Count, DIGenericSubrange::BoundType LowerBound, DIGenericSubrange::BoundType UpperBound, DIGenericSubrange::BoundType Stride)
Definition: DIBuilder.cpp:714
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:487
DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
Definition: DIBuilder.cpp:269
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:439
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:645
DITemplateValueParameter * createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault, Constant *Val)
Create debugging information for template value parameter.
Definition: DIBuilder.cpp:462
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:804
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:226
void replaceArrays(DICompositeType *&T, DINodeArray Elements, DINodeArray TParams=DINodeArray())
Replace arrays on a composite type.
Definition: DIBuilder.cpp:1136
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:921
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:2558
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:331
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
Metadata node.
Definition: Metadata.h:943
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1407
bool isTemporary() const
Definition: Metadata.h:1127
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1411
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1399
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:1177
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:1167
Tracking metadata reference owned by Metadata.
Definition: Metadata.h:772
static MDString * get(LLVMContext &Context, StringRef Str)
Definition: Metadata.cpp:497
Tuple of metadata.
Definition: Metadata.h:1328
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1356
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a temporary node.
Definition: Metadata.h:1376
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:1587
void addOperand(MDNode *M)
Definition: Metadata.cpp:1221
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Definition: PointerUnion.h:118
T get() const
Returns the value of the specified pointer type.
Definition: PointerUnion.h:155
bool is() const
Test if the Union currently holds the type matching T.
Definition: PointerUnion.h:150
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:392
LLVM Value Representation.
Definition: Value.h:74
LLVMContext & getContext() const
All values hold a context through their type.
Definition: Value.cpp:994
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:1506
@ 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:120
#define N
A single checksum, represented by a Kind and a Value (a string).