skip to main content
10.1145/1621607.1621611acmconferencesArticle/Chapter ViewAbstractPublication PagesgpceConference Proceedingsconference-collections
research-article

Reusable, generic program analyses and transformations

Published:04 October 2009Publication History

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle Scholar
  4. 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 ScholarGoogle Scholar
  5. 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 ScholarGoogle ScholarCross RefCross Ref
  6. C. Click and K.D. Cooper. Combining analyses, combining optimizations. ACM Trans. Program. Lang. Syst., 17(2):181--196, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. de Dinechin. XLR: Extensible language and runtime, Nov. 2007. http://xlr.sourceforge.net/.Google ScholarGoogle Scholar
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. C.D. Farnum. Pattern-based languages for prototyping of compiler optimizers. Technical report, University of California, Berkeley, 1990.Google ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Gregor and S. Schupp. STLlint: Lifting static checking from languages to libraries. Software: Practice&Experience, Mar. 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle Scholar
  16. S.Z. Guyer and C. Lin. Broadway: A compiler for exploiting the domain-specific semantics of software libraries. Proceedings of the IEEE, 2004.Google ScholarGoogle Scholar
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. International Organization for Standardization. ISO\slash IEC 14882:1998: Programming languages -- C++. Geneva, Switzerland, Sept. 1998.Google ScholarGoogle Scholar
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. L.C. Paulson. Organizing numerical theories using axiomatic type classes. J. Autom. Reason., 33(1):29--49, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle Scholar
  24. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  25. 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 ScholarGoogle ScholarCross RefCross Ref
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. J. Siek, L.-Q. Lee, and A. Lumsdaine. The Boost Graph Library: User Guide and Reference Manual. Addison-Wesley, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. J.G. Siek. A Language for Generic Programming. PhD thesis, Indiana University, August 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. Silicon Graphics, Inc. SGI Implementation of the Standard Template Library, 2004. http://www.sgi.com/tech/stl/.Google ScholarGoogle Scholar
  31. B. Steffen. Data flow analysis as model checking. In Theoretical Aspects of Computer Software, pages 346--365, London, UK, 1991. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. M.M. Strout, J. Mellor-Crummey, and P. Hovland. Representation-independent program analysis. SIGSOFT Softw. Eng. Notes, 31(1):67--74, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science, 248(1-2):211--242, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. X. Tang and J. Järvi. Concept-based optimization. In ACM SIGPLAN Symposium on Library-Centric Software Design (LCSD'07), Oct. 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. 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 ScholarGoogle Scholar
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. T. L. Veldhuizen. Expression templates. C++ Report, 7(5):26--31, June 1995. Reprinted in C++ Gems, ed. Stanley Lippman.Google ScholarGoogle Scholar
  38. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  39. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  40. M. Wenzel. Using axiomatic type classes in Isabelle (manual), 1995. www.cl.cam.ac.uk/Research/HVG/Isabelle/docs.html.Google ScholarGoogle Scholar
  41. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  42. J.J. Willcock. A Language for Specifying Compiler Optimizations for Generic Software. PhD thesis, Indiana University, Jan. 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Reusable, generic program analyses and transformations

    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
    • Published in

      cover image ACM Conferences
      GPCE '09: Proceedings of the eighth international conference on Generative programming and component engineering
      October 2009
      194 pages
      ISBN:9781605584942
      DOI:10.1145/1621607
      • General Chair:
      • Jeremy Siek,
      • Program Chair:
      • Bernd Fischer
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 45, Issue 2
        GPCE '09
        February 2010
        182 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1837852
        Issue’s Table of Contents

      Copyright © 2009 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 4 October 2009

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      GPCE '09 Paper Acceptance Rate18of62submissions,29%Overall Acceptance Rate56of180submissions,31%

    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!