Module 14: Approaches to Control Flow Analysis
  Lecture 28: Structural Analysis
 


Reaching Definition Analysis

A definition d reaches end of a block iff either

  • It is generated in the block
  • It reaches block and not killed

Kill & gen known for each block. A program with N blocks has 2N equations with 2N unknowns and therefore, solution is possible.

  • Use iterative forward bit vector approach
for each block B do
in(B) = ;
out(B) = gen(B)
endfor;
change = true;
while change do
change = false;
for each block B do
newin = S out(P)
if newin 6= in(B) then {
change = true;
in(B) = newin;
out(B) = in(B) - kill(B) S gen(B);
}
endfor
endwhile