llvm-project/clang/lib/Basic
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
..
Attributes.cpp Complete support for the SD-6 standing document (based off N4200) with support for __has_cpp_attribute. 2014-11-14 13:44:02 +00:00
Builtins.cpp CodeGen: make target builtins support languages 2014-07-02 17:41:27 +00:00
CMakeLists.txt Revert r223578, perf data collection depends on the old symbol name. 2014-12-10 23:49:03 +00:00
CharInfo.cpp CharInfo: Add missing "using namespace clang::charinfo" in .cpp file. 2013-02-08 22:37:49 +00:00
Diagnostic.cpp Prefer SmallVector::append/insert over push_back loops. Clang edition. 2015-02-17 16:48:30 +00:00
DiagnosticIDs.cpp Simplify boolean expressions in clang with clang-tidy 2015-03-09 02:02:07 +00:00
FileManager.cpp Remove many superfluous SmallString::str() calls. 2015-03-18 10:17:07 +00:00
FileSystemStatCache.cpp Make VFS and FileManager match the current MemoryBuffer API. 2014-10-26 22:44:13 +00:00
IdentifierTable.cpp OpenCL: CL2.0 atomic types 2015-03-18 12:55:29 +00:00
LangOptions.cpp Allow to specify multiple -fsanitize-blacklist= arguments. 2015-02-04 17:40:08 +00:00
Makefile Revert r223578, perf data collection depends on the old symbol name. 2014-12-10 23:49:03 +00:00
Module.cpp [modules] Restrict the module use-declaration to only appear in top-level 2015-03-26 22:10:01 +00:00
ObjCRuntime.cpp Add a define for the ObjFW runtime ABI version. 2013-09-16 16:31:49 +00:00
OpenMPKinds.cpp [OPENMP] Codegen for 'copyin' clause in 'parallel' directive. 2015-04-16 05:39:01 +00:00
OperatorPrecedence.cpp Replace C++0x in a comment with C++11 2013-07-14 17:04:56 +00:00
SanitizerBlacklist.cpp Allow to specify multiple -fsanitize-blacklist= arguments. 2015-02-04 17:40:08 +00:00
Sanitizers.cpp [Sanitizer] Refactor SanitizerArgs parsing in Driver. 2014-11-14 02:59:20 +00:00
SourceLocation.cpp Inline function into only use. 2014-08-18 18:17:32 +00:00
SourceManager.cpp Prefer uninitialized memory for scratch space. 2015-04-06 17:45:11 +00:00
TargetInfo.cpp Implement target-specific __attribute__((aligned)) value 2015-04-21 17:29:35 +00:00
Targets.cpp Implement target-specific __attribute__((aligned)) value 2015-04-21 17:29:35 +00:00
TokenKinds.cpp [C++11] Use 'nullptr'. 2014-05-08 06:41:40 +00:00
Version.cpp Revert r223578, perf data collection depends on the old symbol name. 2014-12-10 23:49:03 +00:00
VersionTuple.cpp MS ABI: Implement driver-level support for thread-safe statics 2015-03-22 08:39:22 +00:00
VirtualFileSystem.cpp Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:00:23 +00:00
Warnings.cpp Use -Rblah, not -Wblah, to control remark diagnostics. This was always the 2014-08-07 00:24:21 +00:00