| | |
Summary: Concise specifications of locally optimal code generators
Andrew W. Appel
Department of Computer Science
Princeton University
Princeton, NJ 08544
ABSTRACT
Dynamic programming allows locally optimal instruction selection for expression
trees. More importantly, the algorithm allows concise and elegant specification of code
generators. Aho, Ganapathi, and Tjiang have built the Twig codegeneratorgenerator,
which produces dynamicprogramming codegenerators from grammarlike
specifications.
Encoding a complex architecture as a grammar for a dynamicprogramming code
generatorgenerator shows the expressive power of the technique. Each instruction,
addressing mode, register and class can be expressed individually in the grammar. The
grammar can be factored much more readily than with the GrahamGlanville LR(1) algo
rithm, so it can be much more concise. Twig specifications for the VAX and MC68020
are described, and the corresponding code generators select very good (and under the
right assumptions, optimal) instruction sequences.
Limitations and possible improvements to the specification language are discussed.
1. Introduction
|