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.
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- W. D. Clinger. Description of benchmarks, 2008. URL http://www.larcenists.org/benchmarksAboutR6.html.Google Scholar
- R. K. Dybvig. Chez Scheme Version 8 User's Guide. Cadence Research Systems, 2009.Google Scholar
- R. K. Dybvig. The Scheme Programming Language. MIT Press, fourth edition, 2009. Google Scholar
Digital Library
- R. K. Dybvig, R. Hieb, and T. Butler. Destination-driven code generation. Technical Report TR302, Indiana University, February 1990.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- N. Frisby, A. Gill, and P. Alexander. A pattern for almost homomorphic functions. In ACM SIGPLAN Workshop on Generic Programming, 09/2012 2012. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- A. W. Keep. A Nanopass Framework for Commercial Compiler Development. PhD thesis, Indiana University, Feb. 2013. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- J. J. Willcock. A Language for Specifying Compiler Optimizations for Generic Software. Doctoral dissertation, Indiana University, Bloomington, Indiana, USA, Dec. 2008. Google Scholar
Digital Library
- 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 Scholar
Index Terms
A nanopass framework for commercial compiler development
Recommendations
A nanopass framework for commercial compiler development
ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programmingContemporary 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 ...







Comments