%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\itm}[1]{\ensuremath{\mathit{#1}}} \newcommand{\ttm}[1]{\ensuremath{\text{\texttt{#1}}}} \newcommand{\LangInt}{\ensuremath{R_{\mathsf{Int}}}} % R0 \newcommand{\LangVar}{$R_{\mathsf{Var}}$} % R1 \newcommand{\LangVarM}{R_{\mathsf{Var}}} \newcommand{\LangCVar}{$C_{\mathsf{Var}}$} % C0 \newcommand{\LangCVarM}{C_{\mathsf{Var}}} % C0 \newcommand{\LangVarANF}{\ensuremath{R^{\mathsf{ANF}}_{\mathsf{Var}}}} \newcommand{\LangVarANFM}{R^{\mathsf{ANF}}_{\mathsf{Var}}} \newcommand{\LangIf}{$R_{\mathsf{If}}$} %R2 \newcommand{\LangIfM}{\ensuremath{R_{\mathsf{If}}}} %R2 \newcommand{\LangCIf}{$C_{\mathsf{If}}$} %C1 \newcommand{\LangCIfM}{\ensuremath{C_{\mathsf{If}}}} %C1 \newcommand{\LangIfANF}{\ensuremath{R^{\mathsf{ANF}}_{\mathsf{if}}}} %R2 \newcommand{\LangVec}{$R_{\mathsf{Vec}}$} %R3 \newcommand{\LangVecM}{R_{\mathsf{Vec}}} %R3 \newcommand{\LangStruct}{\ensuremath{R^{\mathsf{Struct}}_{\mathsf{Vec}}}} %R^s3 \newcommand{\LangCVec}{$C_{\mathsf{Vec}}$} %C2 \newcommand{\LangCVecM}{C_{\mathsf{Vec}}} %C2 \newcommand{\LangVecANF}{\ensuremath{R^{\mathsf{ANF}}_{\mathsf{Vec}}}} %R3 \newcommand{\LangVecANFM}{R^{\mathsf{ANF}}_{\mathsf{Vec}}} %R3 \newcommand{\LangAlloc}{\ensuremath{R_{\mathsf{Alloc}}}} %R3' \newcommand{\LangFun}{$R_{\mathsf{Fun}}$} %R4 \newcommand{\LangFunM}{R_{\mathsf{Fun}}} %R4 \newcommand{\LangCFun}{$C_{\mathsf{Fun}}$} %C3 \newcommand{\LangCFunM}{C_{\mathsf{Fun}}} %C3 \newcommand{\LangFunANF}{\ensuremath{R^{\mathsf{ANF}}_{\mathsf{Fun}}}} %R4 \newcommand{\LangFunRef}{$R_{\mathsf{FunRef}}$} %F1 \newcommand{\LangFunRefM}{R_{\mathsf{FunRef}}} %F1 \newcommand{\LangFunRefAlloc}{\ensuremath{R^{\mathsf{Alloc}}_{\mathsf{FunRef}}}} %R'4 \newcommand{\LangLam}{$R_\lambda$} %R5 \newcommand{\LangLamM}{\ensuremath{R_\lambda}} %R5 \newcommand{\LangCLam}{$C_{\mathsf{Clos}}$} %C4 \newcommand{\LangCLamM}{C_{\mathsf{Clos}}} %C4 \newcommand{\LangAny}{$R_{\mathsf{Any}}$} %R6 \newcommand{\LangAnyM}{R_{\mathsf{Any}}} %R6 \newcommand{\LangAnyFunRef}{\ensuremath{R^{\mathsf{FunRef}}_{\mathsf{Any}}}} %R'6 \newcommand{\LangAnyAlloc}{\ensuremath{R^{\mathsf{Alloc}}_{\mathsf{Any}}}} %R'6 \newcommand{\LangCAny}{$C_{\mathsf{Any}}$} %C5 \newcommand{\LangCAnyM}{C_{\mathsf{Any}}} %C5 \newcommand{\LangDyn}{$R_{\mathsf{Dyn}}$} %R7 \newcommand{\LangDynM}{R_{\mathsf{Dyn}}} %R7 \newcommand{\LangDynFunRef}{\ensuremath{R^{\mathsf{FunRef}}_{\mathsf{Dyn}}}} %R'7 \newcommand{\LangLoop}{$R_{\mathsf{While}}$} %R8 \newcommand{\LangLoopM}{R_{\mathsf{While}}} %R8 \newcommand{\LangLoopFunRef}{\ensuremath{R^{\mathsf{FunRef}}_{\mathsf{While}}}} %R'8 \newcommand{\LangLoopAlloc}{\ensuremath{R^{\mathsf{Alloc}}_{\mathsf{While}}}} %R'8 \newcommand{\LangCLoop}{$C_{\circlearrowleft}$} %C7 \newcommand{\LangCLoopM}{C_{\circlearrowleft}} %C7 \newcommand{\LangLoopANF}{\ensuremath{R^{\mathsf{ANF}}_{\mathsf{While}}}} %R8 \newcommand{\LangArray}{\ensuremath{R^{\mathsf{Vecof}}_{\mathsf{While}}}} %R^s3 \newcommand{\LangGrad}{$R_{\mathsf{?}}$} %R9 \newcommand{\LangGradM}{R_{\mathsf{?}}} %R9 \newcommand{\LangCast}{$R_{\mathsf{cast}}$} %R9' \newcommand{\LangCastM}{R_{\mathsf{cast}}} %R9' \newcommand{\LangProxy}{\ensuremath{R_{\mathsf{proxy}}}} %R8'' \newcommand{\LangPVec}{\ensuremath{R_{\mathsf{PVec}}}} %R8'' \newcommand{\LangPVecFunRef}{\ensuremath{R^{\mathsf{FunRef}}_{\mathsf{PVec}}}} %R8'' \newcommand{\LangPVecAlloc}{\ensuremath{R^{\mathsf{Alloc}}_{\mathsf{PVec}}}} %R8'' \newcommand{\LangPoly}{\ensuremath{R_{\mathsf{Poly}}}} %R10 \newcommand{\LangInst}{\ensuremath{R_{\mathsf{Inst}}}} %R'10 \newcommand{\LangCLoopPVec}{\ensuremath{C^{\mathsf{PVec}}_{\circlearrowleft}}} %Cp7 \newcommand{\LangXVar}{\ensuremath{\mathrm{x86}_{\mathsf{Var}}}} % pseudo x86_0 \newcommand{\LangXASTInt}{\ensuremath{\mathrm{x86}_{\mathsf{Int}}}} % x86_0 \newcommand{\LangXInt}{$\mathrm{x86}_{\mathsf{Int}}$} %x86^{\dagger}_0 \newcommand{\LangXIntM}{\mathrm{x86}_{\mathsf{Int}}} %x86^{\dagger}_0 \newcommand{\LangXASTIf}{\ensuremath{\mathrm{x86}_{\mathsf{If}}}} %x86_1 \newcommand{\LangXIf}{$\mathrm{x86}_{\mathsf{If}}$} %x86^{\dagger}_1 \newcommand{\LangXIfM}{\mathrm{x86}_{\mathsf{If}}} %x86^{\dagger}_1 \newcommand{\LangXIfVar}{\ensuremath{\mathrm{x86}^{\mathsf{Var}}_{\mathsf{If}}}} %x86^{*}_1 \newcommand{\LangXASTGlobal}{\ensuremath{\mathrm{x86}_{\mathsf{Global}}}} %x86_2 \newcommand{\LangXGlobal}{$\mathrm{x86}_{\mathsf{Global}}$} %x86^{\dagger}_2 \newcommand{\LangXGlobalM}{\mathrm{x86}_{\mathsf{Global}}} %x86^{\dagger}_2 \newcommand{\LangXGlobalVar}{\ensuremath{\mathrm{x86}^{\mathsf{Var}}_{\mathsf{Global}}}} %x86^{*}_2 \newcommand{\LangXIndCall}{$\mathrm{x86}_{\mathsf{callq*}}$} %x86_3 \newcommand{\LangXIndCallM}{\mathrm{x86}_{\mathsf{callq*}}} %x86_3 \newcommand{\LangXIndCallVar}{\ensuremath{\mathrm{x86}^{\mathsf{Var}}_{\mathsf{callq*}}}} %x86^*_3 \newcommand{\Stmt}{\itm{stmt}} \newcommand{\Exp}{\itm{exp}} \newcommand{\Def}{\itm{def}} \newcommand{\Type}{\itm{type}} \newcommand{\FType}{\itm{ftype}} \newcommand{\Instr}{\itm{instr}} \newcommand{\Block}{\itm{block}} \newcommand{\Tail}{\itm{tail}} \newcommand{\Prog}{\itm{prog}} \newcommand{\Arg}{\itm{arg}} \newcommand{\Atm}{\itm{atm}} \newcommand{\Reg}{\itm{reg}} \newcommand{\Int}{\itm{int}} \newcommand{\Var}{\itm{var}} \newcommand{\Op}{\itm{op}} \newcommand{\key}[1]{\texttt{#1}} \newcommand{\code}[1]{\texttt{#1}} \newcommand{\LP}[0]{\key{(}} \newcommand{\RP}[0]{\key{)}} \newcommand{\LS}[0]{\key{[}} \newcommand{\RS}[0]{\key{]}} \newcommand{\INT}[1]{\key{(Int}~#1\key{)}} \newcommand{\BOOL}[1]{\key{(Bool}~#1\key{)}} \newcommand{\PRIM}[2]{\LP\key{Prim}~#1~\LP #2\RP\RP} \newcommand{\READ}{\key{(Prim}~\code{read}~\key{())}} \newcommand{\CREAD}{\key{(read)}} \newcommand{\NEG}[1]{\key{(Prim}~\code{-}~\code{(}#1\code{))}} \newcommand{\CNEG}[1]{\LP\key{-}~#1\RP} \newcommand{\PROGRAM}[2]{\LP\code{Program}~#1~#2\RP} \newcommand{\CPROGRAM}[2]{\LP\code{CProgram}~#1~#2\RP} \newcommand{\XPROGRAM}[2]{\LP\code{X86Program}~#1~#2\RP} \newcommand{\PROGRAMDEFSEXP}[3]{\code{(ProgramDefsExp}~#1~#2~#3\code{)}} \newcommand{\PROGRAMDEFS}[2]{\code{(ProgramDefs}~#1~#2\code{)}} \newcommand{\ADD}[2]{\key{(Prim}~\code{+}~\code{(}#1~#2\code{))}} \newcommand{\CADD}[2]{\LP\key{+}~#1~#2\RP} \newcommand{\CMUL}[2]{\LP\key{*}~#1~#2\RP} \newcommand{\SUB}[2]{\key{(Prim}~\code{-}~\code{(}#1~#2\code{))}} \newcommand{\CSUB}[2]{\LP\key{-}~#1~#2\RP} \newcommand{\CWHILE}[2]{\LP\key{while}~#1~#2\RP} \newcommand{\WHILE}[2]{\LP\key{WhileLoop}~#1~#2\RP} \newcommand{\CBEGIN}[2]{\LP\key{begin}~#1~#2\RP} \newcommand{\CMAKEVEC}[2]{\LP\key{make-vector}~#1~#2\RP} \newcommand{\BEGIN}[2]{\LP\key{Begin}~#1~#2\RP} \newcommand{\CSETBANG}[2]{\LP\key{set!}~#1~#2\RP} \newcommand{\SETBANG}[2]{\LP\key{SetBang}~#1~#2\RP} \newcommand{\AND}[2]{\key{(Prim}~\code{and}~\code{(}#1~#2\code{))}} \newcommand{\OR}[2]{\key{(Prim}~\code{or}~\code{(}#1~#2\code{))}} \newcommand{\NOT}[1]{\key{(Prim}~\code{not}~\code{(}#1~\code{))}} \newcommand{\UNIOP}[2]{\key{(Prim}~#1~\code{(}#2\code{))}} \newcommand{\CUNIOP}[2]{\LP #1~#2 \RP} \newcommand{\BINOP}[3]{\key{(Prim}~#1~\code{(}#2~#3\code{))}} \newcommand{\CBINOP}[3]{\LP #1~#2~#3\RP} \newcommand{\CLET}[3]{\LP\key{let}~\LP\LS#1~#2\RS\RP~#3\RP} \newcommand{\CIF}[3]{\LP\key{if}~#1~#2~#3\RP} \newcommand{\VAR}[1]{\key{(Var}~#1\key{)}} \newcommand{\LET}[3]{\key{(Let}~#1~#2~#3\key{)}} \newcommand{\IF}[3]{\key{(If}\,#1~#2~#3\key{)}} \newcommand{\CAST}[3]{\LP\key{Cast}~#1~#2~#3\RP} \newcommand{\VECTOR}[1]{\LP\key{Prim}~\code{vector}~\LP~#1\RP\RP} \newcommand{\VECREF}[2]{\LP\key{Prim}~\code{vector-ref}~\LP~#1~#2\RP\RP} \newcommand{\VECSET}[3]{\LP\key{Prim}~\code{vector-set!}~\LP~#1~#2~#3\RP\RP} \newcommand{\VECLEN}[1]{\LP\key{Prim}~\code{vector-length}~\LP~#1\RP\RP} \newcommand{\ANYVECREF}[2]{\LP\key{Prim}~\code{any-vector-ref}~\LP~#1~#2\RP\RP} \newcommand{\ANYVECSET}[3]{\LP\key{Prim}~\code{any-vector-set!}~\LP~#1~#2~#3\RP\RP} \newcommand{\ANYVECLEN}[1]{\LP\key{Prim}~\code{any-vector-length}~\LP~#1\RP\RP} \newcommand{\CLOSURE}[2]{\LP\key{Closure}~#1~#2\RP} \newcommand{\ALLOC}[2]{\LP\key{Allocate}~#1~#2\RP} \newcommand{\ALLOCCLOS}[3]{\LP\key{AllocateClosure}~#1~#2~#3\RP} \newcommand{\VOID}[1]{\key{(Void)}} \newcommand{\APPLY}[2]{\key{(Apply}~#1~#2\code{)}} \newcommand{\CALL}[2]{\key{(Call}~#1~#2\code{)}} \newcommand{\TAILCALL}[2]{\key{(TailCall}~#1~#2\code{)}} \newcommand{\FUNDEF}[5]{\key{(Def}~#1~#2~#3~#4~#5\code{)}} \newcommand{\FUNREF}[1]{\key{(FunRef}~#1\code{)}} \newcommand{\CFUNREF}[1]{\key{(fun-ref}~#1\code{)}} \newcommand{\FUNREFARITY}[2]{\key{(FunRefArity}~#1~#2\code{)}} \newcommand{\CFUNREFARITY}[2]{\key{(fun-ref-arity}~#1~#2\code{)}} \newcommand{\LAMBDA}[3]{\key{(Lambda}~#1~#2~#3\code{)}} \newcommand{\CLAMBDA}[3]{\LP\key{lambda:}\,#1\,\key{:}\,#2~\Exp\RP} \newcommand{\CGLAMBDA}[3]{\LP\key{lambda:}\,#1\,#2~\Exp\RP} \newcommand{\INJECT}[2]{\LP\key{Inject}~#1~#2\RP} \newcommand{\PROJECT}[2]{\LP\key{Project}~#1~#2\RP} \newcommand{\CINJECT}[2]{\LP\key{inject}~#1~#2\RP} \newcommand{\CPROJECT}[2]{\LP\key{project}~#1~#2\RP} \newcommand{\VALUEOF}[2]{\LP\key{ValueOf}~#1~#2\RP} \newcommand{\ASSIGN}[2]{\key{(Assign}~#1~#2\key{)}} \newcommand{\RETURN}[1]{\key{(Return}~#1\key{)}} \newcommand{\SEQ}[2]{\key{(Seq}~#1~#2\key{)}} \newcommand{\GOTO}[1]{\key{(Goto}~#1\key{)}} \newcommand{\IFSTMT}[3]{\key{(IfStmt}\,#1~#2~#3\key{)}} \newcommand{\IMM}[1]{\key{(Imm}~#1\key{)}} \newcommand{\REG}[1]{\key{(Reg}~#1\key{)}} \newcommand{\BYTEREG}[1]{\key{(ByteReg}~#1\key{)}} \newcommand{\DEREF}[2]{\key{(Deref}~#1~#2\key{)}} \newcommand{\DEF}[5]{\LP\key{Def}~#1~#2~#3~#4~#5\RP} \newcommand{\CDEF}[4]{\LP\key{define}~\LP#1~#2\RP\,\key{:}\,#3~#4\RP} \newcommand{\CGDEF}[4]{\LP\key{define}~\LP#1~#2\RP\,#3~#4\RP} \newcommand{\DECL}[2]{\LP\key{Decl}~#1~#2\RP} \newcommand{\INST}[3]{\LP\key{Inst}~#1~#2~#3\RP} \newcommand{\CFG}[1]{\key{(CFG}~#1\key{)}} \newcommand{\BLOCK}[2]{\key{(Block}~#1~#2\key{)}} \newcommand{\STACKLOC}[1]{(\key{stack}~#1)} \newcommand{\BININSTR}[3]{\key{(Instr}~#1~\key{(}~#2~#3\key{))}} \newcommand{\UNIINSTR}[2]{\key{(Instr}~#1~\key{(}~#2\key{))}} \newcommand{\CALLQ}[2]{\key{(Callq}~#1~#2\key{)}} \newcommand{\INDCALLQ}[2]{\key{(IndirectCallq}~#1~#2\key{)}} \newcommand{\RETQ}{\key{(Retq)}} \newcommand{\PUSHQ}[1]{\key{(Pushq}~#1\key{)}} \newcommand{\POPQ}[1]{\key{(Popq}~#1\key{)}} \newcommand{\JMP}[1]{\key{(Jmp}~#1\key{)}} \newcommand{\TAILJMP}[2]{\key{(TailJmp}~#1~#2\key{)}} \newcommand{\JMPIF}[2]{\key{(JmpIf}~#1~#2\key{)}} \newcommand{\TTKEY}[1]{{\normalfont\tt #1}} \newenvironment{transformation}{ \newcommand{\compilesto}{% \end{minipage}&$\Rightarrow$&\begin{minipage}{0.4\textwidth}} \begin{center}\begin{tabular}{lll}\begin{minipage}{0.4\textwidth} }{% \end{minipage}\end{tabular}\end{center}% }