l4 - Lecture 4 More on Data Flow Constant Propagation Speed...

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

View Full Document Right Arrow Icon
Lecture 4 More on Data Flow: Constant Propagation, Speed, Loops I. Constant Propagation II. Efficiency of Data Flow Analysis III. Algorithm to find loops Reading: Chapter 9.4, 9.6 M. Lam CS243: Constants, Speed, Loops 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
I. Constant Propagation/Folding At every basic block boundary, for each variable v determine if v is a constant if so, what is the value? M. Lam CS243: Constants, Speed, Loops 2 x = 2 m = x + e e = 3 p = e + 4 e = 1
Background image of page 2
Semi-lattice Diagram Finite domain? Finite height? M. Lam CS243: Constants, Speed, Loops 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
Equivalent Definition Meet Operation: Note: undef c2 = c2! M. Lam CS243: Constants, Speed, Loops 4 v1 v2 v1 v2 undef undef c 2 NAC c 1 undef c 2 NAC NAC undef c 2 NAC
Background image of page 4
Example M. Lam CS243: Constants, Speed, Loops 5 x = 2 p = x
Background image of page 5

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

View Full DocumentRight Arrow Icon
Transfer Function Assume a basic block has only 1 instruction Let IN[b,x], OUT[b,x] be the information for variable x at entry and exit of basic block b OUT[entry, x] = undef, for all x. Non-assignment instructions: OUT[b,x] = IN[b,x] Assignment instructions: (next page) M. Lam CS243: Constants, Speed, Loops 6
Background image of page 6
Constant Propagation (Cont.) Let an assignment be of the form x 3 = x 1 + x 2 “+” represents a generic operator OUT[b,x] = IN [b,x], if x x 3 Use: x y implies f(x) f(y) to check if framework is monotone [v 1 v 2 . .. ] [v 1 ’ v 2 ’ . .. ], f([v 1 v 2 . .. ]) f ([v 1 ’ v 2 ... ]) M. Lam CS243: Constants, Speed, Loops 7 IN[b,x 1 ] IN[b,x 2 ] OUT[b,x 3 ] undef undef c 2 NAC c 1 undef c 2 1 2 NAC NAC undef c 2 NAC
Background image of page 7

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

View Full DocumentRight Arrow Icon
Distributive? Iterative solutions is not precise!
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 23

l4 - Lecture 4 More on Data Flow Constant Propagation Speed...

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

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