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

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

View Full Document Right Arrow Icon
Carnegie Mellon 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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Carnegie Mellon I. Compiler Organization M. Lam CS243: Intro to Data Flow 2
Background image of page 2
Carnegie Mellon 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
Background image of page 3

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

View Full DocumentRight Arrow Icon
Carnegie Mellon 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
Background image of page 4
Carnegie Mellon 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
Background image of page 5

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

View Full DocumentRight Arrow Icon
Carnegie Mellon 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. Problem statement
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 03/12/2012.

Page1 / 22

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

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

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