Code generation in a machine-independent compiler

  • Authors:
  • R. G. G. Cattell;Joseph M. Newcomer;Bruce W. Leverett

  • Affiliations:
  • Sun Microsystems, Santa Clara, CA;Joseph M. Newcomer Co., Pittsburgh, PA;Spinnaker Networks, Pittsburgh, PA

  • Venue:
  • ACM SIGPLAN Notices - Best of PLDI 1979-1999
  • Year:
  • 2004

Quantified Score

Hi-index 0.01

Visualization

Abstract

This paper presents some code generation issues in the context of the PQCC Production-Quality Compiler-Compiler project [8]. The approach taken is unusual in several ways. The machine-dependent information for selection of code sequences, register assignments, etc., has been separated throughout, in tabular form, from the machine-independent algorithms. This not only greatly simplifies the development of code generators for new machines or languages, but paves the way for automatic generation of these tables from formal machine descriptions such as ISP [1]. A parse-tree-like internal program representation is used, facilitating the use of context and data dependency information about expressions. The code generation process has been broken into several phases. This leads to simplification and better understanding of the code generation process, and also allows important improvements in the quality of generated code. The algorithms for preliminary determination of addressing modes, allocation of registers and other locations, and the code selection case analysis are dlscussed. The algorithms described In the paper are being implemented and used in the PQCC compiler.