Vax performance V-008 SP User's Guide Page 95

  • Download
  • Add to my manuals
  • Print
  • Page
    / 176
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 94
Improving the Performance of Ported Code
4.4 Common-Based Referencing
4.4 Common-Based Referencing
On an OpenVMS Alpha system, references to data cells generally require two
memory references—one reference to load the data cell address from the linkage
section and another reference to the data cell itself. If several data cells are
located in proximity to one other, and the ADDRESSES optimization is used, the
compiler can load a register with a common base address and then reference the
individual data cells as offsets from that base address. This eliminates the load of
each individual data cell address and is known as common-based referencing.
The compiler performs this optimization automatically for local data psects when
the ADDRESSES optimization is turned on. The compiler generates symbols of
the form $PSECT_BASEn to use as the base of a local psect.
To use common-based referencing for external data psects, you must create a
prefix file which defines symbols as offsets from a common base. The prefix file
cannot be used when assembling the module for OpenVMS VAX because the VAX
MACRO assembler does not allow symbols to be defined as offsets from external
symbols.
4.4.1 Creating a Prefix File for Common-Based Referencing
The following example illustrates the benefits of creating a prefix file to use
common-based referencing. It shows:
Code generated without the use of a prefix file
How to create a prefix file
Code generated with the use of a prefix file
Consider the following simple code section (CODE.MAR), which refers to data
cells in another module (DATA.MAR):
Module DATA.MAR:
.PSECT DATA NOEXE
BASE::
A:: .LONG 1
B:: .LONG 2
C:: .LONG 3
D:: .LONG 4
.END
Module CODE.MAR:
.PSECT CODE NOWRT
E:: .CALL_ENTRY
MOVL A,R1
MOVL B,R2
MOVL C,R3
MOVL D,R4
RET
.END
When compiling CODE.MAR without using common-based referencing, the
following code is generated:
In the linkage section:
.ADDRESS A
.ADDRESS B
.ADDRESS C
.ADDRESS D
Improving the Performance of Ported Code 4–9
Page view 94
1 2 ... 90 91 92 93 94 95 96 97 98 99 100 ... 175 176

Comments to this Manuals

No comments