Hongbin Zheng via llvm-dev
2017-Nov-22 21:29 UTC
[llvm-dev] Retrieving DbgInfoIntrinsics for a given value
Hi LLVM, If I have an llvm value "<16 x float> addrspace(1)* %in", and in the LLVM IR, there is a @llvm.dbg.value like: call void @llvm.dbg.value(metadata <16 x float> addrspace(1)* %in, i64 0, metadata !216, metadata !28), !dbg !217 How I can retrieve this @llvm.dbg.value when I have "%in"? Since Metadata is not a part of the uselist anymore, is there some way rather than iterate over every instructions in the function to get this @llvm.dbg.value? Thanks Hongbin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171122/878b7ba5/attachment.html>
Reid Kleckner via llvm-dev
2017-Nov-27 23:21 UTC
[llvm-dev] Retrieving DbgInfoIntrinsics for a given value
Check out llvm::findDbgValues: void llvm::findDbgValues(SmallVectorImpl<DbgValueInst *> &DbgValues, Value *V) { if (auto *L = LocalAsMetadata::getIfExists(V)) if (auto *MDV = MetadataAsValue::getIfExists(V->getContext(), L)) for (User *U : MDV->users()) if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(U)) DbgValues.push_back(DVI); } Basically, there is a DenseMap of all values used by debug intrinsics in the LLVM context. On Wed, Nov 22, 2017 at 1:29 PM, Hongbin Zheng via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi LLVM, > > If I have an llvm value "<16 x float> addrspace(1)* %in", and in the LLVM > IR, there is a @llvm.dbg.value like: > > call void @llvm.dbg.value(metadata <16 x float> addrspace(1)* %in, i64 0, > metadata !216, metadata !28), !dbg !217 > > How I can retrieve this @llvm.dbg.value when I have "%in"? > > Since Metadata is not a part of the uselist anymore, is there some way > rather than iterate over every instructions in the function to get this > @llvm.dbg.value? > > Thanks > Hongbin > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171127/bdf398ce/attachment.html>
Hongbin Zheng via llvm-dev
2017-Nov-29 00:17 UTC
[llvm-dev] Retrieving DbgInfoIntrinsics for a given value
Thanks, this is very useful On Mon, Nov 27, 2017 at 3:21 PM, Reid Kleckner <rnk at google.com> wrote:> Check out llvm::findDbgValues: > > void llvm::findDbgValues(SmallVectorImpl<DbgValueInst *> &DbgValues, > Value *V) { > if (auto *L = LocalAsMetadata::getIfExists(V)) > if (auto *MDV = MetadataAsValue::getIfExists(V->getContext(), L)) > for (User *U : MDV->users()) > if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(U)) > DbgValues.push_back(DVI); > } > > Basically, there is a DenseMap of all values used by debug intrinsics in > the LLVM context. > > On Wed, Nov 22, 2017 at 1:29 PM, Hongbin Zheng via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hi LLVM, >> >> If I have an llvm value "<16 x float> addrspace(1)* %in", and in the LLVM >> IR, there is a @llvm.dbg.value like: >> >> call void @llvm.dbg.value(metadata <16 x float> addrspace(1)* %in, i64 0, >> metadata !216, metadata !28), !dbg !217 >> >> How I can retrieve this @llvm.dbg.value when I have "%in"? >> >> Since Metadata is not a part of the uselist anymore, is there some way >> rather than iterate over every instructions in the function to get this >> @llvm.dbg.value? >> >> Thanks >> Hongbin >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171128/fca2c9a8/attachment.html>