User`s guide
How the MACRO Compiler Functions on Different Platforms
2.3 Routine Calls and Declarations
On an OpenVMS I64 system, there is only one call format and only one
subroutine call instruction, br.call. For routines that expect parameters, the
first eight parameters are passed in R32 through R39, with the parameter
count in R25 and subsequent parameters in quadwords on the stack. (Note
that the MACRO compiler on OpenVMS I64 does not provide direct control
over the register stack or any syntax for accessing registers greater than R31.)
The hardware execution of the br.call instruction simply passes control to the
subroutine, places the return address in a designated register, and adjusts the
hardware register stack. 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.
The compiler must generate code that conforms to the HP OpenVMS Calling
Standard yet emulates the function of the different VAX MACRO instructions.
This requires special code both at the calling instruction to manipulate the input
parameters and at the entry point of the routine itself to create a stack frame and
other context.
The compiler generates code only for source instructions that are part of a
declared routine. For the compiler to generate the proper linkage information
and proper routine code, you must insert a compiler directive at the entry points
in the VAX MACRO source.
2.3.1 Linkage Section (OpenVMS Alpha only)
On Alpha systems, all external (out-of-module) references are made through a
linkage section. The linkage section is a program section (psect) containing:
• Addresses of external variables
• Constants too large to fit directly in the code stream
• Linkage pairs
• Procedure descriptors
A linkage pair is a data structure used when making a call to an external
module. The linkage pair contains the address of the callee’s procedure descriptor,
and the entry point address. The linkage pair resides in the caller’s linkage
section; therefore, there may be several linkage pairs for a particular routine, one
in each caller’s linkage section. Linkage pairs are not used for module-local calls,
since the compiler can refer to the callee’s frame descriptor directly.
A procedure descriptor is a data structure that provides basic information
about a routine, such as register and stack usage. Each routine has one
unique procedure descriptor, and it is located in its linkage section. The
procedure descriptor is normally not accessed at run time. Its primary use is
for interpreting the frame in case of exceptions, by the debugger, for example.
For more information about these and other data structures, see the HP
OpenVMS Calling Standard.
2.3.2 Prologue and Epilogue Code
To mimic the behavior of VAX subroutines, the compiler must generate code at
the entry and exit of each routine. This code emulates the functions that are done
by the VAX hardware, and is called the prologue and epilogue code.
How the MACRO Compiler Functions on Different Platforms 2–5