Rewriting Strategies for Instruction Selection

  • Martin Bravenboer
  • Eelco Visser
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2378)


Instruction selection (mapping IR trees to machine instructions) can be expressed by means of rewrite rules. Typically, such sets of rewrite rules are highly ambiguous. Therefore, standard rewriting engines based on fixed, exhaustive strategies are not appropriate for the execution of instruction selection. Code generator generators use special purpose implementations employing dynamic programming. In this paper we show how rewriting strategies for instruction selection can be encoded concisely in Stratego, a language for program transformation based on the paradigm of programmable rewriting strategies. This embedding obviates the need for a language dedicated to code generation, and makes it easy to combine code generation with other optimizations.


Dynamic Programming Instruction Tree Purpose Implementation Program Transformation Intermediate Representation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    A. V. Aho, M. Ganapathi, and S. W. K. Tjiang. Code generation using tree pattern matching and dynamic programming. ACM Transactions on Programming Languages and Systems, 11(4):491–516, October 1989.Google Scholar
  2. 2.
    A. V. Aho and S. C. Johnson. Optimimal code generation for expression trees. Journal of the ACM, 23(3):488–501, 1976.zbMATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    A. W. Appel. Modern Compiler Implementation in ML. Cambridge University Press, 1998.Google Scholar
  4. 4.
    A. van Deursen, J. Heering, and P. Klint, editors. Language Prototyping. An Algebraic Specification Approach, volume 5 of AMAST Series in Computing. World Scientific, Singapore, September 1996.zbMATHGoogle Scholar
  5. 5.
    H. Emmelmann, F.-W. Schroer, and R. Landwehr. BEG-a generator for efficient back ends. In ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation (PLDI’89), pages 227–237. ACM, July 1989.Google Scholar
  6. 6.
    C. H. Hoffmann and M. J. O’Donnell. Pattern matching in trees. Journal of the ACM, 29(1):68–95, January 1982.Google Scholar
  7. 7.
    P. Johann and E. Visser. Fusing logic and control with local transformations: An example optimization. In B. Gramlich and S. Lucas, editors, Workshop on Reduction Strategies in Rewriting and Programming (WRS’01), volume 57 of Electronic Notes in Theoretical Computer Science, Utrecht, The Netherlands, May 2001. El-sevier Science Publishers.Google Scholar
  8. 8.
    T. A. Proebsting. BURS automata generation. ACM Transactions on Programming Languages and Systems, 17(3):461–486, May 1995.Google Scholar
  9. 9.
    E. Visser. Scoped dynamic rewrite rules. In M. van den Brand and R. Verma, editors, Rule Based Programming (RULE’01), volume 59/4 of Electronic Notes in Theoretical Computer Science. Elsevier Science Publishers, September 2001.Google Scholar
  10. 10.
    E. Visser. Stratego: A language for program transformation based on rewriting strategies. System description of Stratego 0.5. 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.CrossRefGoogle Scholar
  11. 11.
    E. Visser, Z.-e.-A. Benaissa, and A. Tolmach. Building program optimizers with rewriting strategies. In Proceedings of the third ACM SIGPLAN International Conference on Functional Programming (ICFP’98), pages 13–26. ACM Press, September 1998.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2002

Authors and Affiliations

  • Martin Bravenboer
    • 1
  • Eelco Visser
    • 1
  1. 1.Institute of Information and Computing SciencesUniversiteit UtrechtUtrechtThe Netherlands

Personalised recommendations