diff options
author | Richard Trembecký <richardt@centrum.sk> | 2016-05-01 16:38:21 +0200 |
---|---|---|
committer | Dan Liew <delcypher@gmail.com> | 2017-05-24 14:24:47 +0100 |
commit | d3a467d8999e6e52892b13c2bc93ac829ee1b7c9 (patch) | |
tree | 99493da4b33f50eb0c27a237213c615520efbd95 /lib/Core/ExternalDispatcher.cpp | |
parent | 92367dec2ee00cb708454e4c33ff34d80eddb878 (diff) | |
download | klee-d3a467d8999e6e52892b13c2bc93ac829ee1b7c9.tar.gz |
llvm: make KLEE compile against LLVM 3.5 and 3.6
Based on work by @ccadeptic23 and @delcypher. Formatting fixed by @snf. Fix compiler warning by @martijnthe. Further fixes by @mchalupa. Refactored, so that changes can be reviewed -- no massive changes in whitespace and in the surrounding code. Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'lib/Core/ExternalDispatcher.cpp')
-rw-r--r-- | lib/Core/ExternalDispatcher.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp index 984e3ab2..9701d35a 100644 --- a/lib/Core/ExternalDispatcher.cpp +++ b/lib/Core/ExternalDispatcher.cpp @@ -23,7 +23,12 @@ #include "llvm/Instructions.h" #include "llvm/LLVMContext.h" #endif +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) +#include "llvm/ExecutionEngine/MCJIT.h" +#else #include "llvm/ExecutionEngine/JIT.h" +#endif + #include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/Support/DynamicLibrary.h" #include "llvm/Support/raw_ostream.h" @@ -89,7 +94,12 @@ ExternalDispatcher::ExternalDispatcher(LLVMContext &ctx) { dispatchModule = new Module("ExternalDispatcher", ctx); std::string error; +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) + dispatchModule_uniptr.reset(dispatchModule); + executionEngine = EngineBuilder(std::move(dispatchModule_uniptr)).create(); +#else executionEngine = ExecutionEngine::createJIT(dispatchModule, &error); +#endif if (!executionEngine) { llvm::errs() << "unable to make jit: " << error << "\n"; abort(); @@ -98,6 +108,10 @@ ExternalDispatcher::ExternalDispatcher(LLVMContext &ctx) { // If we have a native target, initialize it to ensure it is linked in and // usable by the JIT. llvm::InitializeNativeTarget(); +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) + llvm::InitializeNativeTargetAsmParser(); + llvm::InitializeNativeTargetAsmPrinter(); +#endif // from ExecutionEngine::create if (executionEngine) { @@ -146,7 +160,11 @@ bool ExternalDispatcher::executeCall(Function *f, Instruction *i, uint64_t *args // ensures that any errors or assertions in the compilation process will // trigger crashes instead of being caught as aborts in the external // function. +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) + executionEngine->finalizeObject(); +#else executionEngine->recompileAndRelinkFunction(dispatcher); +#endif } } else { dispatcher = it->second; |