[LLVMdev] compile .bc in cpp program

Duncan Sands baldrick at free.fr
Sun Jan 8 06:02:21 PST 2012


Hi Андрей Кабылин,

the tools directory contains a bunch of cpp programs that load, optimize and
codegen bitcode (eg: opt and llc).  They are quite small since all the real
work is done in the LLVM libraries.  I suggest you copy what they do.

Ciao, Duncan.

> Hello, can i compile binary file .bc in my cpp program? now i use following code:
>
> if (system("opt a.out.bc -std-compile-opts -disable-inlining -loop-deletion
> -loop-extract -loop-extract-single -loop-rotate -loop-index-split -loop-unroll
> -opt-phis -loop-unswitch -loop-reduce -o test.bc") == -1) {
> Error("Don't install LLVM!");
> exit(1);
> }
>
> if (system("llvmc test.bc -o test.out") != -1) {...}
> if (system("ldd test.out") == -1) {...}
>
> and what keys using in clang with flag -O3?
> With respect Andrei.
>
>
> _______________________________________________
> 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