Module 15: Reaching Definition
  Lecture 30: Analysis
 


Example

  • U is the universal set of all expressions appearing in a program
  • In[B] and out[B] are sets of expressions available at the beginning/end of B
  • E-gen[B] and e-kill[B] are sets of expressions generated and killed in B
  • Out[B] = in[B] - e-kill[B] e-gen[B]
    In[B] = out[P] for B not initial
    In[B] = where B0 is the initial block
  • Initialization:
    In[B0] =
    Out[B0] = e-gen[B0]
    Out[B] = U - e-kill[B] if B is not an entry block

Live Variable Analysis

  • Used for dead code elimination
  • In[B] and out[B] are sets of live variables at entry and exit
  • Def[B] set of variables assigned value in B prior to use in B
  • Use[B] set of variables whose value may be used before definition in B
  • In[B] = use[B] S (out[B] - def[B])
    Out[B] = S in[S] where S is successor of B
  • A variable is live coming into a block if EITHER is it used in the block before re-definition OR it is live coming out and not re-defined
  • A variable is live coming out of a block if it is live coming into one of its successors
  • Initialization:
    in[B]= for all B