View worked solution
Answer: 8
To find the least number of temporary variables required to represent the given expression in Static Single Assignment (SSA) form, we first analyze the expression and its operator precedence:
1. Operator Precedence and Associativity
- Multiplication (
*) and division (/) have higher precedence than addition (+) and subtraction (-), and they associate from left to right. - Addition (
+) and subtraction (-) associate from left to right.
Parenthesizing the expression according to these rules gives:
2. Three-Address Code in SSA Form
In SSA form, every variable (including temporaries) must be assigned exactly once. Since there are no common subexpressions to eliminate, each of the binary operations requires a unique temporary variable:
Thus, the minimum number of temporary variables required is 8.
Free practice · Your answers on this page are not saved.
