skip to main content
research-article

A nanopass framework for commercial compiler development

Published:25 September 2013Publication History
Skip Abstract Section

Abstract

Contemporary compilers must typically handle sophisticated high-level source languages, generate efficient code for multiple hardware architectures and operating systems, and support source-level debugging, profiling, and other program development tools. As a result, compilers tend to be among the most complex of software systems. Nanopass frameworks are designed to help manage this complexity. A nanopass compiler is comprised of many single-task passes with formally defined intermediate languages. The perceived downside of a nanopass compiler is that the extra passes will lead to substantially longer compilation times. To determine whether this is the case, we have created a plug replacement for the commercial Chez Scheme compiler, implemented using an updated nanopass framework, and we have compared the speed of the new compiler and the code it generates against the original compiler for a large set of benchmark programs. This paper describes the updated nanopass framework, the new compiler, and the results of our experiments. The compiler produces faster code than the original, averaging 15-27% depending on architecture and optimization level, due to a more sophisticated but slower register allocator and improvements to several optimizations. Compilation times average well within a factor of two of the original compiler, despite the slower register allocator and the replacement of five passes of the original 10 with over 50 nanopasses.

References

  1. O. S. Bagge, K. T. Kalleberg, M. Haveraaen, and E. Visser. Design of the CodeBoost transformation system for domain-specific optimisation of C++programs. In D. Binkley and P. Tonella, editors, Proc. 3rd International Workshop on Source Code Analysis and Manipulation, SCAM '03, pages 65--75, Amsterdam, Sept. 2003. IEEE Computer Society Press. URL http://www.codeboost.org/papers/codeboost-scam03.pdf.Google ScholarGoogle Scholar
  2. M. Bravenboer, K. T. Kalleberg, R. Vermaas, and E. Visser. Stratego/XT 0.17. A language and toolset for program transformation. Science of Computer Programming, 72 (1-2): 52--70, June 2008. URL http://dx.doi.org/10.1016/j.scico.2007.11.003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. R. G. Burger, O. Waddell, and R. K. Dybvig. Register allocation using lazy saves, eager restores, and greedy shuffling. In Proc. ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation, PLDI '95, pages 130--138, New York, 1995. ACM. URL http://doi.acm.org/10.1145/207110.207125. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. W. D. Clinger. Description of benchmarks, 2008. URL http://www.larcenists.org/benchmarksAboutR6.html.Google ScholarGoogle Scholar
  5. R. K. Dybvig. Chez Scheme Version 8 User's Guide. Cadence Research Systems, 2009.Google ScholarGoogle Scholar
  6. R. K. Dybvig. The Scheme Programming Language. MIT Press, fourth edition, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. K. Dybvig, R. Hieb, and T. Butler. Destination-driven code generation. Technical Report TR302, Indiana University, February 1990.Google ScholarGoogle Scholar
  8. R. K. Dybvig, R. Hieb, and C. Bruggeman. Syntactic abstraction in Scheme. LISP and Symbolic Computation, 5 (4): 295--326, Dec. 1992. URL http://dx.doi.org/10.1007/BF01806308. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. T. Ekman and G. Hedin. The JastAdd system -- modular extensible compiler construction. Science of Computer Programming, 69 (1-3): 14--26, Dec. 2007. 10.1016/j.scico.2007.02.003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. N. Frisby, A. Gill, and P. Alexander. A pattern for almost homomorphic functions. In ACM SIGPLAN Workshop on Generic Programming, 09/2012 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. E. Gagnon and L. Hendren. SableCC, an object-oriented compiler framework. In Proc. 26th Conference on Technology of Object-Oriented Languages, TOOLS '98, pages 140--154, 1998. 10.1109/TOOLS.1998.711009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. A. Ghuloum and R. K. Dybvig. Implicit phasing for R6RS libraries. In Proc. 12th ACM SIGPLAN International Conference on Functional Programming, pages 303--314, New York, 2007. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. A. Ghuloum and R. K. Dybvig. Fixing letrec (reloaded). In Proc. 2009 Workshop on Scheme and Functional Programming, Scheme '09, pages 57--65, 2009.Google ScholarGoogle Scholar
  14. A. W. Keep. A Nanopass Framework for Commercial Compiler Development. PhD thesis, Indiana University, Feb. 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. A. W. Keep, A. Hearn, and R. K. Dybvig. Optimizing closures in O(0) time. In Proc. 2012 Workshop on Scheme and Functional Programming, Scheme '12, 2012.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. S. Lerner, T. Millstein, E. Rice, and C. Chambers. Automated soundness proofs for dataflow analyses and transformations via local rules. In Proc. 32nd ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, POPL '05, pages 364--377, New York, 2005. ACM. URL http://doi.acm.org/10.1145/1040305.1040335. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. E. Meijer, M. M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In Proc. 5th ACM Conference on Functional Programming Languages and Computer Architecture, pages 124--144, London, UK, 1991. Springer-Verlag. ISBN 3-540-54396-1. URL http://dl.acm.org/citation.cfm?id=645420.652535. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. D. Quinlan, M. Schordan, Q. Yi, and B. R. de Supinski. Semantic-driven parallelization of loops operating on user-defined containers. In Lecture Notes in Computer Science, volume 2958/2004 of Lecture Notes in Computer Science, pages 524--538. Springer Berlin / Heidelberg, 2004.Google ScholarGoogle Scholar
  19. C. V. Reeuwijk. Tm: A code generator for recursive data structures. Software: Practice and Experience, 22 (10): 899--908, Oct. 1992. URL http://dx.doi.org/10.1002/spe.4380221008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. D. Sarkar, O. Waddell, and R. K. Dybvig. A nanopass infrastructure for compiler education. In Proc. 9th ACM SIGPLAN International Conference on Functional Programming, ICFP '04, pages 201--212, New York, 2004. ACM. URL http://doi.acm.org/10.1145/1016850.1016878. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. E. R. Scherpelz, S. Lerner, and C. Chambers. Automatic inference of optimizer flow functions from semantic meanings. In Proc. 2007 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI '07, pages 135--145, New York, 2007. ACM. URL http://doi.acm.org/10.1145/1250734.1250750. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. O. Waddell and R. K. Dybig. Fast and effective procedure inlining. In Proc. 4th International Symposium on Static Analysis, SAS '97, pages 35--52, London, 1997. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. O. Waddell and R. K. Dybvig. Extending the scope of syntactic abstraction. In Proc. 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '99, pages 203--215, New York, 1999. ACM. URL http://doi.acm.org/10.1145/292540.292559. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. O. Waddell, D. Sarkar, and R. K. Dybvig. Fixing letrec: A faithful yet efficient implementation of Scheme's recursive binding construct. Higher-order and Symbolic Computation, 18 (3/4): 299--326, December 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. J. J. Willcock. A Language for Specifying Compiler Optimizations for Generic Software. Doctoral dissertation, Indiana University, Bloomington, Indiana, USA, Dec. 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Q. Yi, K. Seymour, H. You, R. Vuduc, and D. Quinlan. POET: Parameterized optimizations for empirical tuning. Technical Report CS-TR-2006-006, University of Texas - San Antonio, 2006. URL http://www.cs.utsa.edu/{~}papers/poet-lang.pdf.Google ScholarGoogle Scholar

Index Terms

  1. A nanopass framework for commercial compiler development

    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

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 48, Issue 9
      ICFP '13
      September 2013
      457 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2544174
      Issue’s Table of Contents
      • cover image ACM Conferences
        ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programming
        September 2013
        484 pages
        ISBN:9781450323260
        DOI:10.1145/2500365

      Copyright © 2013 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 25 September 2013

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!