Reaching Definition in Dataflow Analysis: Lecture 29, Slides of Computer Science

A series of lecture notes on reaching definition in dataflow analysis. It covers topics such as taxonomy of dataflow problems, techniques for forward and backward analysis, and specific dataflow problems like if-then constructs, if-then-else constructs, while loops, and improper regions. The notes also include examples and explanations of flow functions and lattice concepts.

Typology: Slides

2012/2013

Uploaded on 03/28/2013

ekanath
ekanath 🇮🇳

3.8

(4)

76 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Objectives_template
file:///D|/...ary,%20Dr.%20Sanjeev%20K%20Aggrwal%20&%20Dr.%20Rajat%20Moona/Multi-core_Architecture/lecture%2029/29_1.htm[6/14/2012 12:09:57 PM]
Module 15: Reaching Definition
Lecture 29: Reaching Definition
The Lecture Contains:
Reaching Definition
Taxonomy of Dataflow Problems
Techniques
Four Kinds of Dataflow Problems
A Lattice L Consists of
Properties of Lattices
Example
Flow Functions For The Flow–graph in The Example
Iterative (forward) Data-flow Analysis
Control Tree Based Data-Flow Analysis
If-then Construct
If-then-else Construct
While Loop
Improper Region
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Reaching Definition in Dataflow Analysis: Lecture 29 and more Slides Computer Science in PDF only on Docsity!

Module 15: Reaching Definition

Lecture 29: Reaching Definition

The Lecture Contains:

Reaching Definition

Taxonomy of Dataflow Problems

Techniques

Four Kinds of Dataflow Problems

A Lattice L Consists of

Properties of Lattices

Example

Flow Functions For The Flow–graph in The Example

Iterative (forward) Data-flow Analysis

Control Tree Based Data-Flow Analysis

If-then Construct

If-then-else Construct

While Loop

Improper Region

Module 15: Reaching Definition

Lecture 29: Reaching Definition

Reaching Definition

Definition: Assignment of a value to a variable A definition d of a variable reaches a point p if there is a path from d to p and value of a variable is same as assigned at d Use iterative forward bit vector problem A bit vector of a 8 bit can be used to represent all the definition Initial condition in(entry) = = 00000000 in(i) = = 00000000 for all nodes i If an instruction re-defines a variable then it is killed

Gen: Definitions generated in a basic block and not subsequently killed in it gen(B1) = 1, 2, 3 = 11100000 gen(B3) = 4 = 00010000 gen(B6) = 5, 6, 7, 8 = 00001111 gen(i) = = 00000000 for i 6= B1, B3, B

Out: Definitions which reach at the end of a basic block out(i) = = 00000000 for all i A definition reaches end of a basic block iff either

It is generated in the basic block OR It reaches in and is preserved

Module 15: Reaching Definition

Lecture 29: Reaching Definition

A Lattice L Consists of

A set of values ’Meet’ operator ’Join’ operator

Properties of Lattices

such that (closure)

(Commutative)

and (associate)

and (distributive)

It has two unique element top and bottom Such that

Forward Reaching Definition Analysis

Elements are bit vectors Meet is bitwise and Join is bitwise or Bottom is 0 n^ and top is 1 n BV n^ denotes lattice of n bits for example BV 3 is

Module 15: Reaching Definition

Lecture 29: Reaching Definition

Example

A function f mapping a lattice to itself f:L → L is monotonic if for all x, y

for example f : BV 3 → BV 3 defined as f : (x 1 , x 2 , x 3 ) → (x 1 , 1, x 3 ) is monotonic Height: it is the length of the longest ascending chain such that there exists x 1 , x 2 ,... , x (^) n such that

Monotonicity and finite height ensure that the data-flow algorithms implementing function f terminate flow function maps lattice to lattice. Flow function for B 1 is given as

Let F (^) B () be the flow function representing flow through block B and F (^) p represent the composition of the flow functions encountered in following path p then

Module 15: Reaching Definition

Lecture 29: Reaching Definition

First Pass

If we do not distinguish between and then

Second Pass

in(if) = in(if-then) in(then) = (in(if))

If we do not distinguish between the true and the false parts

in(if) = in(if-then) in(then) = (in(if))

If-then-else Construct

First Pass

-then –else = (F then ) (F else o )

Second Pass

in(if) = in(if-then-else) in(then) = (in(if)) in(else) = (in(if))

Module 15: Reaching Definition

Lecture 29: Reaching Definition

While Loop

First Pass

Second Pass

in(while) = (in(while-loop)) in(body) = (in(while))

If we do not distinguish between and^ then

In(while) = (in while- loop)) In(body) = (in (while))

file:///D|/...ry,%20Dr.%20Sanjeev%20K%20Aggrwal%20&%20Dr.%20Rajat%20Moona/Multi-core_Architecture/lecture%2029/29_10.htm[6/14/2012 12:09:58 PM]

Module 15: Reaching Definition

Lecture 29: Reaching Definition

Example

Consider the flow graph in an earlier slide and its structural flow analysis

First Pass

Second Pass

For entrya block

file:///D|/...ry,%20Dr.%20Sanjeev%20K%20Aggrwal%20&%20Dr.%20Rajat%20Moona/Multi-core_Architecture/lecture%2029/29_10.htm[6/14/2012 12:09:58 PM]

For if-then else block