Reusable, generic program analyses and transformations

The optimizations in modern compilers are constructed for a predetermined set of primitive types. As a result, programmers are unable to exploit optimizations for user-defined types where these optimizations would be correct and beneficial. Moreover, because the set of optimizations is also fixed, programmers are unable to incorporate new optimizations into the compiler. To address these limitations, we apply the reuse methodologies from generic programming to compiler analyses and optimizations. To enable compilers to apply optimizations to classes of types rather than particular types, we define optimizations in terms of generic interface descriptions (similar to C++ concepts or Haskell type classes). By extending these interface descriptions to include associated program analysis and transformation fragments, we enable compilers to incorporate user-defined transformations and analyses. Since these transformations are explicitly associated with interface descriptions, they can be applied in generic fashion by the compiler. We demonstrate that classical compiler optimizations, when generalized using this framework, can apply to a broad range of types, both built-in and user-defined. Finally, we present an initial implementation, the principles of which are generalizable to other compilers.

[1]  Sorin Lerner,et al.  Automated soundness proofs for dataflow analyses and transformations via local rules , 2005, POPL '05.

[2]  Xiaolong Tang,et al.  Concept-based optimization , 2007, LCSD '07.

[3]  Jaakko Järvi,et al.  An extended comparative study of language support for generic programming , 2007, Journal of Functional Programming.

[4]  John M. Mellor-Crummey,et al.  FIAT: A Framework for Interprocedural Analysis and Transfomation , 1993, LCPC.

[5]  Todd L. Veldhuizen,et al.  Expression templates , 1996 .

[6]  Ian J. Hayes,et al.  Integration of generic program analysis tools into a software development environment , 2005, ACSC.

[7]  Philip Wadler,et al.  How to make ad-hoc polymorphism less ad hoc , 1989, POPL '89.

[8]  Paul D. Hovland,et al.  Representation-independent program analysis , 2005, PASTE '05.

[9]  Lori A. Clarke,et al.  A flexible architecture for building data flow analyzers , 1995, Proceedings of IEEE 18th International Conference on Software Engineering.

[10]  Bernhard Steffen,et al.  Data Flow Analysis as Model Checking , 1990, TACS.

[11]  Andrew Lumsdaine,et al.  A language for specifying compiler optimizations for generic software , 2007 .

[12]  Markus Schordan,et al.  A Source-to-Source Architecture for User-Defined Optimizations , 2003, JMLC.

[13]  Bronis R. de Supinski,et al.  Semantic-Driven Parallelization of Loops Operating on User-Defined Containers , 2003, LCPC.

[14]  M. Wenzel Using Axiomatic Type Classes in Isabelle , 2000 .

[15]  Lawrence C. Paulson Organizing Numerical Theories Using Axiomatic Type Classes , 2004, Journal of Automated Reasoning.

[16]  Sibylle Schupp,et al.  Generic Programming and High-Performance Libraries , 2004, 18th International Parallel and Distributed Processing Symposium, 2004. Proceedings..

[17]  Calvin Lin,et al.  Broadway: A Compiler for Exploiting the Domain-Specific Semantics of Software Libraries , 2005, Proceedings of the IEEE.

[18]  Arch D. Robison,et al.  Impact of economics on compiler optimization , 2001, JGI '01.

[19]  Jeremy G. Siek,et al.  A language for generic programming , 2005 .

[20]  Magne Haveraaen,et al.  Axiom-Based Transformations: Optimisation and Testing , 2009, Electron. Notes Theor. Comput. Sci..

[21]  Magne Haveraaen,et al.  Domain-Specific Optimisation with User-Defined Rules in CodeBoost , 2003, Electron. Notes Theor. Comput. Sci..

[22]  David R. Musser,et al.  Code-carrying theory , 2008, SAC '08.

[23]  Eelco Visser,et al.  Stratego: A Language for Program Transformation Based on Rewriting Strategies , 2001, RTA.

[24]  Sally A. McKee,et al.  A semantics-based approach to optimizing unstructured mesh abstractions , 2008 .

[25]  Jeremy G. Siek,et al.  The Boost Graph Library - User Guide and Reference Manual , 2001, C++ in-depth series.

[26]  Sibylle Schupp,et al.  User-Extensible Simplification - Type-Based Optimizer Generators , 2001, CC.

[27]  Charles Donald Farnum,et al.  Pattern-based languages for prototyping of compiler optimizers , 1990 .

[28]  Magne Haveraaen,et al.  Design of the CodeBoost transformation system for domain-specific optimisation of C++ programs , 2003, Proceedings Third IEEE International Workshop on Source Code Analysis and Manipulation.

[29]  Jeremy G. Siek,et al.  The Matrix Template Library: A Generic Programming Approach to High Performance Numerical Linear Algebra , 1998, ISCOPE.

[30]  Keith D. Cooper,et al.  Combining analyses, combining optimizations , 1995, TOPL.

[31]  Magne Haveraaen,et al.  Testing with concepts and axioms in C++ , 2008, OOPSLA Companion.

[32]  Sibylle Schupp,et al.  STLlint: lifting static checking from languages to libraries , 2006, Softw. Pract. Exp..

[33]  Matthew H. Austern Generic programming and the STL - using and extending the C++ standard template library , 1999, Addison-Wesley professional computing series.

[34]  Walid Taha,et al.  MetaML and multi-stage programming with explicit annotations , 2000, Theor. Comput. Sci..

[35]  Sibylle Schupp,et al.  Making the Usage of STL Safe , 2002, Generic Programming.

[36]  Sorin Lerner,et al.  Automatically proving the correctness of compiler optimizations , 2003, PLDI '03.

[37]  Benjamin Livshits,et al.  Finding application errors and security flaws using PQL: a program query language , 2005, OOPSLA '05.