LLVM: a compilation framework for lifelong program analysis & transformation

We describe LLVM (low level virtual machine), a compiler framework designed to support transparent, lifelong program analysis and transformation for arbitrary programs, by providing high-level information to compiler transformations at compile-time, link-time, run-time, and in idle time between runs. LLVM defines a common, low-level code representation in static single assignment (SSA) form, with several novel features: a simple, language-independent type-system that exposes the primitives commonly used to implement high-level language features; an instruction for typed address arithmetic; and a simple mechanism that can be used to implement the exception handling features of high-level languages (and setjmp/longjmp in C) uniformly and efficiently. The LLVM compiler framework and code representation together provide a combination of key capabilities that are important for practical, lifelong analysis and transformation of programs. To our knowledge, no existing compilation approach provides all these capabilities. We describe the design of the LLVM representation and compiler framework, and evaluate the design in three ways: (a) the size and effectiveness of the representation, including the type information it provides; (b) compiler performance for several interprocedural problems; and (c) illustrative examples of the benefits LLVM provides for several challenging compiler problems.

[1]  Thomas B. Steel,et al.  UNCOL: The myth and the fact , 1961 .

[2]  L. Peter Deutsch,et al.  Efficient implementation of the smalltalk-80 system , 1984, POPL.

[3]  David W. Wall,et al.  Global register allocation at link time , 1986, SIGPLAN '86.

[4]  Randall B. Smith,et al.  SELF: The power of simplicity , 1987, OOPSLA '87.

[5]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[6]  David W. Wall,et al.  A practical system fljr intermodule code optimization at link-time , 1993 .

[7]  Linda Torczon,et al.  Interprocedural optimization: eliminating unnecessary recompilation , 1986, SIGPLAN '86.

[8]  Mary F. Fernández,et al.  Simple and effective link-time optimization of Modula-3 programs , 1995, PLDI '95.

[9]  Robert Wahbe,et al.  Efficient and language-independent mobile programs , 1996, PLDI '96.

[10]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[11]  Michael Franz,et al.  Slim binaries , 1997, CACM.

[12]  Alec Wolman,et al.  Instrumentation and optimization of Win32/intel executables using Etch , 1997 .

[13]  Norman Rubin,et al.  Spike: an optimizer for alpha/NT executables , 1997 .

[14]  K. Ebcioglu,et al.  Daisy: Dynamic Compilation For 10o?40 Architectural Compatibility , 1997, Conference Proceedings. The 24th Annual International Symposium on Computer Architecture.

[15]  Erik R. Altman,et al.  Daisy: Dynamic Compilation For 10o?40 Architectural Compatibility , 1997, Conference Proceedings. The 24th Annual International Symposium on Computer Architecture.

[16]  Robert S. Cohn,et al.  Optimizing Alpha Executables on Windows NT with Spike , 1998, Digit. Tech. J..

[17]  J.E. Smith,et al.  Achieving high performance via co-designed virtual machines , 1998, Innovative Architecture for Future Generation High-Performance Processors and Systems.

[18]  Zhong Shao,et al.  Implementing typed intermediate languages , 1998, ICFP '98.

[19]  Andrew Ayers,et al.  Scalable cross-module optimization , 1998, PLDI '98.

[20]  John Yates,et al.  FX!32 a profile-directed binary translator , 1998, IEEE Micro.

[21]  Saumya K. Debray,et al.  Alto: a platform for object code modification , 1999 .

[22]  MorrisettGreg,et al.  From system F to typed assembly language , 1999 .

[23]  James R. Larus,et al.  Cache-conscious structure definition , 1999, PLDI '99.

[24]  E. Duesterwald,et al.  Dynamo: a transparent dynamic optimization system , 2000, PLDI '00.

[25]  Michael Hind,et al.  Which pointer analysis should I use? , 2000, ISSTA '00.

[26]  Robert DeLine,et al.  Enforcing high-level protocols in low-level software , 2001, PLDI '01.

[27]  Jeffery von Ronne,et al.  SafeTSA: a type safe and referentially secure mobile-code representation based on static single assignment form , 2001, PLDI '01.

[28]  James Cheney,et al.  Region-based memory management in cyclone , 2002, PLDI '02.

[29]  Dinakar Dhurjati,et al.  Ensuring code safety without runtime checks for real-time control systems , 2002, CASES '02.

[30]  Vikram S. Adve,et al.  Automatic pool allocation for disjoint data structures , 2003, MSP '02.

[31]  Wayne Gramlich,et al.  Implementation of exception handling , 2003 .

[32]  Monica S. Lam,et al.  A practical flow-sensitive and context-sensitive C and C++ memory leak detector , 2003, PLDI '03.

[33]  Dinakar Dhurjati,et al.  Memory safety without runtime checks or garbage collection , 2003, LCTES '03.

[34]  Richard Johnson,et al.  The Transmeta Code Morphing#8482; Software: using speculation, recovery, and adaptive retranslation to address real-life challenges , 2003, CGO.

[35]  Vikram S. Adve,et al.  LLVA: A Low-level Virtual Instruction Set Architecture , 2003, MICRO.

[36]  Chris Lattner,et al.  Data Structure Analysis: A Fast and Scalable Context-Sensitive Heap Analysis , 2003 .

[37]  Richard Johnson,et al.  The Transmeta Code Morphing/spl trade/ Software: using speculation, recovery, and adaptive retranslation to address real-life challenges , 2003, International Symposium on Code Generation and Optimization, 2003. CGO 2003..

[38]  Vikram S. Adve,et al.  LLVA: a low-level virtual instruction set architecture , 2003, Proceedings. 36th Annual IEEE/ACM International Symposium on Microarchitecture, 2003. MICRO-36..

[39]  Andrew W. Appel,et al.  A provably sound TAL for back-end optimization , 2003, PLDI '03.

[40]  Michael Franz,et al.  Continuous program optimization: A case study , 2003, TOPL.