Getting started with LLVM: Some things to try: 1) make sure that llvm is installed on your machine. It's already installed on the lab machines (see below), and it's available using many popular package managers for other popular platforms. To see whether it's installed, look for one of the llvm binaries: llvm-as, or llvm-ld. On the lab machines, you can find these binaries in ~clements/llvm-2.4/bin/ 2) make sure that llvm-gcc is installed on your machine. This is a *separate* installation. On the lab machines, you can find these binaries in ~clements/llvm-gcc4.2-2.4-x86-linux-RHEL4/bin/ 3) Try it out! Here's a C file: #include int main() { printf("4 + 6 = %d\n",4+6); return 0; } Compile this file into llvm bitcode like this: llvm-gcc -c -emit-llvm foo.c Now, let's make an executable of it: llvm-ld -o foo foo.o And, let's try running it: ./foo If it works: Well done! Now, let's take a look at the llvm code, using the disassembler: llvm-dis foo.o less foo.o.ll Yep, there it is. Okay, let's create our own LLVM file, called "my-llvm.s". Now, let's add a new llvm function: define i32 @first_fun(){ ret i32 19 } Okay, let's compile it: llvm-as my-llvm.s Now, let's change our C file so that it calls this function: #include extern unsigned int first_fun(); int main() { printf("4 + 6 = %d\n",first_fun()); return 0; } Recompile it: llvm-gcc -emit-llvm -c foo.c Now, let's link them both together: llvm-ld -o foo my-llvm.s.bc foo.o Now, let's run the resulting binary: ./foo Awesome! Except for the fact that 4+6 is not actually 19, that is... Okay, now you're off and running...