• Media type: E-Article
  • Title: The Compilation of Loop Induction Expressions
  • Contributor: Sites, Richard L.
  • imprint: Association for Computing Machinery (ACM), 1979
  • Published in: ACM Transactions on Programming Languages and Systems
  • Language: English
  • DOI: 10.1145/357062.357065
  • ISSN: 0164-0925; 1558-4593
  • Keywords: Software
  • Origination:
  • Footnote:
  • Description: <jats:p>In an optimizing compiler, it is often desirable to compile subscript expressions such as Abase-2 + I*2 so that the value of the expression is available in a register and is simply incremented whenever I is incremented, thus avoiding the multiplication inside the loop. This change is effected by a standard optimization called strength reduction. Program loops often contain several such expressions stemming perhaps from references to operands A(I), A(I+1), B(I), and C(K,J,I,L). Under what circumstances can we do better than keeping four addresses in four separate registers or temporaries? A general technique is presented which minimizes the number of registers needed to hold such values, while simultaneously minimizing the amount of computation inside the loop. In the above collection, it is possible to use as few as two registers for the four I-dependent values.</jats:p>