diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-10-31 20:38:11 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-10-31 20:38:11 -0700 |
commit | c3964ff60af5992fe14c2dd1933c3e880b20835f (patch) | |
tree | 102a79a681b62c738f2df7f13dc0676430ecd576 | |
parent | 84a77452245bed7e75940d37e6ca80694878b06d (diff) | |
download | mu-c3964ff60af5992fe14c2dd1933c3e880b20835f.tar.gz |
7150
-rw-r--r-- | mu_instructions | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mu_instructions b/mu_instructions index f0e66917..bece4fc1 100644 --- a/mu_instructions +++ b/mu_instructions @@ -215,6 +215,22 @@ Comparisons must always start with a register: compare var1/xreg1, var2/xreg2 => "0f 2f/compare %" xreg2 " " xreg1 "/x32" compare var1/xreg1, var2 => "0f 2f/compare *(ebp+" var2.stack-offset ") " xreg1 "/x32" +## Blocks + +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 => "81 0/subop/add %esp " size-of(var) "/imm32" +Clean up var/reg => "8f 0/subop/pop %" reg + +Clean up var/xreg => "f3 0f 10/-> *esp " xreg "/x32" + "81 0/subop/add %esp 4/imm32" + +## Jumps + +Besides having to clean up any variable declarations (see above) between +themselves and their target, jumps translate like this: + break => "e9/jump break/disp32" break label => "e9/jump " label ":break/disp32" loop => "e9/jump loop/disp32" |