Given a llvm.dbg.declare
, how can I get its llvm value?
e.g.
call void @llvm.dbg.declare(metadata !{i32** %r}, metadata !23), !dbg !24
I want get the Value i32** %r
, not the metadata !{i32** %r}
.
Please give me the code!
Thanks!
Given a llvm.dbg.declare
, how can I get its llvm value?
e.g.
call void @llvm.dbg.declare(metadata !{i32** %r}, metadata !23), !dbg !24
I want get the Value i32** %r
, not the metadata !{i32** %r}
.
Please give me the code!
Thanks!
metadata !{i32** %r}
is the 1st operand of the call instruction, and i32** %r
is the 1st operand of the metadata. So something like this should work:
CallInst I = ... // get the @llvm.dbg.declare call
Value* referredValue = cast<MDNode>(I->getOperand(0))->getOperand(0);