In Fig XXXXXXXXXXis a function id that is the "identity function"; it returns exactly what it is given as an argument. We also see a code fragment consisting of a branch and following assignment that...


In Fig. 12.11 is a function id that is the "identity function"; it returns exactly what it is given as an argument. We also see a code fragment consisting of a branch and following assignment that sums x + y.

a) Examining the code, what can we tell about the value of z at the end?

b) Construct the flow graph for the code fragment, treating the calls to id as control flow.


c) If we run a constant-propagation analysis, as in Section 9.4, on your flow graph from (b), what constant values are determined?

d) What are all the call sites in Fig. 12.11?

e) What are all the contexts in which id is called?


f) Rewrite the code of Fig. 12.11 by cloning a new version of id for each context in which it is called. g) Construct the flow graph of your code from (f), treating the calls as control flow.


Fig. 12.11






h) Perform a constant-propagation analysis on your flow graph from (g). What constant values are determined now?



May 22, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here