diff options
Diffstat (limited to 'html/mu_instructions.html')
-rw-r--r-- | html/mu_instructions.html | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/html/mu_instructions.html b/html/mu_instructions.html index 858e9d27..2403bdff 100644 --- a/html/mu_instructions.html +++ b/html/mu_instructions.html @@ -239,6 +239,22 @@ Comparisons must always start with a register: compare var1/xreg1, var2/xreg2 => <span class="Constant">"0f 2f/compare %"</span> xreg2 <span class="Constant">" "</span> xreg1 <span class="Constant">"/x32"</span> compare var1/xreg1, var2 => <span class="Constant">"0f 2f/compare *(ebp+"</span> var2.stack-offset <span class="Constant">") "</span> xreg1 <span class="Constant">"/x32"</span> +<span class="muComment">## Blocks</span> + +In themselves, blocks generate no instructions. However, if a block contains +variable declarations, they must be cleaned up when the block ends. + +Clean up var on the stack => <span class="Constant">"81 0/subop/add %esp "</span> size-of(var) <span class="Constant">"/imm32"</span> +Clean up var/reg => <span class="Constant">"8f 0/subop/pop %"</span> reg + +Clean up var/xreg => <span class="Constant">"f3 0f 10/-> *esp "</span> xreg <span class="Constant">"/x32"</span> + <span class="Constant">"81 0/subop/add %esp 4/imm32"</span> + +<span class="muComment">## Jumps</span> + +Besides having to clean up any variable declarations (see above) between +themselves and their target, jumps translate like this: + <span class="PreProc">break</span> => <span class="Constant">"e9/jump break/disp32"</span> <span class="PreProc">break</span> label => <span class="Constant">"e9/jump "</span> label <span class="Constant">":break/disp32"</span> <span class="PreProc">loop</span> => <span class="Constant">"e9/jump loop/disp32"</span> @@ -298,6 +314,17 @@ Similar float variants like `<span class="PreProc">break-if-float<`</span> ar `addr` equivalents. The x86 instruction set stupidly has floating-point operations only update a subset of flags. +<span class="muComment">## Returns</span> + +The `<span class="PreProc">return</span>` instruction cleans up variable declarations just like an unconditional +`<span class="PreProc">jump</span>` to end of function, but also emits a series of copies before the final +`<span class="PreProc">jump</span>`, copying each argument of `<span class="PreProc">return</span>` to the register appropriate to the +respective function output. This doesn't work if a function output register +contains a later `<span class="PreProc">return</span>` argument (e.g. if the registers for two outputs are +swapped in `<span class="PreProc">return</span>`), so you can't do that. + +<span class="PreProc">return</span> => <span class="Constant">"c3/return"</span> + --- In the following instructions types are provided for clarity even if they must |