CSCE 434 Lecture 40

From Notes
Jump to navigation Jump to search

« previous | Monday, December 2, 2013 | next »

End Exam 2 content


Data Flow Framework

  1. Semilattice L, that includes a domain of values V and a meet (confluence) operator
  2. Family of functions F={ff:VV} closed under composition
  3. Direction (forward or backward)

Partial ordering such that uvuv=u for u,vL.


Semilattice

Pair L,, where

  • L is a nonempty set of values V
  • is a binary meet operator on L such that for all x,y,zL,
    • xx=x (idempotent)
    • xy=yx (commutative)
    • x(yz)=(xy)z (associative)


Top element , such that for all xV, x=x.

Optionally a bottom element , such that for all xV, x=.

Example: Reaching Definitions

L={xx=values at top of nodes in a flow graph}=2D, where D is the set of all defs in the program.

F={f(x)A(XB)}, where A and B are sets of defs in L representing GEN and KILL sets, respectively.

Meet operator is union ().


Example: Available Expressions

|L|=2D, where D is the set of all expressions computed by program.

F={f(x)A(XB)}, where A and B are sets of defs in L representing GEN and KILL sets, respectively.

Meet operator is intersection ().

Example: Constant Propagation

L={ψ:vars{nonconstant,undefined}}

Variables in a program can be one of undefined, nonconstant, or constant.

Transfer functions are quite complicated, but here's the gist:

const val d nonconst unknown
const val c c == d ? c : nonconst nonconst c
nonconst nonconst nonconst nonconst
unknown d nonconst unknown


Monotonicity and Distributivity

A framework L,F, is monotone if and only if

  • uv implies f(u)f(v) for all u,vL and all fF, or equivalently
  • f(uv)f(u)f(v) for all u,vL and all fF.


L,F, is distributive if and only if

f(uv)=f(u)f(v) for all u,vL and fF

Distributivity implies monotonicity.