x := expIf p1 is the program point just before the assignment and p2 is the point just after the assignment it is clear that
AVAIL(p2) = ( AVAIL(p1) + { sub-expression of exp } - KILL(x))In the remaining cases, I will indicate where the program points I wish to talk about are by putting their names in angle brackets at the appropriate points. Thus, the assignment would become:
< p1 > x := exp < p2 >
< p0 > if exp then < p1 > stmt1 < p3 > else < p2 > stmt2 < p4 > end < p5 >
AVAIL( p5 ) = AVAIL( p3 ) &AVAIL( p4 )
AVAIL( p1 ) = AVAIL( p2 ) = AVAIL( p0 ) + { expressions appearing in exp }
< p0 > while < p1 > exp do < p2 > stmt < p3 > end < p4 >
AVAIL( p1 ) = ( AVAIL( p0 ) &AVAIL( p3 ))
AVAIL( p2 ) = AVAIL( p4 ) = AVAIL( p1 ) + { expressions appearing in exp }
| {} | x := y*z; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p0> m := z/n; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p1> while <p2> y*z > 0 do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p3> if z/n > l then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p4> z := y*z <p6> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p5> z := y*z - 1 <p7> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p8> m := z/n <p9> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end <p10> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AVAIL(p0) = {} + {y*z} - {}
AVAIL(p1) = AVAIL(p0) + {z/n} - {}
AVAIL(p2) = AVAIL(p1) &AVAIL(p9)
AVAIL(p3) = AVAIL(p10) = AVAIL(p2) + {y*z}
AVAIL(p4) = AVAIL(p5) = AVAIL(p3) + {z/n}
AVAIL(p6) = AVAIL(p4) + {y*z} - {y*z,z/n}
AVAIL(p7) = AVAIL(p5) + {y*z} - {y*z,z/n}
AVAIL(p8) = AVAIL(p6) &AVAIL(p7)
AVAIL(p9) = AVAIL(p8) + {z/n} - {}
(to keep things readable, I have merged variables
which clearly must have equal values)
p0 p1 p2 p3, p10 p4 ,p5 p6 ,p7 ,p8 p9
{} {} {} {} {} {} {}
{ y*z } { y*z, z/n } {} { y*z } { y*z } {} {z/n}
{ y*z } { y*z, z/n } {z/n} { y*z, z/n } { y*z, z/n } {} {z/n}
{ y*z } { y*z, z/n } {z/n} { y*z, z/n } { y*z, z/n } {} {z/n}