r256240 - [mips] Add _GCC_HAVE_SYNC_COMPARE_AND_SWAP macros.
Daniel Sanders via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 22 04:59:30 PST 2015
Author: dsanders
Date: Tue Dec 22 06:59:30 2015
New Revision: 256240
URL: http://llvm.org/viewvc/llvm-project?rev=256240&view=rev
Log:
[mips] Add _GCC_HAVE_SYNC_COMPARE_AND_SWAP macros.
This fixes the 'pure virtual function called' failure with ThreadPool in a
clang-built clang. This fixes the llvm-mips-linux builder.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/predefined-macros.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=256240&r1=256239&r2=256240&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Dec 22 06:59:30 2015
@@ -6585,6 +6585,12 @@ public:
Builder.defineMacro("_MIPS_ARCH", "\"" + CPU + "\"");
Builder.defineMacro("_MIPS_ARCH_" + StringRef(CPU).upper());
+
+ // These shouldn't be defined for MIPS-I but there's no need to check
+ // for that since MIPS-I isn't supported.
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
}
ArrayRef<Builtin::Info> getTargetBuiltins() const override {
@@ -6959,6 +6965,8 @@ public:
}
else
llvm_unreachable("Invalid ABI for Mips64.");
+
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
}
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
static const TargetInfo::GCCRegAlias GCCRegAliases[] = {
Modified: cfe/trunk/test/Preprocessor/predefined-macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-macros.c?rev=256240&r1=256239&r2=256240&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/predefined-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-macros.c Tue Dec 22 06:59:30 2015
@@ -134,3 +134,15 @@
// RUN: %clang_cc1 %s -E -dM -o - -triple armv6 -target-cpu cortex-m0 \
// RUN: | FileCheck %s --check-prefix=CHECK-SYNC_CAS_ARMv6
// CHECK-SYNC_CAS_ARMv6-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP
+//
+// RUN: %clang_cc1 %s -E -dM -o - -triple mips -target-cpu mips2 \
+// RUN: | FileCheck %s --check-prefix=CHECK-SYNC_CAS_MIPS \
+// RUN: --check-prefix=CHECK-SYNC_CAS_MIPS32
+// RUN: %clang_cc1 %s -E -dM -o - -triple mips64 -target-cpu mips3 \
+// RUN: | FileCheck %s --check-prefix=CHECK-SYNC_CAS_MIPS \
+// RUN: --check-prefix=CHECK-SYNC_CAS_MIPS64
+// CHECK-SYNC_CAS_MIPS: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
+// CHECK-SYNC_CAS_MIPS: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
+// CHECK-SYNC_CAS_MIPS: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+// CHECK-SYNC_CAS_MIPS32-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
+// CHECK-SYNC_CAS_MIPS64: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
More information about the cfe-commits
mailing list