Reduce header dependencies.
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>
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index 67dd392..fb1cf03 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 <xmmintrin.h>
#include <fstream>
@@ -66,12 +67,13 @@
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 @@
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 @@
::function = nullptr;
::module = nullptr;
- codegenMutex.unlock();
+ ::codegenMutex.unlock();
}
Routine *Nucleus::acquireRoutine(const wchar_t *name, bool runOptimizations)
@@ -1961,7 +1963,7 @@
// 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 @@
// 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 a788cf2..47cb195 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 <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 @@
private:
void optimize();
-
- static BackoffLock codegenMutex;
};
}
diff --git a/src/Reactor/Reactor.hpp b/src/Reactor/Reactor.hpp
index 7557a9f..c9ecdbb 100644
--- a/src/Reactor/Reactor.hpp
+++ b/src/Reactor/Reactor.hpp
@@ -18,6 +18,10 @@
#include "Nucleus.hpp"
#include "Routine.hpp"
+#include <cstddef>
+#include <cwchar>
+#undef Bool
+
namespace sw
{
class Byte;
@@ -514,7 +518,7 @@
{
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 @@
{
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);