|
@@ -2660,8 +2660,8 @@ with $t.1$.
|
|
|
\node (w) at (3,0) {$w:-,\{\}$};
|
|
|
\node (x) at (6,0) {$x:-,\{\}$};
|
|
|
\node (y) at (3,-1.5) {$y:-,\{\}$};
|
|
|
-\node (z) at (6,-1.5) {$z:-,\{0\}$};
|
|
|
-\node (t1) at (9,-1.5) {$t.1:0,\{\}$};
|
|
|
+\node (z) at (6,-1.5) {$z:-,\{\mathbf{0}\}$};
|
|
|
+\node (t1) at (9,-1.5) {$t.1:\mathbf{0},\{\}$};
|
|
|
\draw (v) to (w);
|
|
|
\foreach \i in {w,x,y}
|
|
|
{
|
|
@@ -2680,11 +2680,11 @@ vertex, which in this case is $z$. We color $z$ with $1$.
|
|
|
\[
|
|
|
\begin{tikzpicture}[baseline=(current bounding box.center)]
|
|
|
\node (v) at (0,0) {$v:-,\{\}$};
|
|
|
-\node (w) at (3,0) {$w:-,\{1\}$};
|
|
|
+\node (w) at (3,0) {$w:-,\{\mathbf{1}\}$};
|
|
|
\node (x) at (6,0) {$x:-,\{\}$};
|
|
|
-\node (y) at (3,-1.5) {$y:-,\{1\}$};
|
|
|
-\node (z) at (6,-1.5) {$z:1,\{0\}$};
|
|
|
-\node (t1) at (9,-1.5) {$t.1:0,\{\}$};
|
|
|
+\node (y) at (3,-1.5) {$y:-,\{\mathbf{1}\}$};
|
|
|
+\node (z) at (6,-1.5) {$z:\mathbf{1},\{0\}$};
|
|
|
+\node (t1) at (9,-1.5) {$t.1:0,\{\mathbf{1}\}$};
|
|
|
\draw (t1) to (z);
|
|
|
\draw (v) to (w);
|
|
|
\foreach \i in {w,x,y}
|
|
@@ -2698,16 +2698,16 @@ vertex, which in this case is $z$. We color $z$ with $1$.
|
|
|
\draw (z) to (y);
|
|
|
\end{tikzpicture}
|
|
|
\]
|
|
|
-The most saturated vertices are now $w$ and $y$. We color $w$ with the
|
|
|
-first available color which is $0$.
|
|
|
+The most saturated vertices are now $w$ and $y$. We color $y$ with the
|
|
|
+first available color, which is $0$.
|
|
|
\[
|
|
|
\begin{tikzpicture}[baseline=(current bounding box.center)]
|
|
|
-\node (v) at (0,0) {$v:-,\{0\}$};
|
|
|
-\node (w) at (3,0) {$w:0,\{1\}$};
|
|
|
-\node (x) at (6,0) {$x:-,\{0,\}$};
|
|
|
-\node (y) at (3,-1.5) {$y:-,\{0,1\}$};
|
|
|
-\node (z) at (6,-1.5) {$z:1,\{0\}$};
|
|
|
-\node (t1) at (9,-1.5) {$t.1:0,\{\}$};
|
|
|
+\node (v) at (0,0) {$v:-,\{\}$};
|
|
|
+\node (w) at (3,0) {$w:-,\{\mathbf{0},1\}$};
|
|
|
+\node (x) at (6,0) {$x:-,\{\mathbf{0},\}$};
|
|
|
+\node (y) at (3,-1.5) {$y:\mathbf{0},\{1\}$};
|
|
|
+\node (z) at (6,-1.5) {$z:1,\{\mathbf{0}\}$};
|
|
|
+\node (t1) at (9,-1.5) {$t.1:0,\{1\}$};
|
|
|
\draw (t1) to (z);
|
|
|
\draw (v) to (w);
|
|
|
\foreach \i in {w,x,y}
|
|
@@ -2721,14 +2721,14 @@ first available color which is $0$.
|
|
|
\draw (z) to (y);
|
|
|
\end{tikzpicture}
|
|
|
\]
|
|
|
-Vertex $y$ is the next most highly saturated, so we color $y$ with $2$.
|
|
|
+Vertex $w$ is now the most highly saturated, so we color $w$ with $2$.
|
|
|
\[
|
|
|
\begin{tikzpicture}[baseline=(current bounding box.center)]
|
|
|
-\node (v) at (0,0) {$v:-,\{0\}$};
|
|
|
-\node (w) at (3,0) {$w:0,\{1,2\}$};
|
|
|
-\node (x) at (6,0) {$x:-,\{0,2\}$};
|
|
|
-\node (y) at (3,-1.5) {$y:2,\{0,1\}$};
|
|
|
-\node (z) at (6,-1.5) {$z:1,\{0,2\}$};
|
|
|
+\node (v) at (0,0) {$v:-,\{2\}$};
|
|
|
+\node (w) at (3,0) {$w:\mathbf{2},\{0,1\}$};
|
|
|
+\node (x) at (6,0) {$x:-,\{0,\mathbf{2}\}$};
|
|
|
+\node (y) at (3,-1.5) {$y:0,\{1,\mathbf{2}\}$};
|
|
|
+\node (z) at (6,-1.5) {$z:1,\{0,\mathbf{2}\}$};
|
|
|
\node (t1) at (9,-1.5) {$t.1:0,\{\}$};
|
|
|
\draw (t1) to (z);
|
|
|
\draw (v) to (w);
|
|
@@ -2746,10 +2746,10 @@ Vertex $y$ is the next most highly saturated, so we color $y$ with $2$.
|
|
|
Now $x$ has the highest saturation, so we color it $1$.
|
|
|
\[
|
|
|
\begin{tikzpicture}[baseline=(current bounding box.center)]
|
|
|
-\node (v) at (0,0) {$v:-,\{0\}$};
|
|
|
-\node (w) at (3,0) {$w:0,\{1,2\}$};
|
|
|
-\node (x) at (6,0) {$x:1,\{0,2\}$};
|
|
|
-\node (y) at (3,-1.5) {$y:2,\{0,1\}$};
|
|
|
+\node (v) at (0,0) {$v:-,\{2\}$};
|
|
|
+\node (w) at (3,0) {$w:2,\{0,\mathbf{1}\}$};
|
|
|
+\node (x) at (6,0) {$x:\mathbf{1},\{0,2\}$};
|
|
|
+\node (y) at (3,-1.5) {$y:0,\{\mathbf{1},2\}$};
|
|
|
\node (z) at (6,-1.5) {$z:1,\{0,2\}$};
|
|
|
\node (t1) at (9,-1.5) {$t.1:0,\{\}$};
|
|
|
\draw (t1) to (z);
|
|
@@ -2765,13 +2765,13 @@ Now $x$ has the highest saturation, so we color it $1$.
|
|
|
\draw (z) to (y);
|
|
|
\end{tikzpicture}
|
|
|
\]
|
|
|
-In the last two steps of the algorithm, we color $v$ with $1$.
|
|
|
+In the last step of the algorithm, we color $v$ with $0$.
|
|
|
\[
|
|
|
\begin{tikzpicture}[baseline=(current bounding box.center)]
|
|
|
-\node (v) at (0,0) {$v:1,\{0\}$};
|
|
|
-\node (w) at (3,0) {$w:0,\{1,2\}$};
|
|
|
+\node (v) at (0,0) {$v:\mathbf{0},\{2\}$};
|
|
|
+\node (w) at (3,0) {$w:2,\{\mathbf{0},1\}$};
|
|
|
\node (x) at (6,0) {$x:1,\{0,2\}$};
|
|
|
-\node (y) at (3,-1.5) {$y:2,\{0,1\}$};
|
|
|
+\node (y) at (3,-1.5) {$y:0,\{1,2\}$};
|
|
|
\node (z) at (6,-1.5) {$z:1,\{0,2\}$};
|
|
|
\node (t1) at (9,-1.5) {$t.1:0,\{\}$};
|
|
|
\draw (t1) to (z);
|
|
@@ -2799,18 +2799,16 @@ is the mapping of colors to registers and stack allocations.
|
|
|
\]
|
|
|
Putting this mapping together with the above coloring of the variables, we
|
|
|
arrive at the assignment:
|
|
|
-
|
|
|
-UNDER CONSTRUCTION
|
|
|
\begin{gather*}
|
|
|
- \{ v \mapsto \key{-8(\%rbp)}, \,
|
|
|
- w \mapsto \key{\%rcx}, \,
|
|
|
- x \mapsto \key{-8(\%rbp)}, \,
|
|
|
- y \mapsto \key{-16(\%rbp)}, \,
|
|
|
+ \{ v \mapsto \key{\%rcx}, \,
|
|
|
+ w \mapsto \key{-16(\%rbp)}, \,
|
|
|
+ x \mapsto \key{-8(\%rbp)}, \\
|
|
|
+ y \mapsto \key{\%rcx}, \,
|
|
|
z\mapsto \key{-8(\%rbp)},
|
|
|
t.1\mapsto \key{\%rcx} \}
|
|
|
\end{gather*}
|
|
|
-Applying this assignment to our running example
|
|
|
-(Figure~\ref{fig:reg-eg}) yields the program on the right.\\
|
|
|
+Applying this assignment to our running example, on the left, yields
|
|
|
+the program on the right.\\
|
|
|
% why frame size of 32? -JGS
|
|
|
\begin{minipage}{0.4\textwidth}
|
|
|
\begin{lstlisting}
|
|
@@ -2834,17 +2832,17 @@ $\Rightarrow$
|
|
|
\begin{minipage}{0.45\textwidth}
|
|
|
\begin{lstlisting}
|
|
|
(block ()
|
|
|
- (movq (int 1) (reg rdx))
|
|
|
- (movq (int 46) (reg rcx))
|
|
|
- (movq (reg rdx) (reg rdx))
|
|
|
- (addq (int 7) (reg rdx))
|
|
|
- (movq (reg rdx) (deref rbp -8))
|
|
|
- (addq (int 4) (deref rbp -8))
|
|
|
- (movq (reg rdx) (reg rdx))
|
|
|
- (addq (reg rcx) (reg rdx))
|
|
|
+ (movq (int 1) (reg rcx))
|
|
|
+ (movq (int 46) (deref rbp -16))
|
|
|
+ (movq (reg rcx) (deref rbp -8))
|
|
|
+ (addq (int 7) (deref rbp -8))
|
|
|
(movq (deref rbp -8) (reg rcx))
|
|
|
+ (addq (int 4) (reg rcx))
|
|
|
+ (movq (deref rbp -8) (deref rbp -8))
|
|
|
+ (addq (deref rbp -16) (deref rbp -8))
|
|
|
+ (movq (reg rcx) (reg rcx))
|
|
|
(negq (reg rcx))
|
|
|
- (movq (reg rdx) (reg rax))
|
|
|
+ (movq (deref rbp -8) (reg rax))
|
|
|
(addq (reg rcx) (reg rax))
|
|
|
(jmp conclusion))
|
|
|
\end{lstlisting}
|