The Generation of Optimal Code for Arithmetic Expressions
- 1 October 1970
- journal article
- Published by Association for Computing Machinery (ACM) in Journal of the ACM
- Vol. 17 (4), 715-728
- https://doi.org/10.1145/321607.321620
Abstract
The problem of evaluating arithmetic expressions on a machine with N ≥ 1 general purpose registers is considered. It is initially assumed that no algebraic laws apply to the operators and operands in the expression. An algorithm for evaluation of expressions under this assumption is proposed, and it is shown to take the shortest possible number of instructions. It is then assumed that certain operators are commutative or both commutative and associative. In this case a procedure is given for finding an expression equivalent to a given one and having the shortest possible evaluation sequence. It is then shown that the algorithms presented here also minimize the number of storage references in the evaluation.Keywords
This publication has 4 references indexed in Scilit:
- On arithmetic expressions and treesCommunications of the ACM, 1969
- On compiling algorithms for arithmetic expressionsCommunications of the ACM, 1967
- A note on some compiling algorithmsCommunications of the ACM, 1964
- An algorithm for coding efficient arithmetic operationsCommunications of the ACM, 1961