Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
DebugProgramInstruction.cpp
Go to the documentation of this file.
1//=====-- DebugProgramInstruction.cpp - Implement DbgRecords/DbgMarkers --====//
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#include "llvm/IR/DebugInfoMetadata.h"
10#include "llvm/IR/DebugProgramInstruction.h"
11#include "llvm/IR/DIBuilder.h"
12#include "llvm/IR/IntrinsicInst.h"
13
14namespacellvm {
15
16template <typename T>
17DbgRecordParamRef<T>::DbgRecordParamRef(constT *Param)
18 :Ref(const_cast<T *>(Param)) {}
19template <typename T>
20DbgRecordParamRef<T>::DbgRecordParamRef(constMDNode *Param)
21 :Ref(const_cast<MDNode *>(Param)) {}
22
23template <typename T>T *DbgRecordParamRef<T>::get() const{
24return cast<T>(Ref);
25}
26
27templateclassDbgRecordParamRef<DIExpression>;
28templateclassDbgRecordParamRef<DILabel>;
29templateclassDbgRecordParamRef<DILocalVariable>;
30
31DbgVariableRecord::DbgVariableRecord(constDbgVariableIntrinsic *DVI)
32 :DbgRecord(ValueKind, DVI->getDebugLoc()),
33DebugValueUser({DVI->getRawLocation(),nullptr,nullptr}),
34 Variable(DVI->getVariable()),Expression(DVI->getExpression()),
35 AddressExpression() {
36switch (DVI->getIntrinsicID()) {
37case Intrinsic::dbg_value:
38Type =LocationType::Value;
39break;
40case Intrinsic::dbg_declare:
41Type =LocationType::Declare;
42break;
43case Intrinsic::dbg_assign: {
44Type =LocationType::Assign;
45constDbgAssignIntrinsic *Assign =
46static_cast<constDbgAssignIntrinsic *>(DVI);
47resetDebugValue(1,Assign->getRawAddress());
48AddressExpression =Assign->getAddressExpression();
49setAssignId(Assign->getAssignID());
50break;
51 }
52default:
53llvm_unreachable(
54"Trying to create a DbgVariableRecord with an invalid intrinsic type!");
55 }
56}
57
58DbgVariableRecord::DbgVariableRecord(constDbgVariableRecord &DVR)
59 :DbgRecord(ValueKind, DVR.getDebugLoc()),DebugValueUser(DVR.DebugValues),
60Type(DVR.getType()), Variable(DVR.getVariable()),
61Expression(DVR.getExpression()),
62 AddressExpression(DVR.AddressExpression) {}
63
64DbgVariableRecord::DbgVariableRecord(Metadata *Location,DILocalVariable *DV,
65DIExpression *Expr,constDILocation *DI,
66LocationTypeType)
67 :DbgRecord(ValueKind, DI),DebugValueUser({Location,nullptr,nullptr}),
68Type(Type), Variable(DV),Expression(Expr) {}
69
70DbgVariableRecord::DbgVariableRecord(Metadata *Value,DILocalVariable *Variable,
71DIExpression *Expression,
72DIAssignID *AssignID,Metadata *Address,
73DIExpression *AddressExpression,
74constDILocation *DI)
75 :DbgRecord(ValueKind, DI),DebugValueUser({Value,Address, AssignID}),
76Type(LocationType::Assign), Variable(Variable),Expression(Expression),
77 AddressExpression(AddressExpression) {}
78
79voidDbgRecord::deleteRecord() {
80switch (RecordKind) {
81caseValueKind:
82delete cast<DbgVariableRecord>(this);
83return;
84caseLabelKind:
85delete cast<DbgLabelRecord>(this);
86return;
87 }
88llvm_unreachable("unsupported DbgRecord kind");
89}
90
91voidDbgRecord::print(raw_ostream &O,bool IsForDebug) const{
92switch (RecordKind) {
93caseValueKind:
94 cast<DbgVariableRecord>(this)->print(O, IsForDebug);
95return;
96caseLabelKind:
97 cast<DbgLabelRecord>(this)->print(O, IsForDebug);
98return;
99 };
100llvm_unreachable("unsupported DbgRecord kind");
101}
102
103voidDbgRecord::print(raw_ostream &O,ModuleSlotTracker &MST,
104bool IsForDebug) const{
105switch (RecordKind) {
106caseValueKind:
107 cast<DbgVariableRecord>(this)->print(O, MST, IsForDebug);
108return;
109caseLabelKind:
110 cast<DbgLabelRecord>(this)->print(O, MST, IsForDebug);
111return;
112 };
113llvm_unreachable("unsupported DbgRecord kind");
114}
115
116boolDbgRecord::isIdenticalToWhenDefined(constDbgRecord &R) const{
117if (RecordKind != R.RecordKind)
118returnfalse;
119switch (RecordKind) {
120caseValueKind:
121return cast<DbgVariableRecord>(this)->isIdenticalToWhenDefined(
122 *cast<DbgVariableRecord>(&R));
123caseLabelKind:
124return cast<DbgLabelRecord>(this)->getLabel() ==
125 cast<DbgLabelRecord>(R).getLabel();
126 };
127llvm_unreachable("unsupported DbgRecord kind");
128}
129
130boolDbgRecord::isEquivalentTo(constDbgRecord &R) const{
131returngetDebugLoc() == R.getDebugLoc() &&isIdenticalToWhenDefined(R);
132}
133
134DbgInfoIntrinsic *
135DbgRecord::createDebugIntrinsic(Module *M,Instruction *InsertBefore) const{
136switch (RecordKind) {
137caseValueKind:
138return cast<DbgVariableRecord>(this)->createDebugIntrinsic(M, InsertBefore);
139caseLabelKind:
140return cast<DbgLabelRecord>(this)->createDebugIntrinsic(M, InsertBefore);
141 };
142llvm_unreachable("unsupported DbgRecord kind");
143}
144
145DbgLabelRecord::DbgLabelRecord(MDNode *Label,MDNode *DL)
146 :DbgRecord(LabelKind,DebugLoc(DL)), Label(Label) {
147assert(Label &&"Unexpected nullptr");
148assert((isa<DILabel>(Label) || Label->isTemporary()) &&
149"Label type must be or resolve to a DILabel");
150}
151DbgLabelRecord::DbgLabelRecord(DILabel *Label,DebugLocDL)
152 :DbgRecord(LabelKind,DL), Label(Label) {
153assert(Label &&"Unexpected nullptr");
154}
155
156DbgLabelRecord *DbgLabelRecord::createUnresolvedDbgLabelRecord(MDNode *Label,
157MDNode *DL) {
158returnnewDbgLabelRecord(Label,DL);
159}
160
161DbgVariableRecord::DbgVariableRecord(DbgVariableRecord::LocationTypeType,
162Metadata *Val,MDNode *Variable,
163MDNode *Expression,MDNode *AssignID,
164Metadata *Address,
165MDNode *AddressExpression,MDNode *DI)
166 :DbgRecord(ValueKind,DebugLoc(DI)),
167DebugValueUser({Val,Address, AssignID}), Type(Type), Variable(Variable),
168 Expression(Expression), AddressExpression(AddressExpression) {}
169
170DbgVariableRecord *DbgVariableRecord::createUnresolvedDbgVariableRecord(
171DbgVariableRecord::LocationTypeType,Metadata *Val,MDNode *Variable,
172MDNode *Expression,MDNode *AssignID,Metadata *Address,
173MDNode *AddressExpression,MDNode *DI) {
174returnnewDbgVariableRecord(Type, Val,Variable,Expression, AssignID,
175Address,AddressExpression, DI);
176}
177
178DbgVariableRecord *
179DbgVariableRecord::createDbgVariableRecord(Value *Location,DILocalVariable *DV,
180DIExpression *Expr,
181constDILocation *DI) {
182returnnewDbgVariableRecord(ValueAsMetadata::get(Location), DV, Expr, DI,
183LocationType::Value);
184}
185
186DbgVariableRecord *DbgVariableRecord::createDbgVariableRecord(
187Value *Location,DILocalVariable *DV,DIExpression *Expr,
188constDILocation *DI,DbgVariableRecord &InsertBefore) {
189auto *NewDbgVariableRecord =createDbgVariableRecord(Location, DV, Expr, DI);
190 NewDbgVariableRecord->insertBefore(&InsertBefore);
191return NewDbgVariableRecord;
192}
193
194DbgVariableRecord *DbgVariableRecord::createDVRDeclare(Value *Address,
195DILocalVariable *DV,
196DIExpression *Expr,
197constDILocation *DI) {
198returnnewDbgVariableRecord(ValueAsMetadata::get(Address), DV, Expr, DI,
199LocationType::Declare);
200}
201
202DbgVariableRecord *
203DbgVariableRecord::createDVRDeclare(Value *Address,DILocalVariable *DV,
204DIExpression *Expr,constDILocation *DI,
205DbgVariableRecord &InsertBefore) {
206auto *NewDVRDeclare =createDVRDeclare(Address, DV, Expr, DI);
207 NewDVRDeclare->insertBefore(&InsertBefore);
208return NewDVRDeclare;
209}
210
211DbgVariableRecord *DbgVariableRecord::createDVRAssign(
212Value *Val,DILocalVariable *Variable,DIExpression *Expression,
213DIAssignID *AssignID,Value *Address,DIExpression *AddressExpression,
214constDILocation *DI) {
215returnnewDbgVariableRecord(ValueAsMetadata::get(Val),Variable,Expression,
216 AssignID,ValueAsMetadata::get(Address),
217AddressExpression, DI);
218}
219
220DbgVariableRecord *DbgVariableRecord::createLinkedDVRAssign(
221Instruction *LinkedInstr,Value *Val,DILocalVariable *Variable,
222DIExpression *Expression,Value *Address,DIExpression *AddressExpression,
223constDILocation *DI) {
224auto *Link = LinkedInstr->getMetadata(LLVMContext::MD_DIAssignID);
225assert(Link &&"Linked instruction must have DIAssign metadata attached");
226auto *NewDVRAssign =DbgVariableRecord::createDVRAssign(
227 Val,Variable,Expression, cast<DIAssignID>(Link),Address,
228AddressExpression, DI);
229 LinkedInstr->getParent()->insertDbgRecordAfter(NewDVRAssign, LinkedInstr);
230return NewDVRAssign;
231}
232
233iterator_range<DbgVariableRecord::location_op_iterator>
234DbgVariableRecord::location_ops() const{
235auto *MD =getRawLocation();
236// If a Value has been deleted, the "location" for this DbgVariableRecord will
237// be replaced by nullptr. Return an empty range.
238if (!MD)
239return {location_op_iterator(static_cast<ValueAsMetadata *>(nullptr)),
240location_op_iterator(static_cast<ValueAsMetadata *>(nullptr))};
241
242// If operand is ValueAsMetadata, return a range over just that operand.
243if (auto *VAM = dyn_cast<ValueAsMetadata>(MD))
244return {location_op_iterator(VAM),location_op_iterator(VAM + 1)};
245
246// If operand is DIArgList, return a range over its args.
247if (auto *AL = dyn_cast<DIArgList>(MD))
248return {location_op_iterator(AL->args_begin()),
249location_op_iterator(AL->args_end())};
250
251// Operand is an empty metadata tuple, so return empty iterator.
252assert(cast<MDNode>(MD)->getNumOperands() == 0);
253return {location_op_iterator(static_cast<ValueAsMetadata *>(nullptr)),
254location_op_iterator(static_cast<ValueAsMetadata *>(nullptr))};
255}
256
257unsignedDbgVariableRecord::getNumVariableLocationOps() const{
258if (hasArgList())
259return cast<DIArgList>(getRawLocation())->getArgs().size();
260return 1;
261}
262
263Value *DbgVariableRecord::getVariableLocationOp(unsigned OpIdx) const{
264auto *MD =getRawLocation();
265if (!MD)
266returnnullptr;
267
268if (auto *AL = dyn_cast<DIArgList>(MD))
269return AL->getArgs()[OpIdx]->getValue();
270if (isa<MDNode>(MD))
271returnnullptr;
272assert(isa<ValueAsMetadata>(MD) &&
273"Attempted to get location operand from DbgVariableRecord with none.");
274auto *V = cast<ValueAsMetadata>(MD);
275assert(OpIdx == 0 &&"Operand Index must be 0 for a debug intrinsic with a "
276"single location operand.");
277return V->getValue();
278}
279
280staticValueAsMetadata *getAsMetadata(Value *V) {
281return isa<MetadataAsValue>(V) ? dyn_cast<ValueAsMetadata>(
282 cast<MetadataAsValue>(V)->getMetadata())
283 :ValueAsMetadata::get(V);
284}
285
286voidDbgVariableRecord::replaceVariableLocationOp(Value *OldValue,
287Value *NewValue,
288bool AllowEmpty) {
289assert(NewValue &&"Values must be non-null");
290
291bool DbgAssignAddrReplaced =isDbgAssign() && OldValue ==getAddress();
292if (DbgAssignAddrReplaced)
293setAddress(NewValue);
294
295auto Locations =location_ops();
296auto OldIt =find(Locations, OldValue);
297if (OldIt == Locations.end()) {
298if (AllowEmpty || DbgAssignAddrReplaced)
299return;
300llvm_unreachable("OldValue must be a current location");
301 }
302
303if (!hasArgList()) {
304// Set our location to be the MAV wrapping the new Value.
305setRawLocation(isa<MetadataAsValue>(NewValue)
306 ? cast<MetadataAsValue>(NewValue)->getMetadata()
307 :ValueAsMetadata::get(NewValue));
308return;
309 }
310
311// We must be referring to a DIArgList, produce a new operands vector with the
312// old value replaced, generate a new DIArgList and set it as our location.
313SmallVector<ValueAsMetadata *, 4> MDs;
314ValueAsMetadata *NewOperand =getAsMetadata(NewValue);
315for (auto *VMD : Locations)
316 MDs.push_back(VMD == *OldIt ? NewOperand :getAsMetadata(VMD));
317setRawLocation(DIArgList::get(getVariableLocationOp(0)->getContext(), MDs));
318}
319
320voidDbgVariableRecord::replaceVariableLocationOp(unsigned OpIdx,
321Value *NewValue) {
322assert(OpIdx <getNumVariableLocationOps() &&"Invalid Operand Index");
323
324if (!hasArgList()) {
325setRawLocation(isa<MetadataAsValue>(NewValue)
326 ? cast<MetadataAsValue>(NewValue)->getMetadata()
327 :ValueAsMetadata::get(NewValue));
328return;
329 }
330
331SmallVector<ValueAsMetadata *, 4> MDs;
332ValueAsMetadata *NewOperand =getAsMetadata(NewValue);
333for (unsignedIdx = 0;Idx <getNumVariableLocationOps(); ++Idx)
334 MDs.push_back(Idx == OpIdx ? NewOperand
335 :getAsMetadata(getVariableLocationOp(Idx)));
336
337setRawLocation(DIArgList::get(getVariableLocationOp(0)->getContext(), MDs));
338}
339
340voidDbgVariableRecord::addVariableLocationOps(ArrayRef<Value *> NewValues,
341DIExpression *NewExpr) {
342assert(NewExpr->hasAllLocationOps(getNumVariableLocationOps() +
343 NewValues.size()) &&
344"NewExpr for debug variable intrinsic does not reference every "
345"location operand.");
346assert(!is_contained(NewValues,nullptr) &&"New values must be non-null");
347setExpression(NewExpr);
348SmallVector<ValueAsMetadata *, 4> MDs;
349for (auto *VMD :location_ops())
350 MDs.push_back(getAsMetadata(VMD));
351for (auto *VMD : NewValues)
352 MDs.push_back(getAsMetadata(VMD));
353setRawLocation(DIArgList::get(getVariableLocationOp(0)->getContext(), MDs));
354}
355
356voidDbgVariableRecord::setKillLocation() {
357// TODO: When/if we remove duplicate values from DIArgLists, we don't need
358// this set anymore.
359SmallPtrSet<Value *, 4> RemovedValues;
360for (Value *OldValue :location_ops()) {
361if (!RemovedValues.insert(OldValue).second)
362continue;
363Value *Poison =PoisonValue::get(OldValue->getType());
364replaceVariableLocationOp(OldValue,Poison);
365 }
366}
367
368boolDbgVariableRecord::isKillLocation() const{
369return (!hasArgList() && isa<MDNode>(getRawLocation())) ||
370 (getNumVariableLocationOps() == 0 && !getExpression()->isComplex()) ||
371any_of(location_ops(), [](Value *V) {return isa<UndefValue>(V); });
372}
373
374std::optional<DbgVariableFragmentInfo>DbgVariableRecord::getFragment() const{
375returngetExpression()->getFragmentInfo();
376}
377
378std::optional<uint64_t>DbgVariableRecord::getFragmentSizeInBits() const{
379if (auto Fragment =getExpression()->getFragmentInfo())
380return Fragment->SizeInBits;
381returngetVariable()->getSizeInBits();
382}
383
384DbgRecord *DbgRecord::clone() const{
385switch (RecordKind) {
386caseValueKind:
387return cast<DbgVariableRecord>(this)->clone();
388caseLabelKind:
389return cast<DbgLabelRecord>(this)->clone();
390 };
391llvm_unreachable("unsupported DbgRecord kind");
392}
393
394DbgVariableRecord *DbgVariableRecord::clone() const{
395returnnewDbgVariableRecord(*this);
396}
397
398DbgLabelRecord *DbgLabelRecord::clone() const{
399returnnewDbgLabelRecord(getLabel(),getDebugLoc());
400}
401
402DbgVariableIntrinsic *
403DbgVariableRecord::createDebugIntrinsic(Module *M,
404Instruction *InsertBefore) const{
405 [[maybe_unused]]DICompileUnit *Unit =
406getDebugLoc()->getScope()->getSubprogram()->getUnit();
407assert(M && Unit &&
408"Cannot clone from BasicBlock that is not part of a Module or "
409"DICompileUnit!");
410LLVMContext &Context =getDebugLoc()->getContext();
411Function *IntrinsicFn;
412
413// Work out what sort of intrinsic we're going to produce.
414switch (getType()) {
415caseDbgVariableRecord::LocationType::Declare:
416 IntrinsicFn =Intrinsic::getOrInsertDeclaration(M, Intrinsic::dbg_declare);
417break;
418caseDbgVariableRecord::LocationType::Value:
419 IntrinsicFn =Intrinsic::getOrInsertDeclaration(M, Intrinsic::dbg_value);
420break;
421caseDbgVariableRecord::LocationType::Assign:
422 IntrinsicFn =Intrinsic::getOrInsertDeclaration(M, Intrinsic::dbg_assign);
423break;
424caseDbgVariableRecord::LocationType::End:
425caseDbgVariableRecord::LocationType::Any:
426llvm_unreachable("Invalid LocationType");
427 }
428
429// Create the intrinsic from this DbgVariableRecord's information, optionally
430// insert into the target location.
431DbgVariableIntrinsic *DVI;
432assert(getRawLocation() &&
433"DbgVariableRecord's RawLocation should be non-null.");
434if (isDbgAssign()) {
435Value *AssignArgs[] = {
436MetadataAsValue::get(Context,getRawLocation()),
437MetadataAsValue::get(Context,getVariable()),
438MetadataAsValue::get(Context,getExpression()),
439MetadataAsValue::get(Context,getAssignID()),
440MetadataAsValue::get(Context,getRawAddress()),
441MetadataAsValue::get(Context,getAddressExpression())};
442 DVI = cast<DbgVariableIntrinsic>(CallInst::Create(
443 IntrinsicFn->getFunctionType(), IntrinsicFn, AssignArgs));
444 }else {
445Value *Args[] = {MetadataAsValue::get(Context,getRawLocation()),
446MetadataAsValue::get(Context,getVariable()),
447MetadataAsValue::get(Context,getExpression())};
448 DVI = cast<DbgVariableIntrinsic>(
449CallInst::Create(IntrinsicFn->getFunctionType(), IntrinsicFn, Args));
450 }
451 DVI->setTailCall();
452 DVI->setDebugLoc(getDebugLoc());
453if (InsertBefore)
454 DVI->insertBefore(InsertBefore->getIterator());
455
456return DVI;
457}
458
459DbgLabelInst *
460DbgLabelRecord::createDebugIntrinsic(Module *M,
461Instruction *InsertBefore) const{
462auto *LabelFn =Intrinsic::getOrInsertDeclaration(M, Intrinsic::dbg_label);
463Value *Args[] = {
464MetadataAsValue::get(getDebugLoc()->getContext(),getLabel())};
465DbgLabelInst *DbgLabel = cast<DbgLabelInst>(
466CallInst::Create(LabelFn->getFunctionType(), LabelFn, Args));
467DbgLabel->setTailCall();
468DbgLabel->setDebugLoc(getDebugLoc());
469if (InsertBefore)
470DbgLabel->insertBefore(InsertBefore->getIterator());
471returnDbgLabel;
472}
473
474Value *DbgVariableRecord::getAddress() const{
475auto *MD =getRawAddress();
476if (auto *V = dyn_cast_or_null<ValueAsMetadata>(MD))
477return V->getValue();
478
479// When the value goes to null, it gets replaced by an empty MDNode.
480assert((!MD || !cast<MDNode>(MD)->getNumOperands()) &&
481"Expected an empty MDNode");
482returnnullptr;
483}
484
485DIAssignID *DbgVariableRecord::getAssignID() const{
486return cast<DIAssignID>(DebugValues[2]);
487}
488
489voidDbgVariableRecord::setAssignId(DIAssignID *New) {
490resetDebugValue(2, New);
491}
492
493voidDbgVariableRecord::setKillAddress() {
494resetDebugValue(
495 1,ValueAsMetadata::get(PoisonValue::get(getAddress()->getType())));
496}
497
498boolDbgVariableRecord::isKillAddress() const{
499Value *Addr =getAddress();
500return !Addr || isa<UndefValue>(Addr);
501}
502
503constInstruction *DbgRecord::getInstruction() const{
504returnMarker->MarkedInstr;
505}
506
507constBasicBlock *DbgRecord::getParent() const{
508returnMarker->MarkedInstr->getParent();
509}
510
511BasicBlock *DbgRecord::getParent() {returnMarker->MarkedInstr->getParent(); }
512
513BasicBlock *DbgRecord::getBlock() {returnMarker->getParent(); }
514
515constBasicBlock *DbgRecord::getBlock() const{returnMarker->getParent(); }
516
517Function *DbgRecord::getFunction() {returngetBlock()->getParent(); }
518
519constFunction *DbgRecord::getFunction() const{
520returngetBlock()->getParent();
521}
522
523Module *DbgRecord::getModule() {returngetFunction()->getParent(); }
524
525constModule *DbgRecord::getModule() const{
526returngetFunction()->getParent();
527}
528
529LLVMContext &DbgRecord::getContext() {returngetBlock()->getContext(); }
530
531constLLVMContext &DbgRecord::getContext() const{
532returngetBlock()->getContext();
533}
534
535voidDbgRecord::insertBefore(DbgRecord *InsertBefore) {
536assert(!getMarker() &&
537"Cannot insert a DbgRecord that is already has a DbgMarker!");
538assert(InsertBefore->getMarker() &&
539"Cannot insert a DbgRecord before a DbgRecord that does not have a "
540"DbgMarker!");
541 InsertBefore->getMarker()->insertDbgRecord(this, InsertBefore);
542}
543voidDbgRecord::insertAfter(DbgRecord *InsertAfter) {
544assert(!getMarker() &&
545"Cannot insert a DbgRecord that is already has a DbgMarker!");
546assert(InsertAfter->getMarker() &&
547"Cannot insert a DbgRecord after a DbgRecord that does not have a "
548"DbgMarker!");
549 InsertAfter->getMarker()->insertDbgRecordAfter(this, InsertAfter);
550}
551
552voidDbgRecord::insertBefore(self_iterator InsertBefore) {
553assert(!getMarker() &&
554"Cannot insert a DbgRecord that is already has a DbgMarker!");
555assert(InsertBefore->getMarker() &&
556"Cannot insert a DbgRecord before a DbgRecord that does not have a "
557"DbgMarker!");
558 InsertBefore->getMarker()->insertDbgRecord(this, &*InsertBefore);
559}
560voidDbgRecord::insertAfter(self_iterator InsertAfter) {
561assert(!getMarker() &&
562"Cannot insert a DbgRecord that is already has a DbgMarker!");
563assert(InsertAfter->getMarker() &&
564"Cannot insert a DbgRecord after a DbgRecord that does not have a "
565"DbgMarker!");
566 InsertAfter->getMarker()->insertDbgRecordAfter(this, &*InsertAfter);
567}
568
569voidDbgRecord::moveBefore(DbgRecord *MoveBefore) {
570assert(getMarker() &&
571"Canot move a DbgRecord that does not currently have a DbgMarker!");
572removeFromParent();
573insertBefore(MoveBefore);
574}
575voidDbgRecord::moveAfter(DbgRecord *MoveAfter) {
576assert(getMarker() &&
577"Canot move a DbgRecord that does not currently have a DbgMarker!");
578removeFromParent();
579insertAfter(MoveAfter);
580}
581
582voidDbgRecord::moveBefore(self_iterator MoveBefore) {
583assert(getMarker() &&
584"Canot move a DbgRecord that does not currently have a DbgMarker!");
585removeFromParent();
586insertBefore(MoveBefore);
587}
588voidDbgRecord::moveAfter(self_iterator MoveAfter) {
589assert(getMarker() &&
590"Canot move a DbgRecord that does not currently have a DbgMarker!");
591removeFromParent();
592insertAfter(MoveAfter);
593}
594
595///////////////////////////////////////////////////////////////////////////////
596
597// An empty, global, DbgMarker for the purpose of describing empty ranges of
598// DbgRecords.
599DbgMarkerDbgMarker::EmptyDbgMarker;
600
601voidDbgMarker::dropDbgRecords() {
602while (!StoredDbgRecords.empty()) {
603auto It =StoredDbgRecords.begin();
604DbgRecord *DR = &*It;
605StoredDbgRecords.erase(It);
606 DR->deleteRecord();
607 }
608}
609
610voidDbgMarker::dropOneDbgRecord(DbgRecord *DR) {
611assert(DR->getMarker() ==this);
612StoredDbgRecords.erase(DR->getIterator());
613 DR->deleteRecord();
614}
615
616constBasicBlock *DbgMarker::getParent() const{
617returnMarkedInstr->getParent();
618}
619
620BasicBlock *DbgMarker::getParent() {returnMarkedInstr->getParent(); }
621
622voidDbgMarker::removeMarker() {
623// Are there any DbgRecords in this DbgMarker? If not, nothing to preserve.
624Instruction *Owner =MarkedInstr;
625if (StoredDbgRecords.empty()) {
626eraseFromParent();
627 Owner->DebugMarker =nullptr;
628return;
629 }
630
631// The attached DbgRecords need to be preserved; attach them to the next
632// instruction. If there isn't a next instruction, put them on the
633// "trailing" list.
634DbgMarker *NextMarker = Owner->getParent()->getNextMarker(Owner);
635if (NextMarker) {
636 NextMarker->absorbDebugValues(*this,true);
637eraseFromParent();
638 }else {
639// We can avoid a deallocation -- just store this marker onto the next
640// instruction. Unless we're at the end of the block, in which case this
641// marker becomes the trailing marker of a degenerate block.
642BasicBlock::iterator NextIt = std::next(Owner->getIterator());
643if (NextIt ==getParent()->end()) {
644getParent()->setTrailingDbgRecords(this);
645MarkedInstr =nullptr;
646 }else {
647 NextIt->DebugMarker =this;
648MarkedInstr = &*NextIt;
649 }
650 }
651 Owner->DebugMarker =nullptr;
652}
653
654voidDbgMarker::removeFromParent() {
655MarkedInstr->DebugMarker =nullptr;
656MarkedInstr =nullptr;
657}
658
659voidDbgMarker::eraseFromParent() {
660if (MarkedInstr)
661removeFromParent();
662dropDbgRecords();
663deletethis;
664}
665
666iterator_range<DbgRecord::self_iterator>DbgMarker::getDbgRecordRange() {
667returnmake_range(StoredDbgRecords.begin(),StoredDbgRecords.end());
668}
669iterator_range<DbgRecord::const_self_iterator>
670DbgMarker::getDbgRecordRange() const{
671returnmake_range(StoredDbgRecords.begin(),StoredDbgRecords.end());
672}
673
674voidDbgRecord::removeFromParent() {
675getMarker()->StoredDbgRecords.erase(getIterator());
676Marker =nullptr;
677}
678
679voidDbgRecord::eraseFromParent() {
680removeFromParent();
681deleteRecord();
682}
683
684voidDbgMarker::insertDbgRecord(DbgRecord *New,bool InsertAtHead) {
685auto It = InsertAtHead ?StoredDbgRecords.begin() :StoredDbgRecords.end();
686StoredDbgRecords.insert(It, *New);
687 New->setMarker(this);
688}
689voidDbgMarker::insertDbgRecord(DbgRecord *New,DbgRecord *InsertBefore) {
690assert(InsertBefore->getMarker() ==this &&
691"DbgRecord 'InsertBefore' must be contained in this DbgMarker!");
692StoredDbgRecords.insert(InsertBefore->getIterator(), *New);
693 New->setMarker(this);
694}
695voidDbgMarker::insertDbgRecordAfter(DbgRecord *New,DbgRecord *InsertAfter) {
696assert(InsertAfter->getMarker() ==this &&
697"DbgRecord 'InsertAfter' must be contained in this DbgMarker!");
698StoredDbgRecords.insert(++(InsertAfter->getIterator()), *New);
699 New->setMarker(this);
700}
701
702voidDbgMarker::absorbDebugValues(DbgMarker &Src,bool InsertAtHead) {
703auto It = InsertAtHead ?StoredDbgRecords.begin() :StoredDbgRecords.end();
704for (DbgRecord &DVR : Src.StoredDbgRecords)
705 DVR.setMarker(this);
706
707StoredDbgRecords.splice(It, Src.StoredDbgRecords);
708}
709
710voidDbgMarker::absorbDebugValues(
711iterator_range<DbgRecord::self_iterator>Range,DbgMarker &Src,
712bool InsertAtHead) {
713for (DbgRecord &DR :Range)
714 DR.setMarker(this);
715
716auto InsertPos =
717 (InsertAtHead) ?StoredDbgRecords.begin() :StoredDbgRecords.end();
718
719StoredDbgRecords.splice(InsertPos, Src.StoredDbgRecords,Range.begin(),
720Range.end());
721}
722
723iterator_range<simple_ilist<DbgRecord>::iterator>DbgMarker::cloneDebugInfoFrom(
724DbgMarker *From, std::optional<simple_ilist<DbgRecord>::iterator> from_here,
725bool InsertAtHead) {
726DbgRecord *First =nullptr;
727// Work out what range of DbgRecords to clone: normally all the contents of
728// the "From" marker, optionally we can start from the from_here position down
729// to end().
730autoRange =
731make_range(From->StoredDbgRecords.begin(),From->StoredDbgRecords.end());
732if (from_here.has_value())
733Range =make_range(*from_here,From->StoredDbgRecords.end());
734
735// Clone each DbgVariableRecord and insert into StoreDbgVariableRecords;
736// optionally place them at the start or the end of the list.
737auto Pos = (InsertAtHead) ?StoredDbgRecords.begin() :StoredDbgRecords.end();
738for (DbgRecord &DR :Range) {
739DbgRecord *New = DR.clone();
740 New->setMarker(this);
741StoredDbgRecords.insert(Pos, *New);
742if (!First)
743First = New;
744 }
745
746if (!First)
747return {StoredDbgRecords.end(),StoredDbgRecords.end()};
748
749if (InsertAtHead)
750// If InsertAtHead is set, we cloned a range onto the front of of the
751// StoredDbgRecords collection, return that range.
752return {StoredDbgRecords.begin(), Pos};
753else
754// We inserted a block at the end, return that range.
755return {First->getIterator(),StoredDbgRecords.end()};
756}
757
758}// end namespace llvm
Poison
@ Poison
Definition:AArch64AsmPrinter.cpp:72
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition:ARMSLSHardening.cpp:73
From
BlockVerifier::State From
Definition:BlockVerifier.cpp:57
DIBuilder.h
Idx
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Definition:DeadArgumentElimination.cpp:353
DebugInfoMetadata.h
DebugProgramInstruction.h
Addr
uint64_t Addr
Definition:ELFObjHandler.cpp:79
IntrinsicInst.h
getDebugLoc
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first found DebugLoc that has a DILocation, given a range of instructions.
Definition:MachineInstrBundle.cpp:109
Range
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
getType
static SymbolRef::Type getType(const Symbol *Sym)
Definition:TapiFile.cpp:39
NewExpr
Definition:ItaniumDemangle.h:2103
T
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition:ArrayRef.h:168
llvm::BasicBlock
LLVM Basic Block Representation.
Definition:BasicBlock.h:61
llvm::BasicBlock::setTrailingDbgRecords
void setTrailingDbgRecords(DbgMarker *M)
Record that the collection of DbgRecords in M "trails" after the last instruction of this block.
Definition:BasicBlock.cpp:1177
llvm::BasicBlock::getParent
const Function * getParent() const
Return the enclosing method, or null if none.
Definition:BasicBlock.h:220
llvm::BasicBlock::iterator
InstListType::iterator iterator
Instruction iterators...
Definition:BasicBlock.h:177
llvm::BasicBlock::getContext
LLVMContext & getContext() const
Get the context in which this basic block lives.
Definition:BasicBlock.cpp:168
llvm::CallInst::Create
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
Definition:Instructions.h:1514
llvm::CallInst::setTailCall
void setTailCall(bool IsTc=true)
Definition:Instructions.h:1602
llvm::DIArgList::get
static DIArgList * get(LLVMContext &Context, ArrayRef< ValueAsMetadata * > Args)
Definition:DebugInfoMetadata.cpp:2315
llvm::DIAssignID
Assignment ID.
Definition:DebugInfoMetadata.h:309
llvm::DICompileUnit
Compile unit.
Definition:DebugInfoMetadata.h:1469
llvm::DIExpression
DWARF expression.
Definition:DebugInfoMetadata.h:2763
llvm::DIExpression::isComplex
bool isComplex() const
Return whether the location is computed on the expression stack, meaning it cannot be a simple regist...
Definition:DebugInfoMetadata.cpp:1540
llvm::DIExpression::getFragmentInfo
static std::optional< FragmentInfo > getFragmentInfo(expr_op_iterator Start, expr_op_iterator End)
Retrieve the details of this fragment expression.
Definition:DebugInfoMetadata.cpp:1677
llvm::DILabel
Label.
Definition:DebugInfoMetadata.h:3551
llvm::DILocalVariable
Local variable.
Definition:DebugInfoMetadata.h:3460
llvm::DILocation
Debug location.
Definition:DebugInfoMetadata.h:1988
llvm::DIVariable::getSizeInBits
std::optional< uint64_t > getSizeInBits() const
Determines the size of the variable's type.
Definition:DebugInfoMetadata.cpp:1331
llvm::DbgAssignIntrinsic
This represents the llvm.dbg.assign instruction.
Definition:IntrinsicInst.h:492
llvm::DbgInfoIntrinsic
This is the common base class for debug info intrinsics.
Definition:IntrinsicInst.h:181
llvm::DbgLabelInst
This represents the llvm.dbg.label instruction.
Definition:IntrinsicInst.h:543
llvm::DbgLabelRecord
Records a position in IR for a source label (DILabel).
Definition:DebugProgramInstruction.h:231
llvm::DbgLabelRecord::clone
DbgLabelRecord * clone() const
Definition:DebugProgramInstruction.cpp:398
llvm::DbgLabelRecord::createUnresolvedDbgLabelRecord
static DbgLabelRecord * createUnresolvedDbgLabelRecord(MDNode *Label, MDNode *DL)
For use during parsing; creates a DbgLabelRecord from as-of-yet unresolved MDNodes.
Definition:DebugProgramInstruction.cpp:156
llvm::DbgLabelRecord::getLabel
DILabel * getLabel() const
Definition:DebugProgramInstruction.h:256
llvm::DbgLabelRecord::createDebugIntrinsic
DbgLabelInst * createDebugIntrinsic(Module *M, Instruction *InsertBefore) const
Definition:DebugProgramInstruction.cpp:460
llvm::DbgLabel
This class is used to track label information.
Definition:DwarfDebug.h:289
llvm::DbgMarker
Per-instruction record of debug-info.
Definition:DebugProgramInstruction.h:583
llvm::DbgMarker::removeFromParent
void removeFromParent()
Definition:DebugProgramInstruction.cpp:654
llvm::DbgMarker::MarkedInstr
Instruction * MarkedInstr
Link back to the Instruction that owns this marker.
Definition:DebugProgramInstruction.h:588
llvm::DbgMarker::cloneDebugInfoFrom
iterator_range< simple_ilist< DbgRecord >::iterator > cloneDebugInfoFrom(DbgMarker *From, std::optional< simple_ilist< DbgRecord >::iterator > FromHere, bool InsertAtHead=false)
Clone all DbgMarkers from From into this marker.
Definition:DebugProgramInstruction.cpp:723
llvm::DbgMarker::insertDbgRecordAfter
void insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter)
Insert a DbgRecord after a DbgRecord contained within this marker.
Definition:DebugProgramInstruction.cpp:695
llvm::DbgMarker::removeMarker
void removeMarker()
Handle the removal of a marker: the position of debug-info has gone away, but the stored debug record...
Definition:DebugProgramInstruction.cpp:622
llvm::DbgMarker::absorbDebugValues
void absorbDebugValues(DbgMarker &Src, bool InsertAtHead)
Transfer any DbgRecords from Src into this DbgMarker.
Definition:DebugProgramInstruction.cpp:702
llvm::DbgMarker::dropDbgRecords
void dropDbgRecords()
Erase all DbgRecords in this DbgMarker.
Definition:DebugProgramInstruction.cpp:601
llvm::DbgMarker::getDbgRecordRange
iterator_range< simple_ilist< DbgRecord >::iterator > getDbgRecordRange()
Produce a range over all the DbgRecords in this Marker.
Definition:DebugProgramInstruction.cpp:666
llvm::DbgMarker::dropOneDbgRecord
void dropOneDbgRecord(DbgRecord *DR)
Erase a single DbgRecord from this marker.
Definition:DebugProgramInstruction.cpp:610
llvm::DbgMarker::getParent
const BasicBlock * getParent() const
Definition:DebugProgramInstruction.cpp:616
llvm::DbgMarker::StoredDbgRecords
simple_ilist< DbgRecord > StoredDbgRecords
List of DbgRecords, the non-instruction equivalent of llvm.dbg.
Definition:DebugProgramInstruction.h:594
llvm::DbgMarker::eraseFromParent
void eraseFromParent()
Definition:DebugProgramInstruction.cpp:659
llvm::DbgMarker::insertDbgRecord
void insertDbgRecord(DbgRecord *New, bool InsertAtHead)
Insert a DbgRecord into this DbgMarker, at the end of the list.
Definition:DebugProgramInstruction.cpp:684
llvm::DbgMarker::EmptyDbgMarker
static DbgMarker EmptyDbgMarker
We generally act like all llvm Instructions have a range of DbgRecords attached to them,...
Definition:DebugProgramInstruction.h:659
llvm::DbgRecordParamRef
A typed tracking MDNode reference that does not require a definition for its parameter type.
Definition:DebugProgramInstruction.h:76
llvm::DbgRecordParamRef::get
T * get() const
Get the underlying type.
Definition:DebugProgramInstruction.cpp:23
llvm::DbgRecordParamRef::DbgRecordParamRef
DbgRecordParamRef()=default
llvm::DbgRecord
Base class for non-instruction debug metadata records that have positions within IR.
Definition:DebugProgramInstruction.h:134
llvm::DbgRecord::insertAfter
void insertAfter(DbgRecord *InsertAfter)
Definition:DebugProgramInstruction.cpp:543
llvm::DbgRecord::removeFromParent
void removeFromParent()
Definition:DebugProgramInstruction.cpp:674
llvm::DbgRecord::getFunction
Function * getFunction()
Definition:DebugProgramInstruction.cpp:517
llvm::DbgRecord::print
void print(raw_ostream &O, bool IsForDebug=false) const
Definition:DebugProgramInstruction.cpp:91
llvm::DbgRecord::getBlock
BasicBlock * getBlock()
Definition:DebugProgramInstruction.cpp:513
llvm::DbgRecord::isEquivalentTo
bool isEquivalentTo(const DbgRecord &R) const
Same as isIdenticalToWhenDefined but checks DebugLoc too.
Definition:DebugProgramInstruction.cpp:130
llvm::DbgRecord::self_iterator
simple_ilist< DbgRecord >::iterator self_iterator
Definition:DebugProgramInstruction.h:213
llvm::DbgRecord::getDebugLoc
DebugLoc getDebugLoc() const
Definition:DebugProgramInstruction.h:208
llvm::DbgRecord::createDebugIntrinsic
DbgInfoIntrinsic * createDebugIntrinsic(Module *M, Instruction *InsertBefore) const
Convert this DbgRecord back into an appropriate llvm.dbg.
Definition:DebugProgramInstruction.cpp:135
llvm::DbgRecord::RecordKind
Kind RecordKind
Subclass discriminator.
Definition:DebugProgramInstruction.h:143
llvm::DbgRecord::deleteRecord
void deleteRecord()
Methods that dispatch to subclass implementations.
Definition:DebugProgramInstruction.cpp:79
llvm::DbgRecord::insertBefore
void insertBefore(DbgRecord *InsertBefore)
Definition:DebugProgramInstruction.cpp:535
llvm::DbgRecord::eraseFromParent
void eraseFromParent()
Definition:DebugProgramInstruction.cpp:679
llvm::DbgRecord::moveBefore
void moveBefore(DbgRecord *MoveBefore)
Definition:DebugProgramInstruction.cpp:569
llvm::DbgRecord::getModule
Module * getModule()
Definition:DebugProgramInstruction.cpp:523
llvm::DbgRecord::ValueKind
@ ValueKind
Definition:DebugProgramInstruction.h:139
llvm::DbgRecord::LabelKind
@ LabelKind
Definition:DebugProgramInstruction.h:139
llvm::DbgRecord::getInstruction
const Instruction * getInstruction() const
Definition:DebugProgramInstruction.cpp:503
llvm::DbgRecord::getMarker
DbgMarker * getMarker()
Definition:DebugProgramInstruction.h:171
llvm::DbgRecord::moveAfter
void moveAfter(DbgRecord *MoveAfter)
Definition:DebugProgramInstruction.cpp:575
llvm::DbgRecord::isIdenticalToWhenDefined
bool isIdenticalToWhenDefined(const DbgRecord &R) const
Definition:DebugProgramInstruction.cpp:116
llvm::DbgRecord::Marker
DbgMarker * Marker
Marker that this DbgRecord is linked into.
Definition:DebugProgramInstruction.h:137
llvm::DbgRecord::setMarker
void setMarker(DbgMarker *M)
Definition:DebugProgramInstruction.h:169
llvm::DbgRecord::clone
DbgRecord * clone() const
Definition:DebugProgramInstruction.cpp:384
llvm::DbgRecord::getContext
LLVMContext & getContext()
Definition:DebugProgramInstruction.cpp:529
llvm::DbgRecord::getParent
const BasicBlock * getParent() const
Definition:DebugProgramInstruction.cpp:507
llvm::DbgVariableIntrinsic
This is the common base class for debug info intrinsics for variables.
Definition:IntrinsicInst.h:308
llvm::DbgVariableIntrinsic::getRawLocation
Metadata * getRawLocation() const
Definition:IntrinsicInst.h:379
llvm::DbgVariableRecord::location_op_iterator
Iterator for ValueAsMetadata that internally uses direct pointer iteration over either a ValueAsMetad...
Definition:DebugProgramInstruction.h:366
llvm::DbgVariableRecord
Record of a variable value-assignment, aka a non instruction representation of the dbg....
Definition:DebugProgramInstruction.h:270
llvm::DbgVariableRecord::DbgVariableRecord
DbgVariableRecord(const DbgVariableIntrinsic *DVI)
Create a new DbgVariableRecord representing the intrinsic DVI, for example the assignment represented...
Definition:DebugProgramInstruction.cpp:31
llvm::DbgVariableRecord::getType
LocationType getType() const
Definition:DebugProgramInstruction.h:443
llvm::DbgVariableRecord::isKillAddress
bool isKillAddress() const
Check whether this kills the address component.
Definition:DebugProgramInstruction.cpp:498
llvm::DbgVariableRecord::Variable
DbgRecordParamRef< DILocalVariable > Variable
Definition:DebugProgramInstruction.h:292
llvm::DbgVariableRecord::isKillLocation
bool isKillLocation() const
Definition:DebugProgramInstruction.cpp:368
llvm::DbgVariableRecord::getAssignID
DIAssignID * getAssignID() const
Definition:DebugProgramInstruction.cpp:485
llvm::DbgVariableRecord::getFragmentSizeInBits
std::optional< uint64_t > getFragmentSizeInBits() const
Get the size (in bits) of the variable, or fragment of the variable that is described.
Definition:DebugProgramInstruction.cpp:378
llvm::DbgVariableRecord::clone
DbgVariableRecord * clone() const
Definition:DebugProgramInstruction.cpp:394
llvm::DbgVariableRecord::setKillLocation
void setKillLocation()
Definition:DebugProgramInstruction.cpp:356
llvm::DbgVariableRecord::createUnresolvedDbgVariableRecord
static DbgVariableRecord * createUnresolvedDbgVariableRecord(LocationType Type, Metadata *Val, MDNode *Variable, MDNode *Expression, MDNode *AssignID, Metadata *Address, MDNode *AddressExpression, MDNode *DI)
Used to create DbgVariableRecords during parsing, where some metadata references may still be unresol...
Definition:DebugProgramInstruction.cpp:170
llvm::DbgVariableRecord::setRawLocation
void setRawLocation(Metadata *NewLocation)
Use of this should generally be avoided; instead, replaceVariableLocationOp and addVariableLocationOp...
Definition:DebugProgramInstruction.h:469
llvm::DbgVariableRecord::createDbgVariableRecord
static DbgVariableRecord * createDbgVariableRecord(Value *Location, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
Definition:DebugProgramInstruction.cpp:179
llvm::DbgVariableRecord::createDVRDeclare
static DbgVariableRecord * createDVRDeclare(Value *Address, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
Definition:DebugProgramInstruction.cpp:194
llvm::DbgVariableRecord::getAddress
Value * getAddress() const
Definition:DebugProgramInstruction.cpp:474
llvm::DbgVariableRecord::isDbgAssign
bool isDbgAssign() const
Definition:DebugProgramInstruction.h:506
llvm::DbgVariableRecord::setExpression
void setExpression(DIExpression *NewExpr)
Definition:DebugProgramInstruction.h:452
llvm::DbgVariableRecord::getExpression
DIExpression * getExpression() const
Definition:DebugProgramInstruction.h:453
llvm::DbgVariableRecord::getVariableLocationOp
Value * getVariableLocationOp(unsigned OpIdx) const
Definition:DebugProgramInstruction.cpp:263
llvm::DbgVariableRecord::setKillAddress
void setKillAddress()
Kill the address component.
Definition:DebugProgramInstruction.cpp:493
llvm::DbgVariableRecord::getVariable
DILocalVariable * getVariable() const
Definition:DebugProgramInstruction.h:449
llvm::DbgVariableRecord::addVariableLocationOps
void addVariableLocationOps(ArrayRef< Value * > NewValues, DIExpression *NewExpr)
Adding a new location operand will always result in this intrinsic using an ArgList,...
Definition:DebugProgramInstruction.cpp:340
llvm::DbgVariableRecord::getRawLocation
Metadata * getRawLocation() const
Returns the metadata operand for the first location description.
Definition:DebugProgramInstruction.h:460
llvm::DbgVariableRecord::setAssignId
void setAssignId(DIAssignID *New)
Definition:DebugProgramInstruction.cpp:489
llvm::DbgVariableRecord::setAddress
void setAddress(Value *V)
Definition:DebugProgramInstruction.h:522
llvm::DbgVariableRecord::createDVRAssign
static DbgVariableRecord * createDVRAssign(Value *Val, DILocalVariable *Variable, DIExpression *Expression, DIAssignID *AssignID, Value *Address, DIExpression *AddressExpression, const DILocation *DI)
Definition:DebugProgramInstruction.cpp:211
llvm::DbgVariableRecord::getNumVariableLocationOps
unsigned getNumVariableLocationOps() const
Definition:DebugProgramInstruction.cpp:257
llvm::DbgVariableRecord::createDebugIntrinsic
DbgVariableIntrinsic * createDebugIntrinsic(Module *M, Instruction *InsertBefore) const
Convert this DbgVariableRecord back into a dbg.value intrinsic.
Definition:DebugProgramInstruction.cpp:403
llvm::DbgVariableRecord::getRawAddress
Metadata * getRawAddress() const
Definition:DebugProgramInstruction.h:509
llvm::DbgVariableRecord::replaceVariableLocationOp
void replaceVariableLocationOp(Value *OldValue, Value *NewValue, bool AllowEmpty=false)
Definition:DebugProgramInstruction.cpp:286
llvm::DbgVariableRecord::LocationType
LocationType
Definition:DebugProgramInstruction.h:274
llvm::DbgVariableRecord::LocationType::Assign
@ Assign
llvm::DbgVariableRecord::LocationType::Declare
@ Declare
llvm::DbgVariableRecord::LocationType::Value
@ Value
llvm::DbgVariableRecord::LocationType::End
@ End
Marks the end of the concrete types.
llvm::DbgVariableRecord::LocationType::Any
@ Any
To indicate all LocationTypes in searches.
llvm::DbgVariableRecord::getFragment
std::optional< DbgVariableFragmentInfo > getFragment() const
Definition:DebugProgramInstruction.cpp:374
llvm::DbgVariableRecord::createLinkedDVRAssign
static DbgVariableRecord * createLinkedDVRAssign(Instruction *LinkedInstr, Value *Val, DILocalVariable *Variable, DIExpression *Expression, Value *Address, DIExpression *AddressExpression, const DILocation *DI)
Definition:DebugProgramInstruction.cpp:220
llvm::DbgVariableRecord::AddressExpression
DbgRecordParamRef< DIExpression > AddressExpression
Definition:DebugProgramInstruction.h:294
llvm::DbgVariableRecord::hasArgList
bool hasArgList() const
Definition:DebugProgramInstruction.h:430
llvm::DbgVariableRecord::getAddressExpression
DIExpression * getAddressExpression() const
Definition:DebugProgramInstruction.h:514
llvm::DbgVariableRecord::location_ops
iterator_range< location_op_iterator > location_ops() const
Get the locations corresponding to the variable referenced by the debug info intrinsic.
Definition:DebugProgramInstruction.cpp:234
llvm::DebugLoc
A debug info location.
Definition:DebugLoc.h:33
llvm::DebugValueUser
Base class for tracking ValueAsMetadata/DIArgLists with user lookups and Owner callbacks outside of V...
Definition:Metadata.h:216
llvm::DebugValueUser::DebugValues
std::array< Metadata *, 3 > DebugValues
Definition:Metadata.h:222
llvm::DebugValueUser::resetDebugValue
void resetDebugValue(size_t Idx, Metadata *DebugValue)
Definition:Metadata.h:277
llvm::Expression
Class representing an expression and its matching format.
Definition:FileCheckImpl.h:189
llvm::Function
Definition:Function.h:63
llvm::Function::getFunctionType
FunctionType * getFunctionType() const
Returns the FunctionType for me.
Definition:Function.h:216
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition:GlobalValue.h:657
llvm::Instruction
Definition:Instruction.h:68
llvm::Instruction::DebugMarker
DbgMarker * DebugMarker
Optional marker recording the position for debugging information that takes effect immediately before...
Definition:Instruction.h:84
llvm::Instruction::insertBefore
void insertBefore(Instruction *InsertPos)
Insert an unlinked instruction into a basic block immediately before the specified instruction.
Definition:Instruction.cpp:99
llvm::Instruction::getMetadata
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
Definition:Instruction.h:426
llvm::Instruction::setDebugLoc
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
Definition:Instruction.h:508
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition:LLVMContext.h:67
llvm::MDNode
Metadata node.
Definition:Metadata.h:1073
llvm::MDNode::getContext
LLVMContext & getContext() const
Definition:Metadata.h:1237
llvm::MetadataAsValue::get
static MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition:Metadata.cpp:103
llvm::Metadata
Root of the metadata hierarchy.
Definition:Metadata.h:62
llvm::ModuleSlotTracker
Manage lifetime of a slot tracker for printing IR.
Definition:ModuleSlotTracker.h:44
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition:Module.h:65
llvm::PoisonValue::get
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
Definition:Constants.cpp:1878
llvm::SmallPtrSetImpl::insert
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:384
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition:SmallPtrSet.h:519
llvm::SmallVectorTemplateBase::push_back
void push_back(const T &Elt)
Definition:SmallVector.h:413
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::ValueAsMetadata
Value wrapper in the Metadata hierarchy.
Definition:Metadata.h:454
llvm::ValueAsMetadata::get
static ValueAsMetadata * get(Value *V)
Definition:Metadata.cpp:501
llvm::Value
LLVM Value Representation.
Definition:Value.h:74
llvm::ilist_detail::node_parent_access::getParent
const ParentTy * getParent() const
Definition:ilist_node.h:32
llvm::ilist_node_impl::getIterator
self_iterator getIterator()
Definition:ilist_node.h:132
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition:iterator_range.h:42
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:raw_ostream.h:52
llvm::simple_ilist::iterator
typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, false >::type iterator
Definition:simple_ilist.h:97
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition:ErrorHandling.h:143
llvm::Intrinsic::getOrInsertDeclaration
Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > Tys={})
Look up the Function declaration of the intrinsic id in the Module M.
Definition:Intrinsics.cpp:732
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::find
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1759
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition:iterator_range.h:77
llvm::any_of
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1746
llvm::getAsMetadata
static ValueAsMetadata * getAsMetadata(Value *V)
Definition:DebugProgramInstruction.cpp:280
llvm::CaptureComponents::Address
@ Address
llvm::ModRefInfo::Ref
@ Ref
The access may reference the value stored in memory.
llvm::IRMemLocation::First
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
llvm::is_contained
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition:STLExtras.h:1903

Generated on Fri Jul 18 2025 11:39:50 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp