IA64 record alignment rules, and modes?
James E Wilson
wilson@specifixinc.com
Tue Mar 8 23:15:00 GMT 2005
Gary Funck wrote:
> Question: If we assume that a TImode would've been a more efficient mode
> to represent the record type above, would it not have been acceptable for
> the compiler to promote the alignment of this type to 128, given there
> are no apparent restrictions otherwise, or are there other C conventions
> at work that dictate otherwise? Is there a configuration tweak that
> would've led to using TImode rather than BLKmode?
The ABI says that the type has alignment of 64-bits, because that is the
largest alignment among the types used in the structure.
It is not OK to promote the alignment of the type to 128-bits, because
we might be given a pointer to an object created by a different compiler
which has only the 64-bit alignment required by the ABI. If we assume a
larger alignment, then we might generate code that fails (or rather in
this case triggers an unwanted kernel unaligned access fixup). Also,
this might break the ABI, since structures with different alignments may
be passed differently as arguments. Also, as others mentioned, this
breaks structure layout when this structure is nested inside other
structures. There may also be other problems.
It would be OK to promote the alignment of a variable with this type to
128-bits. We could then perhaps generate more efficient code to access
this variable, and if we take a pointer and pass it to another compiler,
there won't be any problems.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
More information about the Gcc
mailing list