An opportunity for optimization in both cases is to share a single label (L) throughout a procedure, and let the result of BL become a common
Global and Static Variable References
References to global or static variables currently require two instructions either to form the address of a variable, or to load or store the contents of the variable:
;to form the address of a variable ADDIL
LDO
;to load the contents of a variable ADDIL
LDW
These sequences must be converted to equivalent sequences using the linkage table pointer in %r19:
;to form the address of a variable
LDW T'var(%r19),tmp1
LDO | x(tmp1),tmp2 | ; omit if x == 0 |
;to load the contents of a variable
LDW T'var(%r19),tmp1
LDW x(tmp1),tmp2
Note that the T' fixup on the LDW instruction allows for a
;form the address of a variable ADDIL LT'var,%r19
LDW RT'var(%r1),tmp1
LDO | x(tmp1),tmp2 | ; omit if x == 0 |
;load the contents of a variable ADDIL LT'var,%r19
LDW RT'var(%r1),tmp1
LDW x(tmp1),tmp2
Procedure Labels
The compilers already mark procedure label constructs so that the linker can process them properly. No changes are needed to the compilers.
When building shared libraries and incomplete executables, the linker modifies the plabel calculation (produced by the compilers in both shared libraries and incomplete executables) to load the contents of a DLT entry, which is built for each symbol associated with a CODE_PLABEL fixup.
In shared libraries and incomplete executables, a plabel value is the address of a PLT entry for the target routine, rather than a procedure address. Hence, $$dyncall must be used when calling a routine with a procedure label. The linker sets the
In order to generate a procedure label that can be used for shared libraries and incomplete executables, assembly code must specify that a procedure address is being taken (and that a plabel is wanted) by using the P' assembler fixup mode. For example, to generate an assembly plabel, the following sequence must be used:
Generating