Project ForgeSign up free
Compiler Design
Code Generation & Optimization
GATE 2015
Hard

The least number of temporary variables required to create a three-address code in static single assignment (SSA) form for the expression q + r/3 + s − t*5 + u*v/w is ____.

8

Explanation

Breaking the expression into elementary binary/unary operations, each needing its own fresh SSA temporary: t1=r/3, t2=q+t1, t3=t*5, t4=t2+s, t5=t4-t3, t6=u*v, t7=t6/w, t8=t5+t7 — exactly 8 temporaries for this 8-operation expression tree.

Source: GATE CS 2015 (Session 1 / 7th Feb Shift 1) (2015)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free