فهرست منبع

Merge branch 'master' of https://github.com/Compiler-Construction-Uni-Freiburg/Essentials-of-Compilation

Peter Thiemann 3 سال پیش
والد
کامیت
3fa20deec7
1فایلهای تغییر یافته به همراه17 افزوده شده و 14 حذف شده
  1. 17 14
      book.tex

+ 17 - 14
book.tex

@@ -10502,10 +10502,11 @@ generate better code by taking this fact into account.
 
 The output language of \code{explicate\_control} is \LangCLoop{}
 (Figure~\ref{fig:c7-syntax}), which is nearly identical to
-\LangCLam{}. The only syntactic difference is that \code{Call} and
-\code{read} may also appear as statements.  The most significant
-difference between \LangCLam{} and \LangCLoop{} is that the
-control-flow graphs of the later may contain cycles.
+\LangCIf{}. The only syntactic difference is that
+\code{read} may also appear as a statement.  The most significant
+difference between programs in \LangCIf{} and programs in \LangCLoop{},
+generated by the passes of the compiler,
+is that the control-flow graphs of the later may contain cycles.
 
 \begin{figure}[tp]
 \fbox{
@@ -11941,8 +11942,11 @@ movq |$\itm{rhs}'$|, |$8(n+1)$|(%r11)
 \fi}
 \end{minipage}
 \end{center}
-The $\itm{lhs}'$, $\itm{tup}'$, and $\itm{rhs}'$ are obtained by
-translating $\itm{tup}$ and $\itm{rhs}$ to x86.  The move of $\itm{tup}'$ to
+\racket{The $\itm{lhs}'$, $\itm{tup}'$, and $\itm{rhs}'$}
+\python{The $\itm{tup}'$ and $\itm{rhs}'$}
+are obtained by translating from \LangCVec{} to x86.
+%
+The move of $\itm{tup}'$ to
 register \code{r11} ensures that offset expression
 \code{$-8(n+1)$(\%r11)} contains a register operand.  This requires
 removing \code{r11} from consideration by the register allocating.
@@ -11952,7 +11956,6 @@ Why not use \code{rax} instead of \code{r11}? Suppose we instead used
 \begin{lstlisting}
 movq |$\itm{tup}'$|, %rax
 movq |$\itm{rhs}'$|, |$8(n+1)$|(%rax)
-movq $0, |$\itm{lhs}'$|
 \end{lstlisting}
 Next, suppose that $\itm{rhs}'$ ends up as a stack location, so
 \code{patch\_instructions} would insert a move through \code{rax}
@@ -11961,7 +11964,6 @@ as follows.
 movq |$\itm{tup}'$|, %rax
 movq |$\itm{rhs}'$|, %rax
 movq %rax, |$8(n+1)$|(%rax)
-movq $0, |$\itm{lhs}'$|
 \end{lstlisting}
 But the above sequence of instructions does not work because we're
 trying to use \code{rax} for two different values ($\itm{tup}'$ and
@@ -12056,7 +12058,7 @@ available for use by the register allocator.
 \begin{array}{lcl}
   \Arg &::=& \gray{ \key{\$}\Int \MID \key{\%}\Reg \MID \Int\key{(}\key{\%}\Reg\key{)} \MID \key{\%}\itm{bytereg} } \MID \Var \key{(\%rip)} \\
 \LangXGlobalM{} &::= & \gray{ \key{.globl main} }\\
-      &    & \gray{ \key{main:} \; \Instr\ldots }
+      &    & \gray{ \key{main:} \; \Instr^{*} }
 \end{array}
 \]
 \end{minipage}
@@ -13962,8 +13964,8 @@ appropriate explicate functions for the various contexts.
 \Exp &::= & \FUNREF{\itm{label}} \MID \CALL{\Atm}{\Atm^{*}} \\
 \Stmt &::= & \TAILCALL{\Atm}{\Atm^{*}} \\
 \Params &::=& \LS\LP\Var\key{,}\Type\RP\code{,}\ldots\RS \\
-\Block &::=& \Stmt^{*} \\
-\Blocks &::=& \LC\itm{label}\key{:}\Block\code{,}\ldots\RC \\
+\Block &::=& \itm{label}\key{:} \Stmt^{*} \\
+\Blocks &::=& \LC\Block\code{,}\ldots\RC \\
 \Def &::=& \DEF{\itm{label}}{\Params}{\Blocks}{\key{None}}{\Type}{\key{None}} 
 \end{array}
 }
@@ -14025,8 +14027,7 @@ language, whose syntax is defined in Figure~\ref{fig:x86-3}.
      \MID \key{callq}\;\key{*}\Arg \MID \key{tailjmp}\;\Arg 
      \MID \key{leaq}\;\Arg\key{,}\;\key{\%}\Reg \\
 \Block &::= & \itm{label}\key{:}\, \Instr^{*} \\
-\Blocks &::=& \Block^* \\
-\Def &::= & \key{.globl}\,\itm{label}\; \Blocks \\ % \LP\key{define} \; \LP\itm{label} \RP \; \Blocks \RP\\
+\Def &::= & \key{.globl}\,\itm{label}\; \Block^{*} \\
 \LangXIndCallM{} &::= & \Def\ldots
 \end{array}
 \]
@@ -14064,7 +14065,9 @@ language, whose syntax is defined in Figure~\ref{fig:x86-3}.
   \Instr &::=& \ldots \MID \INDCALLQ{\Arg}{\itm{int}}
     \MID \TAILJMP{\Arg}{\itm{int}}\\
     &\MID& \BININSTR{\scode{leaq}}{\Arg}{\REG{\Reg}}\\
-  \Def &::= & \DEF{\itm{label}}{\LS\RS}{\LC\itm{label}\key{:}\,\Instr^{*}\code{,}\ldots\RC}{\_}{\Type}{\_} \\
+  \Block &::=&\itm{label}\key{:}\,\Instr^{*} \\
+  \Blocks &::= & \LC\Block\code{,}\ldots\RC\\
+  \Def &::= & \DEF{\itm{label}}{\LS\RS}{\Blocks}{\_}{\Type}{\_} \\
 \LangXIndCallM{} &::= & \XPROGRAMDEFS{\LS\Def\code{,}\ldots\RS}
 \end{array}
 \]