|
@@ -40,7 +40,6 @@
|
|
|
\else
|
|
|
\newcommand{\rn}[1]{}
|
|
|
\newcommand{\margincomment}[1]{}
|
|
|
-% \newcommand{\margincomment}[1]{}
|
|
|
\fi
|
|
|
|
|
|
\lstset{%
|
|
@@ -2183,7 +2182,7 @@ stack locations or registers.
|
|
|
After instruction selection:
|
|
|
\begin{lstlisting}
|
|
|
(program
|
|
|
- ((locals . (v w x y z t.1 t.2)))
|
|
|
+ ((locals . (v w x y z t.1)))
|
|
|
((start .
|
|
|
(block ()
|
|
|
(movq (int 1) (var v))
|
|
@@ -2454,10 +2453,9 @@ Figure~\ref{fig:interfere}.
|
|
|
\node (v) at (0,0) {$v$};
|
|
|
\node (w) at (2,0) {$w$};
|
|
|
\node (x) at (4,0) {$x$};
|
|
|
-\node (t1) at (6,0) {$t.1$};
|
|
|
+\node (t1) at (6,-2) {$t.1$};
|
|
|
\node (y) at (2,-2) {$y$};
|
|
|
\node (z) at (4,-2) {$z$};
|
|
|
-\node (t2) at (6,-2) {$t.2$};
|
|
|
|
|
|
\draw (v) to (w);
|
|
|
\foreach \i in {w,x,y}
|
|
@@ -2470,7 +2468,6 @@ Figure~\ref{fig:interfere}.
|
|
|
\draw (z) to (w);
|
|
|
\draw (z) to (y);
|
|
|
\draw (t1) to (z);
|
|
|
-\draw (t2) to (t1);
|
|
|
\end{tikzpicture}
|
|
|
\]
|
|
|
\caption{The interference graph of the example program.}
|
|
@@ -2478,10 +2475,10 @@ Figure~\ref{fig:interfere}.
|
|
|
\end{figure}
|
|
|
|
|
|
Our next concern is to choose a data structure for representing the
|
|
|
-interference graph. There are many standard choices for how to
|
|
|
-represent a graph: \emph{adjacency matrix}, \emph{adjacency list}, and
|
|
|
-\emph{edge set}~\citep{Cormen:2001uq}. The right way to choose a data
|
|
|
-structure is to study the algorithm that uses the data structure,
|
|
|
+interference graph. There are many choices for how to represent a
|
|
|
+graph, for example, \emph{adjacency matrix}, \emph{adjacency list},
|
|
|
+and \emph{edge set}~\citep{Cormen:2001uq}. The right way to choose a
|
|
|
+data structure is to study the algorithm that uses the data structure,
|
|
|
determine what operations need to be performed, and then choose the
|
|
|
data structure that provide the most efficient implementations of
|
|
|
those operations. Often times the choice of data structure can have an
|
|
@@ -2493,20 +2490,20 @@ correct choice of graph representation is that of an adjacency
|
|
|
list. There are helper functions in \code{utilities.rkt} for
|
|
|
representing graphs using the adjacency list representation:
|
|
|
\code{make-graph}, \code{add-edge}, and \code{adjacent}
|
|
|
-(Appendix~\ref{appendix:utilities}). In particular, those functions
|
|
|
-use a hash table to map each vertex to the set of adjacent vertices,
|
|
|
-and the sets are represented using Racket's \key{set}, which is also a
|
|
|
-hash table.
|
|
|
+(Appendix~\ref{appendix:utilities}).
|
|
|
+%
|
|
|
+\margincomment{\footnotesize To do: change to use the
|
|
|
+ Racket graph library. \\ --Jeremy}
|
|
|
+%
|
|
|
+In particular, those functions use a hash table to map each vertex to
|
|
|
+the set of adjacent vertices, and the sets are represented using
|
|
|
+Racket's \key{set}, which is also a hash table.
|
|
|
|
|
|
\begin{exercise}\normalfont
|
|
|
Implement the compiler pass named \code{build-interference} according
|
|
|
-to the algorithm suggested above. The output of this pass should
|
|
|
-replace the live-after sets with the interference $\itm{graph}$ as
|
|
|
-follows.
|
|
|
-\begin{lstlisting}
|
|
|
- (program (|$\Var^{*}$| |$\itm{graph}$|) |$\Instr^{+}$|)
|
|
|
-\end{lstlisting}
|
|
|
-
|
|
|
+to the algorithm suggested above. The output of this pass should be
|
|
|
+stored in the $\itm{info}$ field of the program, under the key
|
|
|
+\code{conflicts}.
|
|
|
\end{exercise}
|
|
|
|
|
|
\section{Graph Coloring via Sudoku}
|