|
@@ -2850,19 +2850,18 @@ $\Rightarrow$
|
|
|
|
|
|
The resulting program is almost an x86 program. The remaining step
|
|
The resulting program is almost an x86 program. The remaining step
|
|
is to apply the patch instructions pass. In this example, the trivial
|
|
is to apply the patch instructions pass. In this example, the trivial
|
|
-move of \code{-16(\%rbp)} to itself is deleted and the addition of
|
|
|
|
-\code{-8(\%rbp)} to \key{-16(\%rbp)} is fixed by going through
|
|
|
|
-\code{rax}. The following shows the portion of the program that
|
|
|
|
-changed.
|
|
|
|
|
|
+move of \code{-8(\%rbp)} to itself is deleted and the addition of
|
|
|
|
+\code{-16(\%rbp)} to \key{-8(\%rbp)} is fixed by going through
|
|
|
|
+\code{rax} as follows.
|
|
\begin{lstlisting}
|
|
\begin{lstlisting}
|
|
- (addq (int 4) (reg rbx))
|
|
|
|
- (movq (deref rbp -8) (reg rax)
|
|
|
|
- (addq (reg rax) (deref rbp -16))
|
|
|
|
|
|
+ (movq (deref rbp -16) (reg rax)
|
|
|
|
+ (addq (reg rax) (deref rbp -8))
|
|
\end{lstlisting}
|
|
\end{lstlisting}
|
|
|
|
+
|
|
An overview of all of the passes involved in register allocation is
|
|
An overview of all of the passes involved in register allocation is
|
|
shown in Figure~\ref{fig:reg-alloc-passes}.
|
|
shown in Figure~\ref{fig:reg-alloc-passes}.
|
|
|
|
|
|
-\begin{figure}[p]
|
|
|
|
|
|
+\begin{figure}[tbp]
|
|
\begin{tikzpicture}[baseline=(current bounding box.center)]
|
|
\begin{tikzpicture}[baseline=(current bounding box.center)]
|
|
\node (R1) at (0,2) {\large $R_1$};
|
|
\node (R1) at (0,2) {\large $R_1$};
|
|
\node (R1-2) at (3,2) {\large $R_1$};
|
|
\node (R1-2) at (3,2) {\large $R_1$};
|