skip to main content
10.1145/1863523.1863538acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

An llVM backend for GHC

Published:30 September 2010Publication History

ABSTRACT

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.

Skip Supplemental Material Section

Supplemental Material

haskell-1530-terei.mov

mov

94.3 MB

References

  1. }}clang: A C language family frontend for LLVM. http://clang.llvm.org/, 2010.Google ScholarGoogle Scholar
  2. }}LDC: LLVM D Compiler. http://www.dsource.org/projects/ldc, 2010.Google ScholarGoogle Scholar
  3. }}llvm-lua, jit/static compiler for lua using llvm on the backend. http: //code.google.com/p/llvm- lua/, 2010.Google ScholarGoogle Scholar
  4. }}Openjdk - zero-assembler project.http://openjdk.java.net/projects/zero/, 2010.Google ScholarGoogle Scholar
  5. }}Unladen Swallow: A faster implementation of Python.http://code.google.com/p/unladen-swallow/, 2010.Google ScholarGoogle Scholar
  6. }}A. W. Appel.SSA is functional programming.ACM SIGPLAN Notices, 33(4):17--20, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}P. Codognet and D. Diaz. wamcc: compiling Prolog to C. In Proceedings of the Twelfth International Conference on Logic Programming, pages 317--331, 1995.Google ScholarGoogle Scholar
  8. }}D. Coutts, R. Leshchinskiy, and D. Stewart. Stream fusion: From lists to streams to nothing at all. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming, ICFP 2007, Apr. 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451--490, October 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}D. Dhurjati, S. Kowshik, and V. Adve. Safecode: enforcing alias analysis for weakly typed languages. In PLDI '06: Proceedings of the 2006 ACM SIGPLAN conference on Programming language design and implementation, pages 144--157, New York, NY, USA, 2006. ACM. ISBN 1-59593-320-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}A. Dijkstra, J. Fokker, and S. D. Swierstra. The structure of the Essential Haskell Compiler or coping with compiler complexity. IFL '07: Proceedings of the 19th International Symposium on Implementation and Application of Functional Languages, pages 107--122, 2007.Google ScholarGoogle Scholar
  12. }}C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In Proceedings ACM SIGPLAN 1993 Conf. on Programming Language Design and Implementation, PLDI'93, volume 28(6), pages 237--247. ACM Press, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. }}A. Gräf. The Pure programming language. http://code.google.com/p/pure-lang/, 2009.Google ScholarGoogle Scholar
  14. }}F. Henderson, Z. Somogyi, and T. Conway. Compiling logic programs to C using GNU C as a portable assembler. In Proceedings of the ILPS'95 Postconference Workshop on Sequential Implementation Technologies for Logic Programming Languages, 1995.Google ScholarGoogle Scholar
  15. }}R. Hickey. The Clojure programming language. In DLS '08: Proceedings of the 2008 symposium on Dynamic languages, pages 1--1, New York, NY, USA, 2008. ACM. ISBN 978-1-60558-270-2. doi: http://doi.acm.org/10.1145/1408681.1408682. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. }}E. International. Standard ECMA-355 - Common Language Infrastructure (CLI). Technical Report 4th Edition. ECMA International, June 2006.Google ScholarGoogle Scholar
  17. }}G. Keller, M. M. T. Chakravarty, R. Leshchinskiy, S. Peyton Jones, and B. Lippmeier. Regular, shape-polymorphic, parallel arrays in Haskell. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming, ICFP 2010, Sept. 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. }}C. Lattner. LLVM: An Infrastructure for Multi-Stage Optimization. Master's thesis, Computer Science Dept., University of Illinois at Urbana-Champaign, December 2002.Google ScholarGoogle Scholar
  19. }}C. Lattner and V. Adve. Llvm: A compilation framework for lifelong program analysis & transformation. In CGO '04: Proceedings of the International Symposium on Code Generation and Optimization, page 75. IEEE Computer Society, 2004. ISBN 0-7695-2102-9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. }}T. Lindholm and F. Yellin. Java Virtual Machine Specification. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, April 1999. ISBN 0201432943. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. }}B. O'Sullivan. criterion: Robust, reliable performance measurement and analysis. http://hackage.haskell.org/package/criterion, 2010.Google ScholarGoogle Scholar
  22. }}W. Partain. The nofib benchmark suite of haskell programs. pages 195--202, London, UK, 1993. Springer-Verlag.Google ScholarGoogle Scholar
  23. }}S. L. Peyton Jones. Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine. Journal of Functional Programming, 2(2), 1992.Google ScholarGoogle Scholar
  24. }}S. L. Peyton Jones, N. Ramsey, and F. Reig. C--: A portable assembly language that supports garbage collection. In PPDP '99: Proceedings of the International Conference PPDP'99 on Principles and Practice of Declarative Programming, pages 1--28. Springer-Verlag, 1999. ISBN 3-540-66540-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. }}N. Ramsey, J. Dias, and S. Peyton Jones. Hoopl: Dataflow optimization made simple. In ACM SIGPLAN Haskell Symposium 2010. ACM Press, 2010.Google ScholarGoogle Scholar
  26. }}M. Sulzmann, M. Chakravarty, S. Peyton Jones, and K. Donnelly. System F with type equality coercions. In ACM SIGPLAN International Workshop on Types in Language Design and Implementation (TLDI'07). ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. }}D. Tarditi, P. Lee, and A. Acharya. No assembly required: compiling Standard ML to C. ACM Lett. Program. Lang. Syst., 1(2):161--177, 1992. ISSN 1057-4514. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. }}The LLVM Team. The LLVM compiler infastructure: LLVM users. http://llvm.org/Users.html.Google ScholarGoogle Scholar
  29. }}J. van Schie. Compiling Haskell to LLVM. Master's thesis, Department of Information and Computing Sciences, Utrecht University, 2008.Google ScholarGoogle Scholar

Index Terms

  1. An llVM backend for GHC

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        Haskell '10: Proceedings of the third ACM Haskell symposium on Haskell
        September 2010
        166 pages
        ISBN:9781450302524
        DOI:10.1145/1863523
        • cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 45, Issue 11
          HASKELL '10
          November 2010
          156 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/2088456
          Issue’s Table of Contents

        Copyright © 2010 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 30 September 2010

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Author Tags

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate57of143submissions,40%

        Upcoming Conference

        ICFP '24

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader