Next: Annexe 1.
Up: Final13042004
Previous: Exercise 9.
Consider the following threeaddress code program fragment
where t3 <> 0 is true if and only if t3 is not zero.
L0: 
s:=0 

i:=0 

n:=10 
L1: 
t1 := ab 

if t1 = 0 goto L3 
L2: 
t2 := i*4 

s := s+t2 

goto L4 
L3: 
s := s+i 
L4: 
i := i+1 

t3 := ni 

if t3 <> 0 goto L1 
L5: 
t4 := ab 
 Give the controlflow graph of this program.
 Identify the back edges and the loops.
 Which optimization (among copy propagation, deadcode elimination, common subexpression elimination, invariant code motion) can be applied to this program?
Show the intermediate transformations of the program.
Computing the dataflow sets is not required.
A brief justification of each transformation will be sufficient.
Answer 10
Next: Annexe 1.
Up: Final13042004
Previous: Exercise 9.
Marc Moreno Maza
20041202