All Topics  
Low Level Virtual Machine

 

   Email Print
   Bookmark   Link






 

Low Level Virtual Machine



 
 
The Low Level Virtual Machine, generally known as LLVM, is a compiler
Compiler

A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program....
 infrastructure, written in C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
, which is designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary programming language
Programming language

A programming language is a machine-readable artificial language designed to express computations that can be performed by a machine, particularly a computer....
s. The LLVM project started in 2000 at the University of Illinois at Urbana-Champaign
University of Illinois at Urbana-Champaign

The University of Illinois at Urbana-Champaign is a public university research university in the state of Illinois, United States. It is the oldest and largest campus in the University of Illinois system....
.

LLVM currently supports the compilation of C
C (programming language)

C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
, C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
, Fortran
Fortran

Fortran is a general-purpose programming language, procedural programming language, imperative programming language programming language that is especially suited to numerical analysis and scientific computing....
, Objective-C
Objective-C

Objective-C is a Reflection , Object-oriented programming programming language which adds Smalltalk-style message passing to C .Today it is used primarily on Mac OS X, iPhone OS, and GNUstep, three environments based on the OpenStep standard, and is the primary language used for the NEXTSTEP, OpenStep#OPENSTEP, and Cocoa application framew...
, Ada
Ada (programming language)

Ada is a structured programming, statically typed, Imperative programming, and Object-oriented programming high-level language computer programming programming language, extended from Pascal and other languages....
, D
D (programming language)

The D programming language, also known simply as D, is an Object-oriented programming, Imperative programming, Multi-paradigm programming language system programming language by Walter Bright of Digital Mars....
, using front-ends derived from version 4.0.1 and 4.2 of the GNU Compiler Collection
GNU Compiler Collection

The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain....
 (GCC).






Discussion
Ask a question about 'Low Level Virtual Machine'
Start a new discussion about 'Low Level Virtual Machine'
Answer questions from other users
Full Discussion Forum



Encyclopedia


The Low Level Virtual Machine, generally known as LLVM, is a compiler
Compiler

A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program....
 infrastructure, written in C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
, which is designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary programming language
Programming language

A programming language is a machine-readable artificial language designed to express computations that can be performed by a machine, particularly a computer....
s. The LLVM project started in 2000 at the University of Illinois at Urbana-Champaign
University of Illinois at Urbana-Champaign

The University of Illinois at Urbana-Champaign is a public university research university in the state of Illinois, United States. It is the oldest and largest campus in the University of Illinois system....
.

LLVM currently supports the compilation of C
C (programming language)

C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
, C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
, Fortran
Fortran

Fortran is a general-purpose programming language, procedural programming language, imperative programming language programming language that is especially suited to numerical analysis and scientific computing....
, Objective-C
Objective-C

Objective-C is a Reflection , Object-oriented programming programming language which adds Smalltalk-style message passing to C .Today it is used primarily on Mac OS X, iPhone OS, and GNUstep, three environments based on the OpenStep standard, and is the primary language used for the NEXTSTEP, OpenStep#OPENSTEP, and Cocoa application framew...
, Ada
Ada (programming language)

Ada is a structured programming, statically typed, Imperative programming, and Object-oriented programming high-level language computer programming programming language, extended from Pascal and other languages....
, D
D (programming language)

The D programming language, also known simply as D, is an Object-oriented programming, Imperative programming, Multi-paradigm programming language system programming language by Walter Bright of Digital Mars....
, using front-ends derived from version 4.0.1 and 4.2 of the GNU Compiler Collection
GNU Compiler Collection

The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain....
 (GCC). An alternative front-end for C-like languages is being developed under the name clang
Clang

clang is a compiler Front-end and back-end for the C , C++, and Objective-C programming languages. It uses the Low Level Virtual Machine as its back end....
. 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.

Using LLVM, one can create compiler
Compiler

A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program....
s for languages like Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
, code generators for specific machine architectures, and optimizers
Compiler optimization

Compiler optimization is the process of tuning the output of a compiler to minimize or maximize some attribute of an executable computer program....
 independent from particular platforms or languages. The LLVM intermediate representation
Intermediate representation

In computing, an intermediate representation is a data structure that is constructed from input data to a computer program, and from which part or all of the output data of the program is constructed in turn....
 (IR) is language and architecture independent; it lies between a language-specific module and a code generator for a specific machine. LLVM includes aggressive inter-procedural optimization support, static and JIT
Just-in-time compilation

In computing, just-in-time compilation , also known as dynamic translation, is a technique for improving the runtime performance of a computer program....
 compilers.

It has many components in various stages of development; including, but not limited to, a Java bytecode
Java bytecode

Java bytecode is the form of instructions that the Java virtual machine executes. Each bytecode instruction or opcode is one byte in length; however, not all of the possible 256 instructions are used....
 front-end, a CIL
Common Intermediate Language

Common Intermediate Language is the lowest-level human-readable programming language in the Common Language Infrastructure and in the .NET Framework....
 front-end, a CPython
CPython

CPython is the default, most-widely used implementation of the Python . It is written in C . In addition to CPython, there are two other production-quality Python implementations: Jython, written in Java , and IronPython, which is written for the Common Language Runtime, as well as several experimental implementations....
 front-end, and a new graph coloring
Graph coloring

In graph theory, graph coloring is a special case of graph labeling; it is an assignment of labels traditionally called "colors" to elements of a graph subject to certain constraints....
 register allocator. The LLVM JIT compiler is capable of optimizing unnecessary static branches out of a program at runtime, and is therefore useful for partial evaluation
Partial evaluation

In computing, partial evaluation is a technique for optimization by specialization.A computer program, prog, is seen as a mapping of input data into output data:...
 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
OpenGL

OpenGL is a standard specification defining a cross-language cross-platform Application programming interface for writing applications that produce 2D computer graphics and 3D computer graphics....
 pipeline of Mac OS X v10.5
Mac OS X v10.5

Mac OS X version 10.5 "Leopard" is the sixth Software version of Mac OS X, Apple Inc. desktop and server operating system for Apple Macintosh computers, and the successor to Mac OS X v10.4 "Tiger"....
 (Leopard) to provide support for missing hardware features.

Code representation

LLVM supports a language-independent instruction set
Instruction set

An instruction set is a list of all the instruction , and all their variations, that a processor can execute.Instructions include:* Arithmetic such as add and subtract...
 and type system
Type system

In computer science, a type system may be defined as "a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute."....
. Most of the instructions have a form similar to three address code
Three address code

In computer science, three-address code is a form of representing intermediate language used by compilers to aid in the implementation of code-improving transformations....
. Each instruction is in static single assignment form
Static single assignment form

In compiler design, static single assignment form is an intermediate representation in which every variable is assigned exactly once. Existing variables in the original IR are split into versions, new variables typically indicated by the original name with a subscript, so that every definition gets its own version....
 (SSA), meaning that each variable (called a typed register) is assigned once and is frozen. This helps simplify the analysis of dependencies among variables.

Any form of type conversion
Type conversion

In computer science, type conversion or typecasting refers to changing an entity of one data type into another. This is done to take advantage of certain features of type hierarchies....
, from coercion
Type conversion

In computer science, type conversion or typecasting refers to changing an entity of one data type into another. This is done to take advantage of certain features of type hierarchies....
 to the downcasting
Downcasting

In object-oriented programming, downcasting or type refinement is the act of Cast a reference to a base class to one of its derived classes.In most programming languages, it is usually possible to check through Runtime Type Information whether the type of the referenced object is indeed the one being cast to or a derived type of it, and th...
 of an object, is performed explicitly using the cast instruction. LLVM has basic types, like integers of fixed sizes, and exactly five derived type
Derived type

A derived type is a type given a new type but structurally the same as the original type. The purpose of this type is to create a new type name so that two values can have two distinct types in terms of name....
s: pointers, array
Array

In computer science, an array is a data structure consisting of a group of element s that are accessed by index . In most programming languages each element has the same data type and the array occupies a contiguous area of computer memory....
s, 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 pointer
Function pointer

A function pointer is a type of pointer in C , C++, D programming language, and other C-like programming languages. When Dereference operator, a function pointer invokes a subroutine, passing it zero or more arguments just like a normal function....
s.

Licensing

LLVM and clang are publicly available under the University of Illinois/NCSA Open Source License
University of Illinois/NCSA Open Source License

The University of Illinois/NCSA Open Source License is a permissive free software licence, based on the MIT License and BSD License licenses. By combining the best parts of these two licenses, it attempts to be clearer and more concise than either....
, a GPL
GNU General Public License

The GNU General Public License is a widely used free software license, originally written by Richard Stallman for the GNU project. The GPL is the most popular and well-known example of the type of strong copyleft license that requires derived works to be available under the same copyleft....
-compatible, OSI
Open Source Initiative

The Open Source Initiative is an organization dedicated to promoting open-source software.The organization was founded in February 1998, by Bruce Perens and Eric S....
-approved license that is very similar to the BSD license.

See also

  • GNU Compiler Collection (GCC)
    GNU Compiler Collection

    The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain....
  • DotGNU
    DotGNU

    DotGNU is a part of the GNU Project that aims to provide a free software replacement for Microsoft's .NET Framework. Other goals of the project are better support for non-Microsoft Windows platforms and support for more processors....
  • Clang C Compiler
    Clang

    clang is a compiler Front-end and back-end for the C , C++, and Objective-C programming languages. It uses the Low Level Virtual Machine as its back end....
  • OpenCL
    OpenCL

    OpenCL is a framework for writing programs that execute across heterogeneous platforms consisting of Central processing unit, Graphics processing unit, and other processors....
  • Comparison of application virtual machines
    Comparison of Application Virtual Machines

    This comparison lists some software virtual machines that implement the concept of application virtualization, typically for the purpose of allowing application bytecode to be portably run on many different computer architectures and operating systems....


External links

  • — a published paper by Chris Lattner
    Chris Lattner

    Chris Lattner is an engineer, best known for his work on LLVM for the University of Illinois at Urbana-Champaign and later Apple Inc.....
     and Vikram Adve.
  • — describes the LLVM intermediate representation.
  • — Google Tech Talk Presentation on LLVM 2.0