[LLVMdev] Compile a large project with llvm?
John Criswell
criswell at cs.uiuc.edu
Fri Mar 5 06:26:12 PST 2010
Wink zhang wrote:
> Hi,
>
> 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
http://llvm.org/docs/LinkTimeOptimization.html and
http://llvm.org/docs/GoldPlugin.html.
If you want to write and use your own link-time passes, then you have
several options:
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.
>
> -Wink
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
More information about the llvm-dev
mailing list