Docsity

Structural Analysis in Control Flow: Objectives and Techniques, Slides of Computer Science

Partial preview of the text

Download Structural Analysis in Control Flow: Objectives and Techniques and more Slides Computer Science in PDF only on Docsity!

Module 14: Approaches to Control Flow Analysis

Lecture 28: Structural Analysis

The Lecture Contains:

T1- T2 Analysis

Structural Analysis

Dataflow Analysis

Typical Equation

Reaching Definitions

Analysis of Structured Programs

Reaching Definition Analysis

Constant Folding

Example

Module 14: Approaches to Control Flow Analysis

Lecture 28: Structural Analysis

T1- T2 Analysis

T1 transformation collapses one node self loop to a node T2 transformation collapses sequence of two nodes into one if the second node has only one predecessor

Module 14: Approaches to Control Flow Analysis

Lecture 28: Structural Analysis

An acyclic region that does not fit any of the simple categories and so is identified as a proper interval

Structural Analysis of a flow graph

Control tree of the flow graph analyzed in the previous slide

access X –pointer *q = y

Module 14: Approaches to Control Flow Analysis

Lecture 28: Structural Analysis

Analysis of Structured Programs

gen(S) = {d} kill(S) = Da - {d} out(S) = gen(S) S in(S) - kill(S)

gen(S) = gen(S2) S gen(S1) - kill(S2) kill(S) = kill(S2) S kill(S1) - gen(S2) in(S1) = in(S) in(S2) = out(S1) out(S) = out(S2)

gen(S) = gen(S1) S gen(S2) kill(S) = kill(S1) T kill(S2) out(S) = out(S1) S out(S2)

Module 14: Approaches to Control Flow Analysis

Lecture 28: Structural Analysis

Reaching Definition Analysis

A definition d reaches end of a block iff either

It is generated in the block It reaches block and not killed

Kill & gen known for each block. A program with N blocks has 2N equations with 2N unknowns and therefore, solution is possible.

Use iterative forward bit vector approach

for each block B do in(B) = ; out(B) = gen(B) endfor; change = true; while change do change = false; for each block B do newin = S out(P) if newin 6= in(B) then { change = true; in(B) = newin; out(B) = in(B) - kill(B) S gen(B); } endfor endwhile