Pattern-Based Languages for Prototyping of Compiler Optimizers

Charles Donald Farnum

EECS Department
University of California, Berkeley
Technical Report No. UCB/CSD-90-608
December 1990

http://www2.eecs.berkeley.edu/Pubs/TechRpts/1990/CSD-90-608.pdf

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. Operations 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 traditions, 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 OUPT. 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 OUPT to languages in the LISP tradition.

Advisor: Susan L. Graham


BibTeX citation:

@phdthesis{Farnum:CSD-90-608,
    Author = {Farnum, Charles Donald},
    Title = {Pattern-Based Languages for Prototyping of Compiler Optimizers},
    School = {EECS Department, University of California, Berkeley},
    Year = {1990},
    Month = {Dec},
    URL = {http://www2.eecs.berkeley.edu/Pubs/TechRpts/1990/6380.html},
    Number = {UCB/CSD-90-608},
    Abstract = {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. <p>Dora uses a lambda-calculus based intermediate language schema to represent programs at both high and low levels. Operations 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. <p>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 traditions, 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. <p>Dora has been used to implement a functional prototype of Frederick Chow's optimizer OUPT. 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 OUPT to languages in the LISP tradition.}
}

EndNote citation:

%0 Thesis
%A Farnum, Charles Donald
%T Pattern-Based Languages for Prototyping of Compiler Optimizers
%I EECS Department, University of California, Berkeley
%D 1990
%@ UCB/CSD-90-608
%U http://www2.eecs.berkeley.edu/Pubs/TechRpts/1990/6380.html
%F Farnum:CSD-90-608