Next: Exercise 10.
Up: Final-13-04-2004
Previous: Exercise 8.
Consider the following three-address code program
(where a quo 2 denotes the quotient in the Euclidean division of a by 2
and a mod b denotes the remainder in the Euclidean division of a by b)
L0: |
a := 10 |
|
if a = 2 goto L6 |
L1: |
b := 2 |
L2: |
d := a / 2 |
|
c := a mod b |
|
if c = 0 goto L5 |
L3: |
if b >= d goto L6 |
L4: |
b := b + 1 |
|
goto L2 |
L5: |
a := a + 1 |
|
goto L1 |
L6: |
p := a |
- Draw a control-flow graph for this program.
- Identify the loops of this control-flow graph.
- Indicate the set of live variables at the exit of each basic block.
You can give these data-flow sets without any justification.
Note that no optimizations is required in this exercise.
Answer 9
![\fbox{
\begin{minipage}{13 cm}
\mbox{ } \\
\mbox{ } \\
\mbox{ } \\
\mbox{ } \...
...\mbox{ } \\
\mbox{ } \\
\mbox{ } \\
\mbox{ } \\
\mbox{ } \\
\end{minipage}}](img73.png)
Next: Exercise 10.
Up: Final-13-04-2004
Previous: Exercise 8.
Marc Moreno Maza
2004-12-02