From 3bbc5e16af2975cf3903ef47a21ed7d75d0874d9 Mon Sep 17 00:00:00 2001 From: Nicolas Capens Date: Tue, 27 Sep 2016 10:49:52 -0400 Subject: [PATCH] Reduce header dependencies. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This removes all Common headers from Reactor headers, making it easier to use Reactor outside of SwiftShader. Bug swiftshader:10 Change-Id: I35c5d138e781d4e911d206954d38e392714d4659 Reviewed-on: https://swiftshader-review.googlesource.com/7330 Tested-by: Nicolas Capens Reviewed-by: Alexis Hétu Reviewed-by: Nicolas Capens --- src/Reactor/LLVMReactor.cpp | 12 +++++++----- src/Reactor/Nucleus.hpp | 15 ++------------- src/Reactor/Reactor.hpp | 8 ++++++-- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp index 67dd3920f..fb1cf03e0 100644 --- a/src/Reactor/LLVMReactor.cpp +++ b/src/Reactor/LLVMReactor.cpp @@ -35,6 +35,7 @@ #include "CPUID.hpp" #include "Thread.hpp" #include "Memory.hpp" +#include "MutexLock.hpp" #include #include @@ -66,12 +67,13 @@ namespace llvm::LLVMContext *context = nullptr; llvm::Module *module = nullptr; llvm::Function *function = nullptr; + + sw::BackoffLock codegenMutex; } namespace sw { using namespace llvm; - BackoffLock Nucleus::codegenMutex; Optimization optimization[10] = {InstructionCombining, Disabled}; @@ -107,7 +109,7 @@ namespace sw Nucleus::Nucleus() { - codegenMutex.lock(); // Reactor and LLVM are currently not thread safe + ::codegenMutex.lock(); // Reactor and LLVM are currently not thread safe InitializeNativeTarget(); JITEmitDebugInfo = false; @@ -166,7 +168,7 @@ namespace sw ::function = nullptr; ::module = nullptr; - codegenMutex.unlock(); + ::codegenMutex.unlock(); } Routine *Nucleus::acquireRoutine(const wchar_t *name, bool runOptimizations) @@ -1961,7 +1963,7 @@ namespace sw // xyzw.parent = this; } - Byte8::Byte8(byte x0, byte x1, byte x2, byte x3, byte x4, byte x5, byte x6, byte x7) + Byte8::Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7) { // xyzw.parent = this; @@ -2298,7 +2300,7 @@ namespace sw // xyzw.parent = this; } - SByte8::SByte8(byte x0, byte x1, byte x2, byte x3, byte x4, byte x5, byte x6, byte x7) + SByte8::SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7) { // xyzw.parent = this; diff --git a/src/Reactor/Nucleus.hpp b/src/Reactor/Nucleus.hpp index a788cf254..47cb195c1 100644 --- a/src/Reactor/Nucleus.hpp +++ b/src/Reactor/Nucleus.hpp @@ -15,18 +15,9 @@ #ifndef sw_Nucleus_hpp #define sw_Nucleus_hpp -#include "Common/Types.hpp" -#include "Common/MutexLock.hpp" - -#include +#include +#include #include -#include -#include - -#undef abs -#undef max -#undef min -#undef Bool namespace sw { @@ -184,8 +175,6 @@ namespace sw private: void optimize(); - - static BackoffLock codegenMutex; }; } diff --git a/src/Reactor/Reactor.hpp b/src/Reactor/Reactor.hpp index 7557a9fa9..c9ecdbb94 100644 --- a/src/Reactor/Reactor.hpp +++ b/src/Reactor/Reactor.hpp @@ -18,6 +18,10 @@ #include "Nucleus.hpp" #include "Routine.hpp" +#include +#include +#undef Bool + namespace sw { class Byte; @@ -514,7 +518,7 @@ namespace sw { public: Byte8(); - Byte8(byte x0, byte x1, byte x2, byte x3, byte x4, byte x5, byte x6, byte x7); + Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7); Byte8(int64_t x); Byte8(RValue rhs); Byte8(const Byte8 &rhs); @@ -568,7 +572,7 @@ namespace sw { public: SByte8(); - SByte8(byte x0, byte x1, byte x2, byte x3, byte x4, byte x5, byte x6, byte x7); + SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7); SByte8(int64_t x); SByte8(RValue rhs); SByte8(const SByte8 &rhs); -- 2.11.0