






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







1
Lecture 2 Control Flow Analysis 2 What is a loop? A subgraph of CFG with the following properties:
3 Property Given two loops: they are either disjoint or one is completely nested within the other. Loops {1,2,4} and {5,6} are Disjoint. Loop {5,6} is nested within loop {2,4,5,6}. Loop {5,6} is nested within loop {2,3,4,5,6}. Identifying Loops
Observation: node m donimates node n iff m dominates all predecessors of n. 8 Let D(n) = set of dominators of n Where Pred(n) is set of immediate predecessors of n in the CFG
Computing Dominator Sets 9 Initial Approximation: D(no) = {no} no is the start node. D(n) = N, for all n!=no N is set of all nodes. Iteratively Refine D(n)’s: Algorithm: Example: Computing Dom. Sets 10
Back Edges: 94, 108, 10 5
Example
13 Loop = {2,7} + {6} + {4} + {5} + {3} Stack = 7 6 4 5 3
Examples 14
L2 nested in L L1 S1,S2,S3,S L2 S2,S3,S L2 nested in L While A do S While B do S Endwhile Endwhile ?
Reducible Flow Graph
15 Reducible Flow Graph
Example 19
Depth First Ordering Back edge Forward edge