Lecture5 - Data-Flow Analysis and Optimizations CSE 501...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Data-Flow Analysis and Optimizations CSE 501 Lecture 5 April 13, 2009 Questions? • Any critiques ready? • Earlier lectures? • Homework? • Reading? Data-Flow Analysis DFA is a collection of techniques for compile-time reasoning about the run-time 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 Round-Robin Data-Flow 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.

Page1 / 39

Lecture5 - Data-Flow Analysis and Optimizations CSE 501...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online