diff options
author | Frank Busse <bb0xfb@gmail.com> | 2022-06-13 10:42:51 +0100 |
---|---|---|
committer | MartinNowack <2443641+MartinNowack@users.noreply.github.com> | 2022-06-30 10:02:30 +0100 |
commit | 6cc8ee707c1b4337120aa2972e2ad13a4861bbc3 (patch) | |
tree | 52aa6fc4f793239963679550e673b6f3a18c3e71 /lib/Core | |
parent | b8539333fdaf32b0f4911d6569ad56a0443190bb (diff) | |
download | klee-6cc8ee707c1b4337120aa2972e2ad13a4861bbc3.tar.gz |
remove LLVM < 9
Diffstat (limited to 'lib/Core')
-rw-r--r-- | lib/Core/Executor.cpp | 38 | ||||
-rw-r--r-- | lib/Core/ExternalDispatcher.cpp | 10 | ||||
-rw-r--r-- | lib/Core/StatsTracker.cpp | 17 |
3 files changed, 2 insertions, 63 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index a2928864..529f8b43 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -56,9 +56,6 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/BasicBlock.h" -#if LLVM_VERSION_CODE < LLVM_VERSION(8, 0) -#include "llvm/IR/CallSite.h" -#endif #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Function.h" @@ -1782,7 +1779,6 @@ void Executor::executeCall(ExecutionState &state, KInstruction *ki, Function *f, } #endif -#if LLVM_VERSION_CODE >= LLVM_VERSION(7, 0) case Intrinsic::fshr: case Intrinsic::fshl: { ref<Expr> op1 = eval(ki, 1, state).value; @@ -1807,7 +1803,6 @@ void Executor::executeCall(ExecutionState &state, KInstruction *ki, Function *f, } break; } -#endif // va_arg is handled by caller and intrinsic lowering, see comment for // ExecutionState::varargs @@ -1928,21 +1923,10 @@ void Executor::executeCall(ExecutionState &state, KInstruction *ki, Function *f, uint64_t offsets[callingArgs]; // offsets of variadic arguments uint64_t argWidth; // width of current variadic argument -#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) const CallBase &cs = cast<CallBase>(*i); -#else - const CallSite cs(i); -#endif for (unsigned k = funcArgs; k < callingArgs; k++) { if (cs.isByValArgument(k)) { -#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0) Type *t = cs.getParamByValType(k); -#else - auto arg = cs.getArgOperand(k); - Type *t = arg->getType(); - assert(t->isPointerTy()); - t = t->getPointerElementType(); -#endif argWidth = kmodule->targetData->getTypeSizeInBits(t); } else { argWidth = arguments[k]->getWidth(); @@ -2152,13 +2136,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { Expr::Width to = getWidthForLLVMType(t); if (from != to) { -#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) const CallBase &cs = cast<CallBase>(*caller); -#else - const CallSite cs(isa<InvokeInst>(caller) - ? CallSite(cast<InvokeInst>(caller)) - : CallSite(cast<CallInst>(caller))); -#endif // XXX need to check other param attrs ? bool isSExt = cs.hasRetAttr(llvm::Attribute::SExt); @@ -2416,14 +2394,8 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { if (isa<DbgInfoIntrinsic>(i)) break; -#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) const CallBase &cs = cast<CallBase>(*i); Value *fp = cs.getCalledOperand(); -#else - const CallSite cs(i); - Value *fp = cs.getCalledValue(); -#endif - unsigned numArgs = cs.arg_size(); Function *f = getTargetFunction(fp, state); @@ -2830,8 +2802,6 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { } // Floating point instructions - -#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) case Instruction::FNeg: { ref<ConstantExpr> arg = toConstant(state, eval(ki, 0, state).value, "floating point"); @@ -2843,7 +2813,6 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt())); break; } -#endif case Instruction::FAdd: { ref<ConstantExpr> left = toConstant(state, eval(ki, 0, state).value, @@ -4643,14 +4612,7 @@ size_t Executor::getAllocationAlignment(const llvm::Value *allocSite) const { type = AI->getAllocatedType(); } else if (isa<InvokeInst>(allocSite) || isa<CallInst>(allocSite)) { // FIXME: Model the semantics of the call to use the right alignment -#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) const CallBase &cs = cast<CallBase>(*allocSite); -#else - llvm::Value *allocSiteNonConst = const_cast<llvm::Value *>(allocSite); - const CallSite cs(isa<InvokeInst>(allocSiteNonConst) - ? CallSite(cast<InvokeInst>(allocSiteNonConst)) - : CallSite(cast<CallInst>(allocSiteNonConst))); -#endif llvm::Function *fn = klee::getDirectCallTarget(cs, /*moduleIsFullyLinked=*/true); if (fn) diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp index aadb340d..c58e2ec8 100644 --- a/lib/Core/ExternalDispatcher.cpp +++ b/lib/Core/ExternalDispatcher.cpp @@ -10,9 +10,6 @@ #include "ExternalDispatcher.h" #include "klee/Config/Version.h" -#if LLVM_VERSION_CODE < LLVM_VERSION(8, 0) -#include "llvm/IR/CallSite.h" -#endif #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/IRBuilder.h" @@ -258,14 +255,7 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target, if (!resolveSymbol(target->getName().str())) return 0; -#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) const CallBase &cs = cast<CallBase>(*inst); -#else - const CallSite cs(inst->getOpcode() == Instruction::Call - ? CallSite(cast<CallInst>(inst)) - : CallSite(cast<InvokeInst>(inst))); -#endif - Value **args = new Value *[cs.arg_size()]; std::vector<Type *> nullary; diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp index 28c52b7f..11199db1 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp @@ -29,9 +29,6 @@ #include "llvm/ADT/SmallBitVector.h" #include "llvm/IR/BasicBlock.h" -#if LLVM_VERSION_CODE < LLVM_VERSION(8, 0) -#include "llvm/IR/CallSite.h" -#endif #include "llvm/IR/CFG.h" #include "llvm/IR/Function.h" #include "llvm/IR/InlineAsm.h" @@ -139,13 +136,8 @@ static bool instructionIsCoverable(Instruction *i) { } else { Instruction *prev = &*(--it); if (isa<CallInst>(prev) || isa<InvokeInst>(prev)) { - Function *target = getDirectCallTarget( -#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) - cast<CallBase>(*prev), -#else - CallSite(prev), -#endif - /*moduleIsFullyLinked=*/true); + Function *target = getDirectCallTarget(cast<CallBase>(*prev), + /*moduleIsFullyLinked=*/true); if (target && target->doesNotReturn()) return false; } @@ -794,13 +786,8 @@ void StatsTracker::computeReachableUncovered() { it != ie; ++it) { Instruction *inst = &*it; if (isa<CallInst>(inst) || isa<InvokeInst>(inst)) { -#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) const CallBase &cs = cast<CallBase>(*inst); if (isa<InlineAsm>(cs.getCalledOperand())) { -#else - const CallSite cs(inst); - if (isa<InlineAsm>(cs.getCalledValue())) { -#endif // We can never call through here so assume no targets // (which should be correct anyhow). callTargets.insert(std::make_pair(inst, |