Commit 0eedc8c6 by Logan Chien

Port SwiftShader to LLVM 7.0

Change-Id: I89601ef9e42e56cfaeb1cd5ece4daa3f32b39950 Reviewed-on: https://swiftshader-review.googlesource.com/20475Tested-by: 's avatarLogan Chien <loganchien@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 172f41b5
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
namespace sw namespace sw
{ {
#if SWIFTSHADER_LLVM_VERSION < 7
LLVMRoutine::LLVMRoutine(int bufferSize) : bufferSize(bufferSize) LLVMRoutine::LLVMRoutine(int bufferSize) : bufferSize(bufferSize)
{ {
void *memory = allocateExecutable(bufferSize); void *memory = allocateExecutable(bufferSize);
...@@ -43,4 +44,10 @@ namespace sw ...@@ -43,4 +44,10 @@ namespace sw
{ {
return functionSize - static_cast<int>((uintptr_t)entry - (uintptr_t)buffer); return functionSize - static_cast<int>((uintptr_t)entry - (uintptr_t)buffer);
} }
#else
LLVMRoutine::~LLVMRoutine()
{
dtor(reactorJIT, moduleKey);
}
#endif
} }
...@@ -17,8 +17,11 @@ ...@@ -17,8 +17,11 @@
#include "Routine.hpp" #include "Routine.hpp"
#include <cstdint>
namespace sw namespace sw
{ {
#if SWIFTSHADER_LLVM_VERSION < 7
class LLVMRoutineManager; class LLVMRoutineManager;
class LLVMRoutine : public Routine class LLVMRoutine : public Routine
...@@ -48,6 +51,32 @@ namespace sw ...@@ -48,6 +51,32 @@ namespace sw
//const bool dynamic; // Generated or precompiled //const bool dynamic; // Generated or precompiled
}; };
#else
class LLVMReactorJIT;
class LLVMRoutine : public Routine
{
public:
LLVMRoutine(void *ent, void (*callback)(LLVMReactorJIT *, uint64_t),
LLVMReactorJIT *jit, uint64_t key)
: entry(ent), dtor(callback), reactorJIT(jit), moduleKey(key)
{ }
virtual ~LLVMRoutine();
const void *getEntry()
{
return entry;
}
private:
const void *entry;
void (*dtor)(LLVMReactorJIT *, uint64_t);
LLVMReactorJIT *reactorJIT;
uint64_t moduleKey;
};
#endif // SWIFTSHADER_LLVM_VERSION < 7
} }
#endif // sw_LLVMRoutine_hpp #endif // sw_LLVMRoutine_hpp
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "LLVMRoutineManager.hpp" #include "LLVMRoutineManager.hpp"
#if SWIFTSHADER_LLVM_VERSION < 7
#include "LLVMRoutine.hpp" #include "LLVMRoutine.hpp"
#include "llvm/Function.h" #include "llvm/Function.h"
#include "../Common/Memory.hpp" #include "../Common/Memory.hpp"
...@@ -146,3 +148,5 @@ namespace sw ...@@ -146,3 +148,5 @@ namespace sw
return result; return result;
} }
} }
#endif // SWIFTSHADER_LLVM_VERSION < 7
...@@ -15,8 +15,10 @@ ...@@ -15,8 +15,10 @@
#ifndef sw_LLVMRoutineManager_hpp #ifndef sw_LLVMRoutineManager_hpp
#define sw_LLVMRoutineManager_hpp #define sw_LLVMRoutineManager_hpp
#include "llvm/GlobalValue.h" #if SWIFTSHADER_LLVM_VERSION < 7
#include "llvm/ExecutionEngine/JITMemoryManager.h" #include "llvm/ExecutionEngine/JITMemoryManager.h"
#include "llvm/GlobalValue.h"
namespace sw namespace sw
{ {
...@@ -54,4 +56,6 @@ namespace sw ...@@ -54,4 +56,6 @@ namespace sw
}; };
} }
#endif // SWIFTSHADER_LLVM_VERSION < 7
#endif // sw_LLVMRoutineManager_hpp #endif // sw_LLVMRoutineManager_hpp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment