Automatic Derivation of Code Generators from Machine Descriptions

Work with compiler compilers has dealt principally with automatic generation of parsers and lexical analyzers. Until recently, little work has been done on formalizing and generating the back end of a compiler, particularly an optimizing compiler. This paper describes formalizations of machines and code generators and describes a scheme for the automatic derivation of code generators from machine descriptions. It was possible to separate all machine dependence from the code generation algorithms for a wide range of typical architectures (IBM-360, PDP-11, PDP-10, Intel 8080) while retaining good code quality. Heuristic search methods from work in artificial intelligence were found to be both fast and general enough for use in generation of code generators with the machine representation proposed. A scheme is proposed to perform as much analysis as possible at code generator generation time, resulting in a fast pattern-matching code generator. The algorithms and representations were implemented to test their practicality in use.

[1]  A. Snyder A PORTABLE COMPILER FOR THE LANGUAGE C , 1975 .

[2]  Bruce R. Schatz,et al.  An Overview of the Production-Quality Compiler-Compiler Project , 1980, Computer.

[3]  Thomas Richard Wilcox Generating machine code for high-level programming languages , 1971 .

[4]  Mark Elson,et al.  Code-Generation Technique for Large-Language Compilers , 1970, IBM Syst. J..

[5]  Robert Steven Glanville,et al.  A Machine Independent Algorithm for Code Generation and Its Use in Retargetable Compilers , 1977 .

[6]  Jerome A. Feldman,et al.  Translator writing systems , 1968, Commun. ACM.

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

[8]  John D. Wick Automatic Generation of Assemblers , 1975, Outstanding Dissertations in the Computer Sciences.

[9]  Joseph Michael Newcomer Machine-independent generation of optimal local code. , 1975 .

[10]  Christopher W. Fraser,et al.  Automatic generation of code generators. , 1977 .

[11]  Donald Carlton Simoneaux High-level language compiling for user-definable architectures. , 1975 .

[12]  John Denniston Oakley Symbolic execution of formal machine descriptions , 1979 .

[13]  William A. Wulf,et al.  The Design of an Optimizing Compiler , 1975 .

[14]  Allen Newell,et al.  Computer Structures: Readings and Examples, , 1971 .

[15]  Steven William Weingart,et al.  An efficient and systematic method of compiler code-generation. , 1973 .

[16]  J. J. Horning,et al.  A compiler generator , 1970 .

[17]  Edward S. Lowry,et al.  Object code optimization , 1969, CACM.

[18]  Stephen C. Johnson A portable compiler: theory and practice , 1978, POPL.

[19]  Michael Kelly Donegan,et al.  An approach to the automatic generation of code-generators. , 1973 .

[20]  R. G. G. Cattell,et al.  Code generation in a machine-independent compiler , 1979, SIGPLAN '79.

[21]  Jerome A. Feldman,et al.  A FORMAL SEMANTICS FOR COMPUTER-ORIENTED LANGUAGES , 1964 .

[22]  P. L. Miller AUTOMATIC CREATION OF A CODE GENERATOR FROM A MACHINE DESCRIPTION , 1971 .

[23]  R. G. G. Cattell,et al.  A Survey and Critique of Some Models of Code Generation , 1977 .

[24]  Roderic Geoffrey Galton Cattell,et al.  Formalization and Automatic Derivation of Code Generators , 1982 .

[25]  Hanan Samet,et al.  Automatically proving the correctness of translations involving optimized code - research sponsored by Advanced Research Projects Agency, ARPA order no. 2494 , 1975, Stanford Artificial Intelligence Laboratory: Memo AIM.

[26]  Daniel P. Siewiorek,et al.  The CMU RT-CAD system: an innovative approach to computer aided design , 1976, AFIPS '76.

[27]  David C. Luckham,et al.  On Formalised Computer Programs , 1970, J. Comput. Syst. Sci..

[28]  R. G. G. Cattell,et al.  Code generation in a machine-independent compiler , 1979, SIGPLAN '79.