gtps1m1cSystem Macros

#SBRC-Standard Linkage Macro Subroutine

Use this system macro to generate the most efficient standard linkage for the macros that call it.

Format




Notes:

  1. P1

  2. P2

  3. P3

  4. P4

  5. P5

INREG=(P1,P2,P3,P4,P5)
This parameter contains positional sublist entries P1, P2,...,P5 for general registers R14, R15, R0, R1, and R2 respectively. There is direct mapping between the position of the sublist entry and the general register to which it refers (for example, P1 refers to R14, P2 refers to R15, and so on).

The format of a sublist entry is (Rx,y) or Null.

Notes:

  1. Registers R14 and R15 are always saved, and their sublist entries P1 and P2 cannot contain Rx parameters. This is because only registers R0-R2 can contain parameters to routines. The INREG parameter is also used by #SBRC to reload any corrupted registers after return from the service subroutine. However, only registers R0, R1 and R2 are considered here since registers R14 and R15 will always be reloaded on return by the service subroutine.

  2. The format of a sublist entry for registers R14 and R15 can only be (,A) or Null because these registers are always used as part of the basic subroutine linkage, and are always saved.

For another example,

INREG=(,(,A),(R6,A),,(R7,))

generates:

STM  R14,R0,SAVAREA
LR   R0,R6
LR   R2,R7

This means R15 and R0 must be saved over this subroutine call, and, R0 and R2 are the inputs to this subroutine through R6 and R7 respectively.

The defaults for each sublist entry are the corresponding mapped registers and null.

OUTREG=(P1,P2,P3)
This parameter deals with initializing registers on return from the service subroutine. It can contain a maximum of 3 registers with P0, P1, and P2 as positional entries for registers R0, R1, and R2 respectively. The delimiter for each position is a comma.

For example, when a subroutine returns R0 and R2 with resultant data, and the calling program expects the results to be contained in registers R6 and R0 respectively, the following #SBRC parameter is formatted. For example,

OUTREG=(R6,,R0)

generates:

LR   R6,R0
LR   R0,R2

The default for each sublist entry is null, which generates no code.

RTN=routine_name
This parameter contains the name of the routine to be invoked. This parameter is mandatory and must not be null. See each individual macro for the specified routine.

WKREG
The specified symbolic register names are free to be used by the macro to save the volatile registers coded on the SAVREG parameter. Up to 3 registers can be specified, but the standard linkage registers R13 through R2 cannot be used here. This parameter is used in conjunction with the SAVREG parameter to generate efficient code and enhance the performance of the macro. The number of registers specified by WKREG should be less than or equal to the number of registers specified by SAVREG. If this parameter is omitted or not used to its maximum capacity, code optimization is sacrificed.

TYPE
This parameter determines the way in which the RTN parameter is resolved.

EXT
The RTN parameter is assumed to specify an external routine, RTN=EXT is the default.

INT
The RTN parameter is assumed to contain a routine that is directly addressable.

GEN
This parameter defines the code generation. There are two options; GEN=ALL, or GEN=TOP followed by a parameter list and GEN=BOT.

ALL
The complete linkage is generated. This is the default.

TOP|BOT
When GEN=TOP is coded, the code is generated through the BASR. This is followed by an inline parameter list, which is followed by GEN=BOT.

When GEN=TOP and GEN=BOT are coded, the other parameters coded on the #SBRC macro must be identical.

For example:

#SBRC   GEN=TOP,INREG=(,(,A),(R6,A),,(R7,)),OUTREG=(R6,,R0),RTN=routine,
TYPE=EXT DC    A(PARMLIST)
#SBRC   GEN=BOT,INREG=(,(,A),(R6,A),,(R7,)),OUTREG=(R6,,R0),RTN=routine,
TYPE=EXT

Entry Requirements

Return Conditions

Programming Considerations

Examples

None.