about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--html/mu_instructions.html248
1 files changed, 248 insertions, 0 deletions
diff --git a/html/mu_instructions.html b/html/mu_instructions.html
new file mode 100644
index 00000000..d986552a
--- /dev/null
+++ b/html/mu_instructions.html
@@ -0,0 +1,248 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<title>~/Attic/Repos/mu/mu_instructions.html</title>
+<meta name="Generator" content="Vim/8.1">
+<meta name="plugin-version" content="vim8.1_v1">
+<meta name="syntax" content="none">
+<meta name="settings" content="use_css,no_foldcolumn,expand_tabs,prevent_copy=">
+<meta name="colorscheme" content="minimal-light">
+<style type="text/css">
+<!--
+pre { font-family: monospace; color: #000000; background-color: #c6c6c6; }
+body { font-family: monospace; color: #000000; background-color: #c6c6c6; }
+* { font-size: 1em; }
+.Comment { color: #005faf; }
+.Constant { color: #008787; }
+.Special { color: #ff6060; }
+.PreProc { color: #c000c0; }
+.SalientComment { color: #0000af; }
+-->
+</style>
+</head>
+<body>
+<pre id='vimCodeElement'>
+<span class="SalientComment">## Mu's instructions and their table-driven translation</span>
+
+Mu is a statement-oriented language. Blocks consist of flat lists of instructions.
+The following chart shows all the instruction forms supported by Mu, along
+with the instruction they're translated to. Variables of the form <span class="Constant">&quot;var/reg&quot;</span>
+live in a register, and other variables are assumed to live on the stack at
+some 'stack-offset' from ebp.
+
+<span class="PreProc">var</span>/<span class="Constant">eax</span> <span class="Special">&lt;-</span> increment              =&gt; <span class="Constant">&quot;40/increment-eax&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">ecx</span> <span class="Special">&lt;-</span> increment              =&gt; <span class="Constant">&quot;41/increment-ecx&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">edx</span> <span class="Special">&lt;-</span> increment              =&gt; <span class="Constant">&quot;42/increment-edx&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">ebx</span> <span class="Special">&lt;-</span> increment              =&gt; <span class="Constant">&quot;43/increment-ebx&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">esi</span> <span class="Special">&lt;-</span> increment              =&gt; <span class="Constant">&quot;46/increment-esi&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">edi</span> <span class="Special">&lt;-</span> increment              =&gt; <span class="Constant">&quot;47/increment-edi&quot;</span>
+increment <span class="PreProc">var</span>                     =&gt; <span class="Constant">&quot;ff 0/subop/increment *(ebp+&quot;</span> <span class="PreProc">var</span>.stack-offset <span class="Constant">&quot;)&quot;</span>
+increment *<span class="PreProc">var</span>/reg                =&gt; <span class="Constant">&quot;ff 0/subop/increment *&quot;</span> reg
+
+<span class="PreProc">var</span>/<span class="Constant">eax</span> <span class="Special">&lt;-</span> decrement              =&gt; <span class="Constant">&quot;48/decrement-eax&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">ecx</span> <span class="Special">&lt;-</span> decrement              =&gt; <span class="Constant">&quot;49/decrement-ecx&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">edx</span> <span class="Special">&lt;-</span> decrement              =&gt; <span class="Constant">&quot;4a/decrement-edx&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">ebx</span> <span class="Special">&lt;-</span> decrement              =&gt; <span class="Constant">&quot;4b/decrement-ebx&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">esi</span> <span class="Special">&lt;-</span> decrement              =&gt; <span class="Constant">&quot;4e/decrement-esi&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">edi</span> <span class="Special">&lt;-</span> decrement              =&gt; <span class="Constant">&quot;4f/decrement-edi&quot;</span>
+decrement <span class="PreProc">var</span>                     =&gt; <span class="Constant">&quot;ff 1/subop/decrement *(ebp+&quot;</span> <span class="PreProc">var</span>.stack-offset <span class="Constant">&quot;)&quot;</span>
+decrement *<span class="PreProc">var</span>/reg                =&gt; <span class="Constant">&quot;ff 1/subop/decrement *&quot;</span> reg
+
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> add var2/reg2          =&gt; <span class="Constant">&quot;01/add-to %&quot;</span> reg <span class="Constant">&quot; &quot;</span> reg2 <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> add var2               =&gt; <span class="Constant">&quot;03/add *(ebp+&quot;</span> var2.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> add *var2/reg2         =&gt; <span class="Constant">&quot;03/add *&quot;</span> reg2 <span class="Constant">&quot; &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+add-to var1, var2/reg             =&gt; <span class="Constant">&quot;01/add-to *(ebp+&quot;</span> var1.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">eax</span> <span class="Special">&lt;-</span> add n                  =&gt; <span class="Constant">&quot;05/add-to-eax &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> add n                  =&gt; <span class="Constant">&quot;81 0/subop/add %&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+add-to <span class="PreProc">var</span>, n                     =&gt; <span class="Constant">&quot;81 0/subop/add *(ebp+&quot;</span> <span class="PreProc">var</span>.stack-offset <span class="Constant">&quot;) &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+add-to *<span class="PreProc">var</span>/reg, n                =&gt; <span class="Constant">&quot;81 0/subop/add *&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> subtract var2/reg2     =&gt; <span class="Constant">&quot;29/subtract-from %&quot;</span> reg <span class="Constant">&quot; &quot;</span> reg2 <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> subtract var2          =&gt; <span class="Constant">&quot;2b/subtract *(ebp+&quot;</span> var2.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> subtract *var2/reg2    =&gt; <span class="Constant">&quot;2b/subtract *&quot;</span> reg2 <span class="Constant">&quot; &quot;</span> reg1 <span class="Constant">&quot;/r32&quot;</span>
+subtract-from var1, var2/reg2     =&gt; <span class="Constant">&quot;29/subtract-from *(ebp+&quot;</span> var1.stack-offset <span class="Constant">&quot;) &quot;</span> reg2 <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">eax</span> <span class="Special">&lt;-</span> subtract n             =&gt; <span class="Constant">&quot;2d/subtract-from-eax &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> subtract n             =&gt; <span class="Constant">&quot;81 5/subop/subtract %&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+subtract-from <span class="PreProc">var</span>, n              =&gt; <span class="Constant">&quot;81 5/subop/subtract *(ebp+&quot;</span> <span class="PreProc">var</span>.stack-offset <span class="Constant">&quot;) &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+subtract-from *<span class="PreProc">var</span>/reg, n         =&gt; <span class="Constant">&quot;81 5/subop/subtract *&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> and var2/reg2          =&gt; <span class="Constant">&quot;21/and-with %&quot;</span> reg <span class="Constant">&quot; &quot;</span> reg2 <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> and var2               =&gt; <span class="Constant">&quot;23/and *(ebp+&quot;</span> var2.stack-offset <span class="Constant">&quot; &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> and *var2/reg2         =&gt; <span class="Constant">&quot;23/and *&quot;</span> reg2 <span class="Constant">&quot; &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+and-with var1, var2/reg           =&gt; <span class="Constant">&quot;21/and-with *(ebp+&quot;</span> var1.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">eax</span> <span class="Special">&lt;-</span> and n                  =&gt; <span class="Constant">&quot;25/and-with-eax &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> and n                  =&gt; <span class="Constant">&quot;81 4/subop/and %&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+and-with <span class="PreProc">var</span>, n                   =&gt; <span class="Constant">&quot;81 4/subop/and *(ebp+&quot;</span> <span class="PreProc">var</span>.stack-offset <span class="Constant">&quot;) &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+and-with *<span class="PreProc">var</span>/reg, n              =&gt; <span class="Constant">&quot;81 4/subop/and *&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> or var2/reg2           =&gt; <span class="Constant">&quot;09/or-with %&quot;</span> reg <span class="Constant">&quot; &quot;</span> reg2 <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> or var2                =&gt; <span class="Constant">&quot;0b/or *(ebp+&quot;</span> var2.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> or *var2/reg2          =&gt; <span class="Constant">&quot;0b/or *&quot;</span> reg2 <span class="Constant">&quot; &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+or-with var1, var2/reg2           =&gt; <span class="Constant">&quot;09/or-with *(ebp+&quot;</span> var1.stack-offset <span class="Constant">&quot; &quot;</span> reg2 <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">eax</span> <span class="Special">&lt;-</span> or n                   =&gt; <span class="Constant">&quot;0d/or-with-eax &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> or n                   =&gt; <span class="Constant">&quot;81 1/subop/or %&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+or-with <span class="PreProc">var</span>, n                    =&gt; <span class="Constant">&quot;81 1/subop/or *(ebp+&quot;</span> <span class="PreProc">var</span>.stack-offset <span class="Constant">&quot;) &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+or-with *<span class="PreProc">var</span>/reg, n               =&gt; <span class="Constant">&quot;81 1/subop/or *&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> xor var2/reg2          =&gt; <span class="Constant">&quot;31/xor-with %&quot;</span> reg <span class="Constant">&quot; &quot;</span> reg2 <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> xor var2               =&gt; <span class="Constant">&quot;33/xor *(ebp+&quot;</span> var2.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> xor *var2/reg2         =&gt; <span class="Constant">&quot;33/xor *&quot;</span> reg2 <span class="Constant">&quot; &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+xor-with var1, var2/reg           =&gt; <span class="Constant">&quot;31/xor-with *(ebp+&quot;</span> var1.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">eax</span> <span class="Special">&lt;-</span> xor n                  =&gt; <span class="Constant">&quot;35/xor-with-eax &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> xor n                  =&gt; <span class="Constant">&quot;81 6/subop/xor %&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+xor-with <span class="PreProc">var</span>, n                   =&gt; <span class="Constant">&quot;81 6/subop/xor *(ebp+&quot;</span> <span class="PreProc">var</span>.stack-offset <span class="Constant">&quot;) &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+xor-with *<span class="PreProc">var</span>/reg, n              =&gt; <span class="Constant">&quot;81 6/subop/xor *&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+
+<span class="PreProc">var</span>/<span class="Constant">eax</span> <span class="Special">&lt;-</span> copy n                 =&gt; <span class="Constant">&quot;b8/copy-to-eax &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">ecx</span> <span class="Special">&lt;-</span> copy n                 =&gt; <span class="Constant">&quot;b9/copy-to-ecx &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">edx</span> <span class="Special">&lt;-</span> copy n                 =&gt; <span class="Constant">&quot;ba/copy-to-edx &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">ebx</span> <span class="Special">&lt;-</span> copy n                 =&gt; <span class="Constant">&quot;bb/copy-to-ebx &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">esi</span> <span class="Special">&lt;-</span> copy n                 =&gt; <span class="Constant">&quot;be/copy-to-esi &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/<span class="Constant">edi</span> <span class="Special">&lt;-</span> copy n                 =&gt; <span class="Constant">&quot;bf/copy-to-edi &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> copy var2/reg2         =&gt; <span class="Constant">&quot;89/&lt;- %&quot;</span> reg <span class="Constant">&quot; &quot;</span> reg2 <span class="Constant">&quot;/r32&quot;</span>
+copy-to var1, var2/reg            =&gt; <span class="Constant">&quot;89/&lt;- *(ebp+&quot;</span> var1.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> copy var2              =&gt; <span class="Constant">&quot;8b/-&gt; *(ebp+&quot;</span> var2.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> copy *var2/reg2        =&gt; <span class="Constant">&quot;8b/-&gt; *&quot;</span> reg2 <span class="Constant">&quot; &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> copy n                 =&gt; <span class="Constant">&quot;c7 0/subop/copy %&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+copy-to <span class="PreProc">var</span>, n                    =&gt; <span class="Constant">&quot;c7 0/subop/copy *(ebp+&quot;</span> <span class="PreProc">var</span>.stack-offset <span class="Constant">&quot;) &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+copy-to *<span class="PreProc">var</span>/reg, n               =&gt; <span class="Constant">&quot;c7 0/subop/copy *&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+
+compare var1, var2/reg2           =&gt; <span class="Constant">&quot;39/compare *(ebp+&quot;</span> var1.stack-offset <span class="Constant">&quot;) &quot;</span> reg2 <span class="Constant">&quot;/r32&quot;</span>
+compare *var1/reg1, var2/reg2     =&gt; <span class="Constant">&quot;39/compare *&quot;</span> reg1 <span class="Constant">&quot; &quot;</span> reg2 <span class="Constant">&quot;/r32&quot;</span>
+compare var1/reg1, var2           =&gt; <span class="Constant">&quot;3b/compare&lt;- *(ebp+&quot;</span> var2.stack-offset <span class="Constant">&quot;) &quot;</span> reg1 <span class="Constant">&quot;/r32&quot;</span>
+compare <span class="PreProc">var</span>/reg, *var2/reg2       =&gt; <span class="Constant">&quot;3b/compare&lt;- *&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+compare <span class="PreProc">var</span>/<span class="Constant">eax</span>, n                =&gt; <span class="Constant">&quot;3d/compare-eax-with &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+compare <span class="PreProc">var</span>, n                    =&gt; <span class="Constant">&quot;81 7/subop/compare *(ebp+&quot;</span> <span class="PreProc">var</span>.stack-offset <span class="Constant">&quot;) &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+compare *<span class="PreProc">var</span>/reg, n               =&gt; <span class="Constant">&quot;81 7/subop/compare *&quot;</span> reg <span class="Constant">&quot; &quot;</span> n <span class="Constant">&quot;/imm32&quot;</span>
+
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> multiply var2          =&gt; <span class="Constant">&quot;0f af/multiply *(ebp+&quot;</span> var2.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> multiply *var2/reg2    =&gt; <span class="Constant">&quot;0f af/multiply *&quot;</span> reg2 <span class="Constant">&quot; &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+
+<span class="PreProc">break</span>                             =&gt; <span class="Constant">&quot;e9/jump break/disp32&quot;</span>
+<span class="PreProc">break</span> label                       =&gt; <span class="Constant">&quot;e9/jump &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop</span>                              =&gt; <span class="Constant">&quot;e9/jump loop/disp32&quot;</span>
+<span class="PreProc">loop</span> label                        =&gt; <span class="Constant">&quot;e9/jump &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+<span class="PreProc">break-if-=</span>                        =&gt; <span class="Constant">&quot;0f 84/jump-if-= break/disp32&quot;</span>
+<span class="PreProc">break-if-=</span> label                  =&gt; <span class="Constant">&quot;0f 84/jump-if-= &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop-if-=</span>                         =&gt; <span class="Constant">&quot;0f 84/jump-if-= loop/disp32&quot;</span>
+<span class="PreProc">loop-if-=</span> label                   =&gt; <span class="Constant">&quot;0f 84/jump-if-= &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+<span class="PreProc">break-if-!=</span>                       =&gt; <span class="Constant">&quot;0f 85/jump-if-!= break/disp32&quot;</span>
+<span class="PreProc">break-if-!=</span> label                 =&gt; <span class="Constant">&quot;0f 85/jump-if-!= &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop-if-!=</span>                        =&gt; <span class="Constant">&quot;0f 85/jump-if-!= loop/disp32&quot;</span>
+<span class="PreProc">loop-if-!=</span> label                  =&gt; <span class="Constant">&quot;0f 85/jump-if-!= &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+<span class="PreProc">break-if-&lt;</span>                        =&gt; <span class="Constant">&quot;0f 8c/jump-if-&lt; break/disp32&quot;</span>
+<span class="PreProc">break-if-&lt;</span> label                  =&gt; <span class="Constant">&quot;0f 8c/jump-if-&lt; &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop-if-&lt;</span>                         =&gt; <span class="Constant">&quot;0f 8c/jump-if-&lt; loop/disp32&quot;</span>
+<span class="PreProc">loop-if-&lt;</span> label                   =&gt; <span class="Constant">&quot;0f 8c/jump-if-&lt; &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+<span class="PreProc">break-if-&gt;</span>                        =&gt; <span class="Constant">&quot;0f 8f/jump-if-&gt; break/disp32&quot;</span>
+<span class="PreProc">break-if-&gt;</span> label                  =&gt; <span class="Constant">&quot;0f 8f/jump-if-&gt; &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop-if-&gt;</span>                         =&gt; <span class="Constant">&quot;0f 8f/jump-if-&gt; loop/disp32&quot;</span>
+<span class="PreProc">loop-if-&gt;</span> label                   =&gt; <span class="Constant">&quot;0f 8f/jump-if-&gt; &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+<span class="PreProc">break-if-&lt;=</span>                       =&gt; <span class="Constant">&quot;0f 8e/jump-if-&lt;= break/disp32&quot;</span>
+<span class="PreProc">break-if-&lt;=</span> label                 =&gt; <span class="Constant">&quot;0f 8e/jump-if-&lt;= &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop-if-&lt;=</span>                        =&gt; <span class="Constant">&quot;0f 8e/jump-if-&lt;= loop/disp32&quot;</span>
+<span class="PreProc">loop-if-&lt;=</span> label                  =&gt; <span class="Constant">&quot;0f 8e/jump-if-&lt;= &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+<span class="PreProc">break-if-&gt;=</span>                       =&gt; <span class="Constant">&quot;0f 8d/jump-if-&gt;= break/disp32&quot;</span>
+<span class="PreProc">break-if-&gt;=</span> label                 =&gt; <span class="Constant">&quot;0f 8d/jump-if-&gt;= &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop-if-&gt;=</span>                        =&gt; <span class="Constant">&quot;0f 8d/jump-if-&gt;= loop/disp32&quot;</span>
+<span class="PreProc">loop-if-&gt;=</span> label                  =&gt; <span class="Constant">&quot;0f 8d/jump-if-&gt;= &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+<span class="PreProc">break-if-addr&lt;</span>                    =&gt; <span class="Constant">&quot;0f 82/jump-if-addr&lt; break/disp32&quot;</span>
+<span class="PreProc">break-if-addr&lt;</span> label              =&gt; <span class="Constant">&quot;0f 82/jump-if-addr&lt; &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop-if-addr&lt;</span>                     =&gt; <span class="Constant">&quot;0f 82/jump-if-addr&lt; loop/disp32&quot;</span>
+<span class="PreProc">loop-if-addr&lt;</span> label               =&gt; <span class="Constant">&quot;0f 82/jump-if-addr&lt; &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+<span class="PreProc">break-if-addr&gt;</span>                    =&gt; <span class="Constant">&quot;0f 87/jump-if-addr&gt; break/disp32&quot;</span>
+<span class="PreProc">break-if-addr&gt;</span> label              =&gt; <span class="Constant">&quot;0f 87/jump-if-addr&gt; &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop-if-addr&gt;</span>                     =&gt; <span class="Constant">&quot;0f 87/jump-if-addr&gt; loop/disp32&quot;</span>
+<span class="PreProc">loop-if-addr&gt;</span> label               =&gt; <span class="Constant">&quot;0f 87/jump-if-addr&gt; &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+<span class="PreProc">break-if-addr&lt;=</span>                   =&gt; <span class="Constant">&quot;0f 86/jump-if-addr&lt;= break/disp32&quot;</span>
+<span class="PreProc">break-if-addr&lt;=</span> label             =&gt; <span class="Constant">&quot;0f 86/jump-if-addr&lt;= &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop-if-addr&lt;=</span>                    =&gt; <span class="Constant">&quot;0f 86/jump-if-addr&lt;= loop/disp32&quot;</span>
+<span class="PreProc">loop-if-addr&lt;=</span> label              =&gt; <span class="Constant">&quot;0f 86/jump-if-addr&lt;= &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+<span class="PreProc">break-if-addr&gt;=</span>                   =&gt; <span class="Constant">&quot;0f 83/jump-if-addr&gt;= break/disp32&quot;</span>
+<span class="PreProc">break-if-addr&gt;=</span> label             =&gt; <span class="Constant">&quot;0f 83/jump-if-addr&gt;= &quot;</span> label <span class="Constant">&quot;:break/disp32&quot;</span>
+<span class="PreProc">loop-if-addr&gt;=</span>                    =&gt; <span class="Constant">&quot;0f 83/jump-if-addr&gt;= loop/disp32&quot;</span>
+<span class="PreProc">loop-if-addr&gt;=</span> label              =&gt; <span class="Constant">&quot;0f 83/jump-if-addr&gt;= &quot;</span> label <span class="Constant">&quot;:loop/disp32&quot;</span>
+
+In the following instructions types are provided for clarity even if they must
+be provided in an earlier '<span class="PreProc">var</span>' declaration.
+
+Address operations
+
+<span class="PreProc">var</span>/reg: (addr T) <span class="Special">&lt;-</span> address <span class="PreProc">var</span>: T
+  =&gt; <span class="Constant">&quot;8d/copy-address *(ebp+&quot;</span> <span class="PreProc">var</span>.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+
+Array operations (TODO: bounds-checking)
+
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> length arr/reg2: (addr array T)
+  =&gt; <span class="Constant">&quot;8b/-&gt; *&quot;</span> reg2 <span class="Constant">&quot; &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> index arr/rega: (addr array T), idx/regi: int  <span class="Comment"># if size(T) is 4 or 8</span>
+  =&gt; <span class="Constant">&quot;8d/copy-address *(&quot;</span> rega <span class="Constant">&quot;+&quot;</span> regi <span class="Constant">&quot;&lt;&lt;&quot;</span> log2(size(T)) <span class="Constant">&quot;+4) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> index arr: (array T sz), idx/regi: int
+  =&gt; <span class="Constant">&quot;8d/copy-address *(ebp+&quot;</span> regi <span class="Constant">&quot;&lt;&lt;&quot;</span> log2(size(T)) <span class="Constant">&quot;+&quot;</span> (arr.stack-offset + <span class="Constant">4</span>) <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> index arr/rega: (addr array T), n
+  =&gt; <span class="Constant">&quot;8d/copy-address *(&quot;</span> rega <span class="Constant">&quot;+&quot;</span> (n*size(T)+<span class="Constant">4</span>) <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> index arr: (array T sz), n
+  =&gt; <span class="Constant">&quot;8d/copy-address *(ebp+&quot;</span> (arr.stack-offset+<span class="Constant">4</span>+n*size(T)) <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+
+<span class="PreProc">var</span>/reg: (offset T) <span class="Special">&lt;-</span> compute-offset arr: (addr array T), idx/regi: int  <span class="Comment"># arr can be in reg or mem</span>
+  =&gt; <span class="Constant">&quot;69/multiply %&quot;</span> regi <span class="Constant">&quot; &quot;</span> size(T) <span class="Constant">&quot;/imm32 &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg: (offset T) <span class="Special">&lt;-</span> compute-offset arr: (addr array T), idx: int       <span class="Comment"># arr can be in reg or mem</span>
+  =&gt; <span class="Constant">&quot;69/multiply *(ebp+&quot;</span> idx.stack-offset <span class="Constant">&quot;) &quot;</span> size(T) <span class="Constant">&quot;/imm32 &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg <span class="Special">&lt;-</span> index arr/rega: (addr array T), o/rego: offset
+  =&gt; <span class="Constant">&quot;8d/copy-address *(&quot;</span> rega <span class="Constant">&quot;+&quot;</span> rego <span class="Constant">&quot;+4) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+
+User-defined types
+
+If a record (product) <span class="PreProc">type</span> T was defined to have elements a, b, c, ... of
+types T_a, T_b, T_c, ..., then accessing one of those elements f of <span class="PreProc">type</span> T_f:
+
+<span class="PreProc">var</span>/reg: (addr T_f) <span class="Special">&lt;-</span> get var2/reg2: (addr F), f
+  =&gt; <span class="Constant">&quot;8d/copy-address *(&quot;</span> reg2 <span class="Constant">&quot;+&quot;</span> offset(f) <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+<span class="PreProc">var</span>/reg: (addr T_f) <span class="Special">&lt;-</span> get var2: (addr F), f
+  =&gt; <span class="Constant">&quot;8d/copy-address *(ebp+&quot;</span> var2.stack-offset <span class="Constant">&quot;+&quot;</span> offset(f) <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+
+Handles for safe access to the heap
+
+copy-handle-to dest: (handle T), src: (handle T)
+  =&gt; <span class="Constant">&quot;50/push-eax&quot;</span>
+     <span class="Constant">&quot;8b/-&gt; *(ebp+&quot;</span> src.stack-offset <span class="Constant">&quot;) 0/r32/eax&quot;</span>
+     <span class="Constant">&quot;89/&lt;- *(ebp+&quot;</span> dest.stack-offset <span class="Constant">&quot;) 0/r32/eax&quot;</span>
+     <span class="Constant">&quot;8b/-&gt; *(ebp+&quot;</span> src.stack-offset+<span class="Constant">4</span> <span class="Constant">&quot;) 0/r32/eax&quot;</span>
+     <span class="Constant">&quot;89/&lt;- *(ebp+&quot;</span> dest.stack-offset+<span class="Constant">4</span> <span class="Constant">&quot;) 0/r32/eax&quot;</span>
+     <span class="Constant">&quot;58/pop-to-eax&quot;</span>
+
+copy-handle-to *dest/reg: (addr handle T), src: (handle T)
+  =&gt; <span class="Constant">&quot;50/push-eax&quot;</span>
+     <span class="Constant">&quot;8b/-&gt; *(ebp+&quot;</span> src.stack-offset <span class="Constant">&quot;) 0/r32/eax&quot;</span>
+     <span class="Constant">&quot;89/&lt;- *&quot;</span> reg <span class="Constant">&quot; 0/r32/eax&quot;</span>
+     <span class="Constant">&quot;8b/-&gt; *(ebp+&quot;</span> src.stack-offset+<span class="Constant">4</span> <span class="Constant">&quot;) 0/r32/eax&quot;</span>
+     <span class="Constant">&quot;89/&lt;- *(&quot;</span> reg <span class="Constant">&quot;+4) 0/r32/eax&quot;</span>
+     <span class="Constant">&quot;58/pop-to-eax&quot;</span>
+
+out/reg: (addr T) <span class="Special">&lt;-</span> lookup in: (handle T)
+  =&gt; <span class="Comment"># payload_allocid = in-&gt;address-&gt;allocid</span>
+     <span class="Constant">&quot;8b/-&gt; *(epb+&quot;</span> (in.stack-offset+<span class="Constant">4</span>) <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+     <span class="Constant">&quot;8b/-&gt; *&quot;</span> reg <span class="Constant">&quot; &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+     <span class="Comment"># if (payload_allocid != handle-&gt;allocid) abort</span>
+     <span class="Constant">&quot;39/compare *(ebp+&quot;</span> in.stack-offset <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+     <span class="Constant">&quot;0f 85/jump-if-!= $lookup:abort/disp32&quot;</span>
+     <span class="Comment"># return payload</span>
+     <span class="Constant">&quot;8b/-&gt; *(epb+&quot;</span> (in.stack-offset+<span class="Constant">4</span>) <span class="Constant">&quot;) &quot;</span> reg <span class="Constant">&quot;/r32&quot;</span>
+     <span class="Constant">&quot;81 0/subop/add %&quot;</span> reg <span class="Constant">&quot; 4/imm32&quot;</span>  <span class="Comment"># skip payload-&gt;allocid</span>
+
+vim&#0058;ft=mu:nowrap:textwidth=<span class="Constant">0</span>
+</pre>
+</body>
+</html>
+<!-- vim: set foldmethod=manual : -->