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.
- Standard LLVM compiler transformations.
- Inlining.
- Vectorization.
- Special instructions.
- Inline compression.
- Language specific passes.
- 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.