|
@@ -5771,11 +5771,11 @@ instructions. \racket{The first instruction is \lstinline{movq $1, v},
|
|
|
so \code{v} interferes with \code{rsp}.}
|
|
|
%
|
|
|
\python{The first instruction is \lstinline{movq $1, v}, and the
|
|
|
- live-after set is $\{\ttm{v}\}$. Rule 1 applies but there is
|
|
|
+ live-after set is $\{\ttm{v}\}$. Rule 1 applies, but there is
|
|
|
no interference because $\ttm{v}$ is the destination of the move.}
|
|
|
%
|
|
|
\racket{The fourth instruction is \lstinline{addq $7, x}, and the
|
|
|
- live-after set is $\{\ttm{w},\ttm{x},\ttm{rsp}\}$. Rule 2 applies so
|
|
|
+ live-after set is $\{\ttm{w},\ttm{x},\ttm{rsp}\}$. Rule 2 applies, so
|
|
|
$\ttm{x}$ interferes with \ttm{w} and \ttm{rsp}.}
|
|
|
%
|
|
|
\python{The fourth instruction is \lstinline{addq $7, x}, and the
|
|
@@ -6309,16 +6309,17 @@ So, we obtain the following coloring:
|
|
|
{\if\edition\pythonEd\pythonColor
|
|
|
%
|
|
|
With the DSATUR algorithm in hand, let us return to the running
|
|
|
-example and consider how to color the interference graph in
|
|
|
-figure~\ref{fig:interfere}. We annotate each variable node with a dash
|
|
|
-to indicate that it has not yet been assigned a color. Each register
|
|
|
-node (not shown) should be assigned the number that the register
|
|
|
-corresponds to, for example, color \code{rcx} with the number \code{0}
|
|
|
-and \code{rdx} with \code{1}. The saturation sets are also shown for
|
|
|
-each node; all of them start as the empty set. We do not show the
|
|
|
-register nodes in the graph below because there were no interference
|
|
|
-edges involving registers in this program, but in general there can
|
|
|
-be.
|
|
|
+example and consider how to color the interference graph shown in
|
|
|
+figure~\ref{fig:interfere}, again mapping 1 to blank, 2 to white, and
|
|
|
+3 to gray. We annotate each variable node with a dash to indicate that
|
|
|
+it has not yet been assigned a color. Each register node (not shown)
|
|
|
+should be assigned the number that the register corresponds to, for
|
|
|
+example, color \code{rcx} with the number \code{0} and \code{rdx} with
|
|
|
+\code{1}. The saturation sets are also shown for each node; all of
|
|
|
+them start as the empty set. We do not show the register nodes in the
|
|
|
+following graph because there were no interference edges involving
|
|
|
+registers in this program; however, in general there can be inference
|
|
|
+edges that involve registers.
|
|
|
%
|
|
|
\[
|
|
|
\begin{tikzpicture}[baseline=(current bounding box.center)]
|
|
@@ -6341,7 +6342,7 @@ be.
|
|
|
\]
|
|
|
The algorithm says to select a maximally saturated vertex, but they
|
|
|
are all equally saturated. So we flip a coin and pick $\ttm{tmp\_0}$
|
|
|
-then color it with the first available integer, which is $0$. We mark
|
|
|
+and then we color it with the first available integer, which is $0$. We mark
|
|
|
$0$ as no longer available for $\ttm{tmp\_1}$ and $\ttm{z}$ because
|
|
|
they interfere with $\ttm{tmp\_0}$.
|
|
|
\[
|
|
@@ -6859,7 +6860,7 @@ allocated.
|
|
|
\code{rbx}, and variables \code{w} and \code{t} was assigned to \code{rcx}.}
|
|
|
%
|
|
|
\python{Variables \code{v}, \code{x}, \code{y}, and \code{tmp\_0}
|
|
|
- were assigned to \code{rcx} and variables \code{w} and \code{tmp\_1}
|
|
|
+ were assigned to \code{rcx}, and variables \code{w} and \code{tmp\_1}
|
|
|
were assigned to \code{rbx}.}
|
|
|
%
|
|
|
Variable \racket{\code{y}}\python{\code{z}} was spilled to the stack
|
|
@@ -7245,7 +7246,7 @@ were \code{tmp\_1}, \code{w}, and \code{y}.
|
|
|
\end{tikzpicture}
|
|
|
\]
|
|
|
We have arbitrarily chosen to color \code{w} instead of \code{tmp\_1}
|
|
|
-or \code{y}, but note that \code{w} is not move related to any
|
|
|
+or \code{y}. Note, however, that \code{w} is not move related to any
|
|
|
variables, whereas \code{y} and \code{tmp\_1} are move related to
|
|
|
\code{tmp\_0} and \code{z}, respectively. If we instead choose
|
|
|
\code{y} and color it $0$, we can delete another move instruction.
|