Language Implementation
7-5
7
Structure Alignment
The alignment of a structure affects how much space the structure
occupies and how efficiently the processor can address the structure
members. A compiler option (for gcc960,
mi960_align; for ic960, Gac)
allows selection of any of the following alignment options for structures:
Optimal natural is the default alignment. For structures smaller
alignment than 16 bytes, this alignment is the size of the
structure rounded up to the nearest power of 2.
The compiler aligns structures of 16 bytes or
larger on 16-byte boundaries. Optimal natural
alignment produces the most efficient code for
assigning values to structures and for passing
structures as arguments.
Backward-compatible aligns a structure according to the greatest
natural alignment alignment requirement of any member of the
structure. This alignment provides higher data
density than optimal natural alignment and
produces code and data compatible with that
generated by ic960 releases before Release 3.0.
ABI-compatible aligns a structure or union to the maximum
alignment of the following:
the greatest alignment requirement of any
members of the structure; or
2 if the structure’s size is 2 and 4 if the
structure’s size is 3 or larger.
User-constrained aligns a structure according to any legal value
alignment you specify. A compiler option (for gcc960,
mi960_align; for ic960, Gac) or #pragma
i960_align
allows specification of alignments
of 1, 2, 4, 8, and 16. Alignments can also be
specified using
#pragma align, described in this
chapter.