static2

# static2 - Lattice Theory Control Flow Graphs Dataflow...

This preview shows pages 1–15. Sign up to view the full content.

1 Lattice Theory Lattice Theory Control Flow Graphs Control Flow Graphs Dataflow Analysis Dataflow Analysis Static Analysis 2009 Static Analysis 2009 Michael I. Schwartzbach Computer Science, University of Aarhus

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 2 Static Analysis Partial Orders Partial Orders ± A partial order is a structure L = (S, ) ± S is a set ± is a binary relation that satisfies: • reflexivity: x S: x x • transitivity: x,y,z S: x y y z x z • anti-symmetry: x,y S: x y y x x = y
3 3 Static Analysis Upper and Lower Bounds Upper and Lower Bounds ± Let X S be a subset ± We say that y S is an upper bound (X y) when: x X: x y ± We say that y S is a lower bound (y X) when: x X: y x ± A least upper bound X is defined by: X X ∧∀ y S: X y X y ± A greatest lower bound X is defined by: X X y S: y X y X

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 4 Static Analysis Lattices Lattices ± A lattice is a partial order where: X and X exist for all X S ± A lattice must have: • a unique largest element, = S • a unique smallest element, = S ± If S is a finite set, then it is a lattice iff: and exist • x y and y x exist for all x,y S
5 5 Static Analysis These Partial Orders Are Lattices These Partial Orders Are Lattices

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 6 Static Analysis These Partial Orders Are Not Lattices These Partial Orders Are Not Lattices
7 7 Static Analysis The Subset Lattice The Subset Lattice ± Every finite set A defines a lattice (2 A , ), where: •= A •x y = x y y = x y {0,1,2,3} {0,1,2} {0,1,3} {0,2,3} {1,2,3} {0,1} {0,2} {0,3} {1,2} {1,3} {2,3} {0} {1} {2} {3} {}

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
8 8 Static Analysis Lattice Height Lattice Height ± The height of a lattice is the length of the longest path from to ± The lattice (2 A , ) has height |A| {0,1,2,3} {0,1,2} {0,1,3} {0,2,3} {1,2,3} {0,1} {0,2} {0,3} {1,2} {1,3} {2,3} {0} {1} {2} {3} {}
9 9 Static Analysis Monotone and Increasing Functions Monotone and Increasing Functions ± A function f: L L is monotone when: x,y S: x y f(x) f(y) ± Monotone functions are closed under composition ± As functions, and are both monotone ± A function is increasing when: x S: x f(x) ± Monotone is different from increasing • e.g. all constant functions are monotone

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
10 10 Static Analysis The Fixed The Fixed - - Point Theorem Point Theorem ± In a lattice with finite height, every monotone function f has a unique least fixed-point: fix (f) = f i ( ) such that f( fix (f)) = fix (f) i 0
11 11 Static Analysis Proof of Existence Proof of Existence ± Clearly, f( ) ± Since f is monotone, we also have f( ) f 2 ( ) ± By induction, f i ( ) f i+1 ( ) ± This means that: f( ) f 2 ( ) ... f i ( ) . .. is an increasing chain ± L has finite height, so for some k : f k ( ) = f k +1 ( ) ± But then fix (f) = f k ( )

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
12 12 Static Analysis Proof of Unique Least Proof of Unique Least ± Assume that x is another fixed-point: x = f( x ) ± Clearly, x ± By induction, f i ( ) f i ( x ) = x ± In particular, fix (f) = f k ( ) x ± Uniqueness then follows from anti-symmetry
13 13 Static Analysis Computing Fixed Computing Fixed - - Points Points ± The time complexity of fix (f) depends on: • the height of the lattice • the cost of computing f • the cost of testing equality x = ; do { t = x; x = f(x); } while (x t);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
14 14
This is the end of the preview. Sign up to access the rest of the document.

## static2 - Lattice Theory Control Flow Graphs Dataflow...

This preview shows document pages 1 - 15. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online