The following program uses six different variables p, q, r, s, t and u. The code is:
p=6
q=7
t=p*q
s=t+p
u=8
u=s*p
s=p+u
r=r*q
t=t+p
return t
Assume that all operations take their operands from registers, the minimum number of registers needed to execute this program without spilling are _____________?
Given answer is 5, but my answer is 4.
I think that the step u=8 can be skipped since 'u' is being reinitialized in the next step.