ARMv7k: implement ABI changes for watchOS from standard iOS.

llvm-svn: 251710
This commit is contained in:
Tim Northover 2015-10-30 16:30:45 +00:00
parent e931f9fc0d
commit 5627d3935a
9 changed files with 473 additions and 18 deletions

View File

@ -3702,6 +3702,11 @@ public:
LongDoubleWidth = 128;
LongDoubleAlign = 128;
SuitableAlign = 128;
MaxVectorAlign = 256;
// The watchOS simulator uses the builtin bool type for Objective-C.
llvm::Triple T = llvm::Triple(Triple);
if (T.isWatchOS())
UseSignedCharForObjCBool = false;
SizeType = UnsignedLong;
IntPtrType = SignedLong;
DataLayoutString = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128";
@ -4243,12 +4248,15 @@ class ARMTargetInfo : public TargetInfo {
// FIXME: Enumerated types are variable width in straight AAPCS.
}
void setABIAPCS() {
void setABIAPCS(bool IsAAPCS16) {
const llvm::Triple &T = getTriple();
IsAAPCS = false;
DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 32;
if (IsAAPCS16)
DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 64;
else
DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 32;
// size_t is unsigned int on FreeBSD.
if (T.getOS() == llvm::Triple::FreeBSD)
@ -4268,7 +4276,10 @@ class ARMTargetInfo : public TargetInfo {
/// gcc.
ZeroLengthBitfieldBoundary = 32;
if (T.isOSBinFormatMachO())
if (T.isOSBinFormatMachO() && IsAAPCS16) {
assert(!BigEndian && "AAPCS16 does not support big-endian");
DataLayoutString = "e-m:o-p:32:32-i64:64-a:0:32-n32-S128";
} else if (T.isOSBinFormatMachO())
DataLayoutString =
BigEndian
? "E-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
@ -4413,6 +4424,8 @@ public:
Triple.getOS() == llvm::Triple::UnknownOS ||
StringRef(CPU).startswith("cortex-m")) {
setABI("aapcs");
} else if (Triple.isWatchOS()) {
setABI("aapcs16");
} else {
setABI("apcs-gnu");
}
@ -4465,10 +4478,8 @@ public:
//
// FIXME: We need support for -meabi... we could just mangle it into the
// name.
// FIXME: aapcs16 isn't really the same as APCS, this allows tests to pass
// until the real ABI is committed.
if (Name == "apcs-gnu" || Name == "aapcs16") {
setABIAPCS();
setABIAPCS(Name == "aapcs16");
return true;
}
if (Name == "aapcs" || Name == "aapcs-vfp" || Name == "aapcs-linux") {
@ -4625,6 +4636,12 @@ public:
// Target properties.
Builder.defineMacro("__REGISTER_PREFIX__", "");
// Unfortunately, __ARM_ARCH_7K__ is now more of an ABI descriptor. The CPU
// happens to be Cortex-A7 though, so it should still get __ARM_ARCH_7A__.
if (getTriple().isWatchOS())
Builder.defineMacro("__ARM_ARCH_7K__", "2");
if (!CPUAttr.empty())
Builder.defineMacro("__ARM_ARCH_" + CPUAttr + "__");
@ -4806,7 +4823,10 @@ public:
}
bool isCLZForZeroUndef() const override { return false; }
BuiltinVaListKind getBuiltinVaListKind() const override {
return IsAAPCS ? AAPCSABIBuiltinVaList : TargetInfo::VoidPtrBuiltinVaList;
return IsAAPCS
? AAPCSABIBuiltinVaList
: (getTriple().isWatchOS() ? TargetInfo::CharPtrBuiltinVaList
: TargetInfo::VoidPtrBuiltinVaList);
}
ArrayRef<const char *> getGCCRegNames() const override;
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
@ -5147,8 +5167,18 @@ public:
// ARMleTargetInfo.
MaxAtomicInlineWidth = 64;
// Darwin on iOS uses a variant of the ARM C++ ABI.
TheCXXABI.set(TargetCXXABI::iOS);
if (Triple.isWatchOS()) {
// Darwin on iOS uses a variant of the ARM C++ ABI.
TheCXXABI.set(TargetCXXABI::WatchOS);
// The 32-bit ABI is silent on what ptrdiff_t should be, but given that
// size_t is long, it's a bit weird for it to be int.
PtrDiffType = SignedLong;
// BOOL should be a real boolean on the new ABI
UseSignedCharForObjCBool = false;
} else
TheCXXABI.set(TargetCXXABI::iOS);
}
};
@ -5204,7 +5234,7 @@ public:
// contributes to the alignment of the containing aggregate in the same way
// a plain (non bit-field) member of that type would, without exception for
// zero-sized or anonymous bit-fields."
UseBitFieldTypeAlignment = true;
assert(UseBitFieldTypeAlignment && "bitfields affect type alignment");
UseZeroLengthBitfieldAlignment = true;
// AArch64 targets default to using the ARM C++ ABI.

View File

@ -4693,7 +4693,8 @@ public:
enum ABIKind {
APCS = 0,
AAPCS = 1,
AAPCS_VFP
AAPCS_VFP = 2,
AAPCS16_VFP = 3,
};
private:
@ -4803,7 +4804,8 @@ public:
Fn->addFnAttr("interrupt", Kind);
if (cast<ARMABIInfo>(getABIInfo()).getABIKind() == ARMABIInfo::APCS)
ARMABIInfo::ABIKind ABI = cast<ARMABIInfo>(getABIInfo()).getABIKind();
if (ABI == ARMABIInfo::APCS)
return;
// AAPCS guarantees that sp will be 8-byte aligned on any public interface,
@ -4869,7 +4871,7 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const {
/// Return the default calling convention that LLVM will use.
llvm::CallingConv::ID ARMABIInfo::getLLVMDefaultCC() const {
// The default calling convention that LLVM will infer.
if (isEABIHF())
if (isEABIHF() || getTarget().getTriple().isWatchOS())
return llvm::CallingConv::ARM_AAPCS_VFP;
else if (isEABI())
return llvm::CallingConv::ARM_AAPCS;
@ -4884,6 +4886,7 @@ llvm::CallingConv::ID ARMABIInfo::getABIDefaultCC() const {
case APCS: return llvm::CallingConv::ARM_APCS;
case AAPCS: return llvm::CallingConv::ARM_AAPCS;
case AAPCS_VFP: return llvm::CallingConv::ARM_AAPCS_VFP;
case AAPCS16_VFP: return llvm::CallingConv::ARM_AAPCS_VFP;
}
llvm_unreachable("bad ABI kind");
}
@ -4897,8 +4900,20 @@ void ARMABIInfo::setCCs() {
if (abiCC != getLLVMDefaultCC())
RuntimeCC = abiCC;
BuiltinCC = (getABIKind() == APCS ?
llvm::CallingConv::ARM_APCS : llvm::CallingConv::ARM_AAPCS);
// AAPCS apparently requires runtime support functions to be soft-float, but
// that's almost certainly for historic reasons (Thumb1 not supporting VFP
// most likely). It's more convenient for AAPCS16_VFP to be hard-float.
switch (getABIKind()) {
case APCS:
case AAPCS16_VFP:
if (abiCC != getLLVMDefaultCC())
BuiltinCC = abiCC;
break;
case AAPCS:
case AAPCS_VFP:
BuiltinCC = llvm::CallingConv::ARM_AAPCS;
break;
}
}
ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,
@ -4973,6 +4988,27 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,
// Base can be a floating-point or a vector.
return ABIArgInfo::getDirect(nullptr, 0, nullptr, false);
}
} else if (getABIKind() == ARMABIInfo::AAPCS16_VFP) {
// WatchOS does have homogeneous aggregates. Note that we intentionally use
// this convention even for a variadic function: the backend will use GPRs
// if needed.
const Type *Base = nullptr;
uint64_t Members = 0;
if (isHomogeneousAggregate(Ty, Base, Members)) {
assert(Base && Members <= 4 && "unexpected homogeneous aggregate");
llvm::Type *Ty =
llvm::ArrayType::get(CGT.ConvertType(QualType(Base, 0)), Members);
return ABIArgInfo::getDirect(Ty, 0, nullptr, false);
}
}
if (getABIKind() == ARMABIInfo::AAPCS16_VFP &&
getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(16)) {
// WatchOS is adopting the 64-bit AAPCS rule on composite types: if they're
// bigger than 128-bits, they get placed in space allocated by the caller,
// and a pointer is passed.
return ABIArgInfo::getIndirect(
CharUnits::fromQuantity(getContext().getTypeAlign(Ty) / 8), false);
}
// Support byval for ARM.
@ -4986,6 +5022,7 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,
ABIAlign = std::min(std::max(TyAlign, (uint64_t)4), (uint64_t)8);
if (getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(64)) {
assert(getABIKind() != ARMABIInfo::AAPCS16_VFP && "unexpected byval");
return ABIArgInfo::getIndirect(CharUnits::fromQuantity(ABIAlign),
/*ByVal=*/true,
/*Realign=*/TyAlign > ABIAlign);
@ -5094,7 +5131,8 @@ static bool isIntegerLikeType(QualType Ty, ASTContext &Context,
ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy,
bool isVariadic) const {
bool IsEffectivelyAAPCS_VFP = getABIKind() == AAPCS_VFP && !isVariadic;
bool IsEffectivelyAAPCS_VFP =
(getABIKind() == AAPCS_VFP || getABIKind() == AAPCS16_VFP) && !isVariadic;
if (RetTy->isVoidType())
return ABIArgInfo::getIgnore();
@ -5159,7 +5197,7 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy,
// Check for homogeneous aggregates with AAPCS-VFP.
if (IsEffectivelyAAPCS_VFP) {
const Type *Base = nullptr;
uint64_t Members;
uint64_t Members = 0;
if (isHomogeneousAggregate(RetTy, Base, Members)) {
assert(Base && "Base class should be set for homogeneous aggregate");
// Homogeneous Aggregates are returned directly.
@ -5181,6 +5219,11 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy,
if (Size <= 16)
return ABIArgInfo::getDirect(llvm::Type::getInt16Ty(getVMContext()));
return ABIArgInfo::getDirect(llvm::Type::getInt32Ty(getVMContext()));
} else if (Size <= 128 && getABIKind() == AAPCS16_VFP) {
llvm::Type *Int32Ty = llvm::Type::getInt32Ty(getVMContext());
llvm::Type *CoerceTy =
llvm::ArrayType::get(Int32Ty, llvm::RoundUpToAlignment(Size, 32) / 32);
return ABIArgInfo::getDirect(CoerceTy);
}
return getNaturalAlignIndirect(RetTy);
@ -5238,9 +5281,18 @@ Address ARMABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
// Use indirect if size of the illegal vector is bigger than 16 bytes.
bool IsIndirect = false;
const Type *Base = nullptr;
uint64_t Members = 0;
if (TyInfo.first > CharUnits::fromQuantity(16) && isIllegalVectorType(Ty)) {
IsIndirect = true;
// ARMv7k passes structs bigger than 16 bytes indirectly, in space
// allocated by the caller.
} else if (TyInfo.first > CharUnits::fromQuantity(16) &&
getABIKind() == ARMABIInfo::AAPCS16_VFP &&
!isHomogeneousAggregate(Ty, Base, Members)) {
IsIndirect = true;
// Otherwise, bound the type's ABI alignment.
// The ABI alignment for 64-bit or 128-bit vectors is 8 for AAPCS and 4 for
// APCS. For AAPCS, the ABI alignment is at least 4-byte and at most 8-byte.
@ -7362,8 +7414,11 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
}
ARMABIInfo::ABIKind Kind = ARMABIInfo::AAPCS;
if (getTarget().getABI() == "apcs-gnu")
StringRef ABIStr = getTarget().getABI();
if (ABIStr == "apcs-gnu")
Kind = ARMABIInfo::APCS;
else if (ABIStr == "aapcs16")
Kind = ARMABIInfo::AAPCS16_VFP;
else if (CodeGenOpts.FloatABI == "hard" ||
(CodeGenOpts.FloatABI != "soft" &&
Triple.getEnvironment() == llvm::Triple::GNUEABIHF))

View File

@ -0,0 +1,88 @@
// RUN: %clang_cc1 -triple thumbv7k-apple-watchos2.0 -target-abi aapcs16 %s -o - -emit-llvm | FileCheck %s
// Make sure 64 and 128 bit types are naturally aligned by the v7k ABI:
// CHECK: target datalayout = "e-m:o-p:32:32-i64:64-a:0:32-n32-S128"
typedef struct {
float arr[4];
} HFA;
// CHECK: define void @simple_hfa([4 x float] %h.coerce)
void simple_hfa(HFA h) {}
// CHECK: define %struct.HFA @return_simple_hfa
HFA return_simple_hfa() {}
typedef struct {
double arr[4];
} BigHFA;
// We don't want any padding type to be included by Clang when using the
// APCS-VFP ABI, that needs to be handled by LLVM if needed.
// CHECK: void @no_padding(i32 %r0, i32 %r1, i32 %r2, [4 x double] %d0_d3.coerce, [4 x double] %d4_d7.coerce, [4 x double] %sp.coerce, i64 %split)
void no_padding(int r0, int r1, int r2, BigHFA d0_d3, BigHFA d4_d7, BigHFA sp,
long long split) {}
// Structs larger than 16 bytes should be passed indirectly in space allocated
// by the caller (a pointer to this storage should be what occurs in the arg
// list).
typedef struct {
float x;
long long y;
double z;
} BigStruct;
// CHECK: define void @big_struct_indirect(%struct.BigStruct* %b)
void big_struct_indirect(BigStruct b) {}
// CHECK: define void @return_big_struct_indirect(%struct.BigStruct* noalias sret
BigStruct return_big_struct_indirect() {}
// Structs smaller than 16 bytes should be passed directly, and coerced to
// either [N x i32] or [N x i64] depending on alignment requirements.
typedef struct {
float x;
int y;
double z;
} SmallStruct;
// CHECK: define void @small_struct_direct([2 x i64] %s.coerce)
void small_struct_direct(SmallStruct s) {}
// CHECK: define [4 x i32] @return_small_struct_direct()
SmallStruct return_small_struct_direct() {}
typedef struct {
float x;
int y;
int z;
} SmallStructSmallAlign;
// CHECK: define void @small_struct_align_direct([3 x i32] %s.coerce)
void small_struct_align_direct(SmallStructSmallAlign s) {}
typedef struct {
char x;
short y;
} PaddedSmallStruct;
// CHECK: define i32 @return_padded_small_struct()
PaddedSmallStruct return_padded_small_struct() {}
typedef struct {
char arr[7];
} OddlySizedStruct;
// CHECK: define [2 x i32] @return_oddly_sized_struct()
OddlySizedStruct return_oddly_sized_struct() {}
// CHECK: define double @test_va_arg(i8* %l)
// CHECK: load double, double*
double test_va_arg(__builtin_va_list l) {
return __builtin_va_arg(l, double);
}

View File

@ -3,6 +3,7 @@
// RUN: %clang_cc1 %s -O1 -emit-llvm -triple i686-unknown-unknown -o - | FileCheck %s --check-prefix=X86
// RUN: %clang_cc1 %s -O1 -emit-llvm -triple powerpc-unknown-unknown -o - | FileCheck %s --check-prefix=PPC
// RUN: %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabihf -o - | FileCheck %s --check-prefix=ARM
// RUN: %clang_cc1 %s -O1 -emit-llvm -triple thumbv7k-apple-watchos2.0 -o - -target-abi aapcs16 | FileCheck %s --check-prefix=ARM7K
float _Complex add_float_rr(float a, float b) {
// X86-LABEL: @add_float_rr(
@ -477,5 +478,8 @@ _Bool ne_float_cc(float _Complex a, float _Complex b) {
_Complex double foo(_Complex double a, _Complex double b) {
// ARM-LABEL: @foo(
// ARM: call arm_aapcscc { double, double } @__muldc3
// ARM7K-LABEL: @foo(
// ARM7K: call { double, double } @__muldc3
return a*b;
}

View File

@ -0,0 +1,68 @@
// RUN: %clang_cc1 %s -triple=thumbv7k-apple-watchos -emit-llvm -o - -target-abi aapcs16 | FileCheck %s
// RUN: %clang_cc1 %s -triple=thumbv7k-apple-watchos -emit-llvm -o - -target-abi aapcs16 | FileCheck -check-prefix=CHECK-GLOBALS %s
// __cxa_guard_acquire argument is 64-bit
// rdar://11540122
struct A {
A();
};
void f() {
// CHECK: call i32 @__cxa_guard_acquire(i32*
static A a;
}
// ARM64 uses the C++11 definition of POD.
// rdar://12650514
namespace test1 {
// This class is POD in C++11 and cannot have objects allocated in
// its tail-padding.
struct ABase {};
struct A : ABase {
int x;
char c;
};
struct B : A {
char d;
};
int test() {
return sizeof(B);
}
// CHECK: define i32 @_ZN5test14testEv()
// CHECK: ret i32 12
}
namespace std {
class type_info;
}
// ARM64 uses string comparisons for what would otherwise be
// default-visibility weak RTTI. rdar://12650568
namespace test2 {
struct A {
virtual void foo();
};
void A::foo() {}
// Tested below because these globals get kindof oddly rearranged.
struct __attribute__((visibility("hidden"))) B {};
const std::type_info &b0 = typeid(B);
// CHECK-GLOBALS: @_ZTSN5test21BE = linkonce_odr hidden constant
// CHECK-GLOBALS: @_ZTIN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTSN5test21BE, i32 0, i32 0) }
const std::type_info &b1 = typeid(B*);
// CHECK-GLOBALS: @_ZTSPN5test21BE = linkonce_odr hidden constant
// CHECK-GLOBALS: @_ZTIPN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @_ZTSPN5test21BE, i32 0, i32 0), i32 0, i8* bitcast
struct C {};
const std::type_info &c0 = typeid(C);
// CHECK-GLOBALS: @_ZTSN5test21CE = linkonce_odr constant [11 x i8] c"N5test21CE\00"
// CHECK-GLOBALS: @_ZTIN5test21CE = linkonce_odr constant { {{.*}}, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTSN5test21CE, i32 0, i32 0) }
}
// va_list should be based on "char *" rather than "void *".
// CHECK: define void @_Z11whatsVaListPc
void whatsVaList(__builtin_va_list l) {}

View File

@ -0,0 +1,7 @@
// REQUIRES: x86-registered-target
// REQUIRES: aarch64-registered-target
// RUN: %clang -target i386-apple-darwin10 -mappletvsimulator-version-min=9.0 -arch x86_64 -S -o - %s | FileCheck %s
// RUN: %clang -target armv7s-apple-darwin10 -mappletvos-version-min=9.0 -arch arm64 -S -o - %s | FileCheck %s
int main() { return 0; }
// CHECK: .tvos_version_min 9, 0

View File

@ -0,0 +1,7 @@
// REQUIRES: x86-registered-target
// REQUIRES: arm-registered-target
// RUN: %clang -target i386-apple-darwin10 -mwatchsimulator-version-min=2.0 -arch i386 -S -o - %s | FileCheck %s
// RUN: %clang -target armv7s-apple-darwin10 -mwatchos-version-min=2.0 -arch armv7k -S -o - %s | FileCheck %s
int main() { return 0; }
// CHECK: .watchos_version_min 2, 0

View File

@ -0,0 +1,184 @@
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=thumbv7k-apple-watchos2.0 < /dev/null | FileCheck %s
// Check that the chosen types for things like size_t, ptrdiff_t etc are as
// expected
// CHECK-NOT: #define _LP64 1
// CHECK-NOT: #define __AARCH_BIG_ENDIAN 1
// CHECK-NOT: #define __ARM_BIG_ENDIAN 1
// CHECK: #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
// CHECK: #define __CHAR16_TYPE__ unsigned short
// CHECK: #define __CHAR32_TYPE__ unsigned int
// CHECK: #define __CHAR_BIT__ 8
// CHECK: #define __DBL_DENORM_MIN__ 4.9406564584124654e-324
// CHECK: #define __DBL_DIG__ 15
// CHECK: #define __DBL_EPSILON__ 2.2204460492503131e-16
// CHECK: #define __DBL_HAS_DENORM__ 1
// CHECK: #define __DBL_HAS_INFINITY__ 1
// CHECK: #define __DBL_HAS_QUIET_NAN__ 1
// CHECK: #define __DBL_MANT_DIG__ 53
// CHECK: #define __DBL_MAX_10_EXP__ 308
// CHECK: #define __DBL_MAX_EXP__ 1024
// CHECK: #define __DBL_MAX__ 1.7976931348623157e+308
// CHECK: #define __DBL_MIN_10_EXP__ (-307)
// CHECK: #define __DBL_MIN_EXP__ (-1021)
// CHECK: #define __DBL_MIN__ 2.2250738585072014e-308
// CHECK: #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
// CHECK: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// CHECK: #define __FLT_DIG__ 6
// CHECK: #define __FLT_EPSILON__ 1.19209290e-7F
// CHECK: #define __FLT_EVAL_METHOD__ 0
// CHECK: #define __FLT_HAS_DENORM__ 1
// CHECK: #define __FLT_HAS_INFINITY__ 1
// CHECK: #define __FLT_HAS_QUIET_NAN__ 1
// CHECK: #define __FLT_MANT_DIG__ 24
// CHECK: #define __FLT_MAX_10_EXP__ 38
// CHECK: #define __FLT_MAX_EXP__ 128
// CHECK: #define __FLT_MAX__ 3.40282347e+38F
// CHECK: #define __FLT_MIN_10_EXP__ (-37)
// CHECK: #define __FLT_MIN_EXP__ (-125)
// CHECK: #define __FLT_MIN__ 1.17549435e-38F
// CHECK: #define __FLT_RADIX__ 2
// CHECK: #define __INT16_C_SUFFIX__ {{$}}
// CHECK: #define __INT16_FMTd__ "hd"
// CHECK: #define __INT16_FMTi__ "hi"
// CHECK: #define __INT16_MAX__ 32767
// CHECK: #define __INT16_TYPE__ short
// CHECK: #define __INT32_C_SUFFIX__ {{$}}
// CHECK: #define __INT32_FMTd__ "d"
// CHECK: #define __INT32_FMTi__ "i"
// CHECK: #define __INT32_MAX__ 2147483647
// CHECK: #define __INT32_TYPE__ int
// CHECK: #define __INT64_C_SUFFIX__ LL
// CHECK: #define __INT64_FMTd__ "lld"
// CHECK: #define __INT64_FMTi__ "lli"
// CHECK: #define __INT64_MAX__ 9223372036854775807LL
// CHECK: #define __INT64_TYPE__ long long int
// CHECK: #define __INT8_C_SUFFIX__ {{$}}
// CHECK: #define __INT8_FMTd__ "hhd"
// CHECK: #define __INT8_FMTi__ "hhi"
// CHECK: #define __INT8_MAX__ 127
// CHECK: #define __INT8_TYPE__ signed char
// CHECK: #define __INTMAX_C_SUFFIX__ LL
// CHECK: #define __INTMAX_FMTd__ "lld"
// CHECK: #define __INTMAX_FMTi__ "lli"
// CHECK: #define __INTMAX_MAX__ 9223372036854775807LL
// CHECK: #define __INTMAX_TYPE__ long long int
// CHECK: #define __INTMAX_WIDTH__ 64
// CHECK: #define __INTPTR_FMTd__ "ld"
// CHECK: #define __INTPTR_FMTi__ "li"
// CHECK: #define __INTPTR_MAX__ 2147483647L
// CHECK: #define __INTPTR_TYPE__ long int
// CHECK: #define __INTPTR_WIDTH__ 32
// CHECK: #define __INT_FAST16_FMTd__ "hd"
// CHECK: #define __INT_FAST16_FMTi__ "hi"
// CHECK: #define __INT_FAST16_MAX__ 32767
// CHECK: #define __INT_FAST16_TYPE__ short
// CHECK: #define __INT_FAST32_FMTd__ "d"
// CHECK: #define __INT_FAST32_FMTi__ "i"
// CHECK: #define __INT_FAST32_MAX__ 2147483647
// CHECK: #define __INT_FAST32_TYPE__ int
// CHECK: #define __INT_FAST64_FMTd__ "lld"
// CHECK: #define __INT_FAST64_FMTi__ "lli"
// CHECK: #define __INT_FAST64_MAX__ 9223372036854775807LL
// CHECK: #define __INT_FAST64_TYPE__ long long int
// CHECK: #define __INT_FAST8_FMTd__ "hhd"
// CHECK: #define __INT_FAST8_FMTi__ "hhi"
// CHECK: #define __INT_FAST8_MAX__ 127
// CHECK: #define __INT_FAST8_TYPE__ signed char
// CHECK: #define __INT_LEAST16_FMTd__ "hd"
// CHECK: #define __INT_LEAST16_FMTi__ "hi"
// CHECK: #define __INT_LEAST16_MAX__ 32767
// CHECK: #define __INT_LEAST16_TYPE__ short
// CHECK: #define __INT_LEAST32_FMTd__ "d"
// CHECK: #define __INT_LEAST32_FMTi__ "i"
// CHECK: #define __INT_LEAST32_MAX__ 2147483647
// CHECK: #define __INT_LEAST32_TYPE__ int
// CHECK: #define __INT_LEAST64_FMTd__ "lld"
// CHECK: #define __INT_LEAST64_FMTi__ "lli"
// CHECK: #define __INT_LEAST64_MAX__ 9223372036854775807LL
// CHECK: #define __INT_LEAST64_TYPE__ long long int
// CHECK: #define __INT_LEAST8_FMTd__ "hhd"
// CHECK: #define __INT_LEAST8_FMTi__ "hhi"
// CHECK: #define __INT_LEAST8_MAX__ 127
// CHECK: #define __INT_LEAST8_TYPE__ signed char
// CHECK: #define __INT_MAX__ 2147483647
// CHECK: #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
// CHECK: #define __LDBL_DIG__ 15
// CHECK: #define __LDBL_EPSILON__ 2.2204460492503131e-16L
// CHECK: #define __LDBL_HAS_DENORM__ 1
// CHECK: #define __LDBL_HAS_INFINITY__ 1
// CHECK: #define __LDBL_HAS_QUIET_NAN__ 1
// CHECK: #define __LDBL_MANT_DIG__ 53
// CHECK: #define __LDBL_MAX_10_EXP__ 308
// CHECK: #define __LDBL_MAX_EXP__ 1024
// CHECK: #define __LDBL_MAX__ 1.7976931348623157e+308L
// CHECK: #define __LDBL_MIN_10_EXP__ (-307)
// CHECK: #define __LDBL_MIN_EXP__ (-1021)
// CHECK: #define __LDBL_MIN__ 2.2250738585072014e-308L
// CHECK: #define __LONG_LONG_MAX__ 9223372036854775807LL
// CHECK: #define __LONG_MAX__ 2147483647L
// CHECK: #define __POINTER_WIDTH__ 32
// CHECK: #define __PTRDIFF_TYPE__ long int
// CHECK: #define __PTRDIFF_WIDTH__ 32
// CHECK: #define __SCHAR_MAX__ 127
// CHECK: #define __SHRT_MAX__ 32767
// CHECK: #define __SIG_ATOMIC_MAX__ 2147483647
// CHECK: #define __SIG_ATOMIC_WIDTH__ 32
// CHECK: #define __SIZEOF_DOUBLE__ 8
// CHECK: #define __SIZEOF_FLOAT__ 4
// CHECK: #define __SIZEOF_INT__ 4
// CHECK: #define __SIZEOF_LONG_DOUBLE__ 8
// CHECK: #define __SIZEOF_LONG_LONG__ 8
// CHECK: #define __SIZEOF_LONG__ 4
// CHECK: #define __SIZEOF_POINTER__ 4
// CHECK: #define __SIZEOF_PTRDIFF_T__ 4
// CHECK: #define __SIZEOF_SHORT__ 2
// CHECK: #define __SIZEOF_SIZE_T__ 4
// CHECK: #define __SIZEOF_WCHAR_T__ 4
// CHECK: #define __SIZEOF_WINT_T__ 4
// CHECK: #define __SIZE_MAX__ 4294967295UL
// CHECK: #define __SIZE_TYPE__ long unsigned int
// CHECK: #define __SIZE_WIDTH__ 32
// CHECK: #define __UINT16_C_SUFFIX__ {{$}}
// CHECK: #define __UINT16_MAX__ 65535
// CHECK: #define __UINT16_TYPE__ unsigned short
// CHECK: #define __UINT32_C_SUFFIX__ U
// CHECK: #define __UINT32_MAX__ 4294967295U
// CHECK: #define __UINT32_TYPE__ unsigned int
// CHECK: #define __UINT64_C_SUFFIX__ ULL
// CHECK: #define __UINT64_MAX__ 18446744073709551615ULL
// CHECK: #define __UINT64_TYPE__ long long unsigned int
// CHECK: #define __UINT8_C_SUFFIX__ {{$}}
// CHECK: #define __UINT8_MAX__ 255
// CHECK: #define __UINT8_TYPE__ unsigned char
// CHECK: #define __UINTMAX_C_SUFFIX__ ULL
// CHECK: #define __UINTMAX_MAX__ 18446744073709551615ULL
// CHECK: #define __UINTMAX_TYPE__ long long unsigned int
// CHECK: #define __UINTMAX_WIDTH__ 64
// CHECK: #define __UINTPTR_MAX__ 4294967295UL
// CHECK: #define __UINTPTR_TYPE__ long unsigned int
// CHECK: #define __UINTPTR_WIDTH__ 32
// CHECK: #define __UINT_FAST16_MAX__ 65535
// CHECK: #define __UINT_FAST16_TYPE__ unsigned short
// CHECK: #define __UINT_FAST32_MAX__ 4294967295U
// CHECK: #define __UINT_FAST32_TYPE__ unsigned int
// CHECK: #define __UINT_FAST64_MAX__ 18446744073709551615UL
// CHECK: #define __UINT_FAST64_TYPE__ long long unsigned int
// CHECK: #define __UINT_FAST8_MAX__ 255
// CHECK: #define __UINT_FAST8_TYPE__ unsigned char
// CHECK: #define __UINT_LEAST16_MAX__ 65535
// CHECK: #define __UINT_LEAST16_TYPE__ unsigned short
// CHECK: #define __UINT_LEAST32_MAX__ 4294967295U
// CHECK: #define __UINT_LEAST32_TYPE__ unsigned int
// CHECK: #define __UINT_LEAST64_MAX__ 18446744073709551615UL
// CHECK: #define __UINT_LEAST64_TYPE__ long long unsigned int
// CHECK: #define __UINT_LEAST8_MAX__ 255
// CHECK: #define __UINT_LEAST8_TYPE__ unsigned char
// CHECK: #define __USER_LABEL_PREFIX__ _
// CHECK: #define __WCHAR_MAX__ 2147483647
// CHECK: #define __WCHAR_TYPE__ int
// CHECK-NOT: #define __WCHAR_UNSIGNED__ 1
// CHECK: #define __WCHAR_WIDTH__ 32
// CHECK: #define __WINT_TYPE__ int
// CHECK: #define __WINT_WIDTH__ 32

View File

@ -0,0 +1,12 @@
// RUN: %clang_cc1 -triple thumbv7s-apple-ios8.0 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-CHAR
// RUN: %clang_cc1 -triple thumbv7k-apple-watchos2.0 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-BOOL
// RUN: %clang_cc1 -triple i386-apple-watchos2.0 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-BOOL
// RUN: %clang_cc1 -triple arm64-apple-ios8.0 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-BOOL
// RUN: %clang_cc1 -triple x86_64-apple-ios8.0 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-BOOL
// RUN: %clang_cc1 -triple i386-apple-macosx10.10 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-CHAR
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-CHAR
// CHECK-CHAR: ObjCBoolLiteralExpr {{.*}} 'signed char' __objc_yes
// CHECK-BOOL: ObjCBoolLiteralExpr {{.*}} '_Bool' __objc_yes
int var = __objc_yes;