### Abstract

The evaluation of arithmetic expressions on both register-oriented and stack-oriented machines can be studied using the same model because registers can be treated as a stack during the evaluation of expression trees, without loss in code efficiency. The machine model in this paper has a hardware stack in which all computations take place. Register-register and register-memory instructions are modeled by considering four possible instructions for each binary operator, depending on whether one or two operands are taken from the stack and on whether the left or the right operand is on top of the stack. There is a cost associated with each operation code, as well as costs for accessing a value in a register or in memory. The minimum cost of computing an expression tree is used to compare machines. As part of the framework that allows the comparisons to be performed, a parameterized algorithm for determining the number of stores that must occur in an optimal computation is developed. This algorithm forms the basis of an optimal code generation algorithm.

Original language | English (US) |
---|---|

Pages (from-to) | 457-478 |

Number of pages | 22 |

Journal | Journal of the ACM |

Volume | 30 |

Issue number | 3 |

DOIs | |

State | Published - Jul 1983 |

Externally published | Yes |

### Fingerprint

### ASJC Scopus subject areas

- Computational Theory and Mathematics
- Computer Graphics and Computer-Aided Design
- Hardware and Architecture
- Information Systems
- Software
- Theoretical Computer Science

### Cite this

*Journal of the ACM*,

*30*(3), 457-478. https://doi.org/10.1145/2402.322388

**INSTRUCTION SETS FOR EVALUATING ARITHMETIC EXPRESSIONS.** / Coffman, E. G.; Sethi, Ravi.

Research output: Contribution to journal › Article

*Journal of the ACM*, vol. 30, no. 3, pp. 457-478. https://doi.org/10.1145/2402.322388

}

TY - JOUR

T1 - INSTRUCTION SETS FOR EVALUATING ARITHMETIC EXPRESSIONS.

AU - Coffman, E. G.

AU - Sethi, Ravi

PY - 1983/7

Y1 - 1983/7

N2 - The evaluation of arithmetic expressions on both register-oriented and stack-oriented machines can be studied using the same model because registers can be treated as a stack during the evaluation of expression trees, without loss in code efficiency. The machine model in this paper has a hardware stack in which all computations take place. Register-register and register-memory instructions are modeled by considering four possible instructions for each binary operator, depending on whether one or two operands are taken from the stack and on whether the left or the right operand is on top of the stack. There is a cost associated with each operation code, as well as costs for accessing a value in a register or in memory. The minimum cost of computing an expression tree is used to compare machines. As part of the framework that allows the comparisons to be performed, a parameterized algorithm for determining the number of stores that must occur in an optimal computation is developed. This algorithm forms the basis of an optimal code generation algorithm.

AB - The evaluation of arithmetic expressions on both register-oriented and stack-oriented machines can be studied using the same model because registers can be treated as a stack during the evaluation of expression trees, without loss in code efficiency. The machine model in this paper has a hardware stack in which all computations take place. Register-register and register-memory instructions are modeled by considering four possible instructions for each binary operator, depending on whether one or two operands are taken from the stack and on whether the left or the right operand is on top of the stack. There is a cost associated with each operation code, as well as costs for accessing a value in a register or in memory. The minimum cost of computing an expression tree is used to compare machines. As part of the framework that allows the comparisons to be performed, a parameterized algorithm for determining the number of stores that must occur in an optimal computation is developed. This algorithm forms the basis of an optimal code generation algorithm.

UR - http://www.scopus.com/inward/record.url?scp=0020781832&partnerID=8YFLogxK

UR - http://www.scopus.com/inward/citedby.url?scp=0020781832&partnerID=8YFLogxK

U2 - 10.1145/2402.322388

DO - 10.1145/2402.322388

M3 - Article

AN - SCOPUS:0020781832

VL - 30

SP - 457

EP - 478

JO - Journal of the ACM

JF - Journal of the ACM

SN - 0004-5411

IS - 3

ER -