Преглед изворни кода

change x86 abstract syntax to the one found in support code (python)

kcaliban пре 3 година
родитељ
комит
fa6e1e416a
2 измењених фајлова са 8 додато и 7 уклоњено
  1. 5 4
      book.tex
  2. 3 3
      defs.tex

+ 5 - 4
book.tex

@@ -25,7 +25,7 @@
 
 \def\racketEd{0}
 \def\pythonEd{1}
-\def\edition{0}
+\def\edition{1}
 
 % material that is specific to the Racket edition of the book
 \newcommand{\racket}[1]{{\if\edition\racketEd{#1}\fi}}
@@ -2576,8 +2576,8 @@ register allocation (Chapter~\ref{ch:register-allocation-Lvar}).
        \MID \BININSTR{\code{subq}}{\Arg}{\Arg} \\
        &\MID& \BININSTR{\code{movq}}{\Arg}{\Arg}
        \MID \UNIINSTR{\code{negq}}{\Arg}\\
-       &\MID& \CALLQ{\itm{label}}{\itm{int}} \MID \RETQ{} 
-       \MID \PUSHQ{\Arg} \MID \POPQ{\Arg} \MID \JMP{\itm{label}} \\
+       &\MID& \PUSHQ{\Arg} \MID \POPQ{\Arg}\\
+       &\MID& \CALLQ{\itm{label}}{\itm{int}} \MID \RETQ{} \MID \JMP{\itm{label}} \\
 \LangXIntM{} &::= & \XPROGRAM{}{\Instr^{*}}{}
 \end{array}
 \]
@@ -7420,7 +7420,8 @@ $\Atm$.
        &\MID& \gray{ \BININSTR{\code{movq}}{\Arg}{\Arg} 
        \MID \UNIINSTR{\code{negq}}{\Arg} } \\
        &\MID& \gray{ \CALLQ{\itm{label}}{\itm{int}} \MID \RETQ{} 
-       \MID \PUSHQ{\Arg} \MID \POPQ{\Arg} \MID \racket{\JMP{\itm{label}}} } \python{\JMP{\itm{label}}}\\
+       \MID \PUSHQ{\Arg}} \\
+       &\MID& \gray{ \POPQ{\Arg} \MID \racket{\JMP{\itm{label}}} } \python{\JMP{\itm{label}}}\\
        &\MID& \BININSTR{\code{xorq}}{\Arg}{\Arg}
        \MID \BININSTR{\code{cmpq}}{\Arg}{\Arg}\\
        &\MID& \BININSTR{\code{set}}{\itm{cc}}{\Arg} 

+ 3 - 3
defs.tex

@@ -319,14 +319,14 @@
 \if\edition\pythonEd
 \newcommand{\TAILJMP}[2]{\key{TailJmp}\LP#1\code{, }#2\RP}
 \newcommand{\INDCALLQ}[2]{\key{IndirectCallq}\LP#1\code{, }#2\RP}
-\newcommand{\IMM}[1]{\key{Constant}\LP #1\RP}
+\newcommand{\IMM}[1]{\key{Immediate}\LP #1\RP}
 \newcommand{\REG}[1]{\key{Reg}\LP #1\RP}
 \newcommand{\DEREF}[2]{\key{Deref}\LP #1 \key{,} #2 \RP}
 \newcommand{\BININSTR}[3]{\key{Instr}\LP #1 \key{,} \LS #2 \key{,} #3 \RS \RP}
 \newcommand{\UNIINSTR}[2]{\key{Instr}\LP #1 \key{,} \LS #2 \RS \RP}
 \newcommand{\CALLQ}[2]{\key{Callq}\LP #1 \key{,} #2 \RP}
-\newcommand{\PUSHQ}[1]{\key{Pushq}\LP #1 \RP}
-\newcommand{\POPQ}[1]{\key{Popq}\LP #1 \RP}
+\newcommand{\PUSHQ}[1]{\key{Instr}\LP \code{pushq} \key{,} \LS #1 \RS \RP}
+\newcommand{\POPQ}[1]{\key{Instr}\LP \code{popq} \key{,} \LS #1 \RS \RP}
 \newcommand{\JMP}[1]{\key{Jump}\LP #1 \RP}
 \newcommand{\JMPIF}[2]{\key{JumpIf}\LP #1 \key{,} #2 \RP}
 \newcommand{\RETQ}{\key{Retq}\LP\RP}