mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 02:25:47 +00:00
Unbreak mingw build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71856 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -27,12 +27,12 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace sys {
|
namespace sys {
|
||||||
|
|
||||||
#if !defined(ENABLE_THREADS) || ENABLE_THREADS == 0
|
#if !defined(ENABLE_THREADS) || ENABLE_THREADS == 0
|
||||||
inline void MemoryFence() {
|
inline void MemoryFence() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef uint32_t cas_flag;
|
typedef uint32_t cas_flag;
|
||||||
inline cas_flag CompareAndSwap(cas_flag* dest, cas_flag exc, cas_flag c) {
|
inline cas_flag CompareAndSwap(cas_flag* dest, cas_flag exc, cas_flag c) {
|
||||||
cas_flag result = *dest;
|
cas_flag result = *dest;
|
||||||
@@ -40,22 +40,22 @@ namespace llvm {
|
|||||||
*dest = exc;
|
*dest = exc;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
|
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
|
||||||
inline void MemoryFence() {
|
inline void MemoryFence() {
|
||||||
__sync_synchronize();
|
__sync_synchronize();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef volatile uint32_t cas_flag;
|
typedef volatile uint32_t cas_flag;
|
||||||
inline cas_flag CompareAndSwap(cas_flag* dest, cas_flag exc, cas_flag c) {
|
inline cas_flag CompareAndSwap(cas_flag* dest, cas_flag exc, cas_flag c) {
|
||||||
return __sync_val_compare_and_swap(dest, exc, c);
|
return __sync_val_compare_and_swap(dest, exc, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
inline void MemoryFence() {
|
inline void MemoryFence() {
|
||||||
OSMemoryBarrier();
|
OSMemoryBarrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef volatile int32_t cas_flag;
|
typedef volatile int32_t cas_flag;
|
||||||
inline cas_flag CompareAndSwap(cas_flag* dest, cas_flag exc, cas_flag c) {
|
inline cas_flag CompareAndSwap(cas_flag* dest, cas_flag exc, cas_flag c) {
|
||||||
cas_flag old = *dest;
|
cas_flag old = *dest;
|
||||||
@@ -63,11 +63,18 @@ namespace llvm {
|
|||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
#elif defined(LLVM_ON_WIN32)
|
#elif defined(LLVM_ON_WIN32)
|
||||||
#warning Memory fence implementation requires Windows 2003 or later.
|
|
||||||
inline void MemoryFence() {
|
inline void MemoryFence() {
|
||||||
|
#ifdef _MSC_VER
|
||||||
MemoryBarrier();
|
MemoryBarrier();
|
||||||
|
#elif 0
|
||||||
|
// FIXME: Requires SSE2 support
|
||||||
|
__asm__ __volatile__("mfence":::"memory");
|
||||||
|
#else
|
||||||
|
// FIXME: just temporary workaround. We need to emit some fence...
|
||||||
|
__asm__ __volatile__("":::"memory");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef volatile long cas_flag;
|
typedef volatile long cas_flag;
|
||||||
inline cas_flag CompareAndSwap(cas_flag* dest, cas_flag exc, cas_flag c) {
|
inline cas_flag CompareAndSwap(cas_flag* dest, cas_flag exc, cas_flag c) {
|
||||||
return InterlockedCompareExchange(dest, exc, c);
|
return InterlockedCompareExchange(dest, exc, c);
|
||||||
@@ -75,8 +82,8 @@ namespace llvm {
|
|||||||
#else
|
#else
|
||||||
#error No memory atomics implementation for your platform!
|
#error No memory atomics implementation for your platform!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user