Jeremy Siek 3 년 전
부모
커밋
10915792d0
1개의 변경된 파일37개의 추가작업 그리고 8개의 파일을 삭제
  1. 37 8
      book.tex

+ 37 - 8
book.tex

@@ -8088,35 +8088,37 @@ in reverse topological order, on all of the basic blocks in the
 program.
 %  
 \fi}
+% Check that the live-after sets that you generate for
+% example X matches the following... -Jeremy
 \end{exercise}
 
 \subsection{Build the Interference Graph}
 \label{sec:build-interference-Rif}
 
-UNDER CONSTRUCTION
-
 Many of the new instructions in \LangXIfVar{} can be handled in the
 same way as the instructions in \LangXVar{}. Thus, if your code was
 already quite general, it will not need to be changed to handle the
 new instructions. If you code is not general enough, we recommend that
 you change your code to be more general. For example, you can factor
 out the computing of the the read and write sets for each kind of
-instruction into two auxiliary functions.
+instruction into auxiliary functions.
 
 Note that the \key{movzbq} instruction requires some special care,
 similar to the \key{movq} instruction. See rule number 1 in
 Section~\ref{sec:build-interference}.
 
 \begin{exercise}\normalfont
-Update the \code{build-interference} pass for \LangXIfVar{} and add the
-following entries to the list of \code{passes} in the
+Update the \code{build\_interference} pass for \LangXIfVar{}.
+{\if\edition\racketEd\color{olive}
+Add the following entries to the list of \code{passes} in the
 \code{run-tests.rkt} script.
 \begin{lstlisting}
 (list "build-interference" build-interference interp-pseudo-x86-1)
 (list "allocate-registers" allocate-registers interp-x86-1)
 \end{lstlisting}
-Run the script to test your compiler on all the \LangIf{} test
-programs.
+\fi}
+% Check that the interference graph that you generate for
+% example X matches the following graph G... -Jeremy
 \end{exercise}
 
 
@@ -8136,14 +8138,17 @@ There are no special restrictions on the jump instructions.
 %
 Update \code{patch-instructions} pass for \LangXIfVar{}.
 %  
+{\if\edition\racketEd\color{olive}
 Add the following entry to the list of \code{passes} in
 \code{run-tests.rkt} and then run this script to test your compiler.
 \begin{lstlisting}
 (list "patch-instructions" patch-instructions interp-x86-1)
 \end{lstlisting}
+\fi}
 \end{exercise}
 
 \begin{figure}[tbp]
+{\if\edition\racketEd\color{olive}
 \begin{tikzpicture}[baseline=(current  bounding  box.center)]
 \node (Rif) at (0,2)  {\large \LangIf{}};
 \node (Rif-2) at (3,2)  {\large \LangIf{}};
@@ -8171,6 +8176,30 @@ Add the following entry to the list of \code{passes} in
 \path[->,bend left=15] (x86-3) edge [above] node {\ttfamily\footnotesize patch-instr.} (x86-4);
 \path[->,bend left=15] (x86-4) edge [right] node {\ttfamily\footnotesize print-x86 } (x86-5);
 \end{tikzpicture}
+\fi}
+{\if\edition\pythonEd\color{purple}
+\begin{tikzpicture}[baseline=(current  bounding  box.center)]
+\node (Rif-1) at (0,2)  {\large \LangIf{}};
+\node (Rif-2) at (3,2)  {\large \LangIf{}};
+\node (Rif-3) at (6,2)  {\large \LangIf{}};
+\node (Rif-4) at (9,2)  {\large \LangIf{}};
+\node (C-1) at (3,0)  {\large \LangCIf{}};
+
+\node (x86-1) at (3,-2)  {\large \LangXIfVar{}};
+\node (x86-2) at (6,-2)  {\large \LangXIfVar{}};
+\node (x86-3) at (9,-2)  {\large \LangXIf{}};
+\node (x86-4) at (12,-2) {\large \LangXIf{}};
+
+\path[->,bend left=15] (Rif-1) edge [above] node {\ttfamily\footnotesize type\_check} (Rif-2);
+\path[->,bend left=15] (Rif-2) edge [above] node {\ttfamily\footnotesize shrink} (Rif-3);
+\path[->,bend left=15] (Rif-3) edge [above] node {\ttfamily\footnotesize remove\_complex.} (Rif-4);
+\path[->,bend left=15] (Rif-4) edge [left] node {\ttfamily\footnotesize explicate\_control} (C-1);
+\path[->,bend right=15] (C-1) edge [left] node {\ttfamily\footnotesize select\_instr.} (x86-1);
+\path[->,bend right=15] (x86-1) edge [below] node {\ttfamily\footnotesize assign\_homes} (x86-2);
+\path[->,bend left=15] (x86-2) edge [above] node {\ttfamily\footnotesize patch\_instr.} (x86-3);
+\path[->,bend left=15] (x86-3) edge [right] node {\ttfamily\footnotesize print\_x86 } (x86-4);
+\end{tikzpicture}
+\fi}
 \caption{Diagram of the passes for \LangIf{}, a language with conditionals.}
  \label{fig:Rif-passes}
 \end{figure}
@@ -8182,7 +8211,7 @@ compilation of \LangIf{}.
 
 Figure~\ref{fig:if-example-x86} shows a simple example program in
 \LangIf{} translated to x86, showing the results of
-\code{explicate\_control}, \code{select-instructions}, and the final
+\code{explicate\_control}, \code{select\_instructions}, and the final
 x86 assembly code.
 
 \begin{figure}[tbp]