Faxén, Karl-Filip (2008) Modular cloning. [SICS Report]
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.
|Item Type:||SICS Report|
|Uncontrolled Keywords:||Modular compilation, cheap eagerness, cloning, static analysis, type inference, functional programming, optimization, program transformation|
|Deposited By:||Vicki Carleson|
|Deposited On:||24 Apr 2008|
|Last Modified:||18 Nov 2009 16:16|
Repository Staff Only: item control page