From: Chris Lattner
Yes, you can use LLVM to convert code from any language LLVM supports to C. +Note that the generated C code will be very low level (all loops are lowered +to gotos, etc) and not very pretty (comments are stripped, original source +formatting is totally lost, variables are renamed, expressions are regrouped), +so this may not be what you're looking for. However, this is a good way to add +C++ support for a processor that does not otherwise have a C++ compiler. +
+ +Use commands like this:
+ +Compile your program as normal with llvm-g++:
or:
+ +With llvm-gcc3, this will generate program and program.bc. The .bc file is +the LLVM version of the program all linked together.
+ +Convert the LLVM code to C code, using the LLC tool with the C +backend:
Finally, compile the c file:
Note that, by default, the C backend does not support exception handling. +If you want/need it for a certain program, you can enable it by passing +"-enable-correct-eh-support" to the llc program. The resultant code will +use setjmp/longjmp to implement exception support that is correct but +relatively slow. +
+