IEABRCX — Relative branch macro extension

Description

The IEABRCX macro defines macros to intercept and change various base-displacement branch instructions to their relative branch equivalents. Many macros contain base-displacement branches that could functionally be relative branches. In order to write an assembler routine that both uses these macros and uses relative branching, you can use IEABRCX to enable those macros to use relative branches. Changing base-displacement branch instructions to their relative branch equivalents can eliminate code addressability issues.
Note:
  1. Using IEABRCX does not guarantee that all macros can be invoked without code addressability. Some macros still require addressability to the location where the macro is invoked.
  2. IBM recommends using IEABRCX instead of IEABRC because IEABRCX provides additional functionality. Using IEABRCX DEFINE is equivalent to using COPY IEABRC.

Environment

There are no specific environment requirements.

Programming requirements

None.

Restrictions

IEABRCX converts branch condition instructions to relative branch condition instructions except when both of the following conditions are true:
  • The branch target ends with ")"
  • A "(" in the 2nd or subsequent characters of the branch target is not preceded by "+" or "-"
For example:
B X(15)
Remains a base/displacement branch
B X+(15)
Converted to a relative branch
B X+Y
Converted to a relative branch

Register information

IEABRCX changes no registers, so there is no need to save and restore register contents.

Performance implications

None.

Syntax

The IEABRCX macro is written prior to any base/displacement branch that needs to be converted to a relative branch as follows:

Syntax Description
   
One or more blanks must precede IEABRCX.
   
IEABRCX  
   
One or more blanks must follow IEABRCX.
   
DEFINE  
PUSH  
DISABLE  
ENABLE  
POP  
   

Parameters

The parameters are explained as follows:
DEFINE
Defines and enables the conversion. It must be placed prior to any base/displacement branch that needs to be converted to a relative branch. It must precede any uses of IEABRCX with other options. At the point of issuing IEABRCX DEFINE, the state of conversions is enabled.
PUSH
Saves the current state (enabled or disabled). At any point in the assembly, the number of PUSH's must not exceed the number of POP's by 255 or an assembler error might result. You must have issued IEABRCX DEFINE prior to this.
DISABLE
Disables the conversions so that subsequent base-displacement branches revert to their normal form. You must have issued IEABRCX DEFINE prior to this.
ENABLE
Enables the conversions so that subsequent base-displacement branches are converted. You must have issued IEABRCX DEFINE prior to this.
POP
Restores to the previous state. A corresponding PUSH must exist or an assembler error might result. You must have issued IEABRCX DEFINE prior to this.

Example

The following example enables conversion of a base/displacement branch to a relative branch, saves the current state, disables the conversion, then restores the previous state.
     TEST     CSECT
     R12      EQU   12
              USING STATICAREA,R12
              IEABRCX DEFINE
              ENQ   (QNAME,RNAME,E,RNAMELEN,SYSTEM)
              IEABRCX PUSH       Save the current state
              IEABRCX DISABLE    Disable conversion
              -- base/displacement branches not converted
              IEABRCX POP        Restore the previous state
              ENQ   (QNAME,RNAME2,E,RNAME2LEN,SYSTEM)                            
     STATICAREA DC  D'0'
     QNAME    DC    CL8'THEQNAME'
     RNAME    DC    CL8'THERNAME'
     RNAMELEN EQU   L'RNAME
     RNAME2   DC    CL9'THERNAME2'
     RNAME2LEN EQU  L'RNAME2
              END   TEST