This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: ECE 468 Problem Set 7: Dataflow analysis 1. Show the results of running a liveness analysis on the following piece of code: For each line of code, show which definitions reach that line of code by indicating the line number the definition occurred in. 1: x = 4; 2: y = 7; L1 3: if (x > c) goto L4 4: if (y > 3) goto L2 5: a = x + 1; 6: b = a + x; 7: goto L3 L2 8: a = a + x; 9: b = x + 1; L3 10: y = a + b; 11: goto L1; L4 12: halt 2. Show the results of running an available expression analysis on the code, by indicating which expressions are available at each instruction. 3. In this problem, your goal is to develop a dataflow analysis to find leaking values. A common error in programs is forgetting to free a variable that has been malloc ed. Write an analysis that can tell, at the end of a function, whether any allocations during the function may not have been freed by the end of the function. Hint: think about this analysis’ relationship to reaching definitions....
View Full Document
This note was uploaded on 02/19/2012 for the course ECE 468 taught by Professor Test during the Fall '08 term at Purdue.
- Fall '08