Code Generation for Expressions with Common Subexpressions

  • Authors:
  • A. V. Aho;S. C. Johnson;J. D. Ullman

  • Affiliations:
  • Bell Laboratories, Murray Hill, NJ;Bell Laboratories, Murray Hill, NJ;Dept. of EECS, Princeton University, Princeton, NJ

  • Venue:
  • Journal of the ACM (JACM)
  • Year:
  • 1977

Quantified Score

Hi-index 0.02

Visualization

Abstract

This paper shows the problem of generating optimal code for expressions containing common subexpressions is computationally difficult, even for simple expressions and simple machines. Some heuristics for code generation are given and their worst-case behavior is analyzed. For one register machines, an optimal code generation algorithm is given whose time complexity is linear in the size of an expression and exponential only in the amount of sharing.