llvm-project/clang/utils
Ulrich Weigand ca3cb7f35c Implement target-specific __attribute__((aligned)) value
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
2015-04-21 17:29:35 +00:00
..
ABITest Fix invalid test generation by utils/ABITest/ABITestGen.py when the same enum is generated more than once. 2014-08-21 10:13:49 +00:00
CIndex
TableGen Implement target-specific __attribute__((aligned)) value 2015-04-21 17:29:35 +00:00
TestUtils
VtableTest
analyzer [analyzer] Rename NewDeleteLeaks checker in the test script. 2014-10-31 17:40:14 +00:00
check_cfc [utils] Add Check Compile Flow Consistency tool (check_cfc.py). 2015-04-02 15:01:53 +00:00
valgrind clang/utils/valgrind/x86_64-pc-linux-gnu_gcc-4.3.3.supp: Add /usr/bin/cmp. 2013-01-20 15:30:41 +00:00
CaptureCmd
ClangDataFormat.py [utils/ClangDataFormat.py] Don't use lldb.frame directly, get the frame from the value. 2013-01-09 23:22:08 +00:00
CmpDriver utils/CmpDriver: add brief documentation to indicate what this does 2014-05-21 02:08:10 +00:00
FindSpecRefs
FuzzTest [utils/FuzzTest] Add '--stop-on-fail' to stop the script on the first failure 2012-03-08 20:29:39 +00:00
builtin-defines.c
clang-completion-mode.el Minor comments and changes to clang-completion-mode.el, from David Wood! 2012-06-07 22:33:29 +00:00
clang.natvis Add a Visualizer for VarDecl. 2014-06-26 16:26:42 +00:00
find-unused-diagnostics.sh Increase the portability of this script a bit: use /usr/bin/env to find bash, 2013-05-24 23:54:21 +00:00
token-delta.py