[LLVMdev] how to get the llvm IR from C source code?

Nick Lewycky nicholas at mxc.ca
Wed Dec 24 20:53:42 PST 2008


Keun Soo Yim wrote:
>
> Please run…
>
> $ llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc
>
> $ llvm-dis < hello.bc > hello.ll
>
> The first command is to generate a byte code
>
> and second is to translate the bytecode to a readable form.
>
llvm-gcc can emit the textual form directly too:

llvm-gcc -O2 -emit-llvm hello.c -S -o hello.ll
llvm-gcc -O2 -emit-llvm hello.c -S -o -

the latter will print it to standard out.

> Thanks!
>
> *From:* llvmdev-bounces at cs.uiuc.edu 
> [mailto:llvmdev-bounces at cs.uiuc.edu] *On Behalf Of *Alex.Wang
> *Sent:* Wednesday, December 24, 2008 10:31 PM
> *To:* llvmdev at cs.uiuc.edu
> *Subject:* [LLVMdev] how to get the llvm IR from C source code?
>
> Hi everyone.
> I want to get the llvm IR from the C source code by LLVM-GCC. But I am 
> not familiar with those command line arguments.
> Can anyone give me a guidance? Thank you very much for any help.
> Good luck.
>
> -- 
> Best regards.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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