Blogs (28) >>
ICFP 2017
Sun 3 - Sat 9 September 2017 Oxford, United Kingdom
Sat 9 Sep 2017 10:55 - 11:20 at L1 - Compiling to LLVM Chair(s): Jan Stolarek

Simplexhc is a work in progress implementation of an STG to LLVM compiler, which aims to explore which advanced optimizations become possible when directly lowering from a lazy abstract machine with rich semantic information to a modern compiler IR which provides support for the efficient lowering of dynamic languages.

Previous work in GHC has explored the compilation of Haskell to a modern compiler IR such as LLVM, but this work has been integrated after lowering from STG to C–, an untyped variant of C that is semantically a lot closer to the LLVM intermediate representation as STG is. However, as part of the lowering from STG to C– a lot of knowledge about the original high-level functional semantics are lost. The work on the Intel haskell compiler is closer in spirit, but they take a whole-program optimisation approach and have their own strict IR, while we propose to starting the lowering process from STG, a lazy IR/machine model.

We are proposing to compile to LLVM, which provides support for type based analysis, an extensible compiler pass pipeline to encode domain-specific knowledge of STG, and a well tested, well optimised codebase that is the heart of modern compilers such as clang. There has been a very successful use of LLVM as a target for a high level language (Java) by Azul systems, who generate LLVM in their JVM JIT compiler. This suggests that the approach of lowering STG to LLVM could also be profitable from a performance standpoint.

We would like to augment GHC’s current code generation capability with the ability to directly generate LLVM. This should not only improve performance, but also should allow GHC to remove a dependency in the tree on C– as well.

We also explore half baked tangential ideas such as:

  • The possibility to use ideas from polyhedral compilation to analyze and optimise purely functional programs.

  • Extending LLVM to support GRIN, an alternate intermediate representation proposed for haskell whole-program optimisation.

Github Repo

Haskell dependence analysis repo

Azul systems talk at EuroLLVM ’16

Sat 9 Sep

Displayed time zone: Belfast change

10:30 - 11:30
Compiling to LLVMHIW at L1
Chair(s): Jan Stolarek University of Edinburgh, UK
10:30
25m
Talk
Native Support for Explicit Stacks in LLVM
HIW
Kavon Farvardin University of Chicago, Simon Peyton Jones Microsoft Research, Cambridge
10:55
25m
Talk
SimplexHC: Lowering High-Level Haskell to Imperative IR
HIW
Siddharth Bhat IIT Hyderabad
11:20
10m
Talk
Lightning Talk Slot #1
HIW