lecture-3 Program Analysis

lecture-3 Program Analysis - 1 Administrative info...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Administrative info Subscribe to the class mailing list!!! instructions are on the class web page, which is accessible from my home page, which is accessible by searching for Sorin Lerner on google From last lecture Flow functions: Given information in before statement s, F s ( in ) returns information after statement s Flow functions are a central component of a dataflow analysis They state constraints on the information flowing into and out of a statement 1: x := ... 2: y := ... 3: y := ... 4: p := ... if(...) ... x ... 5: x := ... ... y ... ... x ... 6: x := ... 7: *p := ... merge ... x ... ... y ... 8: y := ... d d 1 d 2 d 3 d 5 d 6 d 7 d 9 d 10 d 11 d 13 d 14 d 15 d 16 d 12 d 4 d 8 Back to example d 1 = F a (d ) d 2 = F b (d 1 ) d 3 = F c (d 2 ) d 4 = F d (d 3 ) d 5 = F e (d 4 ) d 6 = F g (d 5 ) d 7 = F h (d 6 ) d 8 = F i (d 7 ) d 10 = F j (d 9 ) d 11 = F k (d 10 ) d 12 = F l (d 11 ) d 9 = F f (d 5 ) d 13 = F m (d 12 , d 8 ) d 14 = F n (d 1 3 ) d 15 = F o (d 1 4 ) d 16 = F p (d 1 5 ) How to find solutions for d i ? How to find solutions for d i ? This is a forward problem given information flowing in to a node, can determine using the flow function the info flow out of the node To solve, simply propagate information forward through the control flow graph, using the flow functions What are the problems with this approach? First problem What about the incoming information? d is not constrained so where do we start? Need to constrain d Two options: explicitly state entry information have an entry node whose flow function sets the information on entry (doesnt matter if entry node has an incoming edge, its flow function ignores any input) Entry node s: entry in out out = { x & s | x Formals } 2 1: x := ... 2: y := ... 3: y := ... 4: p := ... if(...) ... x ... 5: x := ... ... y ... ... x ... 6: x := ... 7: *p := ... merge ... x ... ... y ... 8: y := ... d d 1 d 2 d 3 d 5 d 6 d 7 d 9 d 10 d 11 d 13 d 14 d 15 d 16 d 12 d 4 d 8 Back to example d 1 = F a (d ) d 2 = F b (d 1 ) d 3 = F c (d 2 ) d 4 = F d (d 3 ) d 5 = F e (d 4 ) d 6 = F g (d 5 ) d 7 = F h (d 6 ) d 8 = F i (d 7 ) d 10 = F j (d 9 ) d 11 = F k (d 10 ) d 12 = F l (d 11 ) d 9 = F f (d 5 ) d 13 = F m (d 12 , d 8 ) d 14 = F n (d 1 3 ) d 15 = F o (d 1 4 ) d 16 = F p (d 1 5 ) d = F entry () Which order to process nodes in? How to find solutions for d i ? Sort nodes in topological order each node appears in the order after all of its predecessors Just run the flow functions for each of the nodes in the topological order Second problem When there are loops, there is no topological order!...
View Full Document

Page1 / 8

lecture-3 Program Analysis - 1 Administrative info...

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

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