Number of Authors: 1
2008 (English)Report (Other academic)
In this paper we deal with the problem of making context dependent interprocedural optimizations (where the legality of optimizing a function depends on properties of the callers of the function) effective and compatible with (a form of) separate compilation. We improve effectiveness by cloning, generating several versions of a single function optimized for different call sites. We attack the separate compilation problem, that code can not be generated until all calls of a function are known, by splitting the compilation process into two phases. The first phase analyses the modules one at a time in bottom-up dependency order ('main' is processed last) and produces code in an intermediate language where the constructs targeted by the optimization are annotated to control the application of the optimization. In cases where the legality of an optimization depends on properties of the callers of the function, these annotations can take the form of annotation variables which become extra formal parameters. The second phase traverses the modules in top-down dependency order, removing all of these extra parameters by specialization. We illustrate our approach with an integrated programming analysis and transformation system featuring a context sensitive type based analysis, cloning with sharing of identical clones and a modular implementation allowing for the compilation of large programs. The system implements cheap eagerness and redundant eval elimination for a lazy functional language.
Place, publisher, year, edition, pages
Swedish Institute of Computer Science , 2008, 1. , 13 p.
SICS Technical Report, ISSN 1100-3154 ; 2008:07
Modular compilation, cheap eagerness, cloning, static analysis, type inference, functional programming, optimization, program transformation
Computer and Information Science
IdentifiersURN: urn:nbn:se:ri:diva-22491OAI: oai:DiVA.org:ri-22491DiVA: diva2:1042056