Function unfolding is a well-known program transformation technique: it is often used to reduce execution overheads incurred by an implementation’s function-calling mechanism and to localise information available in global definitions (localization simplifies further optimizations such as constant propagation and the static evaluation of expressions). Unfolding function definitions that exhibit either self- or mutual-recursion presents a problem for automated transformation systems: sophisticated control mechanisms may need to be incorporated into the unfolding process to ensure termination. Consequently, many automated transformation systems do not attempt to unfold recursive function definitions. Many of the optimizations that follow from unfolding non-recursive functions can still be performed using techniques such as function cloning and specialization but, because of the separation of function definitions and function uses, these techniques are more complex for an automated system to perform than are the corresponding techniques used for non-recursive functions. In this paper, the use of the paradoxical combinator, Y, to unfold all function definitions, including recursive definitions, is discussed. Full unfolding with the Y combinator is simple for an automated system to perform(requiringonly an exhaustive application of a straightforwardsubstitution process). In particular, terminationisassured withoutnecessitating aseparatecontrolmechanism. Afterunfoldinghas been performed, many optimizations can be applied in the same manner as they are applied to unfolded, non-recursive definitions.
[1]
James M. Boyle,et al.
Automatic, Self-adaptive Control and Unfold Transformations
,
1994,
PROCOMET.
[2]
Ken Kennedy,et al.
A Methodology for Procedure Cloning
,
1993,
Computer languages.
[3]
John Darlington,et al.
A Transformation System for Developing Recursive Programs
,
1977,
J. ACM.
[4]
BJORN LISPER,et al.
Total unfolding: theory and applications
,
1994,
Journal of Functional Programming.
[5]
James M. Boyle,et al.
A practical functional program for the CRAY X-MP
,
1992,
Journal of Functional Programming.
[6]
J. Vuillemin.
Proof techniques for recursive programs
,
1973
.
[7]
C. R. Ramakrishnan,et al.
On the conversion of indirect to direct recursion
,
1993,
LOPL.
[8]
Peter Kilpatrick,et al.
A Family of Data-Parallel Derivations
,
1994,
HPCN.