about summary refs log tree commit diff homepage
path: root/lib/Core/ExternalDispatcher.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-14 05:08:59 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-14 05:08:59 +0000
commitc70345caa213288aa748070f7a03c84fbdf89b5c (patch)
tree75252446281ec8c9c0a750461b8751fdd73566a8 /lib/Core/ExternalDispatcher.cpp
parent5099d8124393dcd577c2dd091834a17fe2d9fcdb (diff)
downloadklee-c70345caa213288aa748070f7a03c84fbdf89b5c.tar.gz
Update for 2.7.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@98467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Core/ExternalDispatcher.cpp')
-rw-r--r--lib/Core/ExternalDispatcher.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index 94dad33c..f746e6fa 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -8,12 +8,25 @@
 //===----------------------------------------------------------------------===//
 
 #include "ExternalDispatcher.h"
+#include "klee/Config/config.h"
+
+// Ugh.
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
 
 #include "llvm/Module.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Instructions.h"
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7)
 #include "llvm/ModuleProvider.h"
+#endif
+#if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7)
+#include "llvm/LLVMContext.h"
+#endif
 #include "llvm/ExecutionEngine/JIT.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
 #include "llvm/Support/CallSite.h"
@@ -68,10 +81,16 @@ void *ExternalDispatcher::resolveSymbol(const std::string &name) {
 
 ExternalDispatcher::ExternalDispatcher() {
   dispatchModule = new Module("ExternalDispatcher", getGlobalContext());
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7)
   ExistingModuleProvider* MP = new ExistingModuleProvider(dispatchModule);
-  
+#endif
+
   std::string error;
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7)
   executionEngine = ExecutionEngine::createJIT(MP, &error);
+#else
+  executionEngine = ExecutionEngine::createJIT(dispatchModule, &error);
+#endif
   if (!executionEngine) {
     std::cerr << "unable to make jit: " << error << "\n";
     abort();
@@ -229,7 +248,10 @@ Function *ExternalDispatcher::createDispatcher(Function *target, Instruction *in
     args[i] = new LoadInst(argp, "", dBB);
   }
 
-  Instruction *result = CallInst::Create(target, args, args+i, "", dBB);
+  Constant *dispatchTarget =
+    dispatchModule->getOrInsertFunction(target->getName(), FTy,
+                                        target->getAttributes());
+  Instruction *result = CallInst::Create(dispatchTarget, args, args+i, "", dBB);
   if (result->getType() != Type::getVoidTy(getGlobalContext())) {
     Instruction *resp = 
       new BitCastInst(argI64s, PointerType::getUnqual(result->getType()),