[llvm-dev] Could I do some control-flow and dataflow analysis cross files and functions via IR

Kevin Hu via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 21 12:33:29 PST 2016


Hi Shulin,

It seems to me what you'll need is your own inter-procedural analysis to
deal with data-flow between functions. That is, you'll need to figure out
the callgraph between all the functions and the dataflow inside all the
functions. In this case, you'll need to find where foo is called (probably
multiple places), what are the use cases for all this callsites in the
dataflow in foo's parent function, and all the functions where the pointer
a's content could be modified. If there're other pointers pointing to the
same address a's pointing to, you may also need pointer analysis, where
things could get really tricky.

To deal with different IR files, you'll either have to implement an LTO
pass, or use llvm-link to link multiple IRs to a combined IR for analysis
run it through your OPT pass like a regular IR.

Regards,
Kevin

On Thu, Jan 21, 2016 at 2:21 AM 周书林 via llvm-dev <llvm-dev at lists.llvm.org>
wrote:

> As mentioned in the title, I want to do some control-flow and dataflow
> analysis. I can only find the assignment statement in a function, but the
> assigned variable is just a parameter of this function.
> For example,
> ****************************************
> int foo(struct A* a, int b, ...){
>     ...
>     a->Int_field = b;
>     ...
>     return 0;
> }
> *****************************************
> in the code above, I want to do some analysis for struct A* a's Int_field,
> but in this function, it is only assigned, I want to find its  Use
> scenario and fetch some constraints about it.
> So, could I achieve this goal via IR?
> Thanks a lot!
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160121/af71a71e/attachment.html>


More information about the llvm-dev mailing list