about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2011-04-23 19:22:22 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2011-04-23 19:22:22 +0000
commit930ae7d06fc1d8cc3117397cb3fd168a0a1090b7 (patch)
treeac1ff2162b5ea6d51bbf6a1ac35f350a297234ac /lib
parent2ec715a7e08724e54cd8c14904446d1b91b42121 (diff)
downloadklee-930ae7d06fc1d8cc3117397cb3fd168a0a1090b7.tar.gz
Patch by arrowdodger (http://keeda.stanford.edu/pipermail/klee-dev/2011-April/000617.html) for compiling KLEE with the latest LLVM changes. Tested against LLVM 2.7 and 2.8. The AsmAddresses test fails in 2.8 unless assertions are explicitely enabled (--enable-assertions).
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@130065 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/Executor.cpp4
-rw-r--r--lib/Core/ExternalDispatcher.cpp4
-rw-r--r--lib/Core/StatsTracker.cpp8
-rw-r--r--lib/Core/TimingSolver.cpp4
-rw-r--r--lib/Expr/Expr.cpp4
-rw-r--r--lib/Expr/Parser.cpp8
-rw-r--r--lib/Module/KModule.cpp10
-rw-r--r--lib/Module/ModuleUtil.cpp4
-rw-r--r--lib/Module/Optimize.cpp5
-rw-r--r--lib/Module/RaiseAsm.cpp2
-rw-r--r--lib/Support/Time.cpp5
-rw-r--r--lib/Support/Timer.cpp5
12 files changed, 61 insertions, 2 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 2baf61e9..aa0b43d2 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -58,7 +58,11 @@
 #include "llvm/Support/CallSite.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/raw_ostream.h"
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9)
 #include "llvm/System/Process.h"
+#else
+#include "llvm/Support/Process.h"
+#endif
 #include "llvm/Target/TargetData.h"
 
 #include <cassert>
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index 665a0461..bc68ce0d 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -30,7 +30,11 @@
 #include "llvm/ExecutionEngine/JIT.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
 #include "llvm/Support/CallSite.h"
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9)
 #include "llvm/System/DynamicLibrary.h"
+#else
+#include "llvm/Support/DynamicLibrary.h"
+#endif
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetSelect.h"
 #include <setjmp.h>
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index 8d2ec479..03d5e926 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -35,8 +35,16 @@
 #include "llvm/Type.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/CFG.h"
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9)
 #include "llvm/System/Process.h"
+#else
+#include "llvm/Support/Process.h"
+#endif
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9)
 #include "llvm/System/Path.h"
+#else
+#include "llvm/Support/Path.h"
+#endif
 
 #include <iostream>
 #include <fstream>
diff --git a/lib/Core/TimingSolver.cpp b/lib/Core/TimingSolver.cpp
index 542a3c8e..d0aa3f6a 100644
--- a/lib/Core/TimingSolver.cpp
+++ b/lib/Core/TimingSolver.cpp
@@ -15,7 +15,11 @@
 
 #include "CoreStats.h"
 
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9)
 #include "llvm/System/Process.h"
+#else
+#include "llvm/Support/Process.h"
+#endif
 
 using namespace klee;
 using namespace llvm;
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index 71e64325..e02a7e49 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -336,7 +336,11 @@ void ConstantExpr::toString(std::string &Res) const {
 ref<ConstantExpr> ConstantExpr::Concat(const ref<ConstantExpr> &RHS) {
   Expr::Width W = getWidth() + RHS->getWidth();
   APInt Tmp(value);
+#if (LLVM_VERSION_MAJOR < 3)
   Tmp.zext(W);
+#else
+  Tmp=Tmp.zext(W);
+#endif
   Tmp <<= RHS->getWidth();
   Tmp |= APInt(RHS->value).zext(W);
 
diff --git a/lib/Expr/Parser.cpp b/lib/Expr/Parser.cpp
index caeeabd7..a41c5624 100644
--- a/lib/Expr/Parser.cpp
+++ b/lib/Expr/Parser.cpp
@@ -1496,9 +1496,17 @@ ExprResult ParserImpl::ParseNumberToken(Expr::Width Type, const Token &Tok) {
     Val = -Val;
 
   if (Type < Val.getBitWidth())
+#if (LLVM_VERSION_MAJOR < 3)
     Val.trunc(Type);
+#else
+    Val=Val.trunc(Type);
+#endif
   else if (Type > Val.getBitWidth())
+#if (LLVM_VERSION_MAJOR < 3)
     Val.zext(Type);
+#else
+    Val=Val.zext(Type);
+#endif
 
   return ExprResult(Builder->Constant(Val));
 }
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 8842febb..0364127d 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -34,7 +34,11 @@
 #if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7)
 #include "llvm/Support/raw_os_ostream.h"
 #endif
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9)
 #include "llvm/System/Path.h"
+#else
+#include "llvm/Support/Path.h"
+#endif
 #include "llvm/Target/TargetData.h"
 #include "llvm/Transforms/Scalar.h"
 
@@ -226,7 +230,11 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
       BasicBlock *exit = BasicBlock::Create(getGlobalContext(), "exit", f);
       PHINode *result = 0;
       if (f->getReturnType() != Type::getVoidTy(getGlobalContext()))
-        result = PHINode::Create(f->getReturnType(), "retval", exit);
+#if (LLVM_VERSION_MAJOR > 2)
+        result = PHINode::Create(f->getReturnType(), 0, "retval", exit);
+#else
+		result = PHINode::Create(f->getReturnType(), "retval", exit);
+#endif
       CallInst::Create(mergeFn, "", exit);
       ReturnInst::Create(getGlobalContext(), result, exit);
 
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
index 935dfa62..11f2b2c5 100644
--- a/lib/Module/ModuleUtil.cpp
+++ b/lib/Module/ModuleUtil.cpp
@@ -25,7 +25,11 @@
 #include "llvm/Support/InstIterator.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Analysis/ValueTracking.h"
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9)
 #include "llvm/System/Path.h"
+#else
+#include "llvm/Support/Path.h"
+#endif
 
 #include <map>
 #include <iostream>
diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp
index 1eadec26..633c21a1 100644
--- a/lib/Module/Optimize.cpp
+++ b/lib/Module/Optimize.cpp
@@ -15,13 +15,18 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "klee/Config/config.h"
 #include "llvm/Module.h"
 #include "llvm/PassManager.h"
 #include "llvm/Analysis/Passes.h"
 #include "llvm/Analysis/LoopPass.h"
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/Support/CommandLine.h"
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9)
 #include "llvm/System/DynamicLibrary.h"
+#else
+#include "llvm/Support/DynamicLibrary.h"
+#endif
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Transforms/IPO.h"
diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp
index 11c89009..76a4f242 100644
--- a/lib/Module/RaiseAsm.cpp
+++ b/lib/Module/RaiseAsm.cpp
@@ -16,7 +16,7 @@
 #endif
 #if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR >= 9)
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/System/Host.h"
+#include "llvm/Support/Host.h"
 #include "llvm/Target/TargetLowering.h"
 #include "llvm/Target/TargetRegistry.h"
 #endif
diff --git a/lib/Support/Time.cpp b/lib/Support/Time.cpp
index 0ec8d9d7..ebcc390a 100644
--- a/lib/Support/Time.cpp
+++ b/lib/Support/Time.cpp
@@ -7,9 +7,14 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "klee/Config/config.h"
 #include "klee/Internal/System/Time.h"
 
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9)
 #include "llvm/System/Process.h"
+#else
+#include "llvm/Support/Process.h"
+#endif
 
 using namespace llvm;
 using namespace klee;
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp
index cddb0707..c51815aa 100644
--- a/lib/Support/Timer.cpp
+++ b/lib/Support/Timer.cpp
@@ -7,9 +7,14 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "klee/Config/config.h"
 #include "klee/Internal/Support/Timer.h"
 
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9)
 #include "llvm/System/Process.h"
+#else
+#include "llvm/Support/Process.h"
+#endif
 
 using namespace klee;
 using namespace llvm;