[llvm-dev] big module for a project

John Criswell via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 11 09:26:07 PST 2016


Dear Yuxi,

There are three general ways to do this (two of which have already been 
mentioned).

First, you can change the Makefiles to emit bitcode and then use 
llvm-link to link all the bitcode files together into a big bitcode 
file.  You can then run the opt program on this large bitcode file.

Second, you can use some third-party tools (for lack of a better term) 
that will get you a single bitcode file with fewer changes to the 
Makefiles.  I'm not very familiar with these, but I think others have 
commented on them.

Third, you can add your analysis pass to the libLTO library and use 
LLVM's link-time optimization framework to run your analysis. 
Documentation libLTO can be found at 
http://llvm.org/docs/LinkTimeOptimization.html and 
http://llvm.org/docs/GoldPlugin.html.  LLVM's LTO infrastructure is 
designed to be transparent (i.e., you shouldn't have to modify Makefiles 
to use it), though some programs' Makefiles are more...complaint than 
others.

I've used the libLTO approach for large programs with reasonable 
success.  However, some of the other third-party approaches have been 
reported to work well, so you might try looking at those.

Regards,

John Criswell

On 3/10/16 9:54 PM, Yuxi Chen via llvm-dev wrote:
> Hi All,
>
> I am using clang to compile Mysql source code. Because I want to do 
> some inter-procedural analysis, hopefully, I want to get a .o(bitcode) 
> file(a module) containing all possible function declarations and 
> definitions. Is it possible to do that ? Or you guys have some 
> suggestions?
>
> To be clear, like Mysql, there is a mysqld routine, which is a major 
> routine. I want to mysqld.o(which is generated by clang) to contain 
> all possible function declarations and definitions. So when I do some 
> analysis, I just need load one module, which is mysqld.o, instead of 
> all .o files.
>
>
> Best,
> Yuxi
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

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


More information about the llvm-dev mailing list