Ver Fonte

fix output of select instructions in chapter 2 example

Jeremy G. Siek há 7 meses atrás
pai
commit
3c65a9e64c
1 ficheiros alterados com 23 adições e 3 exclusões
  1. 23 3
      book.tex

+ 23 - 3
book.tex

@@ -3958,9 +3958,11 @@ section~\ref{sec:remove-complex-opera-Lvar}:\\
 \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
@@ -3975,6 +3977,24 @@ movq -8(%rbp), -16(%rbp)
 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