sp08-sl-sfb - ECE 3035 B 1-2 p.m Computing Mechanisms Spring 2008 5 problems 8 pages Final Exam Solutions 28 April 2008 Problem 1(5 parts 30 points

sp08-sl-sfb - ECE 3035 B 1-2 p.m Computing Mechanisms...

This preview shows page 1 - 4 out of 6 pages.

ECE 3035 B 1 -2 p.m. Computing Mechanisms Spring 2008 5 problems, 8 pages Final Exam Solutions 28 April 2008 Problem 1(5 parts, 30 points)Compiler OptimizationConsider the following program fragment.a = f(50);b = g(0);if (a < 0) {if (b > 100)e = h(a, b);elsee = 0;b = e * a;} else {g = g(1);h = g * 4;h = h + g;}printf(“answer: %d\n”, b);Part A (5 points) The control flow graph for thisfragment is shown below. Fill in the definitionsand uses of the variables (e.g., “def x” and “use w”)in the basic blocks of the graph.Part B (7 points) Identify the webs (of def-usechains) in the control flow graph by drawing aregion for each variable and labeling each web S1,S2, etc.FTFTdef adef buse ause bdef guse gdef huse huse gdef huse ause bdef edef euse euse adef buse bs1s2s3s4s5s6 1
Image of page 1