Next: Exercise 10.
Up: Final13042004
Previous: Exercise 8.
Consider the following threeaddress 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 controlflow graph for this program.
 Identify the loops of this controlflow graph.
 Indicate the set of live variables at the exit of each basic block.
You can give these dataflow sets without any justification.
Note that no optimizations is required in this exercise.
Answer 9
Next: Exercise 10.
Up: Final13042004
Previous: Exercise 8.
Marc Moreno Maza
20041202