OSDN Git Service

Reduce header dependencies.
authorNicolas Capens <capn@google.com>
Tue, 27 Sep 2016 14:49:52 +0000 (10:49 -0400)
committerNicolas Capens <capn@google.com>
Wed, 28 Sep 2016 22:20:54 +0000 (22:20 +0000)
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 <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
src/Reactor/LLVMReactor.cpp
src/Reactor/Nucleus.hpp
src/Reactor/Reactor.hpp

index 67dd392..fb1cf03 100644 (file)
@@ -35,6 +35,7 @@
 #include "CPUID.hpp"
 #include "Thread.hpp"
 #include "Memory.hpp"
+#include "MutexLock.hpp"
 
 #include <xmmintrin.h>
 #include <fstream>
@@ -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;
 
index a788cf2..47cb195 100644 (file)
 #ifndef sw_Nucleus_hpp
 #define sw_Nucleus_hpp
 
-#include "Common/Types.hpp"
-#include "Common/MutexLock.hpp"
-
-#include <stdarg.h>
+#include <cstdarg>
+#include <cstdint>
 #include <vector>
-#include <stdio.h>
-#include <wchar.h>
-
-#undef abs
-#undef max
-#undef min
-#undef Bool
 
 namespace sw
 {
@@ -184,8 +175,6 @@ namespace sw
 
        private:
                void optimize();
-
-               static BackoffLock codegenMutex;
        };
 }
 
index 7557a9f..c9ecdbb 100644 (file)
 #include "Nucleus.hpp"
 #include "Routine.hpp"
 
+#include <cstddef>
+#include <cwchar>
+#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<Byte8> 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<SByte8> rhs);
                SByte8(const SByte8 &rhs);