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={f∣f:V→V} closed under composition
  3. Direction (forward or backward)

Partial ordering ≤ such that u≤v⟺u∧v=u for u,v∈L.


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,z∈L,
    • x∧x=x (idempotent)
    • x∧y=y∧x (commutative)
    • x∧(y∧z)=(x∧y)∧z (associative)


Top element ⊤, such that for all x∈V, ⊤∧x=x.

Optionally a bottom element ⊥, such that for all x∈V, ⊥∧x=⊥.

Example: Reaching Definitions

L={x∣x=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∪(X∖B)}, 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∪(X∖B)}, 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

  • u≤v implies f(u)≤f(v) for all u,v∈L and all f∈F, or equivalently
  • f(u∧v)≤f(u)∧f(v) for all u,v∈L and all f∈F.


⟨L,F,∧⟩ is distributive if and only if

f(u∧v)=f(u)∧f(v) for all u,v∈L and f∈F

Distributivity implies monotonicity.