[LLVMdev] how to compile a large project to LLVM IR?

Mehdi Amini mehdi.amini at apple.com
Thu Jun 25 07:46:09 PDT 2015


Hi,

> On Jun 24, 2015, at 6:30 PM, Q Z <zhaoqian301 at gmail.com> wrote:
> 
> 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?

I think it depends the kind of check you want to perform. If it is something local enough that a function pass or module pass would work, you may not need the entire project as a whole in a single IR file. In this case you can add your pass to the pipeline and recompile clang or again depending on what you want to perform you can try a solution like this: https://homes.cs.washington.edu/~asampson/blog/clangpass.html <https://homes.cs.washington.edu/~asampson/blog/clangpass.html>

— 
Mehdi


> 
> 2015-06-25 1:54 GMT+08:00 Pete Cooper <peter_cooper at apple.com <mailto:peter_cooper at apple.com>>:
> 
>> On Jun 24, 2015, at 10:19 AM, Eli Bendersky <eliben at google.com <mailto:eliben at google.com>> wrote:
>> 
>> 
>> 
>> On Wed, Jun 24, 2015 at 7:05 AM, Q Z <zhaoqian301 at gmail.com <mailto:zhaoqian301 at gmail.com>> wrote:
>> 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?)
> 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
>> 
>> I suggest you take a look at the "NaCl ports" project (https://code.google.com/p/naclports/ <https://urldefense.proofpoint.com/v2/url?u=https-3A__code.google.com_p_naclports_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=RfjvEJWweAkWHLneLw1ksvf1RoobZbEIUUVtXtJgYv4&s=RvO9OeVGsfCkE0U5HJQV_pwo1s2U1qoZg2Wx-gK19cs&e=>). 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
>> 
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>         http://llvm.cs.uiuc.edu <http://llvm.cs.uiuc.edu/>
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev <http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev>
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

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


More information about the llvm-dev mailing list