diff --git a/Common/Atomic_GCC.h b/Common/Atomic_GCC.h deleted file mode 100644 index c4c2c4f0f5..0000000000 --- a/Common/Atomic_GCC.h +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 -// Refer to the license.txt file included. - -// IWYU pragma: private, include "Common/Atomic.h" - -#pragma once - -#include "CommonTypes.h" - -// Atomic operations are performed in a single step by the CPU. It is -// impossible for other threads to see the operation "half-done." -// -// Some atomic operations can be combined with different types of memory -// barriers called "Acquire semantics" and "Release semantics", defined below. -// -// Acquire semantics: Future memory accesses cannot be relocated to before the -// operation. -// -// Release semantics: Past memory accesses cannot be relocated to after the -// operation. -// -// These barriers affect not only the compiler, but also the CPU. - -namespace Common -{ - -inline void AtomicAdd(volatile u32& target, u32 value) -{ - __sync_add_and_fetch(&target, value); -} - -inline void AtomicAnd(volatile u32& target, u32 value) -{ - __sync_and_and_fetch(&target, value); -} - -inline void AtomicDecrement(volatile u32& target) -{ - __sync_add_and_fetch(&target, -1); -} - -inline void AtomicIncrement(volatile u32& target) -{ - __sync_add_and_fetch(&target, 1); -} - -inline void AtomicOr(volatile u32& target, u32 value) -{ - __sync_or_and_fetch(&target, value); -} - -// Support clang versions older than 3.4. -#if __clang__ -#if !__has_feature(cxx_atomic) -template -_Atomic(T)* ToC11Atomic(volatile T* loc) -{ - return (_Atomic(T)*) loc; -} - -#define __atomic_load_n(p, m) __c11_atomic_load(ToC11Atomic(p), m) -#define __atomic_store_n(p, v, m) __c11_atomic_store(ToC11Atomic(p), v, m) -#define __atomic_exchange_n(p, v, m) __c11_atomic_exchange(ToC11Atomic(p), v, m) -#endif -#endif - -#ifndef __ATOMIC_RELAXED -#error __ATOMIC_RELAXED not defined; your compiler version is too old. -#endif - -template -inline T AtomicLoad(volatile T& src) -{ - return __atomic_load_n(&src, __ATOMIC_RELAXED); -} - -template -inline T AtomicLoadAcquire(volatile T& src) -{ - return __atomic_load_n(&src, __ATOMIC_ACQUIRE); -} - -template -inline void AtomicStore(volatile T& dest, U value) -{ - __atomic_store_n(&dest, value, __ATOMIC_RELAXED); -} - -template -inline void AtomicStoreRelease(volatile T& dest, U value) -{ - __atomic_store_n(&dest, value, __ATOMIC_RELEASE); -} - -template -inline T* AtomicExchangeAcquire(T* volatile& loc, U newval) -{ - return __atomic_exchange_n(&loc, newval, __ATOMIC_ACQ_REL); -} - -} diff --git a/Common/Atomic_Win32.h b/Common/Atomic_Win32.h deleted file mode 100644 index 7040deb809..0000000000 --- a/Common/Atomic_Win32.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 -// Refer to the license.txt file included. - -// IWYU pragma: private, include "Common/Atomic.h" - -#pragma once - -#include - -#include "CommonTypes.h" -#include "CommonWindows.h" - -// Atomic operations are performed in a single step by the CPU. It is -// impossible for other threads to see the operation "half-done." -// -// Some atomic operations can be combined with different types of memory -// barriers called "Acquire semantics" and "Release semantics", defined below. -// -// Acquire semantics: Future memory accesses cannot be relocated to before the -// operation. -// -// Release semantics: Past memory accesses cannot be relocated to after the -// operation. -// -// These barriers affect not only the compiler, but also the CPU. -// -// NOTE: Acquire and Release are not differentiated right now. They perform a -// full memory barrier instead of a "one-way" memory barrier. The newest -// Windows SDK has Acquire and Release versions of some Interlocked* functions. - -namespace Common -{ - -inline void AtomicAdd(volatile u32& target, u32 value) -{ - _InterlockedExchangeAdd((volatile LONG*)&target, (LONG)value); -} - -inline void AtomicAnd(volatile u32& target, u32 value) -{ - _InterlockedAnd((volatile LONG*)&target, (LONG)value); -} - -inline void AtomicIncrement(volatile u32& target) -{ - _InterlockedIncrement((volatile LONG*)&target); -} - -inline void AtomicDecrement(volatile u32& target) -{ - _InterlockedDecrement((volatile LONG*)&target); -} - -inline void AtomicOr(volatile u32& target, u32 value) -{ - _InterlockedOr((volatile LONG*)&target, (LONG)value); -} - -// For the comment below to hold, better only use this with 32-bit types.. -template -inline T AtomicLoad(volatile T& src) -{ - return src; // 32-bit reads are always atomic. -} - -// For the comment below to hold, better only use this with 32-bit types.. -template -inline T AtomicLoadAcquire(volatile T& src) -{ - T result = src; // 32-bit reads are always atomic. - _ReadBarrier(); // Compiler instruction only. x86 loads always have acquire semantics. - return result; -} - -// For the comment below to hold, better only use this with 32-bit types.. -template -inline void AtomicStore(volatile T& dest, U value) -{ - dest = (T)value; // 32-bit writes are always atomic. -} - -// For the comment below to hold, better only use this with 32-bit types.. -template -inline void AtomicStoreRelease(volatile T& dest, U value) -{ - _WriteBarrier(); // Compiler instruction only. x86 stores always have release semantics. - dest = (T)value; // 32-bit writes are always atomic -} - -#ifdef __MINGW32__ -void *_InterlockedExchangePointer_acq(void *volatile *, void volatile *); -#endif - -template -inline T* AtomicExchangeAcquire(T* volatile& loc, U newval) -{ - return (T*)_InterlockedExchangePointer_acq((void* volatile*)&loc, (void*)newval); -} - -} diff --git a/Common/Atomics.h b/Common/Atomics.h deleted file mode 100644 index bdf2161d7e..0000000000 --- a/Common/Atomics.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0 or later versions. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#ifdef _WIN32 - -#include "Atomic_Win32.h" - -#else - -// GCC-compatible compiler assumed! -#include "Atomic_GCC.h" - -#endif diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index 037f4258ea..ddc0fd6869 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -384,9 +384,6 @@ - - - diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters index 65547b8502..9a413fe9a8 100644 --- a/Common/Common.vcxproj.filters +++ b/Common/Common.vcxproj.filters @@ -3,9 +3,6 @@ - - - diff --git a/Common/ConsoleListener.cpp b/Common/ConsoleListener.cpp index 4875aa2b17..18472eaa07 100644 --- a/Common/ConsoleListener.cpp +++ b/Common/ConsoleListener.cpp @@ -35,7 +35,6 @@ #include "util/text/utf8.h" #include "Common.h" #include "ConsoleListener.h" // Common -#include "Atomics.h" #if defined(USING_WIN_UI) const int LOG_PENDING_MAX = 120 * 10000; diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index 4ec83aa1da..2f0016d511 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -24,7 +24,6 @@ #include "profiler/profiler.h" #include "Common/MsgHandler.h" -#include "Common/Atomics.h" #include "Core/CoreTiming.h" #include "Core/Core.h" #include "Core/Config.h" diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index 1d31185348..e462a94efd 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -21,7 +21,6 @@ #include "Common/CommonTypes.h" #include "Common/ChunkFile.h" #include "Common/FixedSizeQueue.h" -#include "Common/Atomics.h" #ifdef _M_SSE #include diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index a463a0e0ae..ac543e36bd 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -16,7 +16,6 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/Common.h" -#include "Common/Atomics.h" #include "Core/Core.h" #include "Core/MemMap.h" diff --git a/UWP/CommonUWP/CommonUWP.vcxproj b/UWP/CommonUWP/CommonUWP.vcxproj index 4eb97efe92..a5fe599d10 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj +++ b/UWP/CommonUWP/CommonUWP.vcxproj @@ -383,9 +383,6 @@ - - - @@ -476,4 +473,4 @@ - \ No newline at end of file + diff --git a/UWP/CommonUWP/CommonUWP.vcxproj.filters b/UWP/CommonUWP/CommonUWP.vcxproj.filters index 67086f1bc2..566049b279 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj.filters +++ b/UWP/CommonUWP/CommonUWP.vcxproj.filters @@ -53,9 +53,6 @@ - - - @@ -99,4 +96,4 @@ Crypto - \ No newline at end of file +