[llvm-dev] Help with new llvm.debug.value metadata API

Zvonimir Rakamaric via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 22 06:53:33 PST 2015


Hi all,

So I started working on upgrading our tool from LLVM 3.5 to 3.6, and I
would appreciate your help with the new metadata API.

In particular, I currently have the following snippet of code:
// ci is llvm.debug.value instruction
    const llvm::MDNode* m1 = dyn_cast<const
llvm::MDNode>(ci.getArgOperand(0));
    const llvm::MDNode* m2 = dyn_cast<const
llvm::MDNode>(ci.getArgOperand(2));
    assert(m1 && "Expected metadata node in first argument to
llvm.dbg.value.");
    assert(m2 && "Expected metadata node in third argument to
llvm.dbg.value.");
    const llvm::MDString* m3 = dyn_cast<const
llvm::MDString>(m2->getOperand(2));
    assert(m3 && "Expected metadata string in the third argument to
metadata node.");

   if (const llvm::Value* V = m1->getOperand(0)) { // this does not compile
any more!
   ... Need Type of Value V here.
    }

In LLVM 3.6, the expression in the if condition does not compile any more.

What I basically need in the if body is to access the type (Type) of the
variable specified in the llvm.debug.value metadata. How do I access its
type using the new metadata API?

Any pointers would be greatly appreciated.

Thanks!
-- Zvonimir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151222/92833728/attachment.html>


More information about the llvm-dev mailing list