forked from OSchip/llvm-project
ca3cb7f35c
The GCC construct __attribute__((aligned)) is defined to set alignment to "the default alignment for the target architecture" according to the GCC documentation: The default alignment is sufficient for all scalar types, but may not be enough for all vector types on a target that supports vector operations. The default alignment is fixed for a particular target ABI. clang currently hard-coded an alignment of 16 bytes for that construct, which is correct on some platforms (including X86), but wrong on others (including SystemZ). Since this value is ABI-relevant, it is important to get correct for compatibility purposes. This patch adds a new TargetInfo member "DefaultAlignForAttributeAligned" that targets can set to the appropriate default __attribute__((aligned)) value. Note that I'm deliberately *not* using the existing "SuitableAlign" value, which is used to set the pre-defined macro __BIGGEST_ALIGNMENT__, since those two values may not be the same on all platforms. In fact, on X86, __attribute__((aligned)) always uses 16-byte alignment, while __BIGGEST_ALIGNMENT__ may be larger if AVX-2 or AVX-512 are supported. (This is actually not yet correctly implemented in clang either.) The patch provides a value for DefaultAlignForAttributeAligned only for SystemZ, and leaves the default for all other targets at 16, which means no visible change in behavior on all other targets. (The value is still wrong for some other targets, but I'd prefer to leave it to the target maintainers for those platforms to fix.) llvm-svn: 235397 |
||
---|---|---|
.. | ||
ABITest | ||
CIndex | ||
TableGen | ||
TestUtils | ||
VtableTest | ||
analyzer | ||
check_cfc | ||
valgrind | ||
CaptureCmd | ||
ClangDataFormat.py | ||
CmpDriver | ||
FindSpecRefs | ||
FuzzTest | ||
builtin-defines.c | ||
clang-completion-mode.el | ||
clang.natvis | ||
find-unused-diagnostics.sh | ||
token-delta.py |