Wednesday, February 13, 2008

LLVM 2.2

Where LLVM stands for Low Level Virtual Machine.
I found about it while skimming through slashdot.

As of Wikipedia,
"The Low Level Virtual Machine, generally known as 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 imperative programming languages. The LLVM project started in 2000 at the University of Illinois at Urbana-Champaign."

As of Slashdot,
".. This is the thirteenth public release of the open-source compiler that started as a GCC fork. LLVM supports several aggressive optimizations, in compile-, link- and run-time, and often produces faster (1.5-3x) code than GCC. It is also much faster than GCC at compiling (despite the slow link-time optimizations). Gentoo users are already trying to build the whole system with the LLVM toolchain to get the extra performance bit."

Few features of LLVM as listed on its homepage are,

  • Front-ends for C and C++ based on the GCC 3.4 and 4.0.1 parsers. They support the ANSI-standard C and C++ languages to the same degree that GCC supports them. Additionally, many GCC extensions are supported. LLVM also includes a front-end for "Stacker", a Forth-like language.
  • A stable implementation of the LLVM instruction set, which serves as both the online and offline code representation, together with assembly (ASCII) and bytecode (binary) readers and writers, and a verifier.
  • A powerful pass-management system that automatically sequences passes (including analysis, transformation, and code-generation passes) based on their dependences, and pipelines them for efficiency.
  • A wide range of global scalar optimizations.
  • A link-time interprocedural optimization framework with a rich set of analyses and transformations, including sophisticated whole-program pointer analysis, call graph construction, and support for profile-guided optimizations.
  • An easily retargettable code generator, which currently supports X86, X86-64, PowerPC, PowerPC-64, ARM, Thumb, SPARC, Alpha, and IA-64.
    A Just-In-Time (JIT) code generation system, which currently supports X86, X86-64, PowerPC and PowerPC-64.
  • Support for generating DWARF debugging information.
  • A C back-end useful for testing and for generating native code on targets other than the ones listed above.
  • A profiling system similar to gprof.
  • A test framework with a number of benchmark codes and applications.
  • APIs and debugging tools to simplify rapid development of LLVM components

Where strengths being,

  • LLVM uses a simple low-level language with strictly defined semantics.
  • It includes front-ends for C, C++, and Stacker (a forth-like language). Front-ends for Java, Scheme, and other languages are in development.
  • It includes an aggressive optimizer, including scalar, interprocedural, profile-driven, and some simple loop optimizations.
  • It supports a life-long compilation model, including link-time, install-time, run-time, and offline optimization.
  • LLVM has full support for accurate garbage collection.
  • The LLVM code generator is relatively easy to retarget, and makes use of a powerful target description language.
  • LLVM has extensive documentation and has hosted many projects of various sorts.
    Many third-party users have claimed that LLVM is easy to work with and develop for. For example, the Stacker front-end was written in
    4 days by someone who started knowing nothing about LLVM. Additionally, LLVM has tools to make development easier.
  • LLVM is under active development and is constantly being extended, enhanced and improved. See the status updates on the left bar to see the rate of development.
  • LLVM is freely available under an OSI-approved "three-clause BSD" license.
  • LLVM is currently used by several commercial entities, who contribute many extensions and new features.

And the intended users include,

  • A compiler researcher interested in compile-time, link-time (interprocedural), and runtime transformations for C and C++ programs.
  • A virtual machine researcher/developer interested in a portable, language-independent instruction set and compilation framework.
  • An architecture researcher interested in compiler/hardware techniques.
  • A security researcher interested in static analysis or instrumentation.
  • An instructor or developer interested in a system for quick prototyping of compiler transformations.
  • An end-user who wants to get better performance out of your code.

[sources:,, Wikipedia]

No comments: