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.
- 1 NAKATA, IKUO. On compiling algorithms for arithmetic expressions. Comm. ACM 10, 8 (Aug. 1967), 492-494. Google Scholar
- 2 MEYERS, W .J . Optimization of computer code. Unpublished memorandum, G. E. Research Center, Schenectady, N. Y., 1965 (12 pp.).Google Scholar
- 3 REDZIEJOWSKI, R .R . On arithmetic expressions and trees. Comm. ACM 12, 2 (Feb. 1969), 81-84. Google Scholar
- 4 FLOYD, R.W. An algorithm for coding efficient arithmetic operations. Comm. ACM , 1 (Jan. 1961), 42-51. Google Scholar
- 5 ANDERSON, J .P . A note on some compiling algorithms. Comm. ACM 7, 3 (March 1964), 149-150. Google Scholar
Index Terms
- The Generation of Optimal Code for Arithmetic Expressions
Recommendations
On the number of registers needed to evaluate arithmetic expressions
AbstractThe question of how many temporary storage registers are needed to evaluate compiled arithmetic and masking expressions is discussed. It is assumed that any combination of left-to-right, right-to-left, top-to-bottom, and bottom-to-top techniques ...
Equivalence checking of arithmetic expressions using fast evaluation
CASES '05: Proceedings of the 2005 international conference on Compilers, architectures and synthesis for embedded systemsArithmetic expressions are the fundamental building blocks of hardware and software systems. An important problem in computational theory is to decide if two arithmetic expressions are equivalent. However, the general problem of equivalence checking, in ...
Comments