ABSTRACT
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.
- M.H. Austern. Generic programming and the STL: Using and extending the C Standard Template Library. Professional Computing Series. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1998. Google Scholar
Digital Library
- A.H. Bagge, V. David, and M. Haveraaen. Testing with concepts and axioms in Cpp. In OOPSLA Companion, pages 773--774, New York, NY, USA, 2008. ACM. Google Scholar
Digital Library
- A.H. Bagge and M. Haveraaen. Axiom-based transformations: Optimisation and testing. In Workshop on Language Description, Tools and Applications. Elsevier, Apr. 2008. http://magnolia-lang.org/publications/axioms-ldta-2008.pdf.Google Scholar
- O.S. Bagge and M. Haveraaen. Domain-specific optimisation with user-defined rules in CodeBoost. In J.-L. Giavitto and P.-E. Moreau, editors, Workshop on Rule-Based Programming, volume 86/2 of Electronic Notes in Theoretical Computer Science, Valencia, Spain, 2003. Elsevier.Google Scholar
- 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, Third IEEE International Workshop on Source Code Analysis and Manipulation, pages 65--74. IEEE Computer Society Press, 2003.Google Scholar
Cross Ref
- C. Click and K.D. Cooper. Combining analyses, combining optimizations. ACM Trans. Program. Lang. Syst., 17(2):181--196, 1995. Google Scholar
Digital Library
- C. de Dinechin. XLR: Extensible language and runtime, Nov. 2007. http://xlr.sourceforge.net/.Google Scholar
- M.B. Dwyer and L.A. Clarke. A flexible architecture for building data flow analyzers. In International Conference on Software Engineering, pages 554--564, Washington, DC, USA, 1996. IEEE Computer Society. Google Scholar
Digital Library
- C.D. Farnum. Pattern-based languages for prototyping of compiler optimizers. Technical report, University of California, Berkeley, 1990.Google Scholar
- R. Garcia, J. Järvi, A. Lumsdaine, J. Siek, and J. Willcock. An extended comparative study of language support for generic programming. Journal of Functional Programming, 17(2):145--205, Mar. 2007. Google Scholar
Digital Library
- E. Glynn, I. Hayes, and A. MacDonald. Integration of generic program analysis tools into a software development environment. In Australasian Conference on Computer Science, pages 249--257, Darlinghurst, Australia, Australia, 2005. Australian Computer Society, Inc. Google Scholar
Digital Library
- D. Gregor, J. Järvi, M. Kulkarni, A. Lumsdaine, D. Musser, and S. Schupp. Generic programming and high-performance libraries. International Journal of Parallel Programming, 33(2), June 2005. Google Scholar
Digital Library
- D. Gregor and S. Schupp. Making the usage of STL safe. In J. Gibbons and J. Jeuring, editors, Proceedings of the IFIP TC2 Working Conference on Generic Programming, pages 127--140, Boston, 2002. Kluwer. Google Scholar
Digital Library
- D. Gregor and S. Schupp. STLlint: Lifting static checking from languages to libraries. Software: Practice&Experience, Mar. 2006. Google Scholar
Digital Library
- D. Gregor, B. Stroustrup, J. Widman, and J. Siek. Concepts (revision 5). Technical Report N2617=08-0127, ISO/IEC JTC 1, Information Technology, Subcommittee SC 22, Programming Language C, June 2008.Google Scholar
- S.Z. Guyer and C. Lin. Broadway: A compiler for exploiting the domain-specific semantics of software libraries. Proceedings of the IEEE, 2004.Google Scholar
- M.W. Hall, J.M. Mellor-Crummey, A. Carle, and R. G. Rodríguez. FIAT: A framework for interprocedural analysis and transfomation. In Languages and Compilers for Parallel Computing, pages 522--545, London, UK, 1994. Springer-Verlag. Google Scholar
Digital Library
- International Organization for Standardization. ISO\slash IEC 14882:1998: Programming languages -- C++. Geneva, Switzerland, Sept. 1998.Google Scholar
- S. Lerner, T. Millstein, and C. Chambers. Automatically proving the correctness of compiler optimizations. In Proceedings of the ACM SIGPLAN 2003 conference on Programming language design and implementation, pages 220--231. ACM Press, 2003. 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 Principles of Programming Languages, pages 364--377, New York, NY, USA, 2005. ACM Press. Google Scholar
Digital Library
- M. Martin, B. Livshits, and M.S. Lam. Finding application errors and security flaws using PQL: a program query language. In OOPSLA, pages 365--383, New York, NY, USA, 2005. ACM Press. Google Scholar
Digital Library
- L.C. Paulson. Organizing numerical theories using axiomatic type classes. J. Autom. Reason., 33(1):29--49, 2004. 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 16th Workshop on Languages and Compilers for Parallel Computing, Oct. 2003. http://parasol.tamu.edu/lcpc03/informal-proceedings/Papers/26.pdf.Google Scholar
- A.D. Robison. Impact of economics on compiler optimization. In Proceedings of the 2001 joint ACM-ISCOPE conference on Java Grande, pages 1--10. ACM Press, 2001. Google Scholar
Digital Library
- M. Schordan and D. Quinlan. A source-to-source architecture for user-defined optimizations. In JMLC'03: Joint Modular Languages Conference, volume 2789 of Lecture Notes in Computer Science, pages 214--223. Springer Verlag, Aug. 2003.Google Scholar
Cross Ref
- S. Schupp, D. Gregor, D.R. Musser, and S.-M. Liu. User-extensible simplification: Type-based optimizer generators. In CC '01: Proceedings of the 10th International Conference on Compiler Construction, pages 86--101, London, UK, 2001. Springer-Verlag. Google Scholar
Digital Library
- J. Siek, L.-Q. Lee, and A. Lumsdaine. The Boost Graph Library: User Guide and Reference Manual. Addison-Wesley, 2002. Google Scholar
Digital Library
- J.G. Siek. A Language for Generic Programming. PhD thesis, Indiana University, August 2005. Google Scholar
Digital Library
- J.G. Siek and A. Lumsdaine. The Matrix Template Library: A generic programming approach to high performance numerical linear algebra. In International Symposium on Computing in Object-Oriented Parallel Environments, number 1505 in Lecture Notes in Computer Science, pages 59--70, 1998. Google Scholar
Digital Library
- Silicon Graphics, Inc. SGI Implementation of the Standard Template Library, 2004. http://www.sgi.com/tech/stl/.Google Scholar
- B. Steffen. Data flow analysis as model checking. In Theoretical Aspects of Computer Software, pages 346--365, London, UK, 1991. Springer-Verlag. Google Scholar
Digital Library
- M.M. Strout, J. Mellor-Crummey, and P. Hovland. Representation-independent program analysis. SIGSOFT Softw. Eng. Notes, 31(1):67--74, 2006. Google Scholar
Digital Library
- W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science, 248(1-2):211--242, 2000. Google Scholar
Digital Library
- X. Tang and J. Järvi. Concept-based optimization. In ACM SIGPLAN Symposium on Library-Centric Software Design (LCSD'07), Oct. 2007. Google Scholar
Digital Library
- The GHC Team. The Glorious Glasgow Haskell Compilation System User's Guide, version 6.10.3 edition. http://www.haskell.org/ghc/docs/latest/html/users_guide/index.html.Google Scholar
- A. Vargun. Code-Carrying Theory. PhD thesis, Rensselaer Polytechnic Institute, Troy, New York, Dec. 2006. http://www.cs.rpi.edu/ musser/gsd/athena/cct-thesis.pdf. Google Scholar
Digital Library
- T. L. Veldhuizen. Expression templates. C++ Report, 7(5):26--31, June 1995. Reprinted in C++ Gems, ed. Stanley Lippman.Google Scholar
- E. Visser. Stratego: A language for program transformation based on rewriting strategies. In A. Middeldorp, editor, Rewriting Techniques and Applications (RTA'01), volume 2051 of Lecture Notes in Computer Science, pages 357--361. Springer-Verlag, May 2001. Google Scholar
Digital Library
- P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad-hoc. In ACM Symposium on Principles of Programming Languages, pages 60--76. ACM, Jan. 1989. Google Scholar
Digital Library
- M. Wenzel. Using axiomatic type classes in Isabelle (manual), 1995. www.cl.cam.ac.uk/Research/HVG/Isabelle/docs.html.Google Scholar
- B.S. White. A Semantics-Based Approach to Optimizing Unstructured Mesh Abstractions. PhD thesis, Cornell University, May 2008. http://www.csl.cornell.edu/ bwhite/papers/thesis.pdf. Google Scholar
Digital Library
- J.J. Willcock. A Language for Specifying Compiler Optimizations for Generic Software. PhD thesis, Indiana University, Jan. 2008. Google Scholar
Digital Library
Index Terms
Reusable, generic program analyses and transformations
Recommendations
Reusable, generic program analyses and transformations
GPCE '09The 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, ...
Dependency-style generic haskell
ICFP '03: Proceedings of the eighth ACM SIGPLAN international conference on Functional programmingGeneric Haskell is an extension of Haskell that supports the construction of generic programs. During the development of several applications, such as an XML editor and compressor, we encountered a number of limitations with the existing (Classic) ...
Dependency-style generic haskell
Generic Haskell is an extension of Haskell that supports the construction of generic programs. During the development of several applications, such as an XML editor and compressor, we encountered a number of limitations with the existing (Classic) ...







Comments