Quiz time
Now that you have completed reading this chapter, try answering the following questions to test your knowledge:
- Given the following Machine IR snippet and assuming the
dsub_x
sub-register indices describe sub-registers that don’t overlap, is this IR in SSA form?undef %4.dsub_0:dquad = COPY %0 %4.dsub_1:dquad = COPY %1 %4.dsub_2:dquad = COPY %2 %4.dsub_3:dquad = COPY %3
The answer is no – this Machine IR isn’t in SSA form.
This was a bit of a trick question because you must think about the virtual register (in this case, %4
) as a whole. Irrespective of how the sub-registers are mapped, the reality is that %4
appears more than once on the left-hand side of the assignment operator, which by definition is against the SSA form.
One way to represent something similar in SSA form is shown here:
%sub0:... = COPY %0
%sub1:... = COPY %1
...
%4:dquad = REG_SEQUENCE %sub0, %subreg.dsub_0,
...