Consider the assignment, a := b*-c + b*-c
.
Fig. 1 Quadruples for the above statement
Below is an excerpt from the red dragon book.
Indirect triples can save some space compared with quadruples if the same temporary value is used more than once. The reason is that two or more entries in the statement array can point to the same line of the
op-arg1-arg2
structure. For example, lines(14)
and(16)
of figure below could be combined and we could then combine(15)
and(17)
.Fig. 2 Indirect triple representation of three address statement
My question is what the excerpt says about saving space with indirect triples, we could as well say the same for the quadruples as follows:
We could write the three address code for the statement as the one on the right, instead as the one on left in the above picture... then we shall get the quadruple below:
which is exactly the thing stated in the excerpt about the advantage of indirect triples over quadruples.
So what conclusions can we arrive at?