skip to main content
article
Free Access

Code Generation for Expressions with Common Subexpressions

Published:01 January 1977Publication History
Skip Abstract Section

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.

References

  1. 1 AHO, A V, HOPCRO~, J E, AND ULLMAN, J D The Design and Analysts of Computer Algorithms Addison Wesley, Reading, Mass, 1974 Google ScholarGoogle Scholar
  2. 2 AHO, A V, AND JOHNSON, S C Optimal code generation for expression trees J ACM 23, 3 (July 1976), 488-501 Google ScholarGoogle Scholar
  3. 3 AHO, A V, AND ULLMAN, J D The Theory of Parsmg, Translation and Compthng, Vol H: Compthng Prentice-Hall, Englewood Chffs, N.J, 1973 Google ScholarGoogle Scholar
  4. 4 BEA'r'rY, j C A register assignment algorithm for generation of highly optimized object code. IBM J Res Develop. 18, 1 (Jan 1974), 20-39Google ScholarGoogle Scholar
  5. 5 BELADY, L A A study of replacement algorithms for virtual storage computers. IBM Syst. J 5, 2 (1966), 78-101Google ScholarGoogle Scholar
  6. 6 BR~UER, M A Generation of optimal code for expressions via factorlzation Comm. ACM 12, 6 (June 1969), 333-340 Google ScholarGoogle Scholar
  7. 7 BRUI~O, J L, AND LASSAGNE, T The generation of optimal code for stack machines J. ACM 22, 3 (July 1975), 382-397 Google ScholarGoogle Scholar
  8. 8 BRUNO, J L, AND SETHt, R Code generation for a one-register machine J ACM 23, 3 (July 1976), 502-510 Google ScholarGoogle Scholar
  9. 9 CHEN, S On the Setht-Ullman algorithm int Z Comp. Math, A, 5 (1975), 37-55Google ScholarGoogle Scholar
  10. 10 COCKE, J AND SCHWARTZ J T Programming Languages and their. Compilers. Courant Institute, New York U, New York, second ed, 1970 Google ScholarGoogle Scholar
  11. 11 DEMERS, A Private commumcatlonGoogle ScholarGoogle Scholar
  12. 12 FA'rEMAr~, R J Optimal code for serial and parallel computation Comm ACM 12, 12 (Dec. 1969), 694-695 Google ScholarGoogle Scholar
  13. 13 FREJBUrtGHOUSE, R A RogJster allocation wa usage counts Comm. ACM 17, 11 (Nov 1974), 638-642 Google ScholarGoogle Scholar
  14. 14 I-I'OROW~TZ, L P., KARP, R.M, MILLER, R.E., ANO WINOGRAD, S Index register allocation. J. ACM 13, 1 (Jan 1966), 43-61 Google ScholarGoogle Scholar
  15. 15 SETm, R Complete register allocation problems SIAM J Computmg 4, 3 (Sept 1975), 226-248Google ScholarGoogle Scholar
  16. 16 SETHI, R Private commumcatlonGoogle ScholarGoogle Scholar
  17. 17 SETHt, R, AND ULLMAN, J D The generation of optimal code for arithmetic expressions J A CM 17, 4 (Oct 1970), 715-728 Google ScholarGoogle Scholar
  18. 18 WAITE, W M. Optimization In Compder Construcnon: An Advanced Course, F L Bauer and J. Elckel, Eds. Sprmger-Verlag, New York, 1974, pp 549-602 Google ScholarGoogle Scholar
  19. 19 WASILEW, S G A compiler writing system with opt~mtzation capabthttes for complex order structures Ph D Th, Northwestern U, Evanston, ii1, 1971 Google ScholarGoogle Scholar
  20. 20 WULF, W A, JOHNSSON, R.K, WEINSTOCK, C B, Hoaas, S O, AND GESCHKE, C M The Design of an Optimizing Compder American Elsevier, New York, 1975 Google ScholarGoogle Scholar

Index Terms

  1. Code Generation for Expressions with Common Subexpressions

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image Journal of the ACM
      Journal of the ACM  Volume 24, Issue 1
      Jan. 1977
      175 pages
      ISSN:0004-5411
      EISSN:1557-735X
      DOI:10.1145/321992
      Issue’s Table of Contents

      Copyright © 1977 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 January 1977
      Published in jacm Volume 24, Issue 1

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader