Overview and industrial application of code generator generators

During the past 10 to 15 years, there has been active research in the area of automatically generating the code generator part of compilers from formal specifications. However, little has been reported on the application of these systems in an industrial setting. This paper attempts to fill this gap, in addition to providing a tutorial overview of the most well-known methods. Four systems for automatic generation of code generators are described in this paper. CGSS, BEG, TWIG and BURG. CGSS is an older Graham-Glanville style system based on pattern matching through parsing, whereas BEG, TWIG, and BURG are more recent systems based on tree pattern matching combined with dynamic programming. An industrial-strength code generator previously implemented for a special-purpose language using the CGSS system is described and compared in some detail to our new implementation based on the BEG system. Several problems of integrating local and global register allocations within automatically generated code generators are described, and some solutions are proposed. In addition, the specification of a full code generator for SUN SPARC with register windows using the BEG system is described. We finally conclude that current technology of automatically generating code generators is viable in an industrial setting. However, further research needs to be done on the problem of properly integrating register allocation and instruction scheduling with instruction selection, when both are generated from declarative specifications.

[1]  P. Canalda,et al.  PAGODE : a back-end generator for RISC machines , 1993 .

[2]  Christoph M. Hoffmann,et al.  Pattern Matching in Trees , 1982, JACM.

[3]  Susan L. Graham,et al.  A new method for compiler code generation , 1978, POPL '78.

[4]  Helmut Emmelmann Testing Completeness of Code Selector Specifications , 1992, CC.

[5]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[6]  Christopher W. Fraser,et al.  BURG: fast optimal instruction selection and tree parsing , 1992, SIGP.

[7]  Helmut Emmelmann,et al.  BEG: a generator for efficient back ends , 1989, PLDI '89.

[8]  Thomas Miiller Employing finite automata for resource scheduling , 1993, MICRO 1993.

[9]  Gerhard Goos,et al.  Experience with an automatic code generator generator , 1982, SIGPLAN '82.

[10]  Simon L. Peyton Jones,et al.  Imperative functional programming , 1993, POPL '93.

[11]  Peter Fritzson Symbolic debugging through incremental compilation in an integrated environment , 1983, J. Syst. Softw..

[12]  Alfred V. Aho,et al.  Code generation using tree matching and dynamic programming , 1989, ACM Trans. Program. Lang. Syst..

[13]  Alfred V. Aho,et al.  Efficient string matching , 1975, Commun. ACM.

[14]  David R. Chase,et al.  An improvement to bottom-up tree pattern matching , 1987, POPL '87.

[15]  Susan L. Graham,et al.  Optimal Code Generation for Expression Trees: An Application of BURS (bottom-Up Rewrite Systems) Theory , 1988 .