User`s guide

How the MACRO Compiler Functions on Different Platforms
2.6 Declaring a Routine’s Register Use
The scratch argument also pertains to the compilers temporary register usage.
The compiler may use registers R13 and above as temporary registers if they are
unused in the routine source code. Since R13 through R15 must be preserved, if
modified, on OpenVMS Alpha and OpenVMS I64 systems, the compiler preserves
those registers if it uses them.
However, if they appear in the scratch register set declaration, the compiler
will not preserve them if it uses them as temporary registers. As a result, these
registers may be scratched at routine exit, even if they were not used in the
routine source but are in the scratch set. If the VAXREGS optimization is used
(Alpha systems only), this applies to registers R2 through R12, as well.
For .JSB32_ENTRY routines, since R2 through R12 are not preserved by default,
their inclusion in the scratch declaration is for documentation purposes only.
2.6.4 Preserve Argument for Entry Point Register Declaration
The preserve argument indicates those registers that should be preserved over
the routine call. This should include only those registers that are modified and
whose full 64-bit contents should be saved and restored.
The preserve argument causes registers to be preserved whether or not they
would have been preserved automatically by the compilers processing of a
.CALL_ENTRY or .JSB_ENTRY directive. This is also the only way in a .JSB32_
ENTRY routine to save and restore the full 64 bits of a register. Note that
because R0 and R1 are scratch registers, the compiler never saves and restores
them in any routine unless you specify them in the preserve argument at the
routine’s entry point.
This argument overrides the output and scratch arguments. If you specify
a register both in the preserve argument and in the output or scratch
arguments, the compiler will preserve the register but will report the following
warning:
%AMAC-W-REGDECCON, register declaration conflict in routine A
The preserve argument has no effect on the compiler’s temporary register
usage.
2.6.5 Help for Specifying Register Sets
When you invoke the compiler, specifying /FLAG=HINTS on the command line,
the compiler generates messages that can assist you in constructing the register
sets for routine entry points. Among the hints the compiler provides are the
following:
Registers that might be used as input to the routine, which may not have
been your intention. If a register is read before being written, it will be
included in this set.
Registers that might be used for output values. If a register is written but not
subsequently read, the compiler will include it in the list of possible output
values. Again, this may not have been your intention.
Registers the compiler saves and restores that are not listed in the entry
point’s preserve argument.
How the MACRO Compiler Functions on Different Platforms 2–15