User`s guide
Improving the Performance of Ported Code
4.4 Common-Based Referencing
In the code section (not including the prologue/epilogue code):
LDQ R28, 40(R27) ;Load address of A from linkage section
LDQ R26, 48(R27) ;Load address of B from linkage section
LDQ R25, 56(R27) ;Load address of C from linkage section
LDQ R24, 64(R27) ;Load address of D from linkage section
LDL R1, (R28) ;Load value of A
LDL R2, (R26) ;Load value of B
LDL R3, (R25) ;Load value of C
LDL R4, (R24) ;Load value of D
By creating a prefix file that defines external data cells as offsets from a common
base address, you can cause the compiler to use common-based referencing for
external references. A prefix file for this example, which defines A, B, C, and D in
terms of BASE, follows:
A = BASE+0
B = BASE+4
C = BASE+8
D = BASE+12
When compiling CODE.MAR using this prefix file and the ADDRESSES
optimization, the following code is generated:
In the linkage section:
.ADDRESS BASE ;Base of data psect
In the code section (not including the prologue/epilogue code):
LDQ R16, 40(R27) ;Load address of BASE from linkage section
LDL R1, (R16) ;Load value of A
LDL R2, 4(R16) ;Load value of B
LDL R3, 8(R16) ;Load value of C
LDL R4, 12(R16) ;Load value of D
In this example, common-based referencing shrinks the size of both the code and
the linkage sections and eliminates three memory references. This method of
creating a prefix file to enable common-based referencing of external data cells
can be useful if you have one large, separate module that defines a data area
used by many modules.
4.4.1.1 Code Sequence Differences on OpenVMS I64 Systems
The same effect shown in Section 4.4.1 occurs on OpenVMS I64 systems, though
the details of the code sequences differ. The unmodified code results in an
instruction sequence such as the following:
add r19 = D, r1
add r22 = C, r1
add r23 = B, r1
add r24 = A, r1
ld8 r19 = [r19]
ld8 r24 = [r24]
ld8 r22 = [r22]
ld8 r23 = [r23]
ld4 r4 = [r19]
ld4 r9 = [r24]
ld4 r3 = [r22]
ld4 r28 = [r23]
sxt4 r4 = r4
sxt4 r9 = r9
sxt4 r3 = r3
sxt4 r28 = r28
4–10 Improving the Performance of Ported Code