Tuesday, January 5, 2010

LLVM | compile, JIT, do run-time optimizations on C/C++ and generate byte-code

Woah!!! This is cool.

We've all known the concept of VM's and the JVM that is being virtually used in every intelligent machine, even the thinnest of a computing client (cell-phones, e-gadgets etc.)

But, we also know that no-matter how much the JVM has evolved thus far... it's a virtual machine and can still not give you the performance of the real machine as close as possible (the in-famous performance debate: C/C++ compiled code Vs. Java byte-code)

Well, here comes the LLVM... Low Level Virtual Machine, a bit more closer to the platform and one that has benefits like:
1) effective optimization at compile time, link-time (particularly interprocedural), run-time and offline transformations (i.e., after software is installed)
2) sophisticated transformations on object code, while remaining light-weight enough to be attached to the executable.
3) static back-ends for many popular (and legacy) architectures, a back-end which emits portable C code, and a Just-In-Time compilers for several architectures
4) does not require garbage collection or run-time code generation (It makes a great static compiler).

To give it a try, write some C/C++ code and then compile it from within the browser.
Observe the LLVM re-generated code, how C/C++ constructs map to LLVM and run some LLVM optimizations.

No comments: