|
Reaching Definition
- Definition: Assignment of a value to a variable
- A definition d of a variable reaches a point p if there is a path from d to p and value of a variable is same as assigned at d
- Use iterative forward bit vector problem
- A bit vector of a 8 bit can be used to represent all the definition
- Initial condition
in(entry) = = 00000000
in(i) = = 00000000 for all nodes i
- If an instruction re-defines a variable then it is killed
Gen: Definitions generated in a basic block and not subsequently killed in it
gen(B1) = 1, 2, 3 = 11100000
gen(B3) = 4 = 00010000
gen(B6) = 5, 6, 7, 8 = 00001111
gen(i) = = 00000000 for i 6= B1, B3, B6
Out: Definitions which reach at the end of a basic block
out(i) = = 00000000 for all i
A definition reaches end of a basic block iff either
- It is generated in the basic block OR
- It reaches in and is preserved
|