Low Level Virtual Machine
|
Low Level Virtual Machine [1] (http://llvm.cs.uiuc.edu), generally known as LLVM, is a compiler infrastructure designed for compile-time, link-time, run-time, and "idle-time" optimization of programs from arbitrary programming languages.
The idea is that, with this, one can create a virtual machine for languages like Java, a code generator for a specific machine architecture and optimizers independent from particular platforms or languages. LLVM thus includes no components for specific languages or machine architectures; it lies between a language-specific module and a code generator for a machine. LLVM includes aggressive interprocedural optimization support, static and JIT compilers, and has many components in various stages of development (including Java bytecode and MSIL frontends, a Python frontend, a new graph coloring register allocator, and more).
It currently supports the compilation of C and C++ programs, using front-ends derived from version 3.4 of the GNU Compiler Collection (GCC). LLVM is written in C++ and has been developed since 2000 at the University of Illinois. It is publicly available under the University of Illinois Open Source License [2] (http://www.opensource.org/licenses/UoI-NCSA.php), an OSI-approved license that is very similar to the BSD license.
As of May 2005, LLVM 1.5 is available.
Code representation
LLVM supports language-independent instruction set and the type system. Most of instructions have a form similar to three address code. Each instruction is also a static single assignment form, meaning each variable (called a typed register) is assigned once and is frozen for the rest of life; this helps simplify the analysis of the dependency among variables.
Any form of type conversion, from coercion to the downcasting of an object, must be explicit and can be done by cast
instruction. The program without casts, thus, can be considered to be type-safe. LLVM has basic types like integers of fixed sizes and exactly four derived types, namely, pointers, arrays, structures and functions. A type construct in a concrete language can be represented by combing these types in LLVM. For example, a class in C++ can be represented by the combination of structures, fuctions and arrays of function pointers.
External Links
- LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation (http://llvm.cs.uiuc.edu/pubs/2004-01-30-CGO-LLVM.pdf) - a published paper by Chris Lattner and Vikram Adve.