[LLVMdev] finding where a Value was initially assigned

Owen Anderson resistor at mac.com
Sun Dec 16 13:54:06 PST 2007


On Dec 16, 2007, at 3:41 PM, lists wrote:
>
> i can visit every instruction in each function, identify the
> appropriate CallInst, get the CallSite of the instruction and extract
> the appropriate (Value) argument with getArgument(X). Unfortunately I
> can't figure out how to get from the Value of the argument to its
> definition/assignment site.

The Value* is the definition.  Instruction inherits from Value.  If  
your argument was defined by an instruction (it could also be an  
argument of the parent function, or a global, or a constant), then the  
Value* you have is polymorphically an Instruction*.  You can use the  
dyn_cast<...> facilities to test this at runtime.

--Owen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071216/4fd7c263/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071216/4fd7c263/attachment.bin>


More information about the llvm-dev mailing list