Datasheet

ARM Compiler Reference
3-12 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
A global register variable maps to a callee-saved register, so its
value is saved and restored across a call to a function in a
compilation unit that does not use it as a global register variable,
such as a library function.
Calls back into a compilation unit that uses a global register
variable are dangerous. For example, if a global register using
function is called from a compilation unit that does not declare the
global register variable, the function reads the wrong values from
its supposed global register variables.
This class can only be used at file scope.
Type qualifiers
This section describes the implementation of various standard C and ARM-specific type
qualifiers. These type qualifiers can be used to instruct the compiler to treat the qualified
type in a special way. Standard qualifiers that do not have ARM-specific behavior or
restrictions are not documented.
__align()
The
__align(
) storage class modifier aligns a top-level object on an byte
boundary. 8-byte alignment is required if you are using the
LDRD
or
STRD
instructions, and can give a significant performance advantage with VFP
instructions.
For example, if you are using
LDRD
or
STRD
instructions to access data
objects defined in C or C++ from ARM assembly language, you must use
the
__align(8)
storage class specifier to ensure that the data objects are
properly aligned.
You can specify a power of 2 for the alignment boundary, however 8 is
the maximum for auto variables. You can only overalign. That is you can
make a 2-byte object 4-byte aligned, but you cannot align a 4-byte object
at 2 bytes.
__align(8
) is a storage class modifier. This means that it can be used only
on top-level objects. You cannot use it on:
types, including typedefs and structure definitions
function parameters.
It can be used in conjunction with
extern
and
static
.
__align(8)
only ensures that the qualified object is 8-byte aligned. This
means, for example, that you must explicitly pad structures if required.