Consider the expression $(a-1)*\left(\dfrac{(b+c)}{3}+d\right)$.
Let $x$ be the minimum number of registers required by an optimal code generation (without any register spill) algorithm for a load/store architecture in which
(i) Only load and store instructions can have memory operands and
(ii) Arithmetic instructions can have only register or immediate operands.
The value of $x$ is _______.
🎥 Video solution / Text Solution of this question is given below:
The expression requires evaluation of $(b+c)$, then division by $3$, then addition with $d$, and finally multiplication with $(a-1)$.
Minimum registers needed to hold intermediate results without spill = 3.