User:Rusack/Sandbox

This page should give a general idea about how to use llvm-gcc and the LLVM tool chain. simple.c is used as an example program.

To compile 'simple.c' into an executible
GCC standard arguments -S and -c work (a .s or .o file respectively will be produced).

llvm-gcc simple.c -o simple

To compile 'simple.c' into LLVM bitcode
llvm-gcc -emit-llvm simple.c -o simple.bc If used with -S or -c arguments, then .ll or .bc respectively will be emitted.

To run the program use
lli simple.bc lli, the LLVM JIT, executes programs in LLVM bitcode.

or

./simple

To use llvm-dis to convert LLVM bitcode to human-readable LLVM assembly language
llvm-dis < simple.bc | less

To compile the program to native assembly
llc simple.bc -o simple.s

To assemble 'simple.s' into a program use GCC
gcc simple.s -o simple

and execute

./simple