Skip to content

Commit

Permalink
fix output of select instructions in chapter 2 example
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiek committed Sep 28, 2024
1 parent df19d46 commit 3c65a9e
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions book.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3958,9 +3958,11 @@ \section{Assign Homes}
\end{minipage}\\
%
The output of \code{select\_instructions} is shown next, on the left,
and the output of \code{assign\_homes} is on the right. In this
example, we assign variable \code{a} to stack location
\code{-8(\%rbp)} and variable \code{b} to location \code{-16(\%rbp)}.
and the output of \code{assign\_homes} is on the right.
In this example, we assign variable \code{a} to stack location
\code{-8(\%rbp)} and variable \code{b} to location \code{-16(\%rbp)}.

{\if\edition\racketEd
\begin{transformation}
\begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
movq $42, a
Expand All @@ -3975,6 +3977,24 @@ \section{Assign Homes}
movq -16(%rbp), %rax
\end{lstlisting}
\end{transformation}
\fi}
{\if\edition\pythonEd
\begin{transformation}
\begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
movq $42, a
movq a, b
movq b, %rdi
callq print_int
\end{lstlisting}
\compilesto
\begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
movq $42, -8(%rbp)
movq -8(%rbp), -16(%rbp)
movq -16(%rbp), %rdi
callq print_int
\end{lstlisting}
\end{transformation}
\fi}

\racket{
The \code{assign\_homes} pass should replace all variables
Expand Down

0 comments on commit 3c65a9e

Please sign in to comment.