User`s guide

How the MACRO Compiler Functions on Different Platforms
2.2 Itanium Architecture, Calling Standard, and Register Mapping
The register mapping was carefully chosen based on which registers were
preserved across calls, which registers may be modified across calls, and which
registers are volatile and do not even survive into or out of a call.
As on OpenVMS Alpha, Macro-32 references to AP are mapped by the compiler
to the appropriate location depending on whether the arguments have been saved
to the stack. To support references to FP, the compiler creates an FP value where
needed. The compiler supports references to 0(FP) to establish condition handlers
just like on OpenVMS VAX and OpenVMS Alpha.
Any references to register numbers elsewhere in this manual refer to the
VAX/Alpha register with that number. The mapping to an actual Itanium register
is totally transparent to the Macro-32 source code (and most of the compiler).
The compiler does not provide any syntax for accessing Itanium registers directly
without going through the mapping table.
The automatic register mapping done by the compiler allows many Macro-32
programs (including those that access Alpha registers R16-R31) to compile
without modificiations.
Note, however, that use of registers R16-R21 as routine parameters on OpenVMS
Alpha is not portable to OpenVMS I64. Use PUSHL to pass parameters to a
CALL, and use 4(AP), 8(AP), and so forth in the called routine to refer to them.
The compiler will generate the correct register references instead of the stack
references implied by the VAX operands.
On OpenVMS I64 systems, the compiler continues to recognize many of the
EVAX_* built-ins that provide direct access to Alpha instructions on OpenVMS
Alpha systems. These built-ins will generate one or more Itanium instructions to
perform the same logical operation. See Appendix C for a complete list of which
EVAX_* built-ins are also supported on I64 systems.
2.3 Routine Calls and Declarations
The HP OpenVMS Calling Standard specifies very different calling conventions
for OpenVMS VAX, OpenVMS Alpha, and OpenVMS I64 systems.
On OpenVMS VAX systems, there are two different call formats, CALL and JSB,
with five different instructions: CALLS, CALLG, JSB, BSBW, and BSBB. CALL
instructions create a frame on the stack which contains return information, saved
registers, and other routine information. Parameters to CALL instructions are
passed in consecutive longword memory locations, either on the stack (CALLS)
or elsewhere (CALLG). JSB instructions have the return address stored on the
stack. For both call formats, the hardware processing of the calling instruction
provides all of these functions.
On OpenVMS Alpha systems, there is only one call format and only one
subroutine call instruction, JSR. For routines that expect parameters, the first six
parameters are passed in R16 through R21, with the parameter count in R25 and
subsequent parameters in quadwords on the stack. The hardware execution of
the JSR instruction simply passes control to the subroutine and places the return
address in a designated register. It neither allocates stack space, nor creates a
call frame, nor provides any parameter manipulations. All of these functions
must be done by the calling routine or the called routine.
2–4 How the MACRO Compiler Functions on Different Platforms