Choosing an appropriate set of optimizations for a particular compiler is a black art; the literature abounds with unimplemented optimization algorithms. This dissertation describes the core tools used in Dora, an environment for exploring the design space of optimizing compilers.
Dora uses a lambda-calculus based intermediate language schema to represent programs at both high and low levels. Operators that are appropriate to a particular language, machine, and/or code-level are defined as necessary for a particular compiler, using a description language that allows the implementor to state the important properties of the operator with regard to optimization. "Machine independent" optimizations, such as moving code out of loops, are written to interrogate this information, enabling a single specification to be applicable to code at many levels for many source languages and target machines.
The language schema and description languages provide the possibility of writing optimizations in a context-independent manner, but the environment must also give special support to ease this writing. Dora includes attribution and transformation languages based on pattern matching. The pattern language is grounded in the efficient automata-driven tradition, but with important extensions for natural handling of variable-arity operators and repetitive vertical constructs such as left-associated addition trees. The attribute system uses the pattern matching system to gain the descriptive advantages of an attribute grammar system (easy access to local context and a declarative functional specification) without inheriting the difficulties of a monolithic specification factored by an often irrelevant abstract syntax. The transformation language uses the pattern matching system for local context, while relying on the attribute system for global analysis.
Dora has been used to implement a functional prototype of Frederick Chow's optimizer UOPT. The example prototype demonstrates the support Dora provides for building actual optimizers. It also makes possible previously infeasible experiments, such as reordering the optimizations, adding non bitvector-based optimizations to the suite, and applying UOPT to languages in the LISP tradition.
[1]
Martin Hopkins,et al.
An overview of the PL.8 compiler
,
1982,
SIGP.
[2]
Deborah S. Coutant,et al.
Compilers for the New Generation of Hewlett-Packard Computers
,
1986,
COMPCON.
[3]
Verzekeren Naar Sparen,et al.
Cambridge
,
1969,
Humphrey Burton: In My Own Time.
[4]
Dennis J. Frailey,et al.
An intermediate language for source and target independent code optimization
,
1979,
SIGPLAN '79.
[5]
Dieter Hammer.
Compiler Compilers and High Speed Compilation
,
1988,
Lecture Notes in Computer Science.
[6]
Paul Hudak,et al.
ORBIT: an optimizing compiler for scheme
,
1986,
SIGPLAN '86.
[7]
Gregory F. Johnson,et al.
Incremental evaluation for a general class of circular attribute grammars
,
1988,
PLDI '88.
[8]
Robert Giegerich,et al.
A truly generative semantics-directed compiler generator
,
1982,
SIGPLAN '82.
[9]
Robin Milner,et al.
A Theory of Type Polymorphism in Programming
,
1978,
J. Comput. Syst. Sci..
[10]
Alfred V. Aho,et al.
Currents In The Theory Of Computing
,
1973
.
[11]
Jean-Pierre Jouannaud,et al.
Rewrite Systems
,
1991,
Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics.
[12]
Mary Lou Soffa,et al.
An approach to ordering optimizing transformations
,
1990,
PPOPP '90.
[13]
S. Doaitse Swierstra,et al.
Higher order attribute grammars
,
1989,
PLDI '89.
[14]
Matthias Felleisen,et al.
The calculi of lambda-nu-cs conversion: a syntactic theory of control and state in imperative higher-order programming languages
,
1987
.
[15]
Rodney Farrow,et al.
LINGUIST-86: Yet another translator writing system based on attribute grammars
,
1982,
SIGPLAN '82.
[16]
Henri E. Bal,et al.
Language- and Machine-Independent Global Optimization on Intermediate Code
,
1986,
Comput. Lang..
[17]
Charles D Farnum.
A tree transformation facility using typed rewrite systems
,
1988
.
[18]
Gerald J. Sussman,et al.
Structure and interpretation of computer programs
,
1985,
Proceedings of the IEEE.