Doubt 1 :
The answer is 3.
When it is asked to find min. no. of temporary variables then we get 3. But here “temporary” is not mentioned still we have to assume that temporary is implicit?
Doubt 2:
The answer given is 4. But my process is giving 2. What is wrong in this please check…
Given :
t1<-a
t2<-b
t3<-c
t4<-d
t5<-t1+t2 // a+b
t6<-t3+t5 // c+t5 = c+a+b
t7<-t6+t4 // t6+d =c+a+b+d
a<-t7
Why can’t i do like this - >
r1<-a
r2<-b
r1<-r1+r2 //a+b
r2<-c
r2<-r2+r1 // c+a+b
r1<-d
r1<-r1+r2 //d+c+a+b
Or is it that we can’t use the concept of code motion here? If yes then why?
Doubt 3:
Why will the if statement be in different basic block. According to the rules it shouldn't be in a separate block right?
Doubt 4:
Is this statement True or False. Please give reason to support.