diff options
author | Tim Northover <tnorthover@apple.com> | 2015-02-06 01:25:07 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2015-02-06 01:25:07 +0000 |
commit | a6a19f1e38769ed23fbb03bb0c2eacee6dbd7d89 (patch) | |
tree | 75edebfd255158517d23c6bafe62032c10c82768 /clang/lib | |
parent | 02bc357b6c8ddc660523a871ca6da63c9e1657ec (diff) | |
download | bcm5719-llvm-a6a19f1e38769ed23fbb03bb0c2eacee6dbd7d89.tar.gz bcm5719-llvm-a6a19f1e38769ed23fbb03bb0c2eacee6dbd7d89.zip |
Preprocessor: support __BIGGEST_ALIGNMENT__ macro
For compatibility with GCC (and because it's generally helpful information
otherwise inaccessible to the preprocessor). This appears to be canonically the
alignment of max_align_t (e.g. on i386, __BIGGEST_ALIGNMENT__ is 4 even though
vector types will be given greater alignment).
Patch mostly by Mats Petersson
llvm-svn: 228367
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index ae3ba6567b4..683c7ece260 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -4672,7 +4672,7 @@ public: MaxAtomicInlineWidth = 128; MaxAtomicPromoteWidth = 128; - LongDoubleWidth = LongDoubleAlign = 128; + LongDoubleWidth = LongDoubleAlign = SuitableAlign = 128; LongDoubleFormat = &llvm::APFloat::IEEEquad; // {} in inline assembly are neon specifiers, not assembly variant @@ -5012,7 +5012,7 @@ public: WCharType = SignedInt; UseSignedCharForObjCBool = false; - LongDoubleWidth = LongDoubleAlign = 64; + LongDoubleWidth = LongDoubleAlign = SuitableAlign = 64; LongDoubleFormat = &llvm::APFloat::IEEEdouble; TheCXXABI.set(TargetCXXABI::iOS64); diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index f4241a94ae0..896277aa545 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -710,6 +710,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__POINTER_WIDTH__", Twine((int)TI.getPointerWidth(0))); + // Define __BIGGEST_ALIGNMENT__ to be compatible with gcc. + Builder.defineMacro("__BIGGEST_ALIGNMENT__", + Twine(TI.getSuitableAlign() / TI.getCharWidth()) ); + if (!LangOpts.CharIsSigned) Builder.defineMacro("__CHAR_UNSIGNED__"); |