Jeremy Siek 9 年之前
父节点
当前提交
6ba4e2fa34
共有 1 个文件被更改,包括 26 次插入1 次删除
  1. 26 1
      book.tex

+ 26 - 1
book.tex

@@ -2718,9 +2718,22 @@ Regarding \key{if} statements, we recommend that you not lower them in
 liveness analysis, \key{if} statments are easier to deal with than
 liveness analysis, \key{if} statments are easier to deal with than
 jump instructions.
 jump instructions.
 
 
+\begin{exercise}\normalfont
+Expand your \code{select-instructions} pass to handle the new features
+of the $R_2$ language. Test the pass on all the examples you have
+created and make sure that you have some test programs that use the
+\code{eq?} operator, creating some if necessary. Test the output of
+\code{select-instructions} using the \code{interp-x86} interpreter
+(Appendix~\ref{appendix:interp}).
+\end{exercise}
+
 \section{Register Allocation}
 \section{Register Allocation}
 \label{sec:register-allocation-r2}
 \label{sec:register-allocation-r2}
 
 
+The changes required for $R_2$ affect the liveness analysis, building
+the interference graph, and assigning homes, but the graph coloring
+algorithm itself should not need to change.
+
 \subsection{Liveness Analysis}
 \subsection{Liveness Analysis}
 \label{sec:liveness-analysis-r2}
 \label{sec:liveness-analysis-r2}
 
 
@@ -2782,6 +2795,13 @@ to be updated to handle the \key{if} statement, simply by recursively
 processing the child nodes.  Hopefully your code already handles the
 processing the child nodes.  Hopefully your code already handles the
 other new instructions, but if not, you can generalize your code.
 other new instructions, but if not, you can generalize your code.
 
 
+\begin{exercise}\normalfont
+Implement the additions to the \code{register-allocation} pass so that
+it works for $R_2$ and test your compiler using your previously
+created programs on the \code{interp-x86} interpreter
+(Appendix~\ref{appendix:interp}).
+\end{exercise}
+
 \section{Patch Instructions}
 \section{Patch Instructions}
 \label{sec:patch-instructions-r2}
 \label{sec:patch-instructions-r2}
 
 
@@ -2820,6 +2840,11 @@ $\Rightarrow$
 \end{minipage}
 \end{minipage}
 \end{tabular} 
 \end{tabular} 
 
 
+\begin{exercise}\normalfont
+Update your \code{patch-instruction} pass to handle $R_2$ and test
+your compiler using your previously created programs on the
+\code{interp-x86} interpreter (Appendix~\ref{appendix:interp}).
+\end{exercise}
 
 
 
 
 \section{An Example Translation}
 \section{An Example Translation}
@@ -2962,7 +2987,7 @@ We provide several interpreters in the \key{interp.rkt} file.  The
 languages considered in this book ($R_1, R_2, \ldots$) and interprets
 languages considered in this book ($R_1, R_2, \ldots$) and interprets
 the program, returning the result value.  The \key{interp-C} function
 the program, returning the result value.  The \key{interp-C} function
 interprets an AST for a program in one of the C-like languages ($C_0,
 interprets an AST for a program in one of the C-like languages ($C_0,
-C_1, \ldots$), and the \key{interp-x86} function interprets an AST for
+C_1, \ldots$), and the \code{interp-x86} function interprets an AST for
 an x86-64 program.
 an x86-64 program.
 
 
 \section{Utility Functions}
 \section{Utility Functions}