GATE Computer ScienceEasyGATE CS (PYQ pattern)

A basic block compiles to six three-address statements: t1 = a + b; t2 = c * d; t3 = a + b; t4 = t1 * t2; t5 = t3 − t4; x = t5. Value numbering shows t1 and t3 are identical. Using indirect triples (each unique triple stored once, a triple takes 3 words, and each statement owns one pointer word in the statement list), how many words are needed in total?

  1. A. 24
  2. B. 18
  3. C. 21
  4. D. 20

Correct answer: C. 21

Unique triples: (+ a b), (* c d), (* (0) (1)), (− (0) (2)), (= x (3)): 5 triples = 15 words, plus 6 pointers = 21. Quadruples would use 6 × 4 = 24.

More Compiler Design questions

Exams that ask this topic