Copy elimination in single assignment languages

Elimination of copies is important when implementing functional languages. Copies arise because these languages lack the concepts of state and variable; hence updating an object involves a copy in a naive implementation. Copies are also possible if proper targeting has not been carried out inside functions and across function calls. Using abstract interpretation, we develop a denotational model to eliminate copies that arise due to updates and copies that occur across function calls. This model uses the notion of address expressions, which describes the symbolic address of an expression in terms of its arguments. This approach is powerful enough to handle copies that exist in divide and conquer problems like quicksort and bitonic sort. Our work is in the context of a single assignment language called SAL. The implementation uses rewrite rules to compute address expressions and also does dependency analysis and temporary introduction. This enables the compilation of a single assignment language SAL to a performance comparable to Pascal on some small but tough benchmarks. An outline of the implementation is given along with the results of optimizing some difficult programs with large numbers of updates. The overall optimization system validates the approach taken--high-level optimization to find a suitable mapping of names into locations followed by generation of intermediate and machine codes.