An optimizer for the
PanLanguage was implemented in Stratego as part of a research on
InliningStrategies. It performs the following optimizations:
- FunctionInlining?
- ConstantFolding?
- CommonSubexpressionElimination?
- CodeMotion?
The optimizer uses the frontend from the compiler for the
TigerLanguage?, which means Pan programs must be written in Tiger.
A master thesis which discusses this implementation is available.
It has the following abstract.
All modern compilers provide inlining, an optimization which replaces a
function call by the function body. Implementations of inlining are usually
focused on specific algorithms to decide which functions should be inlined
or specific source languages. This report instead describes the
implementation of a general inlining implementation in the program
transformation language Stratego. This inliner should be usable for
different source languages and decision algorithms. The implementation
separates the analysis and transformation of the program, the traversal of
the program and the decision when to do inlining. In addition, the
implementation of several other optimizations that are enabled by inlining
is discussed in the context of the highly optimizable Pan language.