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

A nanopass framework for commercial compiler development

Published: 25 September 2013 Publication History

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.
[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.
[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.
[4]
W. D. Clinger. Description of benchmarks, 2008. URL http://www.larcenists.org/benchmarksAboutR6.html.
[5]
R. K. Dybvig. Chez Scheme Version 8 User's Guide. Cadence Research Systems, 2009.
[6]
R. K. Dybvig. The Scheme Programming Language. MIT Press, fourth edition, 2009.
[7]
R. K. Dybvig, R. Hieb, and T. Butler. Destination-driven code generation. Technical Report TR302, Indiana University, February 1990.
[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.
[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.
[10]
N. Frisby, A. Gill, and P. Alexander. A pattern for almost homomorphic functions. In ACM SIGPLAN Workshop on Generic Programming, 09/2012 2012.
[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.
[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.
[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.
[14]
A. W. Keep. A Nanopass Framework for Commercial Compiler Development. PhD thesis, Indiana University, Feb. 2013.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[25]
J. J. Willcock. A Language for Specifying Compiler Optimizations for Generic Software. Doctoral dissertation, Indiana University, Bloomington, Indiana, USA, Dec. 2008.
[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.

Cited By

View all
  • (2024)A Low-Level Look at A-Normal FormProceedings of the ACM on Programming Languages10.1145/36897178:OOPSLA2(165-191)Online publication date: 8-Oct-2024
  • (2024)Compiled, Extensible, Multi-language DSLs (Functional Pearl)Proceedings of the ACM on Programming Languages10.1145/36746278:ICFP(64-87)Online publication date: 15-Aug-2024
  • (2023)Generic Programming with Extensible Data Types: Or, Making Ad Hoc Extensible Data Types Less Ad HocProceedings of the ACM on Programming Languages10.1145/36078437:ICFP(356-384)Online publication date: 31-Aug-2023
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

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
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 the author(s) 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].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 25 September 2013

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. compiler
  2. nanopass
  3. scheme

Qualifiers

  • Research-article

Conference

ICFP'13
Sponsor:
ICFP'13: ACM SIGPLAN International Conference on Functional Programming
September 25 - 27, 2013
Massachusetts, Boston, USA

Acceptance Rates

ICFP '13 Paper Acceptance Rate 40 of 133 submissions, 30%;
Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)52
  • Downloads (Last 6 weeks)2
Reflects downloads up to 22 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2024)A Low-Level Look at A-Normal FormProceedings of the ACM on Programming Languages10.1145/36897178:OOPSLA2(165-191)Online publication date: 8-Oct-2024
  • (2024)Compiled, Extensible, Multi-language DSLs (Functional Pearl)Proceedings of the ACM on Programming Languages10.1145/36746278:ICFP(64-87)Online publication date: 15-Aug-2024
  • (2023)Generic Programming with Extensible Data Types: Or, Making Ad Hoc Extensible Data Types Less Ad HocProceedings of the ACM on Programming Languages10.1145/36078437:ICFP(356-384)Online publication date: 31-Aug-2023
  • (2023)A Multi-threaded Fast Hardware Compiler for HDLsProceedings of the 32nd ACM SIGPLAN International Conference on Compiler Construction10.1145/3578360.3580254(25-36)Online publication date: 17-Feb-2023
  • (2021)Catala: a programming language for the lawProceedings of the ACM on Programming Languages10.1145/34735825:ICFP(1-29)Online publication date: 19-Aug-2021
  • (2020)Pattern Eliminating TransformationsLogic-Based Program Synthesis and Transformation10.1007/978-3-030-68446-4_4(74-92)Online publication date: 7-Sep-2020
  • (2015)Profile-guided meta-programmingACM SIGPLAN Notices10.1145/2813885.273799050:6(403-412)Online publication date: 3-Jun-2015
  • (2015)Profile-guided meta-programmingProceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/2737924.2737990(403-412)Online publication date: 3-Jun-2015
  • (2014)Co-dfnsProceedings of ACM SIGPLAN International Workshop on Libraries, Languages, and Compilers for Array Programming10.1145/2627373.2627384(62-67)Online publication date: 9-Jun-2014
  • (2014)Design Exploration through Code-generating DSLsQueue10.1145/2611429.262637412:4(40-52)Online publication date: 22-Apr-2014
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media