10 likes | 117 Views
FOR Each Block B, DO ENDFOR. B. 1. 2. 3. 4. B. In ( ) = Φ Out ( ) = Gen ( ). 2. 3. B. 4. B. B. 2. 4. 3. B. 1. 1. Block 1. Def 1: A ≥ 1 Def 2: B ≥ 1. WHILE There are changes DO ENDWHILE. FOR Each Block B DO ENDFOR.
E N D
FOR Each Block B, DO ENDFOR B 1 2 3 4 B In ( ) = Φ Out ( ) = Gen ( ) 2 3 B 4 B B 2 4 3 B 1 1 Block 1 Def 1: A ≥ 1 Def 2: B ≥ 1 WHILE There are changes DO ENDWHILE FOR Each Block B DO ENDFOR In ( ) = Out ( ) B 2 4 2, 3 1, 4 1 P 3 4 1 P Block 2 Block 3 P Pred ( ) B 1 2 3 4 Def 3: A := 1 Def 4: B := 1 {Def 2, Def 3} {Def 1, Def 4, Def 5} = {Def 1, Def 2, Def 3, Def 4, Def 5} {Def 1, Def 2} {Def 5} = {Def 1, Def 2, Def 5} Out(1) = {Def 1, Def 2} Out(4) = {Def 5} Out(1) = {Def 1, Def 2} Out(4) = {Def 2, Def 4, Def 5} Out(2) = {Def 2, Def 3} Out(3) = {Def 1, Def 4, Def 5} Out(1) Out(4) = {Def 1, Def 2, Def 4, Def 5} In(2) = {Def 1, Def 2} In (1) = {Def 2, Def 4, Def 5} Out (4) = {Def 2, Def 4, Def 5} Out(4) = {Def 5} In (1) = {Def 5} Out (1) = {Def 1, Def 2} Out ( ) = (In( ) – Kill ( )) Gen ( ) B 4 B 3 1 2 4 3 1 B 2 3 4 1 2 Block 4 1 4 2 3 B Def 5: A ≥ 1 { } Gen (1) = { } {Def 1, Def 2} = {Def 1, Def 2} In (1) = {Def 2, Def 4, Def 5} Kill (1) = {Def 3, Def 4, Def 5} In(3) = {Def 1, Def 2, Def 5} Kill(3) = {Def 2} In(1) – Kill (1) = {Def 1, Def 4, Def 5} In(4) – Kill(4) = {Def 2, Def 4, Def 5} In(4) = {ALL} Kill(4) = {Def 1, Def 3} {Def 1, Def 4, Def 5} Gen(3) = {Def 1, Def 4, Def 5} {Def 4} {Def 1, Def 5} Gen(3) = {Def 1, Def 5} {Def 4} = {Def 1, Def 4, Def 5} {Def 1, Def 4, Def 5} Gen(4) = {Def 1, Def 4, Def 5} {Def 2} Gen (1) = Def {2} {Def 1, Def 2} = {Def 1, Def 2} In(3) = {Def 1, Def 2, Def 4, Def 5} Kill (3) = {Def 2} {Def 2} Gen (2) = {Def 2} {Def 3} = {Def 2, Def 3} In(2) = {Def 1, Def 2} Kill (2) = {Def 1, Def 5} In(1) = {Def 5} Kill(1) = {Def 3, Def 4, Def 5} In(1) – Kill(1) = {Def 2} No Change. Stop Changes? Go through again In(2) – Kill(2) = {Def 1, Def 3} In (1) – Kill (1) = { } Out(3) = {Def 1, Def 4, Def 5} Out (4) = {Def 2, Def 4, Def 5} In(2) – Kill (2) = {Def 2} For Loop While Loop Iteration 1 While Loop Iteration 2 While Loop Iteration 3 In = {Def 5} Out = {Def 1, Def 2} In = Φ Out = {Def 1, Def 2} In = {Def 2, Def 4, Def 5} Out = {Def 1, Def 2} In = {Def 2, Def 4, Def 5} Out = {Def 1, Def 2} 1 In = Φ Out = {Def 3} 2 In = {Def 1, Def 2} Out = {Def 2, Def 3} In = {Def 1, Def 2} Out = {Def 2, Def 3} In = {Def 1, Def 2} Out = {Def 2, Def 3} 3 In = Φ Out = {Def 4} In = {Def 1, Def 2, Def 3} Out = {Def 1, Def 4, Def 5} In = {Def 1, Def 2, Def 4, Def 5} Out = {Def 1, Def 4, Def 5} In = {Def 1, Def 2, Def 4, Def 5} Out = {Def 1, Def 4, Def 5} 4 In = Φ Out = {Def 5} In = {All} Out = {Def 2, Def 4, Def 5} In = {All} Out = {Def 2, Def 4 , Def 5} In = {All} Out = {Def 2, Def 4 , Def 5}