next up previous
Next: Exercise 3. Up: Quiz8 Previous: Exercise 1.

Exercise 2.

Consider the following three-address code fragment.
L0 a := 15
  b := 12
L1 d := a - b
  if d = 0 goto L5
L2 if d > 0 goto L4
L3 b := a - b
  b := - b
  goto L1
L4 a := a - b
  goto L1
L5 g := b
  1. Give the flow graph of this program.
  2. Identify the back edges and the loops.
  3. Is there any propagation of a copy statement that can be performed. Justify your answer briefly.
  4. Explain how the techniques developed in the course can help discover that two arithmetic operations of the above program can be eliminated (and replaced by a copy statement).
  5. After this transformation, is there any propagation of a copy statement that can be performed?

Answer 2  
% latex2html id marker 379
\fbox{
\begin{minipage}{13 cm}
I give here only indic...
...nd the elimination of {\tt b := t} in $B_3$.
\end{enumerate}\par
\end{minipage}}


next up previous
Next: Exercise 3. Up: Quiz8 Previous: Exercise 1.
Marc Moreno Maza
2004-12-02