<div dir="ltr"><div><div><div>Dear Shulin,<br><br></div>Sounds like you'll need an inter-procedural analysis across different source files. One<br></div>option I can think of is to manually update the Makefiles, make compiler emit bitcode <br>files, merge them with llvm-link and run it through your optimization pass as a big bitcode <br>file. This somehow could involve huge amount of tedious work for a huge project like <br>Apache, and may be error-prone. <br></div><div><br></div><div>Another option I can think of is the libLTO. It should link all bitcode files and run optimization<br></div><div>passes for you.<br><br><a href="http://llvm.org/docs/LinkTimeOptimization.html#phase-3-optimize-bitcode-files">http://llvm.org/docs/LinkTimeOptimization.html#phase-3-optimize-bitcode-files</a><br><br></div><div>I've never dealt with it myself and I don't find abundant tutorials and examples online. You<br></div><div>probably need to dig into the source code. (in lib/LTO ?)<br><br></div><div>Correct me where I'm wrong or if there are any other good approaches.<br><br></div><div>Regards,<br></div><div>Kevin</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Feb 29, 2016 at 9:15 PM 周书林 via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am learning to do some basic dataflow analysis on C code projects,<br>
such as Apache httpd. Now I am a newbie of LLVM IR, and there are some<br>
problems in doing that.<br>
In the official User Manual of how to write a LLVM PASS, they only<br>
show the way to generate IR of a single ".c" source file. But in fact<br>
there are so many examples that the usage and definition of a function<br>
are not in the same ".c" source file, rising the difficulty of<br>
analzing the dataflow of such functions.<br>
So, I want to know, is there any method of strategies to generate the<br>
IR among many related source files?<br>
Thanks a lot !<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>