|
@@ -6803,7 +6803,7 @@ addition of \key{if} expressions to \LangIf{}, \code{explicate-control}
|
|
|
produces many basic blocks arranged in a control-flow graph. We
|
|
|
recommend that you create a new auxiliary function named
|
|
|
\code{uncover-live-CFG} that applies liveness analysis to a
|
|
|
-control-flow graph.
|
|
|
+control-flow graph. \ocaml{This structuring suggestion is not crucial.}
|
|
|
|
|
|
The first question we is: what order should we process the basic
|
|
|
blocks in the control-flow graph? Recall that to perform liveness
|
|
@@ -6867,11 +6867,22 @@ instruction's argument and for computing the variables read-from ($R$)
|
|
|
or written-to ($W$) by an instruction need to be updated to handle the
|
|
|
new kinds of arguments and instructions in \LangXIfVar{}.
|
|
|
|
|
|
+\begin{ocamlx}
|
|
|
+ It will now become convenient to process the \code{main} and \code{conclusion}
|
|
|
+ blocks uniformly with the others. That should be straightforward, but note
|
|
|
+ two things: (a) to avoid having \code{`framesize} appear as a live variable,
|
|
|
+ we should avoid adding it to the set of read variables; (b) The
|
|
|
+ \code{\%rbp} register may show up in some live sets; this is harmless,
|
|
|
+ so long as it is precolored with a negative color in {\tt AllocateRegisters}.
|
|
|
+\end{ocamlx}
|
|
|
+
|
|
|
\begin{exercise}\normalfont
|
|
|
Update the \code{uncover-live} pass and implement the
|
|
|
\code{uncover-live-CFG} auxiliary function to apply liveness analysis
|
|
|
to the control-flow graph.
|
|
|
-\ocaml{This is in the \code{UncoverLive} submodule of \code{Chapter4.ml}.}
|
|
|
+\ocaml{Place your solution in the \code{UncoverLive} submodule of \code{Chapter4.ml}.
|
|
|
+ You don't have to structure it with an auxiliary function unless
|
|
|
+ you find that useful.}
|
|
|
Add the following entry to the list of
|
|
|
\code{passes} in the \code{run-tests.rkt} script.
|
|
|
\begin{lstlisting}
|