about summary refs log tree commit diff stats
path: root/mu_instructions
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-01 18:01:11 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-01 18:02:02 -0800
commitccadc6e604c5cf3779ddc34eef5b075d1dc3cb62 (patch)
treee7e161d3d5aecfdce3b0fdf30fa67e72ba057e9e /mu_instructions
parentc694b8e2cb0e4d2b8939f2f7d83a04c0594dbe5b (diff)
downloadmu-ccadc6e604c5cf3779ddc34eef5b075d1dc3cb62.tar.gz
7152 - 'return' instruction
https://github.com/akkartik/mu/issues/45#issuecomment-719990879, task 1.

We don't have checking for it yet. Soon.
Diffstat (limited to 'mu_instructions')
-rw-r--r--mu_instructions11
1 files changed, 11 insertions, 0 deletions
diff --git a/mu_instructions b/mu_instructions
index bece4fc1..253ede30 100644
--- a/mu_instructions
+++ b/mu_instructions
@@ -290,6 +290,17 @@ Similar float variants like `break-if-float<` are aliases for the corresponding
 `addr` equivalents. The x86 instruction set stupidly has floating-point
 operations only update a subset of flags.
 
+## Returns
+
+The `return` instruction cleans up variable declarations just like an unconditional
+`jump` to end of function, but also emits a series of copies before the final
+`jump`, copying each argument of `return` to the register appropriate to the
+respective function output. This doesn't work if a function output register
+contains a later `return` argument (e.g. if the registers for two outputs are
+swapped in `return`), so you can't do that.
+
+return                            => "c3/return"
+
 ---
 
 In the following instructions types are provided for clarity even if they must