Advertisement

Code generation = A* + BURS

  • Albert Nymeyer
  • Joost -Pieter Katoen
  • Ymte Westra
  • Henk Alblas
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1060)

Abstract

A system called BURS that is based on term rewrite systems and a search algorithm A* are combined to produce a code generator that generates optimal code. The theory underlying BURS is re-developed, formalised and explained in this work. The search algorithm uses a cost heuristic that is derived from the term rewrite system to direct the search. The advantage of using a search algorithm is that we need to compute only those costs that may be part of an optimal rewrite sequence.

Key words

compiler generators code generation term rewrite systems search algorithms formal techniques 

References

  1. 1.
    A. V. Aho, M. Ganapathi, and S. W. K. Tjiang. Code generation using tree matching and dynamic programming. ACM Transactions on Programming Languages and Systems, 11(4):491–516, October 1989.Google Scholar
  2. 2.
    A. Balachandran, D. M. Dhamdhere, and S. Biswas. Efficient retargetable code generation using bottom-up tree pattern matching. Computer Languages, 15(3): 127–140, 1990.Google Scholar
  3. 3.
    J. Cai, R. Paige, and R. Tarjan. More efficient bottom-up multi-pattern matching in trees. Theoretical Computer Science, 106:21–60, 1992.Google Scholar
  4. 4.
    R. G. G. Cattell. Code generation in a machine-independent compiler. Proceedings of the ACM SIGPLAN 1979 Symposium on Compiler Construction, ACM SIGPLAN Notices, 14(8):65–75, August 1979.Google Scholar
  5. 5.
    R. G. G. Cattell. Automatic derivation of code generators from machine descriptions. ACM Transactions on Programming Languages and Systems, 2(2): 173–190, April 1980.Google Scholar
  6. 6.
    R. G. G. Cattell. Formalization and Automatic Derivation of Code Generators. UMI Research Press, Ann Arbor, Michigan, 1982.Google Scholar
  7. 7.
    D. R. Chase. An improvement to bottom-up tree pattern matching. In Proceedings of the Fourteenth Annual ACM Symposium on Principles of Programming Languages, pages 168–177, Munich, Germany, January 1987.Google Scholar
  8. 8.
    T. W. Christopher, P. J. Hatcher, and R. C. Kukuk. Using dynamic programming to generate optimised code in a Graham-Glanville style code generator. Proceedings of the ACM SIGPLAN 1984 Symposium on Compiler Construction, ACM SIGPLAN Notices, 19(6):25–36, June 1984.Google Scholar
  9. 9.
    N. Dershowitz and J.-P. Jouannaud. Rewrite systems. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science (Vol. B: Formal Models and Semantics), chapter 6, pages 245–320. Elsevier Science Publishers B.V., 1990.Google Scholar
  10. 10.
    H. Emmelmann. Code selection by regularly controlled term rewriting. In R. Giegerich and S. L. Graham, editors, Code generation—concepts, tools, techniques, Workshops in Computing Series, pages 3–29. Springer-Verlag, New York-Heidelberg-Berlin, 1991.Google Scholar
  11. 11.
    H. Emmelmann, F. W. Schröer, and R. Landwehr. BEG—a generator for efficient back ends. ACM SIGPLAN Notices, 24(7):246–257, July 1989.Google Scholar
  12. 12.
    C. Ferdinand, H. Seidl, and R. Wilhelm. Tree automata for code selection. Acta Informatica, 31(8):741–760, 1994.Google Scholar
  13. 13.
    C. W. Fraser, D. R. Hanson, and T. A. Proebsting. Engineering a simple, efficient code-generator generator. ACM Letters on Programming Languages and Systems, 1(3): 213–226, September 1992.Google Scholar
  14. 14.
    C. W. Fraser, R. R. Henry, and T. A. Proebsting. BURG—fast optimal instruction selection and tree parsing. ACM SIGPLAN Notices, 27(4):68–76, July 1992.Google Scholar
  15. 15.
    R. Giegerich. Code selection by inversion of order-sorted derivors. Theoretical Computer Science, 73:177–211, 1990.Google Scholar
  16. 16.
    R. Giegerich and K. Schmal. Code selection techniques: pattern matching, tree parsing, and inversion of derivors. In H. Ganzinger, editor, Proc. 2nd European Symp. on Programming, volume 300 of Lecture Notes in Computer Science, pages 247–268. Springer-Verlag, New York-Heidelberg-Berlin, 1988.Google Scholar
  17. 17.
    P. J. Hatcher and T. W. Christopher. High-quality code generation via bottom-up tree pattern matching. In Proceedings of the Thirteenth Annual ACM Symposium on Principles of Programming Languages, pages 119–130, Tampa Bay, Florida, January 1986.Google Scholar
  18. 18.
    C. Hemerik and J.-P. Katoen. Bottom-up tree acceptors. Science of Computer Programming, 13:51–72, January 1990.Google Scholar
  19. 19.
    R. R. Henry. The codegen user's manual. Technical report 87-08-04, Computer Science Department, University of Washington, Seattle, Washington, October 1988.Google Scholar
  20. 20.
    R. R. Henry. Encoding optimal pattern selection in a table-driven bottom-up tree-pattern matcher. Technical report 89-02-04, Computer Science Department, University of Washington, Seattle, Washington, February 1989.Google Scholar
  21. 21.
    R. R. Henry and P. C. Damron. Algorithms for table-driven generators using tree-pattern matching. Technical report 89-02-03, Computer Science Department, University of Washington, Seattle, Washington, February 1989.Google Scholar
  22. 22.
    R. R. Henry and P. C. Damron. Performance of table-driven code generators using treepattern matching. Technical report 89-02-02, Computer Science Department, University of Washington, Seattle, Washington, February 1989.Google Scholar
  23. 23.
    C. M. Hoffmann and M. J. O'Donnell. Pattern matching in trees. Journal of the ACM, 29(1):68–95, January 1982.Google Scholar
  24. 24.
    L. Kanal and V. Kumar, editors. Search in Artificial Intelligence. Springer, 1988.Google Scholar
  25. 25.
    H. Kron. Tree Templates and Subtree Transformational Grammars. PhD thesis, Information Sciences Department, University of California, Santa Cruz, CA, 1975.Google Scholar
  26. 26.
    N. J. Nilsson. Problem-solving methods in artificial intelligence. McGraw-Hill, New York, 1971.Google Scholar
  27. 27.
    N. J. Nilsson. Principles of artificial intelligence, Morgan Kaufmann Publishers, Palo Alto, CA, 1980.Google Scholar
  28. 28.
    A. Nymeyer and J.-P. Katoen. Code generation based on formal BURS theory and heuristic search. Technical report 95-42, Department of Computer Science, University of Twente, Enschede, The Netherlands, November 1995.Google Scholar
  29. 29.
    E. Pelegrí-Llopart. Rewrite systems, pattern matching, and code generation. PhD thesis, University of California, Berkeley, December 1987. (Also as Technical Report CSD-88-423).Google Scholar
  30. 30.
    E. Pelegrí-Llopart and S. L. Graham. Optimal code generation for expression trees: An application of BURS theory. In Proceedings of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, pages 294–308, San Diego, CA, January 1988.Google Scholar
  31. 31.
    T. A. Proebsting. BURS automata generation. ACM Transactions on Programming Languages and Systems, 3(17):461–486, 1995.Google Scholar
  32. 32.
    B. Weisgerber and R. Wilhelm. Two tree pattern matchers for code selection. In D. Hammer, editor, Compiler compilers and high speed compilation, volume 371 of Lecture Notes in Computer Science, pages 215–229. Springer-Verlag, New York-Heidelberg-Berlin, October 1989.Google Scholar
  33. 33.
    W. A. Wulf, B. W. Leverett, R. G. G. Cattell, S. O. Hobbs, J. M. Newcomer, A. H. Reiner, and B. R. Schatz. An overview of the production-quality compiler compiler project. IEEE Computer, 13(8):38–49, August 1980.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Albert Nymeyer
    • 1
  • Joost -Pieter Katoen
    • 1
  • Ymte Westra
    • 1
  • Henk Alblas
    • 1
  1. 1.Department of Computer ScienceUniversity of TwenteAE EnschedeThe Netherlands

Personalised recommendations