浏览代码

wibbles on ch. 9

Andrew Tolmach 4 年之前
父节点
当前提交
9118cf7e94
共有 1 个文件被更改,包括 13 次插入6 次删除
  1. 13 6
      book.tex

+ 13 - 6
book.tex

@@ -12484,7 +12484,7 @@ fine to place \code{begin} there.
 
 
 Recall that in the \code{explicate-control} pass we define one helper
 Recall that in the \code{explicate-control} pass we define one helper
 function for each kind of position in the program.  For the \LangVar{}
 function for each kind of position in the program.  For the \LangVar{}
-language of integers and variables we needed kinds of positions:
+language of integers and variables we needed \ocaml{two} kinds of positions:
 assignment and tail. The \code{if} expressions of \LangIf{} introduced
 assignment and tail. The \code{if} expressions of \LangIf{} introduced
 predicate positions. For \LangLoop{}, the \code{begin} expression introduces
 predicate positions. For \LangLoop{}, the \code{begin} expression introduces
 yet another kind of position: effect position. Except for the last
 yet another kind of position: effect position. Except for the last
@@ -12559,6 +12559,9 @@ need to be updated. The three new language forms, \code{while},
 positions.  Only \code{begin} may appear in predicate positions; the
 positions.  Only \code{begin} may appear in predicate positions; the
 other two have result type \code{Void}.
 other two have result type \code{Void}.
 
 
+\ocaml{Note that it should never be necessary to generate a \LangCIf{}
+  \code{atom} corresponding to the \LangLoop{} void constant \code{()}.}
+
 \section{Select Instructions}
 \section{Select Instructions}
 \label{sec:select-instructions-loop}
 \label{sec:select-instructions-loop}
 
 
@@ -12586,8 +12589,8 @@ We recommend using the generic \code{analyze-dataflow} function that
 was presented at the end of Section~\ref{sec:dataflow-analysis} to
 was presented at the end of Section~\ref{sec:dataflow-analysis} to
 perform liveness analysis, replacing the code in
 perform liveness analysis, replacing the code in
 \code{uncover-live-CFG} that processed the basic blocks in topological
 \code{uncover-live-CFG} that processed the basic blocks in topological
-order (Section~\ref{sec:liveness-analysis-Rif}). \ocaml{This function
-  has been programmed for you, in file \code{dataflow.ml}.}
+order (Section~\ref{sec:liveness-analysis-Rif}). \ocaml{An implementation
+  of this algorithm is provided to you as a functor in file \code{dataflow.ml}.}
 
 
 The \code{analyze-dataflow} function has four parameters.
 The \code{analyze-dataflow} function has four parameters.
 \begin{enumerate}
 \begin{enumerate}
@@ -12595,7 +12598,8 @@ The \code{analyze-dataflow} function has four parameters.
   \code{racket/graph} package (see the sidebar in
   \code{racket/graph} package (see the sidebar in
   Section~\ref{sec:build-interference}) that represents the
   Section~\ref{sec:build-interference}) that represents the
   control-flow graph. \ocaml{Remember that it is necessary to
   control-flow graph. \ocaml{Remember that it is necessary to
-    transpose the CFG for a backward dataflow problem.}
+    transpose the CFG for a backward dataflow problem. The functor
+  provides separate entry points for forward and backward analyses.}
 \item The second parameter \code{transfer} is a function that applies
 \item The second parameter \code{transfer} is a function that applies
   liveness analysis to a basic block. It takes two parameters: the
   liveness analysis to a basic block. It takes two parameters: the
   label for the block to analyze and the live-after set for that
   label for the block to analyze and the live-after set for that
@@ -12603,11 +12607,14 @@ The \code{analyze-dataflow} function has four parameters.
   the block.  Also, as a side-effect, it should update the block's
   the block.  Also, as a side-effect, it should update the block's
   $\itm{info}$ with the liveness information for each instruction. To
   $\itm{info}$ with the liveness information for each instruction. To
   implement the \code{transfer} function, you should be able to reuse
   implement the \code{transfer} function, you should be able to reuse
-  the code you already have for analyzing basic blocks.
+  the code you already have for analyzing basic blocks. \ocaml{Depending on
+    how you wrote that code, you may need to refactor it slightly.}
 \item The third and fourth parameters of \code{analyze-dataflow} are
 \item The third and fourth parameters of \code{analyze-dataflow} are
   \code{bottom} and \code{join} for the lattice of abstract states,
   \code{bottom} and \code{join} for the lattice of abstract states,
   i.e.  sets of locations. The bottom of the lattice is the empty set
   i.e.  sets of locations. The bottom of the lattice is the empty set
-  \code{(set)} and the join operator is \code{set-union}.
+  \code{(set)} and the join operator is \code{set-union}. \ocaml{These
+    parameters are provided once-and-for-all when the functor is
+    instanstantiated.}
 \end{enumerate}
 \end{enumerate}