diff options
author | Daniel Schemmel <daniel@schemmel.net> | 2024-02-01 14:51:37 +0000 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2024-02-16 21:35:55 +0000 |
commit | 325c6cdcab632a6824be8ca9a926f4c4573adbdb (patch) | |
tree | 2c896335b546ae6ec4197ae26155dc9760b6c913 /lib | |
parent | c966cc6aada0e401fa0fa7caf2c359bfc5c4eb9a (diff) | |
download | klee-325c6cdcab632a6824be8ca9a926f4c4573adbdb.tar.gz |
drop llvm 9 and 10
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Core/Executor.cpp | 32 | ||||
-rw-r--r-- | lib/Core/GetElementPtrTypeIterator.h | 10 | ||||
-rw-r--r-- | lib/Core/MemoryManager.cpp | 14 | ||||
-rw-r--r-- | lib/Module/IntrinsicCleaner.cpp | 4 | ||||
-rw-r--r-- | lib/Module/Optimize.cpp | 2 | ||||
-rw-r--r-- | lib/Module/OptimizeLegacy.cpp | 4 |
6 files changed, 1 insertions, 65 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 78b3dd35..d70a2c4e 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -77,11 +77,7 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/Process.h" -#if LLVM_VERSION_CODE >= LLVM_VERSION(10, 0) #include "llvm/Support/TypeSize.h" -#else -typedef unsigned TypeSize; -#endif #include "llvm/Support/raw_ostream.h" #include <algorithm> @@ -1990,12 +1986,8 @@ void Executor::executeCall(ExecutionState &state, KInstruction *ki, Function *f, argWidth = arguments[k]->getWidth(); } -#if LLVM_VERSION_CODE >= LLVM_VERSION(11, 0) MaybeAlign ma = cb.getParamAlign(k); unsigned alignment = ma ? ma->value() : 0; -#else - unsigned alignment = cb.getParamAlignment(k); -#endif if (WordSize == Expr::Int32 && !alignment) alignment = 4; @@ -3245,11 +3237,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { return; } uint64_t iIdx = cIdx->getZExtValue(); -#if LLVM_VERSION_MAJOR >= 11 const auto *vt = cast<llvm::FixedVectorType>(iei->getType()); -#else - const llvm::VectorType *vt = iei->getType(); -#endif unsigned EltBits = getWidthForLLVMType(vt->getElementType()); if (iIdx >= vt->getNumElements()) { @@ -3287,11 +3275,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { return; } uint64_t iIdx = cIdx->getZExtValue(); -#if LLVM_VERSION_MAJOR >= 11 const auto *vt = cast<llvm::FixedVectorType>(eei->getVectorOperandType()); -#else - const llvm::VectorType *vt = eei->getVectorOperandType(); -#endif unsigned EltBits = getWidthForLLVMType(vt->getElementType()); if (iIdx >= vt->getNumElements()) { @@ -3502,10 +3486,6 @@ void Executor::bindInstructionConstants(KInstruction *KI) { #endif } else if (InsertValueInst *ivi = dyn_cast<InsertValueInst>(KI->inst)) { KGEPInstruction *kgepi = static_cast<KGEPInstruction *>(KI); -#if LLVM_VERSION_CODE <= LLVM_VERSION(10, 0) - computeOffsets(kgepi, iv_type_begin(ivi), iv_type_end(ivi)); - assert(kgepi->indices.empty() && "InsertValue constant offset expected"); -#else llvm::Value *agg = ivi->getAggregateOperand(); llvm::Type *current_type = agg->getType(); std::uint64_t offset = 0; @@ -3526,14 +3506,8 @@ void Executor::bindInstructionConstants(KInstruction *KI) { current_type = GetElementPtrInst::getTypeAtIndex(current_type, index); } kgepi->offset = offset; -#endif } else if (ExtractValueInst *evi = dyn_cast<ExtractValueInst>(KI->inst)) { KGEPInstruction *kgepi = static_cast<KGEPInstruction *>(KI); -#if LLVM_VERSION_CODE <= LLVM_VERSION(10, 0) - computeOffsets(kgepi, ev_type_begin(evi), ev_type_end(evi)); - assert(kgepi->indices.empty() && "ExtractValue constant offset expected"); -#else - llvm::Value *agg = evi->getAggregateOperand(); llvm::Type *current_type = agg->getType(); uint64_t offset = 0; @@ -3554,7 +3528,6 @@ void Executor::bindInstructionConstants(KInstruction *KI) { current_type = GetElementPtrInst::getTypeAtIndex(current_type, index); } kgepi->offset = offset; -#endif } } @@ -4955,12 +4928,7 @@ size_t Executor::getAllocationAlignment(const llvm::Value *allocSite) const { type = GO->getType(); } } else if (const AllocaInst *AI = dyn_cast<AllocaInst>(allocSite)) { -#if LLVM_VERSION_CODE <= LLVM_VERSION(10, 0) - alignment = AI->getAlignment(); - -#else alignment = AI->getAlign().value(); -#endif type = AI->getAllocatedType(); } else if (isa<InvokeInst>(allocSite) || isa<CallInst>(allocSite)) { // FIXME: Model the semantics of the call to use the right alignment diff --git a/lib/Core/GetElementPtrTypeIterator.h b/lib/Core/GetElementPtrTypeIterator.h index 4e0314cb..e4ca8dc9 100644 --- a/lib/Core/GetElementPtrTypeIterator.h +++ b/lib/Core/GetElementPtrTypeIterator.h @@ -71,12 +71,7 @@ public: llvm::Type *operator*() const { return CurTy; } llvm::Type *getIndexedType() const { -#if LLVM_VERSION_CODE >= LLVM_VERSION(11, 0) return llvm::GetElementPtrInst::getTypeAtIndex(CurTy, getOperand()); -#else - llvm::CompositeType *CT = cast<llvm::CompositeType>(CurTy); - return CT->getTypeAtIndex(getOperand()); -#endif } // This is a non-standard operator->. It allows you to call methods on the @@ -86,14 +81,9 @@ public: llvm::Value *getOperand() const { return asValue(*OpIt); } generic_gep_type_iterator& operator++() { // Preincrement -#if LLVM_VERSION_CODE >= LLVM_VERSION(11, 0) if (isa<llvm::StructType>(CurTy) || isa<llvm::ArrayType>(CurTy) || isa<llvm::VectorType>(CurTy)) { CurTy = llvm::GetElementPtrInst::getTypeAtIndex(CurTy, getOperand()); -#else - if (llvm::CompositeType *CT = dyn_cast<llvm::CompositeType>(CurTy)) { - CurTy = CT->getTypeAtIndex(getOperand()); -#endif } else if (CurTy->isPointerTy()) { CurTy = CurTy->getPointerElementType(); } else { diff --git a/lib/Core/MemoryManager.cpp b/lib/Core/MemoryManager.cpp index 3b0f5064..9d291578 100644 --- a/lib/Core/MemoryManager.cpp +++ b/lib/Core/MemoryManager.cpp @@ -22,11 +22,7 @@ DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/GlobalVariable.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/MathExtras.h" -#if LLVM_VERSION_CODE >= LLVM_VERSION(10, 0) #include "llvm/Support/Alignment.h" -#else -#include "llvm/Support/MathExtras.h" -#endif DISABLE_WARNING_POP #include <cinttypes> @@ -187,28 +183,18 @@ MemoryManager::MemoryManager(ArrayCache *_arrayCache) stackFactory, nullptr); // check invariants -#if LLVM_VERSION_CODE >= LLVM_VERSION(10, 0) llvm::Align pageAlignment(pageSize); -#endif for (auto &requestedSegment : requestedSegments) { auto &segment1 = std::get<0>(requestedSegment); auto &start1 = std::get<1>(requestedSegment); auto &size1 = std::get<2>(requestedSegment); // check for page alignment // NOTE: sizes are assumed to be page aligned due to multiplication -#if LLVM_VERSION_CODE >= LLVM_VERSION(10, 0) if (start1 != 0 && !llvm::isAligned(pageAlignment, start1)) { klee_error("Deterministic allocator: Requested start address for %s " "is not page aligned (page size: %" PRIu64 " B)", segment1.c_str(), pageAlignment.value()); } -#else - if (start1 != 0 && llvm::OffsetToAlignment(start1, pageSize) != 0) { - klee_error("Deterministic allocator: Requested start address for %s " - "is not page aligned (page size: %zu B)", - segment1.c_str(), pageSize); - } -#endif // check for overlap of segments std::uintptr_t end1 = start1 + size1; diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index af77ed70..8d507754 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -25,9 +25,7 @@ DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" -#if LLVM_VERSION_CODE >= LLVM_VERSION(10, 0) #include "llvm/IR/IntrinsicsX86.h" -#endif #include "llvm/IR/Module.h" #include "llvm/IR/Type.h" #include "llvm/Pass.h" @@ -391,9 +389,7 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { case Intrinsic::readcyclecounter: case Intrinsic::returnaddress: case Intrinsic::round: -#if LLVM_VERSION_CODE >= LLVM_VERSION(11, 0) case Intrinsic::roundeven: -#endif case Intrinsic::sin: case Intrinsic::sqrt: case Intrinsic::stackrestore: diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp index 9475512b..654279f4 100644 --- a/lib/Module/Optimize.cpp +++ b/lib/Module/Optimize.cpp @@ -25,4 +25,4 @@ void klee::optimiseAndPrepare(bool OptimiseKLEECall, bool Optimize, llvm::ArrayRef<const char *> preservedFunctions, llvm::Module *module) { assert(0); -} \ No newline at end of file +} diff --git a/lib/Module/OptimizeLegacy.cpp b/lib/Module/OptimizeLegacy.cpp index e8d2f499..ee2b7ba4 100644 --- a/lib/Module/OptimizeLegacy.cpp +++ b/lib/Module/OptimizeLegacy.cpp @@ -89,11 +89,7 @@ static void AddStandardCompilePasses(legacy::PassManager &PM) { addPass(PM, createPromoteMemoryToRegisterPass()); // Kill useless allocas addPass(PM, createGlobalOptimizerPass()); // Optimize out global vars addPass(PM, createGlobalDCEPass()); // Remove unused fns and globs -#if LLVM_VERSION_CODE >= LLVM_VERSION(11, 0) addPass(PM, createSCCPPass()); // Constant prop with SCCP -#else - addPass(PM, createIPConstantPropagationPass()); // IP Constant Propagation -#endif addPass(PM, createDeadArgEliminationPass()); // Dead argument elimination addPass(PM, createInstructionCombiningPass()); // Clean up after IPCP & DAE addPass(PM, createCFGSimplificationPass()); // Clean up after IPCP & DAE |