Brussels / 1 & 2 February 2014


Case study/tutorial on using LLVM in REPL systems

LLVM is a modular system of compiler components with backends for most popular architectures. It is primarily designed as a compiler construction framework, but also provides facilities for Just-In-Time (JIT) compilation of code. Although a lot of interest has focused on the implementation of LLVM-based compilers for `compiled ahead-of-time' (AOT) languages (eg, clang for C), one of the most exciting uses is to generate code on-the-fly, taking advantage of situation-specific knowledge to perform better on the particular computation at hand.

This proposal is a short talk that falls somewhere between a case study and a tutorial, tackling various LLVM mechanisms which can be used to boosting performance in interactive exploratory programs that run in a read-evaluate-print loop (REPL). It will be cover these aspects at an intermediate level, not discussing all the low-level API details but showing how the various mechanisms of LLVM IR and passes within LLVM can be easily be used.

This talk will focus on 7 simple techniques for improving performance of a REPL based-system with LLVM.

  1. Standard LLVM compiler transformations.
  2. Inlining.
  3. Vectorization.
  4. Special instructions.
  5. Inline compression.
  6. Language specific passes.
  7. Function specialisation.

These are all relatively simple to implement with the help of LLVM, and by following a running example utilising the BEST dataset, we will see how they can improve the performance of interactive computation.


David Tweed