Higher-Order and Symbolic Computation, 15(2/3)161-180
Optimizing Nested Loops Using Local CPS Conversion
John Reppy, Bell Labs, Lucent Technologies, 600 Mountain Avenue,
Murray Hill, NJ 07901, USA
Abstract: Local CPS 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
Local CPS 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 Local CPS conversion.
Keywords: continuation-passing style, CPS, compiling functional
languages, direct-style representation
|
This article can be downloaded [here].
|
|