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.
- 1 AHO, A V, HOPCRO~, J E, AND ULLMAN, J D The Design and Analysts of Computer Algorithms Addison Wesley, Reading, Mass, 1974 Google Scholar
- 2 AHO, A V, AND JOHNSON, S C Optimal code generation for expression trees J ACM 23, 3 (July 1976), 488-501 Google Scholar
- 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 Scholar
- 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 Scholar
- 5 BELADY, L A A study of replacement algorithms for virtual storage computers. IBM Syst. J 5, 2 (1966), 78-101Google Scholar
- 6 BR~UER, M A Generation of optimal code for expressions via factorlzation Comm. ACM 12, 6 (June 1969), 333-340 Google Scholar
- 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 Scholar
- 8 BRUNO, J L, AND SETHt, R Code generation for a one-register machine J ACM 23, 3 (July 1976), 502-510 Google Scholar
- 9 CHEN, S On the Setht-Ullman algorithm int Z Comp. Math, A, 5 (1975), 37-55Google Scholar
- 10 COCKE, J AND SCHWARTZ J T Programming Languages and their. Compilers. Courant Institute, New York U, New York, second ed, 1970 Google Scholar
- 11 DEMERS, A Private commumcatlonGoogle Scholar
- 12 FA'rEMAr~, R J Optimal code for serial and parallel computation Comm ACM 12, 12 (Dec. 1969), 694-695 Google Scholar
- 13 FREJBUrtGHOUSE, R A RogJster allocation wa usage counts Comm. ACM 17, 11 (Nov 1974), 638-642 Google Scholar
- 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 Scholar
- 15 SETm, R Complete register allocation problems SIAM J Computmg 4, 3 (Sept 1975), 226-248Google Scholar
- 16 SETHI, R Private commumcatlonGoogle Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
Index Terms
-
Code Generation for Expressions with Common Subexpressions
-
Recommendations
-
Code generation for expressions with common subexpressions (Extended Abstract)
POPL '76: Proceedings of the 3rd ACM SIGACT-SIGPLAN symposium on Principles on programming languagesEasy as the task may seem, many compilers generate rather inefficient code. Some of the difficulty of generating good code may arise from the lack of realistic models for programming language and machine semantics. In this paper we show that the ...
-
Factoring and eliminating common subexpressions in polynomial expressions
ICCAD '04: Proceedings of the 2004 IEEE/ACM International conference on Computer-aided designPolynomial expressions are used to compute a wide variety of mathematical functions commonly found in signal processing and graphics applications, which provide good opportunities for optimization. However existing compiler techniques for reducing code ...
-
Routine run-time code generation
Run-time code generation (RTCG) would be used routinely if application programmers had a facility with which they could easily create their own run-time code generators, because it would offer benefits both in terms of the efficiency of the code that ...
Comments