← 📝 Intermediate Code Generation
Subtopic 3 of 5

8.3DAG of a basic block

One node per distinct value; operators with the same operands reuse the node, exposing common subexpressions and dead code. Variables are labels attached to nodes.

  • a = b + c → new node n2 for b + c
  • b = a - d → new node n4 for a - d
  • c = b + c → new node n5 for b + c
  • d = a - d → reuse node n4 (common subexpression a - d)

4 statements → 3 operator nodes. A reused node is a common subexpression found (only while its operands are unchanged).

Previous year questions: Intermediate Code Generation (5)

PYQs are grouped by topic, so this is the full set for Intermediate Code Generation; try the ones that match this subtopic. Open all 5 on the topic page.