[LLVMdev] Data flow analysis

John Criswell criswell at illinois.edu
Sun May 1 13:09:45 PDT 2011


On 4/30/11 4:39 AM, Wenhan Gu wrote:
> Hi all,
>
> in this case:
>
> ...
> int* p = ...
> int* q = p;
> ...
>
> How can I know that data-flow from p to q,
> i.e., which LLVM pass of header files could I use?

It's not completely clear what sort of analysis you want.  If you want 
reaching definitions for just SSA virtual register values, then you only 
need to follow the explicit def-use chains in the SSA graph (see the 
use_iterator of class llvm::Value, IIRC).

If you need to know if p and q point to the same memory object (assuming 
that the memory object is not eliminated by the mem2reg pass), then you 
need to either use the AliasAnalysis analysis group or a points-to 
analysis like DSA.

If you need reaching definitions analysis for all values (including 
those that travel into/out of memory objects), then you need a points-to 
analysis combined with a reaching definitions analysis.  I do not think 
anyone has implemented such an analysis for LLVM yet, although a 
(relatively) simple one could probably be written on top of DSA.

-- John T.


>
> Thank you all.
>
> -- 
> Best regards,
> Wen-Han
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110501/fe9fab5e/attachment.html>


More information about the llvm-dev mailing list