Gate2017 cs Q24

0. Consider the following intermediate program in three address code
p = a - b
q = p * c
p = u * v
q = p + q
Which one of the following corresponds to a static single assignment form of the above code?

  • Option : B
  • Explanation :
    According to Static Single Assignment
    --> A variable cannot be used more than once in the LHS
    --> A variable should be initialized atmost once.
    Now looking at the given options
    1. a – code violates condition 1 as p1 is initialized again in this statement: p1 = u * v
    2. c- code is not valid as q1 = p2 * c , q2 = p4 + q3 – In these statements p2, p4, q3 are not initialized anywhere
    3. d- code is invalid as q2 = p + q is incorrect without moving it to register
    Therefore, option B is only correct option.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *