GATE Computer ScienceVery hardGATE CS (PYQ pattern)
For the nested-loop code 1: s = 0; 2: i = 0; 3: L1: if i >= n goto L5; 4: j = 0; 5: L2: if j >= i goto L4; 6: s = s + j; 7: j = j + 1; 8: goto L2; 9: L4: i = i + 1; 10: goto L1; 11: L5: return s, how many φ-functions does minimal SSA form (no pruning) need?
- A. 5
- B. 4
- C. 6
- D. 7
Correct answer: A. 5
Each loop header and each loop exit join collects the variables redefined inside the loop: s at statements 3,5, i at statements 3, j at statements 3,5; 5 in all.
More Compiler Design questions
- For the grammar E → T E'; E' → + T E' | ε; T → F T'; T' → F T' | ε; F → ( E ) | id, what is FOLLOW(T)?
- Which of the following about iterative data-flow analyses is/are true? I. Live-variable analysis is a backward problem whose meet operator…
- For the code 1: x = 0; 2: y = 1; 3: L1: if x > n goto L4; 4: if y > m goto L2; 5: y = y + x; 6: goto L3; 7: L2: x = x + 2; 8: L3: x = x +…
- For the grammar S → A B; A → a | ε; B → A b | c, what is FOLLOW(A)?
- Expressions are compared textually and an assignment to an operand kills the expressions that use it. Which expressions are available on…
- A scanner (longest match, ties to the earlier rule) has rules: COMMENT = //[^newline]; STR = "[^"]"; DIV = /; EQ = ==; ASSIGN = =; ID =…