<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 21, 2016, at 12:33 PM, Kevin Hu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Shulin,<div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">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.</div></div></div></blockquote><div><br class=""></div><div>Just note on this last aspect of the problem: I don’t see any fundamental reason a custom interprocedural-analysis can’t run over a call graph involving functions defined in multiple modules without linking them in a single IR. This is admittedly more involved though.</div><div><br class=""></div><div>— </div><div>Mehdi</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Regards,</div><div class="">Kevin</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Jan 21, 2016 at 2:21 AM 周书林 via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class="">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.<br class=""></div>For example,<br class="">****************************************<br class=""></div>int foo(struct A* a, int b, ...){<br class="">    ...<br class=""></div>    a->Int_field = b;<br class="">    ...<br class=""></div>    return 0;<br class=""><div class=""><div class="">}<br class="">*****************************************<br class="">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  <span class="">Use scenario and fetch some constraints about it.<br class=""></span></div><div class=""><span class="">So, could I achieve this goal via IR?<br class=""></span></div><div class=""><span class="">Thanks a lot!<br class=""></span></div></div></div>
_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
</blockquote></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></body></html>