From ccadc6e604c5cf3779ddc34eef5b075d1dc3cb62 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 1 Nov 2020 18:01:11 -0800 Subject: 7152 - 'return' instruction https://github.com/akkartik/mu/issues/45#issuecomment-719990879, task 1. We don't have checking for it yet. Soon. --- mu_instructions | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mu_instructions') 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 -- cgit 1.4.1-2-gfad0