Subtopic 2 of 5
8.2Quadruples, triples, indirect triples
Quadruple (op, arg1, arg2, result): easy to move. Triple (op, arg1, arg2): results referred by position, so moving breaks references. Indirect triples: a separate list of pointers to triples allows reordering.
| # | op | arg1 | arg2 | result |
|---|---|---|---|---|
| 0 | uminus | c | t1 | |
| 1 | * | b | t1 | t2 |
| 2 | uminus | c | t3 | |
| 3 | * | b | t3 | t4 |
| 4 | + | t2 | t4 | t5 |
| 5 | = | t5 | a |
Quadruples name a result explicitly (temporary), so instructions can be moved freely: good for optimisation. (6 instructions, 5 temporaries)
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.