Optimizing nested loops using local CPS conversion

Abstract

Local CPS (LCPS) conversion is a compiler transformation for improving the code generated for nested loops by a direct-style compiler that uses recursive functions to represent loops. The transformation selectively applies CPS conversion at non-tail call sites, which allows the compiler to use a single machine procedure and stack frame for both the caller and callee. In this paper, we describe LCPS conversion, as well as a supporting analysis. We have implemented LCPS conversion in the Moby compiler and describe our implementation. In addition to improving the performance of loops, Local CPS conversion is also used to aid the optimization of non-local control flow by the Moby compiler. We present results from preliminary experiments with our compiler that show significant reductions in loop overhead as a result of LCPS conversion.

An earlier version of this paper was presented at the The Third ACM SIGPLAN Workshop on Continuations.


Last modified: April 6, 2004.
Comments to: John Reppy