{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

l2-handout

# l2-handout - Lecture 2 Introduction to Data Flow Analysis I...

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

1 Lecture 2 Introduction to Data Flow Analysis I. Introduction II. Example: Reaching definition analysis III. Example: Liveness analysis IV. A General Framework (Theory in next lecture) Reading: Chapter 9.2 M. Lam CS243: Intro to Data Flow 1 I. Compiler Organization M. Lam CS243: Intro to Data Flow 2

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

View Full Document
2 Flow Graph Basic block = a maximal sequence of consecutive instructions s.t. flow of control only enters at the beginning flow of control can only leave at the end (no halting or branching except perhaps at end of block) Flow Graphs Nodes: basic blocks Edges B i --> B j , iff B j can follow B i immediately in execution M. Lam CS243: Intro to Data Flow 3 What is Data Flow Analysis? Data flow analysis: Flow-sensitive: sensitive to the control flow in a function intraprocedural analysis Examples of optimizations: Constant propagation Common subexpression elimination Dead code elimination M. Lam CS243: Intro to Data Flow 4 Value of x? Which “definition” defines x? Is the definition still meaningful (live)? e = b + c a = 243 e = d+3 g = a a = b + c d = 7
3 Static Program vs. Dynamic Execution Statically : Finite program Dynamically : Can have infinitely many possible execution paths Data flow analysis abstraction: For each point in the program: combines information of all the instances of the same program point. Example of a data flow question: Which definition defines the value used in statement “b = a”? M. Lam CS243: Intro to Data Flow 5 Reaching Definitions Every assignment is a definition A definition d reaches a point p if there exists path from the point immediately following d to p such that d is not killed (overwritten) along that path.

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

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

{[ snackBarMessage ]}

### Page1 / 11

l2-handout - Lecture 2 Introduction to Data Flow Analysis I...

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

View Full Document
Ask a homework question - tutors are online