Very Busy Expression
- In[B] and Out[B] are sets of VBE at the beginning and end of B
- Use[B] set of expressions b+c computed in B with no prior definition of b or c
- Def[B] set of expression b+c for which either b or c is defined in block B prior to computation of b+c
- In[B] = out[B] - def[B]
use[B]
out[B] =
in[S] where S is successor of B
- An expression is VBE coming into a block if either it is used in B or it is live coming out and not defined in B
- An expression is VBE coming out of a block if it is live going into all the successors of B
- Initialization:
in[B] = U for all B
Common Sub-expression Elimination
For every statement s of the form x=y+z such that y+z is available at the beginning of the block and y and z are not re-defined
prior to s
- Find all definitions which have y+z that reach s’ block
- Create a new variable u
- Replace each w=y+z found in (1) by
u=y+z; w=u
- Replace statement s by x=u
|