[llvm-commits] [llvm] r140064 - in /llvm/trunk: autoconf/configure.ac cmake/config-ix.cmake cmake/modules/CheckAtomic.cmake configure include/llvm/Config/config.h.cmake include/llvm/Config/config.h.in include/llvm/Config/llvm-config.h.cmake include/llvm/Config/llvm-config.h.in lib/Support/Atomic.cpp lib/Support/Threading.cpp
Eric Christopher
echristo at apple.com
Mon Sep 19 13:43:23 PDT 2011
Author: echristo
Date: Mon Sep 19 15:43:23 2011
New Revision: 140064
URL: http://llvm.org/viewvc/llvm-project?rev=140064&view=rev
Log:
Rename LLVM_MULTITHREADED define and fix build without threads.
Patch by Arrowdodger.
Modified:
llvm/trunk/autoconf/configure.ac
llvm/trunk/cmake/config-ix.cmake
llvm/trunk/cmake/modules/CheckAtomic.cmake
llvm/trunk/configure
llvm/trunk/include/llvm/Config/config.h.cmake
llvm/trunk/include/llvm/Config/config.h.in
llvm/trunk/include/llvm/Config/llvm-config.h.cmake
llvm/trunk/include/llvm/Config/llvm-config.h.in
llvm/trunk/lib/Support/Atomic.cpp
llvm/trunk/lib/Support/Threading.cpp
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=140064&r1=140063&r2=140064&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Mon Sep 19 15:43:23 2011
@@ -1515,9 +1515,9 @@
]]),
AC_LANG_POP([C++])
AC_MSG_RESULT(yes)
- AC_DEFINE(LLVM_MULTITHREADED, 1, Build multithreading support into LLVM),
+ AC_DEFINE(LLVM_HAS_ATOMICS, 1, Has gcc/MSVC atomic intrinsics),
AC_MSG_RESULT(no)
- AC_DEFINE(LLVM_MULTITHREADED, 0, Build multithreading support into LLVM)
+ AC_DEFINE(LLVM_HAS_ATOMICS, 0, Has gcc/MSVC atomic intrinsics)
AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing]))
dnl===-----------------------------------------------------------------------===
Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=140064&r1=140063&r2=140064&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Mon Sep 19 15:43:23 2011
@@ -272,7 +272,7 @@
unset(HAVE_FFI_CALL CACHE)
endif( LLVM_ENABLE_FFI )
-# Define LLVM_MULTITHREADED if gcc atomic builtins exists.
+# Define LLVM_HAS_ATOMICS if gcc or MSVC atomic builtins are supported.
include(CheckAtomic)
if( LLVM_ENABLE_PIC )
Modified: llvm/trunk/cmake/modules/CheckAtomic.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CheckAtomic.cmake?rev=140064&r1=140063&r2=140064&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/CheckAtomic.cmake (original)
+++ llvm/trunk/cmake/modules/CheckAtomic.cmake Mon Sep 19 15:43:23 2011
@@ -22,8 +22,8 @@
#endif
return 0;
}
-" LLVM_MULTITHREADED)
+" LLVM_HAS_ATOMICS)
-if( NOT LLVM_MULTITHREADED )
+if( NOT LLVM_HAS_ATOMICS )
message(STATUS "Warning: LLVM will be built thread-unsafe because atomic builtins are missing")
endif()
Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=140064&r1=140063&r2=140064&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Mon Sep 19 15:43:23 2011
@@ -21027,7 +21027,7 @@
echo "${ECHO_T}yes" >&6; }
cat >>confdefs.h <<\_ACEOF
-#define LLVM_MULTITHREADED 1
+#define LLVM_HAS_ATOMICS 1
_ACEOF
else
@@ -21038,7 +21038,7 @@
echo "${ECHO_T}no" >&6; }
cat >>confdefs.h <<\_ACEOF
-#define LLVM_MULTITHREADED 0
+#define LLVM_HAS_ATOMICS 0
_ACEOF
{ echo "$as_me:$LINENO: WARNING: LLVM will be built thread-unsafe because atomic builtins are missing" >&5
Modified: llvm/trunk/include/llvm/Config/config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=140064&r1=140063&r2=140064&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/config.h.cmake Mon Sep 19 15:43:23 2011
@@ -566,8 +566,8 @@
/* Installation directory for man pages */
#cmakedefine LLVM_MANDIR "${LLVM_MANDIR}"
-/* Build multithreading support into LLVM */
-#cmakedefine LLVM_MULTITHREADED ${LLVM_MULTITHREADED}
+/* Has gcc/MSVC atomic intrinsics */
+#define LLVM_HAS_ATOMICS ${LLVM_HAS_ATOMICS}
/* LLVM architecture name for the native architecture, if available */
#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}
Modified: llvm/trunk/include/llvm/Config/config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=140064&r1=140063&r2=140064&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.in (original)
+++ llvm/trunk/include/llvm/Config/config.h.in Mon Sep 19 15:43:23 2011
@@ -564,8 +564,8 @@
/* Installation directory for man pages */
#undef LLVM_MANDIR
-/* Build multithreading support into LLVM */
-#undef LLVM_MULTITHREADED
+/* Has gcc/MSVC atomic intrinsics */
+#undef LLVM_HAS_ATOMICS
/* LLVM architecture name for the native architecture, if available */
#undef LLVM_NATIVE_ARCH
Modified: llvm/trunk/include/llvm/Config/llvm-config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/llvm-config.h.cmake?rev=140064&r1=140063&r2=140064&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/llvm-config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/llvm-config.h.cmake Mon Sep 19 15:43:23 2011
@@ -46,8 +46,8 @@
/* Installation directory for man pages */
#cmakedefine LLVM_MANDIR "${LLVM_MANDIR}"
-/* Build multithreading support into LLVM */
-#cmakedefine LLVM_MULTITHREADED ${LLVM_MULTITHREADED}
+/* Has gcc/MSVC atomic intrinsics */
+#define LLVM_HAS_ATOMICS ${LLVM_HAS_ATOMICS}
/* LLVM architecture name for the native architecture, if available */
#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}
Modified: llvm/trunk/include/llvm/Config/llvm-config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/llvm-config.h.in?rev=140064&r1=140063&r2=140064&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/llvm-config.h.in (original)
+++ llvm/trunk/include/llvm/Config/llvm-config.h.in Mon Sep 19 15:43:23 2011
@@ -46,8 +46,8 @@
/* Installation directory for man pages */
#undef LLVM_MANDIR
-/* Build multithreading support into LLVM */
-#undef LLVM_MULTITHREADED
+/* Has gcc/MSVC atomic intrinsics */
+#undef LLVM_HAS_ATOMICS
/* LLVM architecture name for the native architecture, if available */
#undef LLVM_NATIVE_ARCH
Modified: llvm/trunk/lib/Support/Atomic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Atomic.cpp?rev=140064&r1=140063&r2=140064&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Atomic.cpp (original)
+++ llvm/trunk/lib/Support/Atomic.cpp Mon Sep 19 15:43:23 2011
@@ -22,7 +22,7 @@
#endif
void sys::MemoryFence() {
-#if LLVM_MULTITHREADED==0
+#if LLVM_HAS_ATOMICS == 0
return;
#else
# if defined(__GNUC__)
@@ -38,7 +38,7 @@
sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* ptr,
sys::cas_flag new_value,
sys::cas_flag old_value) {
-#if LLVM_MULTITHREADED==0
+#if LLVM_HAS_ATOMICS == 0
sys::cas_flag result = *ptr;
if (result == old_value)
*ptr = new_value;
@@ -53,7 +53,7 @@
}
sys::cas_flag sys::AtomicIncrement(volatile sys::cas_flag* ptr) {
-#if LLVM_MULTITHREADED==0
+#if LLVM_HAS_ATOMICS == 0
++(*ptr);
return *ptr;
#elif defined(__GNUC__)
@@ -66,7 +66,7 @@
}
sys::cas_flag sys::AtomicDecrement(volatile sys::cas_flag* ptr) {
-#if LLVM_MULTITHREADED==0
+#if LLVM_HAS_ATOMICS == 0
--(*ptr);
return *ptr;
#elif defined(__GNUC__)
@@ -79,7 +79,7 @@
}
sys::cas_flag sys::AtomicAdd(volatile sys::cas_flag* ptr, sys::cas_flag val) {
-#if LLVM_MULTITHREADED==0
+#if LLVM_HAS_ATOMICS == 0
*ptr += val;
return *ptr;
#elif defined(__GNUC__)
Modified: llvm/trunk/lib/Support/Threading.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Threading.cpp?rev=140064&r1=140063&r2=140064&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Threading.cpp (original)
+++ llvm/trunk/lib/Support/Threading.cpp Mon Sep 19 15:43:23 2011
@@ -24,7 +24,7 @@
static sys::Mutex* global_lock = 0;
bool llvm::llvm_start_multithreaded() {
-#ifdef LLVM_MULTITHREADED
+#if ENABLE_THREADS != 0
assert(!multithreaded_mode && "Already multithreaded!");
multithreaded_mode = true;
global_lock = new sys::Mutex(true);
@@ -39,7 +39,7 @@
}
void llvm::llvm_stop_multithreaded() {
-#ifdef LLVM_MULTITHREADED
+#if ENABLE_THREADS != 0
assert(multithreaded_mode && "Not currently multithreaded!");
// We fence here to insure that all threaded operations are complete BEFORE we
@@ -63,7 +63,7 @@
if (multithreaded_mode) global_lock->release();
}
-#if defined(LLVM_MULTITHREADED) && defined(HAVE_PTHREAD_H)
+#if ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H)
#include <pthread.h>
struct ThreadInfo {
@@ -102,7 +102,7 @@
error:
::pthread_attr_destroy(&Attr);
}
-#elif defined(LLVM_MULTITHREADED) && defined(LLVM_ON_WIN32)
+#elif ENABLE_THREADS!=0 && defined(LLVM_ON_WIN32)
#include "Windows/Windows.h"
#include <process.h>
More information about the llvm-commits
mailing list