Low Level Virtual Machine
From Seo Wiki - Search Engine Optimization and Programming Languages
|Developer(s)||LLVM Developer Group|
|Stable release||2.6 / October 23, 2009|
|License||University of Illinois/NCSA Open Source License|
The Low Level Virtual Machine (LLVM) is a compiler infrastructure, written in C++, which is designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary programming languages. LLVM was originally developed as a research infrastructure at the University of Illinois at Urbana-Champaign to investigate dynamic compilation techniques for static and dynamic programming languages. Originally implemented for C/C++, the language-independent design (and the success) of LLVM has since spawned a wide variety of front-ends, including Objective C, Fortran, Ada, Java bytecode, Python, Ruby, ActionScript, GLSL, and others.
The LLVM project started in 2000 at the University of Illinois at Urbana-Champaign, under the direction of Vikram Adve and Chris Lattner. In 2005, Apple Inc. hired Lattner and formed a team to work on the LLVM system for various uses within Apple's development systems. LLVM is released under a BSD-style license and has a wide group of active developers and users.
LLVM can replace most of the "lower levels" of the GCC toolchain, performing its own optimizations and code generation from the intermediate form generated by GCC front ends. LLVM supports a language-independent instruction set and type system. Each instruction is in static single assignment form (SSA), meaning that each variable (called a typed register) is assigned once and is frozen. This helps simplify the analysis of dependencies among variables. LLVM allows code to be compiled statically, as it is under the traditional GCC system, or left for late-compiling from the IF to machine code in a just-in-time compiler (JIT) in a fashion similar to Java.
Any form of type conversion, from coercion to the downcasting of an object, is performed explicitly using the
cast instruction. LLVM has basic types, like integers of fixed sizes, and exactly five derived types: pointers, arrays, vectors, structures, and functions. A type construct in a concrete language can be represented by combining these basic types in LLVM. For example, a class in C++ can be represented by a combination of structures, functions and arrays of function pointers.
The LLVM JIT compiler is capable of optimizing unnecessary static branches out of a program at runtime, and is therefore useful for partial evaluation in cases where a program has many options—most of which can easily be determined unnecessary in a specific environment. Because of this, it is used in the OpenGL pipeline of Mac OS X v10.5 (Leopard) to provide support for missing hardware features. Graphics code within the OpenGL stack was left in intermediate form, and then compiled when run on the target machine. On systems with high-end GPUs the resulting code was quite thin, passing the instructions onto the GPU with minimal changes. On systems with low-end graphics the code would create procedures to run on the local CPU to handle any instructions that the GPU could not run internally. LLVM was instrumental in improving performance on low-end machines using Intel GMA chipsets.
LLVM was originally written to be a more aggressive, higher performance system for the existing GCC stack, and many of the GCC front-ends have been modified to work with it. LLVM currently supports the compilation of C, C++, Fortran, Objective-C, Ada, D, using front-ends derived from version 4.0.1 and 4.2 of the GNU Compiler Collection (GCC).
Widespread interest in LLVM has led to a number of efforts to develop entirely new front-ends for a variety of languages. One that has received the most attention is clang, a new compiler supporting C, Objective-C and C++. Primarily supported by Apple, clang is aimed at replacing the C/Objective-C compiler in the GCC system with a modern system that is more easily integrated with IDEs, and has wider support for multithreading. Objective-C development under GCC was somewhat moribund[dubious ] and Apple's changes to the language were supported in a separately maintained branch. Creating their own compiler allowed them to address many of the same problems LLVM addressed in terms of IDE integration and other modern features, while also making the primary development branch the primary Objective-C implementation.
The Essential Haskell Compiler can generate code for LLVM which, though the generator is in the early stages of development, has been shown in many cases to be more efficient than the C code generator. There are many other components in various stages of development; including, but not limited to, a Java bytecode front-end, a CIL front-end, a CPython front-end, various frontends for Standard ML, and a new graph coloring register allocator.
- libJIT Just-In-Time compilation library
- GNU lightning
- GNU Compiler Collection (GCC)
- Clang C Compiler
- Pure (programming language)
- Comparison of application virtual machines
- ↑ Adam Treat, mkspecs and patches for LLVM compile of Qt4
- ↑ Chris Lattner (August 15, 2006). "A cool use of LLVM at Apple: the OpenGL stack". LLVMdev mailing list. http://lists.cs.uiuc.edu/pipermail/llvmdev/2006-August/006492.html. Retrieved 2008-10-26.
- ↑ Lattner, Chris; Vikram Adve (May 2003). "Architecture For a Next-Generation GCC". First Annual GCC Developers' Summit. http://llvm.org/pubs/2003-05-01-GCCSummit2003.html. Retrieved 2009-09-06.
- ↑ "Compiling Haskell To LLVM". http://www.cs.uu.nl/wiki/bin/view/Stc/CompilingHaskellToLLVM. Retrieved 2009-02-22.
- ↑ "unladen-swallow - A faster implementation of Python". http://code.google.com/p/unladen-swallow/. Retrieved 2009-05-07.
- The LLVM Compiler Infrastructure Project
- LLVM Project Blog
- LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation — a published paper by Chris Lattner and Vikram Adve.
- LLVM Language Reference Manual — describes the LLVM intermediate representation.
- LLVM 2.0 Presentation — Google Tech Talk Presentation on LLVM 2.0
- Discussion of LLVM by John Siracusa at Ars Technica