defs.tex 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. \newcommand{\LangInt}{\ensuremath{R_{\ttm{Int}}}} % R0
  3. \newcommand{\LangVar}{\ensuremath{R_{\ttm{Var}}}} % R1
  4. \newcommand{\LangCVar}{\ensuremath{C_{\ttm{Var}}}} % C0
  5. \newcommand{\LangVarANF}{\ensuremath{R^{\mathsf{ANF}}_{\ttm{Var}}}}
  6. \newcommand{\LangIf}{\ensuremath{R_{\ttm{If}}}} %R2
  7. \newcommand{\LangCIf}{\ensuremath{C_{\ttm{If}}}} %C1
  8. \newcommand{\LangIfANF}{\ensuremath{R^{\mathsf{ANF}}_{\ttm{if}}}} %R2
  9. \newcommand{\LangVec}{\ensuremath{R_{\ttm{Vec}}}} %R3
  10. \newcommand{\LangStruct}{\ensuremath{R^{\ttm{Struct}}_{\ttm{Vec}}}} %R^s3
  11. \newcommand{\LangCVec}{\ensuremath{C_{\ttm{Vec}}}} %C2
  12. \newcommand{\LangVecANF}{\ensuremath{R^{\mathsf{ANF}}_{\ttm{Vec}}}} %R3
  13. \newcommand{\LangAlloc}{\ensuremath{R_{\ttm{Alloc}}}} %R3'
  14. \newcommand{\LangFun}{\ensuremath{R_{\ttm{Fun}}}} %R4
  15. \newcommand{\LangCFun}{\ensuremath{C_{\ttm{Fun}}}} %C3
  16. \newcommand{\LangFunANF}{\ensuremath{R^{\mathsf{ANF}}_{\ttm{Fun}}}} %R4
  17. \newcommand{\LangFunRef}{\ensuremath{R_{\ttm{FunRef}}}} %F1
  18. \newcommand{\LangFunRefAlloc}{\ensuremath{R^{\ttm{Alloc}}_{\ttm{FunRef}}}} %R'4
  19. \newcommand{\LangLam}{\ensuremath{R_\lambda}} %R5
  20. \newcommand{\LangCLam}{\ensuremath{C_{\ttm{Clos}}}} %C4
  21. \newcommand{\LangAny}{\ensuremath{R_{\ttm{Any}}}} %R6
  22. \newcommand{\LangAnyFunRef}{\ensuremath{R^{\ttm{FunRef}}_{\ttm{Any}}}} %R'6
  23. \newcommand{\LangAnyAlloc}{\ensuremath{R^{\ttm{Alloc}}_{\ttm{Any}}}} %R'6
  24. \newcommand{\LangCAny}{\ensuremath{C_{\ttm{Any}}}} %C5
  25. \newcommand{\LangDyn}{\ensuremath{R_{\ttm{Dyn}}}} %R7
  26. \newcommand{\LangDynFunRef}{\ensuremath{R^{\ttm{FunRef}}_{\ttm{Dyn}}}} %R'7
  27. \newcommand{\LangLoop}{\ensuremath{R_{\ttm{While}}}} %R8
  28. \newcommand{\LangLoopFunRef}{\ensuremath{R^{\ttm{FunRef}}_{\ttm{While}}}} %R'8
  29. \newcommand{\LangLoopAlloc}{\ensuremath{R^{\ttm{Alloc}}_{\ttm{While}}}} %R'8
  30. \newcommand{\LangCLoop}{\ensuremath{C_{\circlearrowleft}}} %C7
  31. \newcommand{\LangLoopANF}{\ensuremath{R^{\mathsf{ANF}}_{\ttm{While}}}} %R8
  32. %\newcommand{\LangArray}{\ensuremath{R^{\ttm{Vecof}}_{\ttm{While}}}} %R^s3
  33. \newcommand{\LangArray}{\ensuremath{R_{\ttm{Array}}}} %R^s3
  34. \newcommand{\LangGrad}{\ensuremath{R_{\ttm{?}}}} %R9
  35. \newcommand{\LangCast}{\ensuremath{R_{\ttm{cast}}}} %R9'
  36. \newcommand{\LangProxy}{\ensuremath{R_{\ttm{proxy}}}} %R8''
  37. \newcommand{\LangPVec}{\ensuremath{R_{\ttm{PVec}}}} %R8''
  38. \newcommand{\LangPVecFunRef}{\ensuremath{R^{\ttm{FunRef}}_{\ttm{PVec}}}} %R8''
  39. \newcommand{\LangPVecAlloc}{\ensuremath{R^{\ttm{Alloc}}_{\ttm{PVec}}}} %R8''
  40. \newcommand{\LangPoly}{\ensuremath{R_{\ttm{Poly}}}} %R10
  41. \newcommand{\LangInst}{\ensuremath{R_{\ttm{Inst}}}} %R'10
  42. \newcommand{\LangCLoopPVec}{\ensuremath{C^{\ttm{PVec}}_{\circlearrowleft}}} %Cp7
  43. \newcommand{\LangTuple}{\ensuremath{R_{\ttm{Tuple}}}}
  44. \newcommand{\LangCTuple}{\ensuremath{C_{\ttm{Tuple}}}}
  45. \newcommand{\LangXVar}{\ensuremath{\mathrm{x86}_{\ttm{Var}}}} % pseudo x86_0
  46. \newcommand{\LangXASTInt}{\ensuremath{\mathrm{x86}_{\ttm{Int}}}} % x86_0
  47. \newcommand{\LangXInt}{\ensuremath{\mathrm{x86}_{\ttm{Int}}}} %x86^{\dagger}_0
  48. \newcommand{\LangXASTIf}{\ensuremath{\mathrm{x86}_{\ttm{If}}}} %x86_1
  49. \newcommand{\LangXIf}{\ensuremath{\mathrm{x86}_{\ttm{If}}}} %x86^{\dagger}_1
  50. \newcommand{\LangXIfVar}{\ensuremath{\mathrm{x86}^{\ttm{Var}}_{\ttm{If}}}} %x86^{*}_1
  51. \newcommand{\LangXASTGlobal}{\ensuremath{\mathrm{x86}_{\ttm{Global}}}} %x86_2
  52. \newcommand{\LangXGlobal}{\ensuremath{\mathrm{x86}_{\ttm{Global}}}} %x86^{\dagger}_2
  53. \newcommand{\LangXGlobalVar}{\ensuremath{\mathrm{x86}^{\ttm{Var}}_{\ttm{Global}}}} %x86^{*}_2
  54. \newcommand{\LangXIndCall}{\ensuremath{\mathrm{x86}_{\ttm{callq*}}}} %x86_3
  55. \newcommand{\LangXIndCallVar}{\ensuremath{\mathrm{x86}^{\ttm{Var}}_{\ttm{callq*}}}} %x86^*_3
  56. \newcommand{\LangXAlloc}{\ensuremath{\mathrm{x86}_{\ttm{Alloc}}}}
  57. \newcommand{\LangXFun}{\ensuremath{\mathrm{x86}_{\ttm{Fun}}}}
  58. \newcommand{\itm}[1]{\ensuremath{\mathit{#1}}}
  59. \newcommand{\ttm}[1]{\ensuremath{\mathtt{#1}}}
  60. \newcommand{\Stmt}{\itm{stmt}}
  61. \newcommand{\Exp}{\itm{exp}}
  62. \newcommand{\Def}{\itm{def}}
  63. \newcommand{\Type}{\itm{type}}
  64. \newcommand{\FType}{\itm{ftype}}
  65. \newcommand{\Instr}{\itm{instr}}
  66. \newcommand{\Block}{\itm{block}}
  67. \newcommand{\Tail}{\itm{tail}}
  68. \newcommand{\Prog}{\itm{prog}}
  69. \newcommand{\Arg}{\itm{arg}}
  70. \newcommand{\Atm}{\itm{atm}}
  71. \newcommand{\Reg}{\itm{reg}}
  72. \newcommand{\Int}{\itm{int}}
  73. \newcommand{\Var}{\itm{var}}
  74. \newcommand{\Op}{\itm{op}}
  75. \newcommand{\key}[1]{\texttt{#1}}
  76. \newcommand{\code}[1]{\texttt{#1}}
  77. \newcommand{\LP}[0]{\key{(}}
  78. \newcommand{\RP}[0]{\key{)}}
  79. \newcommand{\LS}[0]{\key{[}}
  80. \newcommand{\RS}[0]{\key{]}}
  81. \newcommand{\INT}[1]{\key{(Int}\;#1\key{)}}
  82. \newcommand{\BOOL}[1]{\key{(Bool}\;#1\key{)}}
  83. \newcommand{\PRIM}[2]{\LP\key{Prim}~#1~\LP #2\RP\RP}
  84. \newcommand{\READ}{\key{(Prim}\;\code{read}\;\key{())}}
  85. \newcommand{\CREAD}{\key{(read)}}
  86. \newcommand{\NEG}[1]{\key{(Prim}\;\code{-}\;\code{(}#1\code{))}}
  87. \newcommand{\CNEG}[1]{\LP\key{-}~#1\RP}
  88. \newcommand{\PROGRAM}[2]{\LP\code{Program}\;#1\;#2\RP}
  89. \newcommand{\CPROGRAM}[2]{\LP\code{CProgram}\;#1\;#2\RP}
  90. \newcommand{\XPROGRAM}[2]{\LP\code{X86Program}\;#1\;#2\RP}
  91. \newcommand{\PROGRAMDEFSEXP}[3]{\code{(ProgramDefsExp}~#1~#2~#3\code{)}}
  92. \newcommand{\PROGRAMDEFS}[2]{\code{(ProgramDefs}~#1~#2\code{)}}
  93. \newcommand{\ADD}[2]{\key{(Prim}\;\code{+}\;\code{(}#1\;#2\code{))}}
  94. \newcommand{\CADD}[2]{\LP\key{+}~#1~#2\RP}
  95. \newcommand{\CMUL}[2]{\LP\key{*}~#1~#2\RP}
  96. \newcommand{\SUB}[2]{\key{(Prim}\;\code{-}\;\code{(}#1\;#2\code{))}}
  97. \newcommand{\CSUB}[2]{\LP\key{-}~#1~#2\RP}
  98. \newcommand{\CWHILE}[2]{\LP\key{while}~#1~#2\RP}
  99. \newcommand{\WHILE}[2]{\LP\key{WhileLoop}~#1~#2\RP}
  100. \newcommand{\CBEGIN}[2]{\LP\key{begin}~#1~#2\RP}
  101. \newcommand{\CMAKEVEC}[2]{\LP\key{make-vector}~#1~#2\RP}
  102. \newcommand{\BEGIN}[2]{\LP\key{Begin}~#1~#2\RP}
  103. \newcommand{\CSETBANG}[2]{\LP\key{set!}~#1~#2\RP}
  104. \newcommand{\SETBANG}[2]{\LP\key{SetBang}~#1~#2\RP}
  105. \newcommand{\AND}[2]{\key{(Prim}\;\code{and}\;\code{(}#1\;#2\code{))}}
  106. \newcommand{\OR}[2]{\key{(Prim}\;\code{or}\;\code{(}#1\;#2\code{))}}
  107. \newcommand{\NOT}[1]{\key{(Prim}\;\code{not}\;\code{(}#1\;\code{))}}
  108. \newcommand{\UNIOP}[2]{\key{(Prim}\;#1\;\code{(}#2\code{))}}
  109. \newcommand{\CUNIOP}[2]{\LP #1\;#2 \RP}
  110. \newcommand{\BINOP}[3]{\key{(Prim}\;#1\;\code{(}#2\;#3\code{))}}
  111. \newcommand{\CBINOP}[3]{\LP #1\;#2\;#3\RP}
  112. \newcommand{\CLET}[3]{\LP\key{let}~\LP\LS#1~#2\RS\RP~#3\RP}
  113. \newcommand{\CIF}[3]{\LP\key{if}~#1~#2~#3\RP}
  114. \newcommand{\VAR}[1]{\key{(Var}\;#1\key{)}}
  115. \newcommand{\LET}[3]{\key{(Let}~#1~#2~#3\key{)}}
  116. \newcommand{\IF}[3]{\key{(If}\,#1\;#2\;#3\key{)}}
  117. \newcommand{\CAST}[3]{\LP\key{Cast}~#1~#2~#3\RP}
  118. \newcommand{\VECTOR}[1]{\LP\key{Prim}\;\code{vector}\;\LP\;#1\RP\RP}
  119. \newcommand{\VECREF}[2]{\LP\key{Prim}\;\code{vector-ref}\;\LP\;#1\;#2\RP\RP}
  120. \newcommand{\VECSET}[3]{\LP\key{Prim}\;\code{vector-set!}\;\LP\;#1\;#2\;#3\RP\RP}
  121. \newcommand{\VECLEN}[1]{\LP\key{Prim}\;\code{vector-length}\;\LP\;#1\RP\RP}
  122. \newcommand{\ANYVECREF}[2]{\LP\key{Prim}\;\code{any-vector-ref}\;\LP\;#1\;#2\RP\RP}
  123. \newcommand{\ANYVECSET}[3]{\LP\key{Prim}\;\code{any-vector-set!}\;\LP\;#1\;#2\;#3\RP\RP}
  124. \newcommand{\ANYVECLEN}[1]{\LP\key{Prim}\;\code{any-vector-length}\;\LP\;#1\RP\RP}
  125. \newcommand{\CLOSURE}[2]{\LP\key{Closure}~#1~#2\RP}
  126. \newcommand{\ALLOC}[2]{\LP\key{Allocate}~#1~#2\RP}
  127. \newcommand{\ALLOCCLOS}[3]{\LP\key{AllocateClosure}~#1~#2~#3\RP}
  128. \newcommand{\VOID}[1]{\key{(Void)}}
  129. \newcommand{\APPLY}[2]{\key{(Apply}\;#1\;#2\code{)}}
  130. \newcommand{\CALL}[2]{\key{(Call}\;#1\;#2\code{)}}
  131. \newcommand{\TAILCALL}[2]{\key{(TailCall}\;#1\;#2\code{)}}
  132. \newcommand{\FUNDEF}[5]{\key{(Def}~#1~#2~#3~#4~#5\code{)}}
  133. \newcommand{\FUNREF}[1]{\key{(FunRef}\;#1\code{)}}
  134. \newcommand{\CFUNREF}[1]{\key{(fun-ref}\;#1\code{)}}
  135. \newcommand{\FUNREFARITY}[2]{\key{(FunRefArity}~#1~#2\code{)}}
  136. \newcommand{\CFUNREFARITY}[2]{\key{(fun-ref-arity}~#1~#2\code{)}}
  137. \newcommand{\LAMBDA}[3]{\key{(Lambda}~#1~#2~#3\code{)}}
  138. \newcommand{\CLAMBDA}[3]{\LP\key{lambda:}\,#1\,\key{:}\,#2\;\Exp\RP}
  139. \newcommand{\CGLAMBDA}[3]{\LP\key{lambda:}\,#1\,#2\;\Exp\RP}
  140. \newcommand{\INJECT}[2]{\LP\key{Inject}~#1~#2\RP}
  141. \newcommand{\PROJECT}[2]{\LP\key{Project}~#1~#2\RP}
  142. \newcommand{\CINJECT}[2]{\LP\key{inject}~#1~#2\RP}
  143. \newcommand{\CPROJECT}[2]{\LP\key{project}~#1~#2\RP}
  144. \newcommand{\VALUEOF}[2]{\LP\key{ValueOf}~#1~#2\RP}
  145. \newcommand{\ASSIGN}[2]{\key{(Assign}~#1\;#2\key{)}}
  146. \newcommand{\RETURN}[1]{\key{(Return}~#1\key{)}}
  147. \newcommand{\SEQ}[2]{\key{(Seq}~#1~#2\key{)}}
  148. \newcommand{\GOTO}[1]{\key{(Goto}~#1\key{)}}
  149. \newcommand{\IFSTMT}[3]{\key{(IfStmt}\,#1\;#2\;#3\key{)}}
  150. \newcommand{\IMM}[1]{\key{(Imm}\;#1\key{)}}
  151. \newcommand{\REG}[1]{\key{(Reg}\;#1\key{)}}
  152. \newcommand{\BYTEREG}[1]{\key{(ByteReg}\;#1\key{)}}
  153. \newcommand{\DEREF}[2]{\key{(Deref}~#1~#2\key{)}}
  154. \newcommand{\DEF}[5]{\LP\key{Def}~#1~#2~#3~#4~#5\RP}
  155. \newcommand{\CDEF}[4]{\LP\key{define}~\LP#1~#2\RP\,\key{:}\,#3~#4\RP}
  156. \newcommand{\CGDEF}[4]{\LP\key{define}~\LP#1~#2\RP\,#3~#4\RP}
  157. \newcommand{\DECL}[2]{\LP\key{Decl}~#1~#2\RP}
  158. \newcommand{\INST}[3]{\LP\key{Inst}~#1~#2~#3\RP}
  159. \newcommand{\CFG}[1]{\key{(CFG}\;#1\key{)}}
  160. \newcommand{\BLOCK}[2]{\key{(Block}\;#1\;#2\key{)}}
  161. \newcommand{\STACKLOC}[1]{(\key{stack}\;#1)}
  162. \newcommand{\BININSTR}[3]{\key{(Instr}\;#1\;\key{(}\;#2\;#3\key{))}}
  163. \newcommand{\UNIINSTR}[2]{\key{(Instr}\;#1\;\key{(}\;#2\key{))}}
  164. \newcommand{\CALLQ}[2]{\key{(Callq}~#1~#2\key{)}}
  165. \newcommand{\INDCALLQ}[2]{\key{(IndirectCallq}~#1~#2\key{)}}
  166. \newcommand{\RETQ}{\key{(Retq)}}
  167. \newcommand{\PUSHQ}[1]{\key{(Pushq}~#1\key{)}}
  168. \newcommand{\POPQ}[1]{\key{(Popq}~#1\key{)}}
  169. \newcommand{\JMP}[1]{\key{(Jmp}~#1\key{)}}
  170. \newcommand{\TAILJMP}[2]{\key{(TailJmp}~#1~#2\key{)}}
  171. \newcommand{\JMPIF}[2]{\key{(JmpIf}~#1~#2\key{)}}
  172. \newcommand{\TTKEY}[1]{{\normalfont\tt #1}}