about summary refs log tree commit diff homepage
path: root/lib/Module
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Module')
-rw-r--r--lib/Module/KModule.cpp15
-rw-r--r--lib/Module/Optimize.cpp2
-rw-r--r--lib/Module/Passes.h4
-rw-r--r--lib/Module/RaiseAsm.cpp11
4 files changed, 22 insertions, 10 deletions
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 94c3d05b..a569242e 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -122,7 +122,7 @@ static Function *getStubFunctionForCtorList(Module *m,
   assert(!gv->isDeclaration() && !gv->hasInternalLinkage() &&
          "do not support old LLVM style constructor/destructor lists");
   
-  std::vector<const Type*> nullary;
+  std::vector<LLVM_TYPE_Q Type*> nullary;
 
   Function *fn = Function::Create(FunctionType::get(Type::getVoidTy(getGlobalContext()), 
 						    nullary, false),
@@ -181,7 +181,8 @@ static void injectStaticConstructorsAndDestructors(Module *m) {
   }
 }
 
-static void forceImport(Module *m, const char *name, const Type *retType, ...) {
+static void forceImport(Module *m, const char *name, LLVM_TYPE_Q Type *retType,
+                        ...) {
   // If module lacks an externally visible symbol for the name then we
   // need to create one. We have to look in the symbol table because
   // we want to check everything (global variables, functions, and
@@ -194,8 +195,8 @@ static void forceImport(Module *m, const char *name, const Type *retType, ...) {
     va_list ap;
 
     va_start(ap, retType);
-    std::vector<const Type *> argTypes;
-    while (const Type *t = va_arg(ap, const Type*))
+    std::vector<LLVM_TYPE_Q Type *> argTypes;
+    while (LLVM_TYPE_Q Type *t = va_arg(ap, LLVM_TYPE_Q Type*))
       argTypes.push_back(t);
     va_end(ap);
 
@@ -208,9 +209,9 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
   if (!MergeAtExit.empty()) {
     Function *mergeFn = module->getFunction("klee_merge");
     if (!mergeFn) {
-      const llvm::FunctionType *Ty = 
+      LLVM_TYPE_Q llvm::FunctionType *Ty = 
         FunctionType::get(Type::getVoidTy(getGlobalContext()), 
-                          std::vector<const Type*>(), false);
+                          std::vector<LLVM_TYPE_Q Type*>(), false);
       mergeFn = Function::Create(Ty, GlobalVariable::ExternalLinkage,
 				 "klee_merge",
 				 module);
@@ -280,7 +281,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
   // by name. We only add them if such a function doesn't exist to
   // avoid creating stale uses.
 
-  const llvm::Type *i8Ty = Type::getInt8Ty(getGlobalContext());
+  LLVM_TYPE_Q llvm::Type *i8Ty = Type::getInt8Ty(getGlobalContext());
   forceImport(module, "memcpy", PointerType::getUnqual(i8Ty),
               PointerType::getUnqual(i8Ty),
               PointerType::getUnqual(i8Ty),
diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp
index e0ae4d99..524f80e2 100644
--- a/lib/Module/Optimize.cpp
+++ b/lib/Module/Optimize.cpp
@@ -158,7 +158,9 @@ static void AddStandardCompilePasses(PassManager &PM) {
   addPass(PM, createAggressiveDCEPass());        // Delete dead instructions
   addPass(PM, createCFGSimplificationPass());    // Merge & remove BBs
   addPass(PM, createStripDeadPrototypesPass());  // Get rid of dead prototypes
+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 0)
   addPass(PM, createDeadTypeEliminationPass());  // Eliminate dead types
+#endif
   addPass(PM, createConstantMergePass());        // Merge dup global constants
 }
 
diff --git a/lib/Module/Passes.h b/lib/Module/Passes.h
index 480fbde6..6257da8f 100644
--- a/lib/Module/Passes.h
+++ b/lib/Module/Passes.h
@@ -40,11 +40,11 @@ class RaiseAsmPass : public llvm::ModulePass {
 
   llvm::Function *getIntrinsic(llvm::Module &M,
                                unsigned IID,
-                               const llvm::Type **Tys,
+                               LLVM_TYPE_Q llvm::Type **Tys,
                                unsigned NumTys);
   llvm::Function *getIntrinsic(llvm::Module &M,
                                unsigned IID, 
-                               const llvm::Type *Ty0) {
+                               LLVM_TYPE_Q llvm::Type *Ty0) {
     return getIntrinsic(M, IID, &Ty0, 1);
   }
 
diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp
index 8f862ffa..6f6a5c90 100644
--- a/lib/Module/RaiseAsm.cpp
+++ b/lib/Module/RaiseAsm.cpp
@@ -28,9 +28,14 @@ char RaiseAsmPass::ID = 0;
 
 Function *RaiseAsmPass::getIntrinsic(llvm::Module &M,
                                      unsigned IID,
-                                     const Type **Tys,
+                                     LLVM_TYPE_Q Type **Tys,
                                      unsigned NumTys) {  
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
+  return Intrinsic::getDeclaration(&M, (llvm::Intrinsic::ID) IID,
+                                   llvm::ArrayRef<llvm::Type*>(Tys, NumTys));
+#else
   return Intrinsic::getDeclaration(&M, (llvm::Intrinsic::ID) IID, Tys, NumTys);
+#endif
 }
 
 // FIXME: This should just be implemented as a patch to
@@ -87,7 +92,11 @@ bool RaiseAsmPass::runOnModule(Module &M) {
     llvm::errs() << "Warning: unable to select native target: " << Err << "\n";
     TLI = 0;
   } else {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
+    TargetMachine *TM = NativeTarget->createTargetMachine(HostTriple, "", "");
+#else
     TargetMachine *TM = NativeTarget->createTargetMachine(HostTriple, "");
+#endif
     TLI = TM->getTargetLowering();
   }
 #endif