[LLVMdev] How to analyze where the address comes from?

Ruiling Song ruiling.song83 at gmail.com
Sun Nov 23 19:06:15 PST 2014


Previously, I started from the load/store instructions, and tried to find
the original definitions by going through defs recursively. And I met the
problem described in last mail.
It seems that I have to do things reversely. That is to start from
definitions of pointers/memory objects and check their uses recursively. I
don't know whether this is a good idea.
Or is there any other good suggestion?

Thanks!
Ruiling

2014-11-19 16:54 GMT+08:00 Ruiling Song <ruiling.song83 at gmail.com>:

> Hi,
>
> I want to get the information where the address of load/store comes from,
> like below load instruction, %152 may come from a getelementpr, or comes
> from some gep+ptrtoint+add+inttoptr... instructions. what's the recommended
> way to find the original memory pointer?
>
>   %153 = load <2 x i16> addrspace(1)* %152, align 2
>
> going through the use-def chain seems not easy, because the 'add'
> operation contains two operands, one come from a pointer, the other is an
> integer offset. I could not know which is at operand 0 and which is at
> operand 1.
>
> Thanks!
> Ruiling
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141124/8f71232b/attachment.html>


More information about the llvm-dev mailing list