Programs typically spend much of their execution time in loops. This makes the generation of efficient code for loops essential for good performance. Loop optimization of logic programming languages is complicated by the fact that such languages lack the iterative constructs of traditional languages, and instead use recursion to express loops. In this paper, we examine the application of unfold/fold transformations to three kinds of loop optimization for logic programming languages: recursion removal, loop fusion and code motion out of loops. We describe simple unfold/fold transformation sequences for these optimizations that can be automated relatively easily. In the process, we show that the properties of unification and logical variables can sometimes be used to generalize, from traditional languages, the conditions under which these optimizations may be carried out. Our experience suggests that such source-level transformations may be used as an effective tool for the optimization of logic programs. © 1988, ACM. All rights reserved.
CITATION STYLE
Debray, S. K. (1988). Unfold/Fold Transformations and Loop Optimization of Logic Programs. ACM SIGPLAN Notices, 23(7), 297–307. https://doi.org/10.1145/960116.54020
Mendeley helps you to discover research relevant for your work.