An llVM backend for GHC

In the presence of ever-changing computer architectures, high-quality optimising compiler backends are moving targets that require specialist knowledge and sophisticated algorithms. In this paper, we explore a new backend for the Glasgow Haskell Compiler (GHC) that leverages the Low Level Virtual Machine (LLVM), a new breed of compiler written explicitly for use by other compiler writers, not high-level programmers, that promises to enable outsourcing of low-level and architecture-dependent aspects of code generation. We discuss the conceptual challenges and our backend design. We also provide an extensive quantitative evaluation of the performance of the backend and of the code it produces.

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

[2]  Will Partain,et al.  The nofib Benchmark Suite of Haskell Programs , 1992, Functional Programming.

[3]  Vikram S. Adve,et al.  LLVM: a compilation framework for lifelong program analysis & transformation , 2004, International Symposium on Code Generation and Optimization, 2004. CGO 2004..

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

[5]  Simon L. Peyton Jones,et al.  Regular, shape-polymorphic, parallel arrays in Haskell , 2010, ICFP '10.

[6]  Simon L. Peyton Jones,et al.  Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine , 1992, Journal of Functional Programming.

[7]  Simon Peyton Jones,et al.  Hoopl: Dataflow Optimization Made Simple , 2009 .

[8]  Andrew W. Appel,et al.  SSA is functional programming , 1998, SIGP.

[9]  S. Doaitse Swierstra,et al.  The Structure of the Essential Haskell Compiler, or Coping with Compiler Complexity , 2007, IFL.

[10]  Amr Sabry,et al.  The essence of compiling with continuations , 1993, PLDI '93.

[11]  Simon L. Peyton Jones,et al.  C--: A Portable Assembly Language that Supports Garbage Collection , 1999, PPDP.

[12]  Simon L. Peyton Jones,et al.  System F with type equality coercions , 2007, TLDI '07.

[13]  FlanaganCormac,et al.  The essence of compiling with continuations , 1993 .

[14]  Philippe Codognet,et al.  WAMCC: Compiling Prolog to C , 1995, ICLP.

[15]  Dinakar Dhurjati,et al.  SAFECode: enforcing alias analysis for weakly typed languages , 2005, PLDI '06.

[16]  Chris Lattner,et al.  LLVM: AN INFRASTRUCTURE FOR MULTI-STAGE OPTIMIZATION , 2000 .

[17]  Roman Leshchinskiy,et al.  Stream fusion: from lists to streams to nothing at all , 2007, ICFP '07.

[18]  Peter Lee,et al.  No assembly required: compiling standard ML to C , 1992, LOPL.

[19]  Rich Hickey,et al.  The Clojure programming language , 2008, DLS '08.