Specification-Driven Optimization
Sheena Day · 1998
Traditionally, optimizing transformations have been built into compilers. The end-user has little or no control over guiding any optimizations that may be applied by the compiler. Moreover, the compiler-writer does not have a simple way to direct the optimizations. Thus, many potentially beneficial opportunities for code optimization may be lost. We have built a system that allows the user to participate in guiding source-to-source transformations via the specification of rewrite rules. A clean separation of the rules from the strategy of applying them makes the system easier to use and modify, compared to other integrated systems. This is especially relevant to the application-specific improvement of code, which is hard to achieve through the usual means. We anticipate our system to be a useful aid to both the end-user and the compiler-writer. A sophisticated end-user might use it very effectively by applying his knowledge of the problem domain to the rewrite rules. The compiler-writer, in addition, would benefit from the increased modularity, flexibility and simplicity of use that it provides. A desirable feature of the design is the ability to express the rewrite rules in a language closely allied to the source language. We illustrate this with the help of several examples. Our system is intended to be an extension to the standard optimizing compiler. To our knowledge, existing compilers do not have this facility.