Unfold/Fold Transformations and Loop Optimization of Logic Programs

Research output: Contribution to journalArticlepeer-review

4 Scopus citations


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.

Original languageEnglish (US)
Pages (from-to)297-307
Number of pages11
JournalSIGPLAN Notices (ACM Special Interest Group on Programming Languages)
Issue number7
StatePublished - Jul 1 1988

ASJC Scopus subject areas

  • Software
  • Computer Graphics and Computer-Aided Design


Dive into the research topics of 'Unfold/Fold Transformations and Loop Optimization of Logic Programs'. Together they form a unique fingerprint.

Cite this