summaryrefslogtreecommitdiff
path: root/klee
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2013-04-04 11:50:07 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2013-04-04 11:50:07 +0000
commitfbd713832ad77a8d73139a17ba9a6d8049d64f5c (patch)
tree5d6afe841cc997de5798286019c6c11a028759be /klee
parent0491787f65611835d57636322857e529d56ef4a5 (diff)
Patch by Michael Contreras and Jiri Slaby for compiling KLEE with LLVM 3.2
Diffstat (limited to 'klee')
-rw-r--r--klee/lib/Core/Executor.cpp14
-rw-r--r--klee/lib/Core/SpecialFunctionHandler.cpp4
-rw-r--r--klee/lib/Module/InstructionInfoTable.cpp4
-rw-r--r--klee/lib/Module/IntrinsicCleaner.cpp4
-rw-r--r--klee/lib/Module/Optimize.cpp10
5 files changed, 31 insertions, 5 deletions
diff --git a/klee/lib/Core/Executor.cpp b/klee/lib/Core/Executor.cpp
index 473f45e57a5..d0ad811d514 100644
--- a/klee/lib/Core/Executor.cpp
+++ b/klee/lib/Core/Executor.cpp
@@ -1380,7 +1380,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
CallSite(cast<CallInst>(caller)));
// XXX need to check other param attrs ?
- if (cs.paramHasAttr(0, llvm::Attribute::SExt)) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
+ bool isSExt = cs.paramHasAttr(0, llvm::Attributes::SExt);
+#else
+ bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt);
+#endif
+ if (isSExt) {
result = SExtExpr::create(result, to);
} else {
result = ZExtExpr::create(result, to);
@@ -1579,7 +1584,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
if (from != to) {
// XXX need to check other param attrs ?
- if (cs.paramHasAttr(i+1, llvm::Attribute::SExt)) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
+ bool isSExt = cs.paramHasAttr(i+1, llvm::Attributes::SExt);
+#else
+ bool isSExt = cs.paramHasAttr(i+1, llvm::Attribute::SExt);
+#endif
+ if (isSExt) {
arguments[i] = SExtExpr::create(arguments[i], to);
} else {
arguments[i] = ZExtExpr::create(arguments[i], to);
diff --git a/klee/lib/Core/SpecialFunctionHandler.cpp b/klee/lib/Core/SpecialFunctionHandler.cpp
index d01a9ef48e0..d44e13b60c9 100644
--- a/klee/lib/Core/SpecialFunctionHandler.cpp
+++ b/klee/lib/Core/SpecialFunctionHandler.cpp
@@ -131,7 +131,11 @@ void SpecialFunctionHandler::prepare() {
// Make sure NoReturn attribute is set, for optimization and
// coverage counting.
if (hi.doesNotReturn)
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
+ f->addFnAttr(Attributes::NoReturn);
+#else
f->addFnAttr(Attribute::NoReturn);
+#endif
// Change to a declaration since we handle internally (simplifies
// module and allows deleting dead code).
diff --git a/klee/lib/Module/InstructionInfoTable.cpp b/klee/lib/Module/InstructionInfoTable.cpp
index 0e1934520f2..d0ef52d0b21 100644
--- a/klee/lib/Module/InstructionInfoTable.cpp
+++ b/klee/lib/Module/InstructionInfoTable.cpp
@@ -24,7 +24,9 @@
#include "llvm/Support/CFG.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Support/raw_ostream.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7)
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
+#include "llvm/DebugInfo.h"
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(2, 7)
#include "llvm/Analysis/DebugInfo.h"
#endif
#include "llvm/Analysis/ValueTracking.h"
diff --git a/klee/lib/Module/IntrinsicCleaner.cpp b/klee/lib/Module/IntrinsicCleaner.cpp
index fd0db91db61..b897fcc76ab 100644
--- a/klee/lib/Module/IntrinsicCleaner.cpp
+++ b/klee/lib/Module/IntrinsicCleaner.cpp
@@ -23,7 +23,11 @@
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Type.h"
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
+#include "llvm/IRBuilder.h"
+#else
#include "llvm/Support/IRBuilder.h"
+#endif
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1)
diff --git a/klee/lib/Module/Optimize.cpp b/klee/lib/Module/Optimize.cpp
index da2c9733597..d05002fe0c4 100644
--- a/klee/lib/Module/Optimize.cpp
+++ b/klee/lib/Module/Optimize.cpp
@@ -197,8 +197,14 @@ void Optimize(Module* M) {
// Now that composite has been compiled, scan through the module, looking
// for a main function. If main is defined, mark all other functions
// internal.
- if (!DisableInternalize)
- addPass(Passes, createInternalizePass(true));
+ if (!DisableInternalize) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
+ ModulePass *pass = createInternalizePass(createInternalizePass(std::vector<const char *>(1, "main"));
+#else
+ ModulePass *pass = createInternalizePass(true);
+#endif
+ addPass(Passes, pass);
+ }
// Propagate constants at call sites into the functions they call. This
// opens opportunities for globalopt (and inlining) by substituting function