LISP and Symbolic Computation, 7(4)337-343

Loop Headers in Lambda-Calculus or CPS

Andrew W. Appel, Department of Computer Science, Princeton University, Princeton, NJ 08544-2087

Abstract: The introduction of a "loop header" block facilitates the hoisting of loop-invariant code from a loop. In a lambda-calculus intermediate representation, which has a notion of scope, this transformation is particularly useful. Loop headers with scope also solve a problem with in-line expansion of recursive functions or loops: if done naively, only the first iteration is inlined. A loop header can encapsulate the loop or recursion for better in-line expansion. This optimization improves performance by about 5% in Standard ML of New Jersey.

Keywords: compiler, optimization, loop header, continuation-passing style, lambda-calculus, in-line expansion

[local copy]
[picture of journal cover]

May 2003 - hosc@brics.dk