how to compile a large project to LLVM IR?

Hello,I want to compile a large project(for example,Apache httpd) to one .bc file. How can I do this? Can you give me some examples?

In general, if the codebase of a certain project is compilable by
Clang/LLVM, this should be possible, but the devil is in the details (for
example - how is the standard library going to get compiled into that .bc
file?)

I suggest you take a look at the "NaCl ports" project (
Monorail - webports - Ports of open-source projects to the web - Monorail). It has ready-made makefiles to
compile a bunch of well known open source projects using the PNaCl
toolchain, which is based on LLVM. Each file is compiled to IR and the LLVM
linker is used to link them all together. This is a full solution, handling
the standard libraries, and so on.

Eli

If you only care about the project itself and not things like the standard library, then LTO is possible too. Depends on the linker you are using, but Apple’s ld and I believe the gold linker both have -save-temps options which save the bit codes before/after optimization but certainly after linking.

Cheers,
Pete

Thank you for you nice answer. But I’am sorry, I find the question I was asked is not what I really want. my situation is that I want to write a LLVM pass to check a large progress. what is the simplest way for me to make the progress become checkable?

You can probably generate different .bc files and link/merge them using llvm-link.

http://llvm.org/releases/2.7/docs/CommandGuide/html/llvm-link.html

Regards,

Ashutosh

Thank you for you nice answer. But I'am sorry, I find the question I was
asked is not what I really want. my situation is that I want to write a
LLVM pass to check a large progress. what is the simplest way for me to
make the progress become checkable?

Sorry, I don't understand what you're asking. What do you mean by
"progress" here?

Eli

Hi,