about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2017-06-15 15:03:29 +0200
committerDan Liew <delcypher@gmail.com>2017-06-16 15:40:50 +0100
commitc5059debfd910edabcbc2fc847d21c9e50c5afe1 (patch)
tree564ee5596349879a0dda633e97e4f1bd43982273
parent4359b5fd1ce7069b7cdf20f31fee8817705c07b3 (diff)
downloadklee-c5059debfd910edabcbc2fc847d21c9e50c5afe1.tar.gz
llvm37: introduce type for PassManager
In LLVM 3.7, PassManager was moved to the legacy:: namespace. Introduce
a type for it and use it in the code.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
-rw-r--r--include/klee/Internal/Module/LLVMPassManager.h22
-rw-r--r--lib/Module/KModule.cpp6
-rw-r--r--lib/Module/Optimize.cpp8
3 files changed, 29 insertions, 7 deletions
diff --git a/include/klee/Internal/Module/LLVMPassManager.h b/include/klee/Internal/Module/LLVMPassManager.h
new file mode 100644
index 00000000..5a1b8927
--- /dev/null
+++ b/include/klee/Internal/Module/LLVMPassManager.h
@@ -0,0 +1,22 @@
+//===-- InstructionInfoTable.h ----------------------------------*- C++ -*-===//
+//
+//                     The KLEE Symbolic Virtual Machine
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7)
+#include "llvm/IR/LegacyPassManager.h"
+#else
+#include "llvm/PassManager.h"
+#endif
+
+namespace klee {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7)
+typedef llvm::legacy::PassManager LegacyLLVMPassManagerTy;
+#else
+typedef llvm::PassManager LegacyLLVMPassManagerTy;
+#endif
+}
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 6438707a..005c8869 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -47,7 +47,7 @@
 #include "llvm/IR/CallSite.h"
 #endif
 
-#include "llvm/PassManager.h"
+#include "klee/Internal/Module/LLVMPassManager.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/raw_os_ostream.h"
@@ -305,7 +305,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
   // invariant transformations that we will end up doing later so that
   // optimize is seeing what is as close as possible to the final
   // module.
-  PassManager pm;
+  LegacyLLVMPassManagerTy pm;
   pm.add(new RaiseAsmPass());
   if (opts.CheckDivZero) pm.add(new DivCheckPass());
   if (opts.CheckOvershift) pm.add(new OvershiftCheckPass());
@@ -373,7 +373,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
   // linked in something with intrinsics but any external calls are
   // going to be unresolved. We really need to handle the intrinsics
   // directly I think?
-  PassManager pm3;
+  LegacyLLVMPassManagerTy pm3;
   pm3.add(createCFGSimplificationPass());
   switch(SwitchType) {
   case eSwitchTypeInternal: break;
diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp
index c0f3f34c..21c77c04 100644
--- a/lib/Module/Optimize.cpp
+++ b/lib/Module/Optimize.cpp
@@ -16,7 +16,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "klee/Config/Version.h"
-#include "llvm/PassManager.h"
+#include "klee/Internal/Module/LLVMPassManager.h"
 #include "llvm/Analysis/Passes.h"
 #include "llvm/Analysis/LoopPass.h"
 #include "llvm/Support/CommandLine.h"
@@ -80,7 +80,7 @@ static cl::alias A1("S", cl::desc("Alias for --strip-debug"),
 
 // A utility function that adds a pass to the pass manager but will also add
 // a verifier pass after if we're supposed to verify.
-static inline void addPass(PassManager &PM, Pass *P) {
+static inline void addPass(klee::LegacyLLVMPassManagerTy &PM, Pass *P) {
   // Add the pass to the pass manager...
   PM.add(P);
 
@@ -92,7 +92,7 @@ static inline void addPass(PassManager &PM, Pass *P) {
 namespace llvm {
 
 
-static void AddStandardCompilePasses(PassManager &PM) {
+static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) {
   PM.add(createVerifierPass());                  // Verify that input is correct
 
 #if LLVM_VERSION_CODE < LLVM_VERSION(3, 0)
@@ -166,7 +166,7 @@ static void AddStandardCompilePasses(PassManager &PM) {
 void Optimize(Module *M, const std::string &EntryPoint) {
 
   // Instantiate the pass manager to organize the passes.
-  PassManager Passes;
+  klee::LegacyLLVMPassManagerTy Passes;
 
   // If we're verifying, start off with a verification pass.
   if (VerifyEach)