User-Extensible Simplification—Type-Based Optimizer Generators

  • Sibylle Schupp
  • Douglas Gregor
  • David Musser
  • Shin-Ming Liu
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2027)


For abstract data types (ADTs) there are many potential optimizations of code that current compilers are unable to perform. These optimizations either depend on the functional specification of the computational task performed through an ADT or on the semantics of the objects defined. In either case the abstract properties on which optimizations would have to be based cannot be automatically inferred by the compiler. In this paper our aim is to address this level-of-abstraction barrier by showing how a compiler can be organized so that it can make use of semantic information about an ADT at its natural abstract level, before type lowering, inlining, or other traditional compiler steps obliterate the chance. We present an extended case study of one component of a C++ compiler, the simplifier; discuss the design decisions of a new simplifier (simplifier generator) and its implementation in C++; and give performance measurements. The new simplifier is connected to the Gnu C++ compiler and currently performs optimizations at very high level in the front end. When tested with the Matrix Template Library, a library already highly fine-tuned by hand, we achieved run-time improvements of up to six percent.


  1. 1.
    A. V. Aho and S. C. Johnson. Optimal code generation for expression trees. JACM, 23(3):488–501, 1976.zbMATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    M. Austern. Generic Programming and the STL: Using and Extending the C++ Standard Template Library. Addison-Wesley, 1999.Google Scholar
  3. 3.
    S. Chiba. A metaobject protocol for C++. In Proc. of the ACM Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), pages 285–299, Oct. 1995.Google Scholar
  4. 4.
    CodeSourcery, LLC. G++ Internal Representation, August 2000.
  5. 5.
    K. Czarnecki and U. W. Eisenecker. Generative Programming—Towards a New Paradigm of Software Engineering. Addison Wesley Longman, 2000.Google Scholar
  6. 6.
    K. Davis and D. Quinlan. ROSE II: An optimizing code transformer for C++ object-oriented array class libraries. In Workshop on Parallel Object-Oriented Scientific Computing (POOSC’98), at 12th European Conference on Object-Oriented Programming (ECOOP’98), volume 1543 of LNCS. Springer Verlag, 1998.Google Scholar
  7. 7.
    C. W. Fraser, D. R. Hanson, and T. A. Proebsting. Engineering a simple, efficient code generator. ACM TOPLAS, 1(3):213–226, 1992.Google Scholar
  8. 8.
    C. W. Fraser, R. Henry, and T. A. Proebsting. BURG—fast optimal instruction selection and tree parsing. SIGPLAN Notices, 4(27):68–76, 1992.CrossRefGoogle Scholar
  9. 9.
    D. Q. Frederico Bassetti, Kei Davis. C++ expression templates performance issues in scientific computing. In 12th International Parallel Processing Symposium and 9th Symposium on Parallel and Distributed Processing, 1998.Google Scholar
  10. 10.
    D. P. Gregor, S. Schupp, and D. Musser. User-extensible simplification. A case study using MTL and LiDIA. Technical Report TR-00-7, Rensselaer Polytechnic Institute, 2000.Google Scholar
  11. 11.
    S. Z. Guyer and C. Li. An annotation language for optimizing software libraries. In T. Ball, editor, 2nd Conference on Domain-Specific Languages. Usenix, 1999.Google Scholar
  12. 12.
    S. Haney, J. Crotinger, S. Karmesin, and S. Smith. PETE, the portable expression template engine. Technical Report LA-UR-99-777, Los Alamos National Laboratory, 1995.Google Scholar
  13. 13.
    D. Kapur and D. R. Musser. Tecton: A language for specifying generic system components. Technical Report 92-20, Rensselaer Polytechnic Institute Computer Science Department, July 1992.Google Scholar
  14. 14.
    D. Kapur, D. R. Musser, and X. Nie. An overview of the Tecton proof system. Theoretical Computer Science, 133:307–339, October 24 1994.zbMATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    L.-Q. Lee, J. Siek, and A. Lumsdaine. The generic graph component library. In Proc. of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages & Applications (OOPSLA’ 99), volume 34, pages 399–414, 1999.Google Scholar
  16. 16.
    K. J. Lieberherr. Adaptive Object-Oriented Software: The Demeter Method with Propagation Patterns. PWS Publishing Company, Boston, 1996. ISBN 0-534-94602-X.Google Scholar
  17. 17.
    S. B. Lippman. C++ Gems. Cambridge University Press, December 1996.Google Scholar
  18. 18.
    M. Mitchell. Type-based alias analysis. Dr.Dobb’s Journal, October 2000.Google Scholar
  19. 19.
    J. E. Moreira, S. P. Midkiff, and M. Gupta. From flop to megaflops: Java for technical computing. ACM TOPLAS, 22(3):265–295, March 2000.CrossRefGoogle Scholar
  20. 20.
    D. Musser and A. Saini. STL Tutorial and Reference Guide. C++ Programming with the Standard Template Library. Addison-Wesley, 1996.Google Scholar
  21. 21.
    D. Musser, S. Schupp, and R. Loos. Requirements-oriented programming. In M. Jazayeri, R. Loos, and D. Musser, editors, Generic Programming—International Seminar, Dagstuhl Castle,Germany 1998, Selected Papers, volume 1766 of Lecture Notes in Computer Science, Springer-Verlag, Heidelberg, Germany, 2000.Google Scholar
  22. 22.
    D. Musser and A. Stepanov. The ADA Generic Library: Linear List Processing Packages. Springer-Verlag, 1989.Google Scholar
  23. 23.
    N. Myers. A new and useful template technique. In C++ Gems [17].Google Scholar
  24. 24.
    J. V. Reynders, P. J. Hinker, J. C. Cummings, S. R. Atlas, S. Banerjee, W. F. Humphrey, S. R. Karmesin, K. Keahey, M. Srikant, and M. Tholburn. POOMA: A framework for scientific simulations on parallel architectures. In G. V. Wilson and P. Lu, editors, Parallel Programming using C++, pages 553–594. MIT Press, 1996.Google Scholar
  25. 25.
    Scale Compiler Group, Dept. of Comp. Science, Univ. Massachusetts. A scalable compiler for analytical experiments., 2000.
  26. 26.
    S. Schupp, D. P. Gregor, and D. Musser. Algebraic concepts represented in C++. Technical Report TR-00-8, Rensselaer Polytechnic Institute, 2000.Google Scholar
  27. 27.
    J. G. Siek. A modern framework for portable high performance numerical linear algebra. Master’s thesis, Notre Dame, 1999.Google Scholar
  28. 28.
    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, 1998.Google Scholar
  29. 29.
    C. Simonyi. The future is intentional. IEEE Computer, 1999.Google Scholar
  30. 30.
    A. A. Stepanov and M. Lee. The Standard Template Library. Technical Report HP-94-93, Hewlett-Packard, 1995.Google Scholar
  31. 31.
    B. Stroustrup. The C++ programming language, Third Edition. Addison-Wesley, 3 edition, 1997.Google Scholar
  32. 32.
    The LiDIA Group. Lidia—a C++ library for computational number theory.
  33. 33.
    T. Veldhuizen. Blitz++.
  34. 34.
    T. Veldhuizen. Expression templates. In C++ Gems [17].Google Scholar
  35. 35.
    R. Wille. Restructuring lattice theory: An approach based on hierarchies of concepts. In I. Rival, editor, Ordered Sets, pages 445–470. Reidel, Dordrecht-Boston, 1982.Google Scholar
  36. 36.
    R. Wille. Concept lattices and conceptual knowledge systems. Computers and Mathematics with Applications, 23:493–522, 1992.zbMATHCrossRefGoogle Scholar
  37. 37.
    P. Wu, S. P. Midkiff, J. E. Moreira, and M. Gupta. Efficient support for complex numbers in Java. In Proceedings of the ACM Java Grande Conference, 1999.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • Sibylle Schupp
    • 1
  • Douglas Gregor
    • 1
  • David Musser
    • 1
  • Shin-Ming Liu
    • 2
  1. 1.Dept. of Computer ScienceRPIUSA
  2. 2.Hewlett PackardUSA

Personalised recommendations