Unfold/fold transformations and loop optimization of logic programs

  • Authors:
  • S. K. Debray

  • Affiliations:
  • Univ. of Arizona, Tucson, AZ

  • Venue:
  • PLDI '88 Proceedings of the ACM SIGPLAN 1988 conference on Programming Language design and Implementation
  • Year:
  • 1988

Quantified Score

Hi-index 0.00

Visualization

Abstract

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.