Next: Exercise 2.
Up: Quiz8
Previous: Guidelines.
Consider the following three-address code fragment.
L0 |
a := 15 |
|
b := 12 |
L1 |
if b = 0 goto L6 |
L2 |
q := 0 |
|
r := a |
L3 |
if r < b goto L5 |
L4 |
r := r - b |
|
q := q + 1 |
|
goto L3 |
L5 |
a := b |
|
b := r |
|
goto L1 |
L6 |
g := a |
- Give the flow graph of this program.
- Identify the back edges and the loops.
- Is there any propagation of a copy statement that can be
performed. Justify your answer briefly.
- Explain how the techniques developed in the course
can help discover that two lines of the above program
can be eliminated.
Answer 1
Figure 1:
The control flow graph.
|
Next: Exercise 2.
Up: Quiz8
Previous: Guidelines.
Marc Moreno Maza
2004-12-02