1 votes 1 votes Consider the following code segment: c=b+a e=c-a f=c*e h=c+a i=h+f The minimum number of $\color{blue} {total}$ and $\color{blue} {temporary }$ variable required to convert the above code segment to static single assignment form are ________ Compiler Design compiler-design static-single-assignment + – Anjan asked Jan 9, 2018 Anjan 1.9k views answer comment Share Follow See all 20 Comments See all 20 20 Comments reply Show 17 previous comments scholaraniket commented Sep 15, 2019 reply Follow Share yeah, you are right the code is itself in SSA form, as there are no variable with multiple assignment. 0 votes 0 votes Sneha negi commented Jan 24, 2021 reply Follow Share although given code is already in SSA but still the results are stored in temprory variable hence 4 or 5 temprory variable must be required.. according to me unless given we should not apply optimization while converting to SSA because its an intermediate representation which is done before optimization so 5 variable are required 0 votes 0 votes suryansh rajput commented Dec 23, 2022 reply Follow Share draw dag and count nodes =7but two things are cosidered through dag in ssa form1. dead code elimination if some node is used to make final node => don't count it as shown in figure 22. if more expressions to evaluate at child level as shown in figure 3 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes p3 = p1 + p2 p4 = p3 - p2 p5 = p3 * p4 p6 = p3 + p2 p7 = p6 + p5 Therefore, total 7 temporary variables are needed. targate2018 answered Jan 16, 2018 targate2018 comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes I guess answer would be 0, because the above code is already in Static single assignment form. Refer to this links. https://www.cs.cmu.edu/~fp/courses/15411-f08/lectures/09-ssa.pdf https://www.geeksforgeeks.org/gate-gate-cs-2016-set-1-question-29/ scholaraniket answered Sep 15, 2019 scholaraniket comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes 4 should be ans Anup dogrial answered Jan 16, 2020 Anup dogrial comment Share Follow See 1 comment See all 1 1 comment reply Antaroop commented Jan 20, 2020 reply Follow Share Why are people saying that answer is 0 in the above comments ? I am getting answer as 4. In the below mentioned GATE 2016 question, the answer is 10 including the temporary variables. My doubt is if the number of temporary variables had to be considered as 0 then the answer should have been 5 right and not 10 considering the fact that we have to convert this code segment in to SSA form. Consider the following code segment. x = u - t; y = x * v; x = y + w; y = t - z; y = x * y; The minimum number of total variables required to convert the above code segment to static single assignment form is ? Somebody please provide a clear understanding on this. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Answer should be 7. 5 For LHS of assignment statements and, 2 for (a,b) as they are not generated and directly been used. ronak.ladhar answered Dec 31, 2020 ronak.ladhar comment Share Follow See all 0 reply Please log in or register to add a comment.