mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-03 14:21:30 +00:00 
			
		
		
		
	Rename LLVM_MULTITHREADED define and fix build without threads.
Patch by Arrowdodger. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140064 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -1515,9 +1515,9 @@ AC_LINK_IFELSE(
 | 
				
			|||||||
    ]]),
 | 
					    ]]),
 | 
				
			||||||
  AC_LANG_POP([C++])
 | 
					  AC_LANG_POP([C++])
 | 
				
			||||||
  AC_MSG_RESULT(yes)
 | 
					  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_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]))
 | 
					  AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing]))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dnl===-----------------------------------------------------------------------===
 | 
					dnl===-----------------------------------------------------------------------===
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -272,7 +272,7 @@ else()
 | 
				
			|||||||
  unset(HAVE_FFI_CALL CACHE)
 | 
					  unset(HAVE_FFI_CALL CACHE)
 | 
				
			||||||
endif( LLVM_ENABLE_FFI )
 | 
					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)
 | 
					include(CheckAtomic)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if( LLVM_ENABLE_PIC )
 | 
					if( LLVM_ENABLE_PIC )
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,8 +22,8 @@ int main() {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
        return 0;
 | 
					        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")
 | 
					  message(STATUS "Warning: LLVM will be built thread-unsafe because atomic builtins are missing")
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								configure
									
									
									
									
										vendored
									
									
								
							@@ -21027,7 +21027,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 | 
				
			|||||||
echo "${ECHO_T}yes" >&6; }
 | 
					echo "${ECHO_T}yes" >&6; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cat >>confdefs.h <<\_ACEOF
 | 
					cat >>confdefs.h <<\_ACEOF
 | 
				
			||||||
#define LLVM_MULTITHREADED 1
 | 
					#define LLVM_HAS_ATOMICS 1
 | 
				
			||||||
_ACEOF
 | 
					_ACEOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
@@ -21038,7 +21038,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 | 
				
			|||||||
echo "${ECHO_T}no" >&6; }
 | 
					echo "${ECHO_T}no" >&6; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cat >>confdefs.h <<\_ACEOF
 | 
					cat >>confdefs.h <<\_ACEOF
 | 
				
			||||||
#define LLVM_MULTITHREADED 0
 | 
					#define LLVM_HAS_ATOMICS 0
 | 
				
			||||||
_ACEOF
 | 
					_ACEOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  { echo "$as_me:$LINENO: WARNING: LLVM will be built thread-unsafe because atomic builtins are missing" >&5
 | 
					  { echo "$as_me:$LINENO: WARNING: LLVM will be built thread-unsafe because atomic builtins are missing" >&5
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -566,8 +566,8 @@
 | 
				
			|||||||
/* Installation directory for man pages */
 | 
					/* Installation directory for man pages */
 | 
				
			||||||
#cmakedefine LLVM_MANDIR "${LLVM_MANDIR}"
 | 
					#cmakedefine LLVM_MANDIR "${LLVM_MANDIR}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Build multithreading support into LLVM */
 | 
					/* Has gcc/MSVC atomic intrinsics */
 | 
				
			||||||
#cmakedefine LLVM_MULTITHREADED ${LLVM_MULTITHREADED}
 | 
					#define LLVM_HAS_ATOMICS ${LLVM_HAS_ATOMICS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* LLVM architecture name for the native architecture, if available */
 | 
					/* LLVM architecture name for the native architecture, if available */
 | 
				
			||||||
#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}
 | 
					#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -564,8 +564,8 @@
 | 
				
			|||||||
/* Installation directory for man pages */
 | 
					/* Installation directory for man pages */
 | 
				
			||||||
#undef LLVM_MANDIR
 | 
					#undef LLVM_MANDIR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Build multithreading support into LLVM */
 | 
					/* Has gcc/MSVC atomic intrinsics */
 | 
				
			||||||
#undef LLVM_MULTITHREADED
 | 
					#undef LLVM_HAS_ATOMICS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* LLVM architecture name for the native architecture, if available */
 | 
					/* LLVM architecture name for the native architecture, if available */
 | 
				
			||||||
#undef LLVM_NATIVE_ARCH
 | 
					#undef LLVM_NATIVE_ARCH
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,8 +46,8 @@
 | 
				
			|||||||
/* Installation directory for man pages */
 | 
					/* Installation directory for man pages */
 | 
				
			||||||
#cmakedefine LLVM_MANDIR "${LLVM_MANDIR}"
 | 
					#cmakedefine LLVM_MANDIR "${LLVM_MANDIR}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Build multithreading support into LLVM */
 | 
					/* Has gcc/MSVC atomic intrinsics */
 | 
				
			||||||
#cmakedefine LLVM_MULTITHREADED ${LLVM_MULTITHREADED}
 | 
					#define LLVM_HAS_ATOMICS ${LLVM_HAS_ATOMICS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* LLVM architecture name for the native architecture, if available */
 | 
					/* LLVM architecture name for the native architecture, if available */
 | 
				
			||||||
#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}
 | 
					#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,8 +46,8 @@
 | 
				
			|||||||
/* Installation directory for man pages */
 | 
					/* Installation directory for man pages */
 | 
				
			||||||
#undef LLVM_MANDIR
 | 
					#undef LLVM_MANDIR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Build multithreading support into LLVM */
 | 
					/* Has gcc/MSVC atomic intrinsics */
 | 
				
			||||||
#undef LLVM_MULTITHREADED
 | 
					#undef LLVM_HAS_ATOMICS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* LLVM architecture name for the native architecture, if available */
 | 
					/* LLVM architecture name for the native architecture, if available */
 | 
				
			||||||
#undef LLVM_NATIVE_ARCH
 | 
					#undef LLVM_NATIVE_ARCH
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@ using namespace llvm;
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void sys::MemoryFence() {
 | 
					void sys::MemoryFence() {
 | 
				
			||||||
#if LLVM_MULTITHREADED==0
 | 
					#if LLVM_HAS_ATOMICS == 0
 | 
				
			||||||
  return;
 | 
					  return;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#  if defined(__GNUC__)
 | 
					#  if defined(__GNUC__)
 | 
				
			||||||
@@ -38,7 +38,7 @@ void sys::MemoryFence() {
 | 
				
			|||||||
sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* ptr,
 | 
					sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* ptr,
 | 
				
			||||||
                                  sys::cas_flag new_value,
 | 
					                                  sys::cas_flag new_value,
 | 
				
			||||||
                                  sys::cas_flag old_value) {
 | 
					                                  sys::cas_flag old_value) {
 | 
				
			||||||
#if LLVM_MULTITHREADED==0
 | 
					#if LLVM_HAS_ATOMICS == 0
 | 
				
			||||||
  sys::cas_flag result = *ptr;
 | 
					  sys::cas_flag result = *ptr;
 | 
				
			||||||
  if (result == old_value)
 | 
					  if (result == old_value)
 | 
				
			||||||
    *ptr = new_value;
 | 
					    *ptr = new_value;
 | 
				
			||||||
@@ -53,7 +53,7 @@ sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* ptr,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sys::cas_flag sys::AtomicIncrement(volatile sys::cas_flag* ptr) {
 | 
					sys::cas_flag sys::AtomicIncrement(volatile sys::cas_flag* ptr) {
 | 
				
			||||||
#if LLVM_MULTITHREADED==0
 | 
					#if LLVM_HAS_ATOMICS == 0
 | 
				
			||||||
  ++(*ptr);
 | 
					  ++(*ptr);
 | 
				
			||||||
  return *ptr;
 | 
					  return *ptr;
 | 
				
			||||||
#elif defined(__GNUC__)
 | 
					#elif defined(__GNUC__)
 | 
				
			||||||
@@ -66,7 +66,7 @@ sys::cas_flag sys::AtomicIncrement(volatile sys::cas_flag* ptr) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sys::cas_flag sys::AtomicDecrement(volatile sys::cas_flag* ptr) {
 | 
					sys::cas_flag sys::AtomicDecrement(volatile sys::cas_flag* ptr) {
 | 
				
			||||||
#if LLVM_MULTITHREADED==0
 | 
					#if LLVM_HAS_ATOMICS == 0
 | 
				
			||||||
  --(*ptr);
 | 
					  --(*ptr);
 | 
				
			||||||
  return *ptr;
 | 
					  return *ptr;
 | 
				
			||||||
#elif defined(__GNUC__)
 | 
					#elif defined(__GNUC__)
 | 
				
			||||||
@@ -79,7 +79,7 @@ sys::cas_flag sys::AtomicDecrement(volatile sys::cas_flag* ptr) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sys::cas_flag sys::AtomicAdd(volatile sys::cas_flag* ptr, sys::cas_flag val) {
 | 
					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;
 | 
					  *ptr += val;
 | 
				
			||||||
  return *ptr;
 | 
					  return *ptr;
 | 
				
			||||||
#elif defined(__GNUC__)
 | 
					#elif defined(__GNUC__)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ static bool multithreaded_mode = false;
 | 
				
			|||||||
static sys::Mutex* global_lock = 0;
 | 
					static sys::Mutex* global_lock = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool llvm::llvm_start_multithreaded() {
 | 
					bool llvm::llvm_start_multithreaded() {
 | 
				
			||||||
#ifdef LLVM_MULTITHREADED
 | 
					#if ENABLE_THREADS != 0
 | 
				
			||||||
  assert(!multithreaded_mode && "Already multithreaded!");
 | 
					  assert(!multithreaded_mode && "Already multithreaded!");
 | 
				
			||||||
  multithreaded_mode = true;
 | 
					  multithreaded_mode = true;
 | 
				
			||||||
  global_lock = new sys::Mutex(true);
 | 
					  global_lock = new sys::Mutex(true);
 | 
				
			||||||
@@ -39,7 +39,7 @@ bool llvm::llvm_start_multithreaded() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void llvm::llvm_stop_multithreaded() {
 | 
					void llvm::llvm_stop_multithreaded() {
 | 
				
			||||||
#ifdef LLVM_MULTITHREADED
 | 
					#if ENABLE_THREADS != 0
 | 
				
			||||||
  assert(multithreaded_mode && "Not currently multithreaded!");
 | 
					  assert(multithreaded_mode && "Not currently multithreaded!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // We fence here to insure that all threaded operations are complete BEFORE we
 | 
					  // We fence here to insure that all threaded operations are complete BEFORE we
 | 
				
			||||||
@@ -63,7 +63,7 @@ void llvm::llvm_release_global_lock() {
 | 
				
			|||||||
  if (multithreaded_mode) global_lock->release();
 | 
					  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>
 | 
					#include <pthread.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct ThreadInfo {
 | 
					struct ThreadInfo {
 | 
				
			||||||
@@ -102,7 +102,7 @@ void llvm::llvm_execute_on_thread(void (*Fn)(void*), void *UserData,
 | 
				
			|||||||
 error:
 | 
					 error:
 | 
				
			||||||
  ::pthread_attr_destroy(&Attr);
 | 
					  ::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 "Windows/Windows.h"
 | 
				
			||||||
#include <process.h>
 | 
					#include <process.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user