User`s guide

Improving the Performance of Ported Code
4.1 Aligning Data
Quadword references in OpenVMS Alpha or OpenVMS I64 built-ins, such as
those in the following example, will be in new code, where alignment should
be correct. Therefore all memory references in the following example will use
aligned quadword load/stores:
EVAX_LDQ R1, (R2)
EVAX_ADDQ (R1), #1, (R3)
If an OpenVMS Alpha or OpenVMS I64 built-in (other than EVAX_LDQU or
EVAX_STQU) is used on an address that is not quadword aligned, an alignment
fault will occur at run time.
4.1.2 Directives and Qualifier for Changing Alignment Assumptions
The compiler provides two directives and one qualifier for changing the compiler’s
alignment assumptions. Both directives enable the compiler to produce more
efficient code. The .SET_REGISTERS directive allows you to specify whether a
register is aligned or unaligned. This directive should be used when the result
of an operation is the reverse of what the compiler expects. It also allows you to
declare registers that the compiler would not otherwise detect as input or output
registers.
The .SYMBOL_ALIGNMENT directive allows you to specify the alignment of any
memory reference that uses a symbolic offset. This directive should be used when
you know the data will be aligned for every use of the symbolic offset.
These directives are described in Appendix B. The examples in each description
show how to use them.
The /UNALIGN qualifier to the MACRO/MIGRATION command tells the compiler
to assume unaligned all the time for all register-based memory references rather
than try to track the alignment. This does not affect stack-based or static
references where the compiler knows the alignment.
This qualifier is described in Appendix A.
4.1.3 Precedence of Alignment Controls
The order of precedence of the compilers alignment controls, from strongest
(.SYMBOL_ALIGNMENT) to weakest (built-in assumptions and tracking
mechanisms), follows:
1. .SYMBOL_ALIGNMENT directive
2. .SET_REGISTER directive
3. /UNALIGN qualifier
4. Built-in assumptions and tracking mechanisms
4.1.4 Recommendations for Aligning Data
The following recommendations are provided for aligning data:
If references to the data must be made atomic with /PRESERVE=ATOMICITY
or .PRESERVE ATOMICITY, the data must be aligned.
Do not fix alignment problems in public interfaces; this could break existing
programs.
4–2 Improving the Performance of Ported Code