diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Core/Executor.cpp | 12 | ||||
-rw-r--r-- | lib/Core/ExecutorUtil.cpp | 3 | ||||
-rw-r--r-- | lib/Core/ExternalDispatcher.cpp | 12 | ||||
-rw-r--r-- | lib/Core/StatsTracker.cpp | 7 | ||||
-rw-r--r-- | lib/Core/TimingSolver.cpp | 3 | ||||
-rw-r--r-- | lib/Expr/Expr.cpp | 3 | ||||
-rw-r--r-- | lib/Expr/Parser.cpp | 5 | ||||
-rw-r--r-- | lib/Module/Checks.cpp | 4 | ||||
-rw-r--r-- | lib/Module/InstructionInfoTable.cpp | 12 | ||||
-rw-r--r-- | lib/Module/IntrinsicCleaner.cpp | 8 | ||||
-rw-r--r-- | lib/Module/KModule.cpp | 11 | ||||
-rw-r--r-- | lib/Module/LowerSwitch.cpp | 3 | ||||
-rw-r--r-- | lib/Module/ModuleUtil.cpp | 8 | ||||
-rw-r--r-- | lib/Module/Optimize.cpp | 12 | ||||
-rw-r--r-- | lib/Module/Passes.h | 14 | ||||
-rw-r--r-- | lib/Module/RaiseAsm.cpp | 14 | ||||
-rw-r--r-- | lib/Support/Time.cpp | 4 | ||||
-rw-r--r-- | lib/Support/Timer.cpp | 4 |
18 files changed, 74 insertions, 65 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 1826a4d6..e46ff9b0 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -34,7 +34,7 @@ #include "klee/util/ExprPPrinter.h" #include "klee/util/ExprUtil.h" #include "klee/util/GetElementPtrTypeIterator.h" -#include "klee/Config/config.h" +#include "klee/Config/Version.h" #include "klee/Internal/ADT/KTest.h" #include "klee/Internal/ADT/RNG.h" #include "klee/Internal/Module/Cell.h" @@ -50,7 +50,7 @@ #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" -#if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7) #include "llvm/LLVMContext.h" #endif #include "llvm/Module.h" @@ -58,7 +58,7 @@ #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) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/Process.h" #else #include "llvm/Support/Process.h" @@ -1309,7 +1309,7 @@ Function* Executor::getCalledFunction(CallSite &cs, ExecutionState &state) { } static bool isDebugIntrinsic(const Function *f, KModule *KM) { -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) // Fast path, getIntrinsicID is slow. if (f == KM->dbgStopPointFn) return true; @@ -1846,7 +1846,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { } // Memory instructions... -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) case Instruction::Malloc: case Instruction::Alloca: { AllocationInst *ai = cast<AllocationInst>(i); @@ -1866,7 +1866,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { executeAlloc(state, size, isLocal, ki); break; } -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) case Instruction::Free: { executeFree(state, eval(ki, 0, state).value); break; diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp index 5f974725..02f18bb4 100644 --- a/lib/Core/ExecutorUtil.cpp +++ b/lib/Core/ExecutorUtil.cpp @@ -15,6 +15,7 @@ #include "klee/Interpreter.h" #include "klee/Solver.h" +#include "klee/Config/Version.h" #include "klee/Internal/Module/KModule.h" #include "klee/util/GetElementPtrTypeIterator.h" @@ -23,7 +24,7 @@ #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) #include "llvm/ModuleProvider.h" #endif #include "llvm/Support/CallSite.h" diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp index bc68ce0d..5c03e42d 100644 --- a/lib/Core/ExternalDispatcher.cpp +++ b/lib/Core/ExternalDispatcher.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// #include "ExternalDispatcher.h" -#include "klee/Config/config.h" +#include "klee/Config/Version.h" // Ugh. #undef PACKAGE_BUGREPORT @@ -21,16 +21,16 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) #include "llvm/ModuleProvider.h" #endif -#if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7) #include "llvm/LLVMContext.h" #endif #include "llvm/ExecutionEngine/JIT.h" #include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/Support/CallSite.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/DynamicLibrary.h" #else #include "llvm/Support/DynamicLibrary.h" @@ -85,12 +85,12 @@ void *ExternalDispatcher::resolveSymbol(const std::string &name) { ExternalDispatcher::ExternalDispatcher() { dispatchModule = new Module("ExternalDispatcher", getGlobalContext()); -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) ExistingModuleProvider* MP = new ExistingModuleProvider(dispatchModule); #endif std::string error; -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) executionEngine = ExecutionEngine::createJIT(MP, &error); #else executionEngine = ExecutionEngine::createJIT(dispatchModule, &error); diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp index 03d5e926..7dcca6b2 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp @@ -13,6 +13,7 @@ #include "klee/ExecutionState.h" #include "klee/Statistics.h" +#include "klee/Config/Version.h" #include "klee/Internal/Module/InstructionInfoTable.h" #include "klee/Internal/Module/KModule.h" #include "klee/Internal/Module/KInstruction.h" @@ -35,12 +36,12 @@ #include "llvm/Type.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/CFG.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/Process.h" #else #include "llvm/Support/Process.h" #endif -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/Path.h" #else #include "llvm/Support/Path.h" @@ -282,7 +283,7 @@ void StatsTracker::stepInstruction(ExecutionState &es) { // // FIXME: This trick no longer works, we should fix this in the line // number propogation. -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) if (isa<DbgStopPointInst>(inst)) #endif es.coveredLines[&ii.file].insert(ii.line); diff --git a/lib/Core/TimingSolver.cpp b/lib/Core/TimingSolver.cpp index d0aa3f6a..d2c07f46 100644 --- a/lib/Core/TimingSolver.cpp +++ b/lib/Core/TimingSolver.cpp @@ -9,13 +9,14 @@ #include "TimingSolver.h" +#include "klee/Config/Version.h" #include "klee/ExecutionState.h" #include "klee/Solver.h" #include "klee/Statistics.h" #include "CoreStats.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/Process.h" #else #include "llvm/Support/Process.h" diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp index 08d5cd27..420eaa90 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "klee/Expr.h" +#include "klee/Config/Version.h" #include "llvm/Support/CommandLine.h" // FIXME: We shouldn't need this once fast constant support moves into @@ -346,7 +347,7 @@ 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 <= 2 && LLVM_VERSION_MINOR <= 8) +#if LLVM_VERSION_CODE <= LLVM_VERSION(2, 8) Tmp.zext(W); #else Tmp=Tmp.zext(W); diff --git a/lib/Expr/Parser.cpp b/lib/Expr/Parser.cpp index a41c5624..a94d5614 100644 --- a/lib/Expr/Parser.cpp +++ b/lib/Expr/Parser.cpp @@ -11,6 +11,7 @@ #include "expr/Lexer.h" +#include "klee/Config/Version.h" #include "klee/Constraints.h" #include "klee/ExprBuilder.h" #include "klee/Solver.h" @@ -1496,13 +1497,13 @@ ExprResult ParserImpl::ParseNumberToken(Expr::Width Type, const Token &Tok) { Val = -Val; if (Type < Val.getBitWidth()) -#if (LLVM_VERSION_MAJOR < 3) +#if LLVM_VERSION_CODE <= LLVM_VERSION(2, 8) Val.trunc(Type); #else Val=Val.trunc(Type); #endif else if (Type > Val.getBitWidth()) -#if (LLVM_VERSION_MAJOR < 3) +#if LLVM_VERSION_CODE <= LLVM_VERSION(2, 8) Val.zext(Type); #else Val=Val.zext(Type); diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp index 2edcf940..c2f98c0f 100644 --- a/lib/Module/Checks.cpp +++ b/lib/Module/Checks.cpp @@ -9,6 +9,8 @@ #include "Passes.h" +#include "klee/Config/Version.h" + #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" @@ -16,7 +18,7 @@ #include "llvm/Instruction.h" #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" -#if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7) #include "llvm/LLVMContext.h" #endif #include "llvm/Module.h" diff --git a/lib/Module/InstructionInfoTable.cpp b/lib/Module/InstructionInfoTable.cpp index e08dc2b3..0e193452 100644 --- a/lib/Module/InstructionInfoTable.cpp +++ b/lib/Module/InstructionInfoTable.cpp @@ -7,15 +7,15 @@ // //===----------------------------------------------------------------------===// -#include "klee/Config/config.h" #include "klee/Internal/Module/InstructionInfoTable.h" +#include "klee/Config/Version.h" #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" #include "llvm/Linker.h" #include "llvm/Module.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) #include "llvm/Assembly/AsmAnnotationWriter.h" #else #include "llvm/Assembly/AssemblyAnnotationWriter.h" @@ -24,7 +24,7 @@ #include "llvm/Support/CFG.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/raw_ostream.h" -#if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7) #include "llvm/Analysis/DebugInfo.h" #endif #include "llvm/Analysis/ValueTracking.h" @@ -37,7 +37,7 @@ using namespace klee; class InstructionToLineAnnotator : public llvm::AssemblyAnnotationWriter { public: -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) void emitInstructionAnnot(const Instruction *i, llvm::raw_ostream &os) { #else void emitInstructionAnnot(const Instruction *i, @@ -74,7 +74,7 @@ static void buildInstructionToLineMap(Module *m, } } -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) static std::string getDSPIPath(const DbgStopPointInst *dspi) { std::string dir, file; bool res = GetConstantStringInfo(dspi->getDirectory(), dir); @@ -98,7 +98,7 @@ static std::string getDSPIPath(DILocation Loc) { bool InstructionInfoTable::getInstructionDebugInfo(const llvm::Instruction *I, const std::string *&File, unsigned &Line) { -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) if (const DbgStopPointInst *dspi = dyn_cast<DbgStopPointInst>(I)) { File = internString(getDSPIPath(dspi)); Line = dspi->getLine(); diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index da0c65f8..8e326af9 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -9,7 +9,7 @@ #include "Passes.h" -#include "klee/Config/config.h" +#include "klee/Config/Version.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" @@ -17,7 +17,7 @@ #include "llvm/Instruction.h" #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" -#if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7) #include "llvm/LLVMContext.h" #endif #include "llvm/Module.h" @@ -61,7 +61,7 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b) { // FIXME: This is much more target dependent than just the word size, // however this works for x86-32 and x86-64. case Intrinsic::vacopy: { // (dst, src) -> *((i8**) dst) = *((i8**) src) -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) Value *dst = ii->getOperand(1); Value *src = ii->getOperand(2); #else @@ -94,7 +94,7 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b) { break; } -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) case Intrinsic::dbg_stoppoint: { // We can remove this stoppoint if the next instruction is // sure to be another stoppoint. This is nice for cleanliness diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp index 0364127d..94c3d05b 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -14,6 +14,7 @@ #include "Passes.h" +#include "klee/Config/Version.h" #include "klee/Interpreter.h" #include "klee/Internal/Module/Cell.h" #include "klee/Internal/Module/KInstruction.h" @@ -22,7 +23,7 @@ #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Instructions.h" -#if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7) #include "llvm/LLVMContext.h" #endif #include "llvm/Module.h" @@ -31,10 +32,10 @@ #include "llvm/Support/CallSite.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" -#if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7) #include "llvm/Support/raw_os_ostream.h" #endif -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/Path.h" #else #include "llvm/Support/Path.h" @@ -230,7 +231,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, BasicBlock *exit = BasicBlock::Create(getGlobalContext(), "exit", f); PHINode *result = 0; if (f->getReturnType() != Type::getVoidTy(getGlobalContext())) -#if (LLVM_VERSION_MAJOR > 2) +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0) result = PHINode::Create(f->getReturnType(), 0, "retval", exit); #else result = PHINode::Create(f->getReturnType(), "retval", exit); @@ -341,7 +342,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, std::ostream *os = ih->openOutputFile("assembly.ll"); assert(os && os->good() && "unable to open source output"); -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 6) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 6) // We have an option for this in case the user wants a .ll they // can compile. if (NoTruncateSourceLines) { diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp index 7d6920be..6667a006 100644 --- a/lib/Module/LowerSwitch.cpp +++ b/lib/Module/LowerSwitch.cpp @@ -15,7 +15,8 @@ //===----------------------------------------------------------------------===// #include "Passes.h" -#if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#include "klee/Config/Version.h" +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7) #include "llvm/LLVMContext.h" #endif #include <algorithm> diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp index 11f2b2c5..029540ae 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -8,14 +8,14 @@ //===----------------------------------------------------------------------===// #include "klee/Internal/Support/ModuleUtil.h" -#include "klee/Config/config.h" +#include "klee/Config/Version.h" #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" #include "llvm/Linker.h" #include "llvm/Module.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) #include "llvm/Assembly/AsmAnnotationWriter.h" #else #include "llvm/Assembly/AssemblyAnnotationWriter.h" @@ -25,7 +25,7 @@ #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) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/Path.h" #else #include "llvm/Support/Path.h" @@ -72,7 +72,7 @@ Function *klee::getDirectCallTarget(CallSite cs) { } static bool valueIsOnlyCalled(const Value *v) { -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) for (Value::use_const_iterator it = v->use_begin(), ie = v->use_end(); it != ie; ++it) { #else diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp index 633c21a1..e0ae4d99 100644 --- a/lib/Module/Optimize.cpp +++ b/lib/Module/Optimize.cpp @@ -15,14 +15,14 @@ // //===----------------------------------------------------------------------===// -#include "klee/Config/config.h" +#include "klee/Config/Version.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) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/DynamicLibrary.h" #else #include "llvm/Support/DynamicLibrary.h" @@ -99,7 +99,7 @@ static void AddStandardCompilePasses(PassManager &PM) { if (DisableOptimizations) return; -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) addPass(PM, createRaiseAllocationsPass()); // call %malloc -> malloc inst #endif addPass(PM, createCFGSimplificationPass()); // Clean up disgusting code @@ -124,7 +124,7 @@ static void AddStandardCompilePasses(PassManager &PM) { addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs addPass(PM, createScalarReplAggregatesPass()); // Break up aggregate allocas addPass(PM, createInstructionCombiningPass()); // Combine silly seq's -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) addPass(PM, createCondPropagationPass()); // Propagate conditionals #endif @@ -134,7 +134,7 @@ static void AddStandardCompilePasses(PassManager &PM) { addPass(PM, createLoopRotatePass()); addPass(PM, createLICMPass()); // Hoist loop invariants addPass(PM, createLoopUnswitchPass()); // Unswitch loops. -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) addPass(PM, createLoopIndexSplitPass()); // Index split loops. #endif // FIXME : Removing instcombine causes nestedloop regression. @@ -150,7 +150,7 @@ static void AddStandardCompilePasses(PassManager &PM) { // Run instcombine after redundancy elimination to exploit opportunities // opened up by them. addPass(PM, createInstructionCombiningPass()); -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 7) addPass(PM, createCondPropagationPass()); // Propagate conditionals #endif diff --git a/lib/Module/Passes.h b/lib/Module/Passes.h index 2b1ea9bc..480fbde6 100644 --- a/lib/Module/Passes.h +++ b/lib/Module/Passes.h @@ -10,7 +10,7 @@ #ifndef KLEE_PASSES_H #define KLEE_PASSES_H -#include "klee/Config/config.h" +#include "klee/Config/Version.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" @@ -34,7 +34,7 @@ namespace klee { class RaiseAsmPass : public llvm::ModulePass { static char ID; -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR >= 9) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 9) const llvm::TargetLowering *TLI; #endif @@ -51,7 +51,7 @@ class RaiseAsmPass : public llvm::ModulePass { bool runOnInstruction(llvm::Module &M, llvm::Instruction *I); public: -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) RaiseAsmPass() : llvm::ModulePass((intptr_t) &ID) {} #else RaiseAsmPass() : llvm::ModulePass(ID) {} @@ -72,7 +72,7 @@ class IntrinsicCleanerPass : public llvm::ModulePass { public: IntrinsicCleanerPass(const llvm::TargetData &TD, bool LI=true) -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) : llvm::ModulePass((intptr_t) &ID), #else : llvm::ModulePass(ID), @@ -101,7 +101,7 @@ class PhiCleanerPass : public llvm::FunctionPass { static char ID; public: -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) PhiCleanerPass() : llvm::FunctionPass((intptr_t) &ID) {} #else PhiCleanerPass() : llvm::FunctionPass(ID) {} @@ -113,7 +113,7 @@ public: class DivCheckPass : public llvm::ModulePass { static char ID; public: -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) DivCheckPass(): ModulePass((intptr_t) &ID) {} #else DivCheckPass(): ModulePass(ID) {} @@ -127,7 +127,7 @@ public: class LowerSwitchPass : public llvm::FunctionPass { public: static char ID; // Pass identification, replacement for typeid -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) LowerSwitchPass() : FunctionPass((intptr_t) &ID) {} #else LowerSwitchPass() : FunctionPass(ID) {} diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp index 76a4f242..8f862ffa 100644 --- a/lib/Module/RaiseAsm.cpp +++ b/lib/Module/RaiseAsm.cpp @@ -8,13 +8,13 @@ //===----------------------------------------------------------------------===// #include "Passes.h" -#include "klee/Config/config.h" +#include "klee/Config/Version.h" #include "llvm/InlineAsm.h" -#if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7) #include "llvm/LLVMContext.h" #endif -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR >= 9) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 9) #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Host.h" #include "llvm/Target/TargetLowering.h" @@ -38,7 +38,7 @@ Function *RaiseAsmPass::getIntrinsic(llvm::Module &M, bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) { if (CallInst *ci = dyn_cast<CallInst>(I)) { if (InlineAsm *ia = dyn_cast<InlineAsm>(ci->getCalledValue())) { -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR >= 9) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 9) (void) ia; return TLI && TLI->ExpandInlineAsm(ci); #else @@ -47,7 +47,7 @@ bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) { const llvm::Type *T = ci->getType(); // bswaps -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) unsigned NumOperands = ci->getNumOperands(); llvm::Value *Arg0 = NumOperands > 1 ? ci->getOperand(1) : 0; #else @@ -62,7 +62,7 @@ bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) { as == "rorw $$8, ${0:w};rorl $$16, $0;rorw $$8, ${0:w}" && cs == "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}"))) { Function *F = getIntrinsic(M, Intrinsic::bswap, Arg0->getType()); -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8) ci->setOperand(0, F); #else ci->setCalledFunction(F); @@ -79,7 +79,7 @@ bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) { bool RaiseAsmPass::runOnModule(Module &M) { bool changed = false; -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR >= 9) +#if LLVM_VERSION_CODE >= LLVM_VERSION(2, 9) std::string Err; std::string HostTriple = llvm::sys::getHostTriple(); const Target *NativeTarget = TargetRegistry::lookupTarget(HostTriple, Err); diff --git a/lib/Support/Time.cpp b/lib/Support/Time.cpp index ebcc390a..fb0e349c 100644 --- a/lib/Support/Time.cpp +++ b/lib/Support/Time.cpp @@ -7,10 +7,10 @@ // //===----------------------------------------------------------------------===// -#include "klee/Config/config.h" +#include "klee/Config/Version.h" #include "klee/Internal/System/Time.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/Process.h" #else #include "llvm/Support/Process.h" diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp index c51815aa..35922d4d 100644 --- a/lib/Support/Timer.cpp +++ b/lib/Support/Timer.cpp @@ -7,10 +7,10 @@ // //===----------------------------------------------------------------------===// -#include "klee/Config/config.h" +#include "klee/Config/Version.h" #include "klee/Internal/Support/Timer.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/Process.h" #else #include "llvm/Support/Process.h" |