This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: DataFlow Analysis and Optimizations CSE 501 Lecture 5 April 13, 2009 Questions? • Any critiques ready? • Earlier lectures? • Homework? • Reading? DataFlow Analysis DFA is a collection of techniques for compiletime reasoning about the runtime fow of values. We use DFA to ¡nd opportunities and prove safety • Not an end unto itself Usually formulated as a set of simultaneous equations • Sets attached to nodes an edges in a graph Desired result is usually a meet over all paths solution: • What is true on every path from the entry? • Can this happen on any path from the entry? DFA equations  Dominance Last lecture, we glanced at our frst DFA equations. Initialization: Fixed point: N is the set o¡ all nodes in the CFG. Domain is nodes (basic blocks) in the CFG we ’ re analyzing Dom( n ) = N , " n Dom( n ) = { n } " ( Dom( p ) p # pred( n ) I ) DFA equations  Liveness DFA equations are only slightly more complex. Initialization: Fixed point: Kill (b) is the set of names de¡ned in b . UE (b) is the set of names used in b before being de¡ned in b . Domain might be registers, locals, globals, … LiveIn( n ) = " , # n LiveOut( b ) = LiveIn( s ) s $ succ( b ) U LiveIn( b ) = UE( b ) % (LiveOut( b ) & Kill( b )) A RoundRobin DataFlow Solver for b in N Dom(b) = N do changed = false for b in N temp = if Dom(b) != temp changed = true Dom(b) = temp while changed { b } " ( Dom ( p ) p # pred( b ) I ) Ordering When we write for b in N any ordering will converge on the same result, but some orderings will converge quicker. For forward problems (dominators), we use a topsort order (where topsort is topological sort). For backward problems (liveness), we use a reverse topsort order. Forward and Backward Problems When we solve forward problems, information ¡ows generally forward in the CFG. Recall the de¢nition of the dominators problem The solution for each block refers to its predecessors in the CFG....
View
Full
Document
This note was uploaded on 02/09/2012 for the course CSE 403 taught by Professor Staff during the Spring '08 term at University of Washington.
 Spring '08
 Staff

Click to edit the document details