[LLVMdev] Compile a large project with llvm?
criswell at cs.uiuc.edu
Fri Mar 5 08:26:12 CST 2010
Wink zhang wrote:
> How to compile a large project (such as Apache) by using llvm-gcc?
> I tried to replace CC with llvm-gcc and CFLAGS with -emit-llvm while
> running configure, but it didn't work.
If you just want to compile the program with llvm-gcc, then Diego's
instructions are fine.
If, however, you want to do inter-procedural optimization or whole
program analysis, then there's additional things you need to do.
If you just want to use LLVM's link-time optimizations, you will need to
use the libLTO library with your linker. Your linker, in turn, must be
able to support plugins (like the gold linker, for example). For
directions on how to set up libLTO, see
If you want to write and use your own link-time passes, then you have
1) Modify the program's Makefiles to use llvm-ld to link bitcode files
together. This will allow you to generate a single bitcode image.
2) Modify libLTO to run your analysis and transform passes. If you plan
to work with several large applications, this is probably the way to
go. SAFECode has a version of libLTO that does whole-program analysis;
you can find this tool in the safecode/tools/LTO directory in the
SAFECode source code (directions for getting SAFECode are at
http://safecode.cs.illinois.edu/downloads.html). This approach can
sometimes alleviate the need for changing the Makefiles.
-- John T.
> Thank you for your help.
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the LLVMdev