next up previous
Next: Exercise 2. Up: Quiz4 Previous: Guidelines.

Exercise 1.

Consider the following three-address code fragment.
  a := 1
  b := 2
L2 c := a + b
  d := c - a
  if d = b goto L5
L3 d := b * d
  if d = b goto L5
  d := a + b
  e := e + 1
  goto L3
L5 b := a + b
  e := c - a
  if d = b goto L2
  a := b + d
  b := a - d
  1. Give the flow graph of this program.
  2. Identify the back edges and the loops.
Note that the results of these computations do not matter. We are only interested here in the relations between the basic blocks.

Answer 1  
% latex2html id marker 540
\fbox{
\begin{minipage}{13 cm}
Figure~\ref{fig:Contro...
... is {\bf not} a loop since it has two entry points.
\end{itemize}\end{minipage}}

Figure 1: The control flow graph.
\begin{figure}\htmlimage
\centering\includegraphics[scale=.45]{ControlFlowGraph4.eps}
.
\end{figure}


next up previous
Next: Exercise 2. Up: Quiz4 Previous: Guidelines.
Marc Moreno Maza
2004-12-02