Low Level Virtual Machine

From Wikipedia, the free encyclopedia

Low Level Virtual Machine
Developer: LLVM Developer Group
Latest release: 1.9 / November 19, 2006
OS: Cross-platform
Use: Compiler
License: University of Illinois Open Source License
Website: http://www.llvm.org

Low Level Virtual Machine, generally known as LLVM, is a compiler infrastructure designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary programming languages.

Using LLVM, 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 is language and architecture independent; 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). The JIT compiler is capable of optimising unnecessary static branches out of a program at runtime, and is therefore useful for cases where a program has many options, most of which can easily determined unnecessary in any environment. Because of this, it is used in the OpenGL pipeline of Mac OS X 10.5 ("Leopard") to provide support for missing hardware features.

It currently supports the compilation of C and C++ programs, using front-ends derived from version 3.4 and 4.0.1 of the GNU Compiler Collection (GCC). LLVM is written in C++ and was started in 2000 at the University of Illinois at Urbana-Champaign. It is publicly available under the University of Illinois Open Source License [1], an OSI-approved license that is very similar to the BSD license.

[edit] Code representation

LLVM supports a language-independent instruction set and type system. Most of the 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; 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 performed explicitly using the cast instruction. 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 combining these types in LLVM. For example, a class in C++ can be represented by a combination of structures, functions and arrays of function pointers.

[edit] External links