69 votes 69 votes 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 __________. Compiler Design gatecse-2016-set1 compiler-design static-single-assignment normal numerical-answers + – Sandeep Singh asked Feb 12, 2016 edited Feb 17, 2016 by makhdoom ghaya Sandeep Singh 27.3k views answer comment Share Follow See all 15 Comments See all 15 15 Comments reply Show 12 previous comments Manukumr commented Sep 23, 2023 reply Follow Share Can anyone give minimum variable for three address code 0 votes 0 votes Rajsukh Mohanty commented Dec 20, 2023 reply Follow Share this video can help in understanding SSA https://youtu.be/uqTT3gI7KU8 0 votes 0 votes Deepak Poonia commented Jan 20 reply Follow Share Detailed Video Solution: GATE CSE 2016 - Static Single Assignment Form SSA Question Static Single Assignment Form SSA Complete Lecture: https://www.youtube.com/watch?v=CQV8hSeMrx8 0 votes 0 votes Please log in or register to add a comment.
11 votes 11 votes t0 = u - t; t1 = to * v; t2 = t1 + w; t3 = t - z; t4 = t2 * t3; Total variables required will be 5(t, u, v, w, z) + 5(temp. variables) = 10 ravi_ssj4 answered Jun 29, 2016 edited Feb 10, 2017 by ravi_ssj4 ravi_ssj4 comment Share Follow See 1 comment See all 1 1 comment reply diksha46 commented Sep 28, 2017 reply Follow Share @arjun sir @ravi_ssj4 Why are you using t0 and t1 for x and y? They can atleast appear once on LHS. If we do it like this then temporary variables will be 3 only. Correct me if I'm wrong. x=u-t y=x*v t1=y+w t2=t-z t3=t1*t2 0 votes 0 votes Please log in or register to add a comment.
9 votes 9 votes ans. is 10 here every variable can be assigned with a value only once. t1 = t2 - t3 t4 = t1 * t5 t6 = t4 + t7 t8 = t2 - t9 t10 = t6 - t8 Vaibhav Singh answered Feb 14, 2016 Vaibhav Singh comment Share Follow See all 4 Comments See all 4 4 Comments reply shruti prashar commented Apr 7, 2016 reply Follow Share why are we using temporaries for variables u,v.w.x,y,z? https://gateoverflow.in/8365/gate2015-1_55 here in above we are not using temporaries for variables please clarify?? 0 votes 0 votes Arjun commented Apr 7, 2016 reply Follow Share The question here asks for total number of variables and not just temporary variables. 9 votes 9 votes shruti prashar commented Apr 7, 2016 reply Follow Share And in another ques they are asking just for temporary variables. got it thanku sir 1 votes 1 votes Tuhin Dutta commented Nov 16, 2017 reply Follow Share t8 = t2 - t9 This should be $t8 = t3 - t9; $ 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes I got 6. Plz comment Debasmita Bhoumik answered Feb 12, 2016 Debasmita Bhoumik comment Share Follow See all 3 Comments See all 3 3 Comments reply Vaibhav Singh commented Feb 12, 2016 reply Follow Share i got 10 3 votes 3 votes shaiklam09 commented Feb 13, 2016 reply Follow Share I got 6 too 0 votes 0 votes Devwritt commented Jan 28, 2017 reply Follow Share SSA- Static Single Assignment Converting ordinary code into SSA form is primarily a simple matter of replacing the target of each assignment with a new variable So from target u'll get 5 directly + 5 from right hand side which is use first time . Static means yo can't change value for that particular variable 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes well I might be totally wrong..but here's what I did .. the expression was (t-z)((u-t)*v+w) each var can be on left side only once u=u-t v=u*v w=v+w t=t-z ans=w*t so total 6 var. i didnt get the total variable definition.I assumed it was referring to some variable which was both on left and right side..which are u,v,w,t so I entered 4. Anirban Mitra answered Feb 15, 2016 Anirban Mitra comment Share Follow See all 0 reply Please log in or register to add a comment.