forked from OSchip/llvm-project
Preprocessor: Add __ALIGNOF_MAX_ALIGN_T__
TargetInfo::getSuitableAlign() was introduced in r146762 and is defined as alignof(std::max_align_t). Introduce __ALIGNOF_MAX_ALIGN_T__ which exposes getSuitableAlign() so that libc++ may take advantage of it. llvm-svn: 201037
This commit is contained in:
parent
d1fc17b931
commit
158ba130ee
|
@ -600,6 +600,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
|||
DefineType("__CHAR16_TYPE__", TI.getChar16Type(), Builder);
|
||||
DefineType("__CHAR32_TYPE__", TI.getChar32Type(), Builder);
|
||||
|
||||
Builder.defineMacro("__ALIGNOF_MAX_ALIGN_T__",
|
||||
Twine(TI.getSuitableAlign() / TI.getCharWidth()));
|
||||
|
||||
DefineFloatMacros(Builder, "FLT", &TI.getFloatFormat(), "F");
|
||||
DefineFloatMacros(Builder, "DBL", &TI.getDoubleFormat(), "");
|
||||
DefineFloatMacros(Builder, "LDBL", &TI.getLongDoubleFormat(), "L");
|
||||
|
|
|
@ -206,6 +206,7 @@
|
|||
//
|
||||
// AARCH64-NETBSD:#define _LP64 1
|
||||
// AARCH64-NETBSD:#define __AARCH64EL__ 1
|
||||
// AARCH64-NETBSD:#define __ALIGNOF_MAX_ALIGN_T__ 16
|
||||
// AARCH64-NETBSD:#define __ARM_64BIT_STATE 1
|
||||
// AARCH64-NETBSD:#define __ARM_ARCH 8
|
||||
// AARCH64-NETBSD:#define __ARM_ARCH_ISA_A64 1
|
||||
|
@ -305,6 +306,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-none < /dev/null | FileCheck -check-prefix ARM %s
|
||||
//
|
||||
// ARM-NOT:#define _LP64
|
||||
// ARM:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// ARM:#define __APCS_32__ 1
|
||||
// ARM:#define __ARMEL__ 1
|
||||
// ARM:#define __ARM_ARCH_6J__ 1
|
||||
|
@ -405,6 +407,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-linux-gnueabi -target-feature +soft-float -target-feature +soft-float-abi < /dev/null | FileCheck -check-prefix ARMEABISOFTFP %s
|
||||
//
|
||||
// ARM-NOT:#define _LP64
|
||||
// ARMEABISOFTFP:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// ARMEABISOFTFP:#define __APCS_32__ 1
|
||||
// ARMEABISOFTFP:#define __ARMEL__ 1
|
||||
// ARMEABISOFTFP:#define __ARM_ARCH 6
|
||||
|
@ -510,6 +513,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-linux-gnueabi < /dev/null | FileCheck -check-prefix ARMEABIHARDFP %s
|
||||
//
|
||||
// ARM-NOT:#define _LP64
|
||||
// ARMEABIHARDFP:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// ARMEABIHARDFP:#define __APCS_32__ 1
|
||||
// ARMEABIHARDFP:#define __ARMEL__ 1
|
||||
// ARMEABIHARDFP:#define __ARM_ARCH 6
|
||||
|
@ -663,6 +667,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-none-none < /dev/null | FileCheck -check-prefix I386 %s
|
||||
//
|
||||
// I386-NOT:#define _LP64
|
||||
// I386:#define __ALIGNOF_MAX_ALIGN_T__ 16
|
||||
// I386:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// I386:#define __CHAR16_TYPE__ unsigned short
|
||||
// I386:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -761,6 +766,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-pc-linux-gnu -target-cpu pentium4 < /dev/null | FileCheck -check-prefix I386-LINUX %s
|
||||
//
|
||||
// I386-LINUX-NOT:#define _LP64
|
||||
// I386-LINUX:#define __ALIGNOF_MAX_ALIGN_T__ 16
|
||||
// I386-LINUX:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// I386-LINUX:#define __CHAR16_TYPE__ unsigned short
|
||||
// I386-LINUX:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -859,6 +865,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd < /dev/null | FileCheck -check-prefix I386-NETBSD %s
|
||||
//
|
||||
// I386-NETBSD-NOT:#define _LP64
|
||||
// I386-NETBSD:#define __ALIGNOF_MAX_ALIGN_T__ 16
|
||||
// I386-NETBSD:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// I386-NETBSD:#define __CHAR16_TYPE__ unsigned short
|
||||
// I386-NETBSD:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -975,6 +982,7 @@
|
|||
// MIPS32BE:#define _MIPS_SZINT 32
|
||||
// MIPS32BE:#define _MIPS_SZLONG 32
|
||||
// MIPS32BE:#define _MIPS_SZPTR 32
|
||||
// MIPS32BE:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// MIPS32BE:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
||||
// MIPS32BE:#define __CHAR16_TYPE__ unsigned short
|
||||
// MIPS32BE:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -1094,6 +1102,7 @@
|
|||
// MIPS32EL:#define _MIPS_SZINT 32
|
||||
// MIPS32EL:#define _MIPS_SZLONG 32
|
||||
// MIPS32EL:#define _MIPS_SZPTR 32
|
||||
// MIPS32EL:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// MIPS32EL:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// MIPS32EL:#define __CHAR16_TYPE__ unsigned short
|
||||
// MIPS32EL:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -1210,6 +1219,7 @@
|
|||
// MIPS64BE:#define _MIPS_SZINT 32
|
||||
// MIPS64BE:#define _MIPS_SZLONG 64
|
||||
// MIPS64BE:#define _MIPS_SZPTR 64
|
||||
// MIPS64BE:#define __ALIGNOF_MAX_ALIGN_T__ 16
|
||||
// MIPS64BE:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
||||
// MIPS64BE:#define __CHAR16_TYPE__ unsigned short
|
||||
// MIPS64BE:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -1328,6 +1338,7 @@
|
|||
// MIPS64EL:#define _MIPS_SZINT 32
|
||||
// MIPS64EL:#define _MIPS_SZLONG 64
|
||||
// MIPS64EL:#define _MIPS_SZPTR 64
|
||||
// MIPS64EL:#define __ALIGNOF_MAX_ALIGN_T__ 16
|
||||
// MIPS64EL:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// MIPS64EL:#define __CHAR16_TYPE__ unsigned short
|
||||
// MIPS64EL:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -1581,6 +1592,7 @@
|
|||
//
|
||||
// MSP430:#define MSP430 1
|
||||
// MSP430-NOT:#define _LP64
|
||||
// MPS430:#define __ALIGNOF_MAX_ALIGN_T__ 4
|
||||
// MSP430:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// MSP430:#define __CHAR16_TYPE__ unsigned short
|
||||
// MSP430:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -1674,6 +1686,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=nvptx-none-none < /dev/null | FileCheck -check-prefix NVPTX32 %s
|
||||
//
|
||||
// NVPTX32-NOT:#define _LP64
|
||||
// NVPTX32:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// NVPTX32:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// NVPTX32:#define __CHAR16_TYPE__ unsigned short
|
||||
// NVPTX32:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -1771,6 +1784,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=nvptx64-none-none < /dev/null | FileCheck -check-prefix NVPTX64 %s
|
||||
//
|
||||
// NVPTX64:#define _LP64 1
|
||||
// NVPTX64:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// NVPTX64:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// NVPTX64:#define __CHAR16_TYPE__ unsigned short
|
||||
// NVPTX64:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -1873,6 +1887,7 @@
|
|||
// PPC603E:#define _ARCH_PPCGR 1
|
||||
// PPC603E:#define _BIG_ENDIAN 1
|
||||
// PPC603E-NOT:#define _LP64
|
||||
// PPC603E:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// PPC603E:#define __BIG_ENDIAN__ 1
|
||||
// PPC603E:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
||||
// PPC603E:#define __CHAR16_TYPE__ unsigned short
|
||||
|
@ -1982,6 +1997,7 @@
|
|||
// PPC64:#define _ARCH_PWR7 1
|
||||
// PPC64:#define _BIG_ENDIAN 1
|
||||
// PPC64:#define _LP64 1
|
||||
// PPC64:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// PPC64:#define __BIG_ENDIAN__ 1
|
||||
// PPC64:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
||||
// PPC64:#define __CHAR16_TYPE__ unsigned short
|
||||
|
@ -2095,6 +2111,7 @@
|
|||
// PPC64LE:#define _ARCH_PWR7 1
|
||||
// PPC64LE:#define _LITTLE_ENDIAN 1
|
||||
// PPC64LE:#define _LP64 1
|
||||
// PPC64LE:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// PPC64LE:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// PPC64LE:#define __CHAR16_TYPE__ unsigned short
|
||||
// PPC64LE:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -2360,6 +2377,7 @@
|
|||
// PPC64-LINUX:#define _ARCH_PPC64 1
|
||||
// PPC64-LINUX:#define _BIG_ENDIAN 1
|
||||
// PPC64-LINUX:#define _LP64 1
|
||||
// PPC64-LINUX:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// PPC64-LINUX:#define __BIG_ENDIAN__ 1
|
||||
// PPC64-LINUX:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
||||
// PPC64-LINUX:#define __CHAR16_TYPE__ unsigned short
|
||||
|
@ -2467,6 +2485,7 @@
|
|||
// PPC:#define _ARCH_PPC 1
|
||||
// PPC:#define _BIG_ENDIAN 1
|
||||
// PPC-NOT:#define _LP64
|
||||
// PPC:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// PPC:#define __BIG_ENDIAN__ 1
|
||||
// PPC:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
||||
// PPC:#define __CHAR16_TYPE__ unsigned short
|
||||
|
@ -2569,6 +2588,7 @@
|
|||
// PPC-LINUX:#define _ARCH_PPC 1
|
||||
// PPC-LINUX:#define _BIG_ENDIAN 1
|
||||
// PPC-LINUX-NOT:#define _LP64
|
||||
// PPC-LINUX:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// PPC-LINUX:#define __BIG_ENDIAN__ 1
|
||||
// PPC-LINUX:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
||||
// PPC-LINUX:#define __CHAR16_TYPE__ unsigned short
|
||||
|
@ -2672,6 +2692,7 @@
|
|||
//
|
||||
// PPC-DARWIN:#define _ARCH_PPC 1
|
||||
// PPC-DARWIN:#define _BIG_ENDIAN 1
|
||||
// PPC-DARWIN:#define __ALIGNOF_MAX_ALIGN_T__ 16
|
||||
// PPC-DARWIN:#define __BIG_ENDIAN__ 1
|
||||
// PPC-DARWIN:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
||||
// PPC-DARWIN:#define __CHAR16_TYPE__ unsigned short
|
||||
|
@ -2870,6 +2891,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-none < /dev/null | FileCheck -check-prefix SPARC %s
|
||||
//
|
||||
// SPARC-NOT:#define _LP64
|
||||
// SPARC:#define __ALIGNOF_MAX_ALIGN_T__ 8
|
||||
// SPARC:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
||||
// SPARC:#define __CHAR16_TYPE__ unsigned short
|
||||
// SPARC:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -2968,6 +2990,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=tce-none-none < /dev/null | FileCheck -check-prefix TCE %s
|
||||
//
|
||||
// TCE-NOT:#define _LP64
|
||||
// TCE:#define __ALIGNOF_MAX_ALIGN_T__ 4
|
||||
// TCE:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
||||
// TCE:#define __CHAR16_TYPE__ unsigned short
|
||||
// TCE:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -3063,6 +3086,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-none-none < /dev/null | FileCheck -check-prefix X86_64 %s
|
||||
//
|
||||
// X86_64:#define _LP64 1
|
||||
// X86_64:#define __ALIGNOF_MAX_ALIGN_T__ 16
|
||||
// X86_64:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// X86_64:#define __CHAR16_TYPE__ unsigned short
|
||||
// X86_64:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -3167,6 +3191,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-pc-linux-gnu < /dev/null | FileCheck -check-prefix X86_64-LINUX %s
|
||||
//
|
||||
// X86_64-LINUX:#define _LP64 1
|
||||
// X86_64-LINUX:#define __ALIGNOF_MAX_ALIGN_T__ 16
|
||||
// X86_64-LINUX:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// X86_64-LINUX:#define __CHAR16_TYPE__ unsigned short
|
||||
// X86_64-LINUX:#define __CHAR32_TYPE__ unsigned int
|
||||
|
@ -3277,6 +3302,7 @@
|
|||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-netbsd < /dev/null | FileCheck -check-prefix X86_64-NETBSD %s
|
||||
//
|
||||
// X86_64-NETBSD:#define _LP64 1
|
||||
// X86_64-NETBSD:#define __ALIGNOF_MAX_ALIGN_T__ 16
|
||||
// X86_64-NETBSD:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
// X86_64-NETBSD:#define __CHAR16_TYPE__ unsigned short
|
||||
// X86_64-NETBSD:#define __CHAR32_TYPE__ unsigned int
|
||||
|
|
Loading…
Reference in New Issue