Code generator generation based on template-driven target term rewriting
A major problem in deriving a compiler from a formal definition is the production of efficient object code. In this context, we propose a solution to the problem of code generator generation.
Our approach is based on a target machine description where the basic concepts used (access modes, access classes and instructions) are bottom-up hierarchically described by tree-patterns. These tree-patterns are written in an abstract tree language which is also used to write the intermediate program representation (input to the code generator).
The first phase of code production is based on access mode template-driven rewritings in which the program intermediate representation is progressively transformed into its "canonical form". The result is that each program instruction is reduced to a sequence of elementary instructions, each of these elementary instructions representing an instance of an instruction pattern.
The local and global optimizations phases as well as the storage management phase may be realized by multipass rewritings and attribute evaluations of the canonical form.
In the last phase of code production, each pattern instruction instance of the updated intermediate form is replaced by the corresponding instance of the associated pattern code.
KeywordsSource Position Code Production Access Mode Access Path Left Child
- [Cat 77]Catell R. G. G. "A Survey and Critique of some Models of Code Generation" Carnegie-Mellon University, Computer Sciences Department, Technical Report, 1977.Google Scholar
- [Cat 80]Cattell R. G. G. "Automatic Derivation of Code Generators from Machine Description" ACM Transactions on Programming Languages and Systems, Vol. 2, No.2 p173..199, April 1980.Google Scholar
- [Des 82]Deschamp Ph. "PERLUETTE: a compiler producing system using abstract data types" Proceedings of International Symposium on Programming, Turin, April 1982.Google Scholar
- [Don 82]Donzeau-Gouge V., "Les raisons des choix dans la définition formelle du langage ADA" Thèse d'état Paris VII 1982.Google Scholar
- [GDM 84]Gaudel M. C., Deschamp Ph, Mazaud M. "Compiler Construction From High Level Specification". Automatic Program Construction Techniques. Macmillan Inc, 1984.Google Scholar
- [Gan Gie 82]Ganzinger H, Giegerich R. "A truly Generative Semantics-Directed Compiler Generator" Proceedings of the SIGPLAN 82 Symposium on Compiler Construction, ACM SIGPLAN No. 17, 6, June 1982.Google Scholar
- [GF 82]Ganapathi M., Fischer C.N. "Descriptive-Driven Code Generation Using attributed Grammars" Conference of the Nineth Annual ACM Symposium on Programming Languages.Google Scholar
- [GG 78]Graham S.L, Glanville R. S. "A New Method for Compiler Code Generation" Conference Record of the Fith Annual ACM Symposium on Principles of Programming Languages, p231–240, January 1978.Google Scholar
- [GH 84]Graham S. L., Henry R. R. et AL "Experiment with a Graham-Glanville Style Code generator" Proceedings of the SIGPLAN 84 Symposium on Compiler Construction, ACM Not 19, 6, June 1984.Google Scholar
- [Gie 85]Giegerich R. "Logic specification of Code Generation Techniques" Lecture Notes in Computer Science. Programs as data objects, Copenhague 17–19 October 1985.Google Scholar
- [GRW 77]Ganzinger H., Ripken K., Wilhelm R. "Automatic Generation of Optimizing Multipass Compilers" IFIP77, North-Holland Publishing Company p535..540, 1977.Google Scholar
- [Kro 75]Kron H. H. "Tree Templates and subtree transformational grammars" PhD-thesis Univ of Cal., Santa Cruz, 1975.Google Scholar
- [Ho O'D 82]Hoffmann C.M, O'Donnell M.J. "Pattern Matching in Trees" JACM vol 29 No 1, Jan 1982, pp 68–95.Google Scholar
- [CHNRSW 79]Leverett B.W., Cattell G.G., Hobbs S.O., Newcomer J.M., Reiner A.H., Schatz B.R., Wulf W.A. "An Overview of the Production Quality Compiler-Compiler Project" CMU-CS-79-105.Google Scholar
- [Lev 81]Leverett B.W. "Register Allocation in Optimizing Compilers" CMU-CS-81-103.Google Scholar
- [Lun 83]Lunell H. "Code Generator writing systems" Software Systems Research Center S-581 83 Linköping, Sweden.Google Scholar
- [Mad 83]Madelaine E. "Système d'aide à la preuve de compilateurs" Th`ese de 3ème cycle, Université de Paris VII, Septembre 1983.Google Scholar
- [MRS 86]Mazaud M., Rakotozafy R., Szumachowski-Despland A. "Code generator generation based on template-driven target term rewriting" rapport de recherche INRIA RR-582, 1986.Google Scholar