0 0 votes In it’s solution how are they obtaining x with the given operation? Should we not have 1 more register to keep x separate? Given program below uses 6 temporary variables \[ \begin{array}{l} \quad u, v, w, x, y, z \\ u=1 \\ v=10 \\ w=20 \\ x=u+v \\ y=w+x \\ z=w+y \\ v=w+y \\ y=v+z \\ z=5+y \\ \text { return } x+5 \end{array} \] Activate Windows Assume that all operation take their operands from registers, what is the minimum number of register needed to execute this program withoutspilling? ings to activate WindsSolution : (c) \[ \begin{array}{lll} R_{1} \leftarrow u & \cdots \cdots \cdots & (u=1) \\ R_{2} \leftarrow v & \cdots \cdots \cdots & (v=10) \\ R_{3} \leftarrow w & \cdots \cdots \cdots & (w=20) \\ R_{1} \leftarrow R_{1}+R_{2} & \cdots \cdots \cdots & (x=u+v) \\ R_{1} \leftarrow R_{3}+R_{1} & \cdots \cdots \cdots & (y=w+x) \\ R_{2} \leftarrow R_{3}+R_{1} & \cdots \cdots \cdots & (z=w+y) \\ R_{3} \leftarrow R_{3}+R_{1} & \cdots \cdots \cdots & (v=w+y) \\ R_{1} \leftarrow R_{2}+R_{3} & \cdots \cdots \cdots & (y=v+z) \\ R_{3} \leftarrow 5+R_{1} & \cdots \cdots \cdots & (x=5+y) \\ \text { return }\left(R_{2}+R_{3}\right) & \cdots \cdots \cdots & \text { return }(x+5) \end{array} \] Hence 3 register needed only. CO & Architecture made-easy-test-series test-series co-and-architecture + – Mrityudoot 370 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.