16.7 Function Return Values
Function return values are returned in registers.
Integral or pointer value are placed in register v0
. All floating-point
values, regardless of precision, are returned in floating-point register
$f0
.
If a function needs to return an actual structure or union – not a pointer to such an
object – the called function copies this object to an area of memory that is reserved by
the caller. The caller passes the address of this memory area in register $4 when the
function is called. The function also returns a pointer to the returned object in
register v0
. Having the caller supply the return object’s space allows
re-entrance.