SPRUI04F july 2015 – april 2023
Return a Value to a C callable Procedure
.return [argument]
The .return directive function is equivalent to the return statement in C/C++ code. It places the optional argument in the appropriate register for a return value as per the C/C++ calling conventions (see Section 8.4).
The optional argument can have the following meanings:
Arguments to the .return directive can be either symbolic register names or machine-register names.
All return statements in a .cproc region must be consistent in the type of the return value. It is not legal to mix a .return arg with a .return hi:lo in the same .cproc region.
The .return directive is unconditional. To perform a conditional .return, simply use a conditional branch around a .return. The assembly optimizer removes the branch and generates the appropriate conditional code. For example, to return if condition cc is true, code the return as:
[!cc] B around
.return
around:
This example uses a symbolic register, tmp, and a machine-register, A5, as .return arguments:
.cproc ...
.reg tmp
...
.return tmp= legal symbolic name
...
.return a5 = legal actual name