aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Core
diff options
context:
space:
mode:
authorMartin Nowack <martin@se.inf.tu-dresden.de>2017-07-22 01:03:44 +0200
committerMartin Nowack <martin@se.inf.tu-dresden.de>2017-07-23 12:18:35 +0200
commit37e92d0c802524c19a9a84164253639aac47fee3 (patch)
tree6b9036dcc8415544eb5a6d5cace7fddb2bfc323a /lib/Core
parent9fb2f5666d5f8c7c2f335fc8408883a0cf958964 (diff)
downloadklee-37e92d0c802524c19a9a84164253639aac47fee3.tar.gz
Remove support for LLVM < 3.4
Request LLVM 3.4 as minimal requirement for KLEE
Diffstat (limited to 'lib/Core')
-rw-r--r--lib/Core/CallPathManager.cpp4
-rw-r--r--lib/Core/Context.cpp5
-rw-r--r--lib/Core/ExecutionState.cpp4
-rw-r--r--lib/Core/Executor.cpp159
-rw-r--r--lib/Core/Executor.h6
-rw-r--r--lib/Core/ExecutorTimers.cpp5
-rw-r--r--lib/Core/ExecutorUtil.cpp20
-rw-r--r--lib/Core/ExternalDispatcher.cpp23
-rw-r--r--lib/Core/Memory.cpp12
-rw-r--r--lib/Core/Searcher.cpp6
-rw-r--r--lib/Core/SpecialFunctionHandler.cpp17
-rw-r--r--lib/Core/StatsTracker.cpp13
12 files changed, 18 insertions, 256 deletions
diff --git a/lib/Core/CallPathManager.cpp b/lib/Core/CallPathManager.cpp
index 03e75108..42be3735 100644
--- a/lib/Core/CallPathManager.cpp
+++ b/lib/Core/CallPathManager.cpp
@@ -13,11 +13,7 @@
#include <map>
#include <vector>
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
#include "llvm/IR/Function.h"
-#else
-#include "llvm/Function.h"
-#endif
#include "llvm/Support/raw_ostream.h"
diff --git a/lib/Core/Context.cpp b/lib/Core/Context.cpp
index 935e4316..8246e631 100644
--- a/lib/Core/Context.cpp
+++ b/lib/Core/Context.cpp
@@ -11,13 +11,8 @@
#include "klee/Expr.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
#include "llvm/IR/Type.h"
#include "llvm/IR/DerivedTypes.h"
-#else
-#include "llvm/Type.h"
-#include "llvm/DerivedTypes.h"
-#endif
#include <cassert>
diff --git a/lib/Core/ExecutionState.cpp b/lib/Core/ExecutionState.cpp
index 30d20266..20b1a162 100644
--- a/lib/Core/ExecutionState.cpp
+++ b/lib/Core/ExecutionState.cpp
@@ -17,11 +17,7 @@
#include "klee/Expr.h"
#include "Memory.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
#include "llvm/IR/Function.h"
-#else
-#include "llvm/Function.h"
-#endif
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index ff842fd1..5560a3e5 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -49,7 +49,6 @@
#include "klee/Internal/System/MemoryUsage.h"
#include "klee/SolverStats.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
#include "llvm/IR/Function.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
@@ -61,22 +60,6 @@
#include "llvm/IR/Module.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/TypeBuilder.h"
-#else
-#include "llvm/Attributes.h"
-#include "llvm/BasicBlock.h"
-#include "llvm/Constants.h"
-#include "llvm/Function.h"
-#include "llvm/Instructions.h"
-#include "llvm/IntrinsicInst.h"
-#include "llvm/LLVMContext.h"
-#include "llvm/Module.h"
-#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1)
-#include "llvm/Target/TargetData.h"
-#else
-#include "llvm/DataLayout.h"
-#include "llvm/TypeBuilder.h"
-#endif
-#endif
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
@@ -293,17 +276,10 @@ namespace {
KLEE_LLVM_CL_VAL_END),
cl::ZeroOrMore);
-#if LLVM_VERSION_CODE < LLVM_VERSION(3, 0)
- cl::opt<unsigned int>
- StopAfterNInstructions("stop-after-n-instructions",
- cl::desc("Stop execution after specified number of instructions (default=0 (off))"),
- cl::init(0));
-#else
cl::opt<unsigned long long>
StopAfterNInstructions("stop-after-n-instructions",
cl::desc("Stop execution after specified number of instructions (default=0 (off))"),
cl::init(0));
-#endif
cl::opt<unsigned>
MaxForks("max-forks",
@@ -420,11 +396,7 @@ const Module *Executor::setModule(llvm::Module *module,
kmodule = new KModule(module);
// Initialize the context.
-#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1)
- TargetData *TD = kmodule->targetData;
-#else
DataLayout *TD = kmodule->targetData;
-#endif
Context::initialize(TD->isLittleEndian(),
(Expr::Width) TD->getPointerSizeInBits());
@@ -469,11 +441,7 @@ Executor::~Executor() {
void Executor::initializeGlobalObject(ExecutionState &state, ObjectState *os,
const Constant *c,
unsigned offset) {
-#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1)
- TargetData *targetData = kmodule->targetData;
-#else
DataLayout *targetData = kmodule->targetData;
-#endif
if (const ConstantVector *cp = dyn_cast<ConstantVector>(c)) {
unsigned elementSize =
targetData->getTypeStoreSize(cp->getType()->getElementType());
@@ -496,7 +464,6 @@ void Executor::initializeGlobalObject(ExecutionState &state, ObjectState *os,
for (unsigned i=0, e=cs->getNumOperands(); i != e; ++i)
initializeGlobalObject(state, os, cs->getOperand(i),
offset + sl->getElementOffset(i));
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 1)
} else if (const ConstantDataSequential *cds =
dyn_cast<ConstantDataSequential>(c)) {
unsigned elementSize =
@@ -504,7 +471,6 @@ void Executor::initializeGlobalObject(ExecutionState &state, ObjectState *os,
for (unsigned i=0, e=cds->getNumElements(); i != e; ++i)
initializeGlobalObject(state, os, cds->getElementAsConstant(i),
offset + i*elementSize);
-#endif
} else if (!isa<UndefValue>(c)) {
unsigned StoreBits = targetData->getTypeStoreSizeInBits(c->getType());
ref<ConstantExpr> C = evalConstant(c);
@@ -539,10 +505,6 @@ void Executor::initializeGlobals(ExecutionState &state) {
if (m->getModuleInlineAsm() != "")
klee_warning("executable has module level assembly (ignoring)");
-#if LLVM_VERSION_CODE < LLVM_VERSION(3, 3)
- assert(m->lib_begin() == m->lib_end() &&
- "XXX do not support dependent libraries");
-#endif
// represent function globals using the address of the actual llvm function
// object. given that we use malloc to allocate memory in states this also
// ensures that we won't conflict. we don't need to allocate a memory object
@@ -610,7 +572,7 @@ void Executor::initializeGlobals(ExecutionState &state) {
// better we could support user definition, or use the EXE style
// hack where we check the object file information.
- LLVM_TYPE_Q Type *ty = i->getType()->getElementType();
+ Type *ty = i->getType()->getElementType();
uint64_t size = 0;
if (ty->isSized()) {
size = kmodule->targetData->getTypeStoreSize(ty);
@@ -659,7 +621,7 @@ void Executor::initializeGlobals(ExecutionState &state) {
os->write8(offset, ((unsigned char*)addr)[offset]);
}
} else {
- LLVM_TYPE_Q Type *ty = i->getType()->getElementType();
+ Type *ty = i->getType()->getElementType();
uint64_t size = kmodule->targetData->getTypeStoreSize(ty);
MemoryObject *mo = memory->allocate(size, /*isLocal=*/false,
/*isGlobal=*/true, /*allocSite=*/v,
@@ -1063,7 +1025,6 @@ ref<klee::ConstantExpr> Executor::evalConstant(const Constant *c) {
return Expr::createPointer(0);
} else if (isa<UndefValue>(c) || isa<ConstantAggregateZero>(c)) {
return ConstantExpr::create(0, getWidthForLLVMType(c->getType()));
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 1)
} else if (const ConstantDataSequential *cds =
dyn_cast<ConstantDataSequential>(c)) {
std::vector<ref<Expr> > kids;
@@ -1073,7 +1034,6 @@ ref<klee::ConstantExpr> Executor::evalConstant(const Constant *c) {
}
ref<Expr> res = ConcatExpr::createN(kids.size(), kids.data());
return cast<ConstantExpr>(res);
-#endif
} else if (const ConstantStruct *cs = dyn_cast<ConstantStruct>(c)) {
const StructLayout *sl = kmodule->targetData->getStructLayout(cs->getType());
llvm::SmallVector<ref<Expr>, 4> kids;
@@ -1581,7 +1541,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
}
if (!isVoidReturn) {
- LLVM_TYPE_Q Type *t = caller->getType();
+ Type *t = caller->getType();
if (t != Type::getVoidTy(i->getContext())) {
// may need to do coercion due to bitcasts
Expr::Width from = result->getWidth();
@@ -1592,13 +1552,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
CallSite(cast<CallInst>(caller)));
// XXX need to check other param attrs ?
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt);
-#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
- bool isSExt = cs.paramHasAttr(0, llvm::Attributes::SExt);
-#else
- bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt);
-#endif
if (isSExt) {
result = SExtExpr::create(result, to);
} else {
@@ -1619,29 +1573,6 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
}
break;
}
-#if LLVM_VERSION_CODE < LLVM_VERSION(3, 1)
- case Instruction::Unwind: {
- for (;;) {
- KInstruction *kcaller = state.stack.back().caller;
- state.popFrame();
-
- if (statsTracker)
- statsTracker->framePopped(state);
-
- if (state.stack.empty()) {
- terminateStateOnExecError(state, "unwind from initial stack frame");
- break;
- } else {
- Instruction *caller = kcaller->inst;
- if (InvokeInst *ii = dyn_cast<InvokeInst>(caller)) {
- transferToBasicBlock(ii->getUnwindDest(), caller->getParent(), state);
- break;
- }
- }
- }
- break;
- }
-#endif
case Instruction::Br: {
BranchInst *bi = cast<BranchInst>(i);
if (bi->isUnconditional()) {
@@ -1676,14 +1607,9 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(cond)) {
// Somewhat gross to create these all the time, but fine till we
// switch to an internal rep.
- LLVM_TYPE_Q llvm::IntegerType *Ty =
- cast<IntegerType>(si->getCondition()->getType());
+ llvm::IntegerType *Ty = cast<IntegerType>(si->getCondition()->getType());
ConstantInt *ci = ConstantInt::get(Ty, CE->getZExtValue());
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 1)
unsigned index = si->findCaseValue(ci).getSuccessorIndex();
-#else
- unsigned index = si->findCaseValue(ci);
-#endif
transferToBasicBlock(si->getSuccessor(index), si->getParent(), state);
} else {
// Handle possible different branch targets
@@ -1699,20 +1625,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
std::map<ref<Expr>, BasicBlock *> expressionOrder;
// Iterate through all non-default cases and order them by expressions
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 1)
for (SwitchInst::CaseIt i = si->case_begin(), e = si->case_end(); i != e;
++i) {
ref<Expr> value = evalConstant(i.getCaseValue());
-#else
- for (unsigned i = 1, cases = si->getNumCases(); i < cases; ++i) {
- ref<Expr> value = evalConstant(si->getCaseValue(i));
-#endif
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 1)
BasicBlock *caseSuccessor = i.getCaseSuccessor();
-#else
- BasicBlock *caseSuccessor = si->getSuccessor(i);
-#endif
expressionOrder.insert(std::make_pair(value, caseSuccessor));
}
@@ -1848,13 +1765,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
if (from != to) {
// XXX need to check other param attrs ?
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
bool isSExt = cs.paramHasAttr(i+1, llvm::Attribute::SExt);
-#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
- bool isSExt = cs.paramHasAttr(i+1, llvm::Attributes::SExt);
-#else
- bool isSExt = cs.paramHasAttr(i+1, llvm::Attribute::SExt);
-#endif
if (isSExt) {
arguments[i] = SExtExpr::create(arguments[i], to);
} else {
@@ -1910,11 +1821,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
break;
}
case Instruction::PHI: {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
ref<Expr> result = eval(ki, state.incomingBBIndex, state).value;
-#else
- ref<Expr> result = eval(ki, state.incomingBBIndex * 2, state).value;
-#endif
bindLocal(ki, state, result);
break;
}
@@ -2233,13 +2140,8 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
!fpWidthToSemantics(right->getWidth()))
return terminateStateOnExecError(state, "Unsupported FAdd operation");
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
llvm::APFloat Res(*fpWidthToSemantics(left->getWidth()), left->getAPValue());
Res.add(APFloat(*fpWidthToSemantics(right->getWidth()),right->getAPValue()), APFloat::rmNearestTiesToEven);
-#else
- llvm::APFloat Res(left->getAPValue());
- Res.add(APFloat(right->getAPValue()), APFloat::rmNearestTiesToEven);
-#endif
bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt()));
break;
}
@@ -2252,13 +2154,8 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
if (!fpWidthToSemantics(left->getWidth()) ||
!fpWidthToSemantics(right->getWidth()))
return terminateStateOnExecError(state, "Unsupported FSub operation");
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
llvm::APFloat Res(*fpWidthToSemantics(left->getWidth()), left->getAPValue());
Res.subtract(APFloat(*fpWidthToSemantics(right->getWidth()), right->getAPValue()), APFloat::rmNearestTiesToEven);
-#else
- llvm::APFloat Res(left->getAPValue());
- Res.subtract(APFloat(right->getAPValue()), APFloat::rmNearestTiesToEven);
-#endif
bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt()));
break;
}
@@ -2272,13 +2169,8 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
!fpWidthToSemantics(right->getWidth()))
return terminateStateOnExecError(state, "Unsupported FMul operation");
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
llvm::APFloat Res(*fpWidthToSemantics(left->getWidth()), left->getAPValue());
Res.multiply(APFloat(*fpWidthToSemantics(right->getWidth()), right->getAPValue()), APFloat::rmNearestTiesToEven);
-#else
- llvm::APFloat Res(left->getAPValue());
- Res.multiply(APFloat(right->getAPValue()), APFloat::rmNearestTiesToEven);
-#endif
bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt()));
break;
}
@@ -2292,13 +2184,8 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
!fpWidthToSemantics(right->getWidth()))
return terminateStateOnExecError(state, "Unsupported FDiv operation");
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
llvm::APFloat Res(*fpWidthToSemantics(left->getWidth()), left->getAPValue());
Res.divide(APFloat(*fpWidthToSemantics(right->getWidth()), right->getAPValue()), APFloat::rmNearestTiesToEven);
-#else
- llvm::APFloat Res(left->getAPValue());
- Res.divide(APFloat(right->getAPValue()), APFloat::rmNearestTiesToEven);
-#endif
bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt()));
break;
}
@@ -2311,14 +2198,9 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
if (!fpWidthToSemantics(left->getWidth()) ||
!fpWidthToSemantics(right->getWidth()))
return terminateStateOnExecError(state, "Unsupported FRem operation");
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
llvm::APFloat Res(*fpWidthToSemantics(left->getWidth()), left->getAPValue());
Res.mod(APFloat(*fpWidthToSemantics(right->getWidth()),right->getAPValue()),
APFloat::rmNearestTiesToEven);
-#else
- llvm::APFloat Res(left->getAPValue());
- Res.mod(APFloat(right->getAPValue()), APFloat::rmNearestTiesToEven);
-#endif
bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt()));
break;
}
@@ -2331,11 +2213,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
if (!fpWidthToSemantics(arg->getWidth()) || resultType > arg->getWidth())
return terminateStateOnExecError(state, "Unsupported FPTrunc operation");
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
llvm::APFloat Res(*fpWidthToSemantics(arg->getWidth()), arg->getAPValue());
-#else
- llvm::APFloat Res(arg->getAPValue());
-#endif
bool losesInfo = false;
Res.convert(*fpWidthToSemantics(resultType),
llvm::APFloat::rmNearestTiesToEven,
@@ -2351,11 +2229,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
"floating point");
if (!fpWidthToSemantics(arg->getWidth()) || arg->getWidth() > resultType)
return terminateStateOnExecError(state, "Unsupported FPExt operation");
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
llvm::APFloat Res(*fpWidthToSemantics(arg->getWidth()), arg->getAPValue());
-#else
- llvm::APFloat Res(arg->getAPValue());
-#endif
bool losesInfo = false;
Res.convert(*fpWidthToSemantics(resultType),
llvm::APFloat::rmNearestTiesToEven,
@@ -2372,11 +2246,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
if (!fpWidthToSemantics(arg->getWidth()) || resultType > 64)
return terminateStateOnExecError(state, "Unsupported FPToUI operation");
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
llvm::APFloat Arg(*fpWidthToSemantics(arg->getWidth()), arg->getAPValue());
-#else
- llvm::APFloat Arg(arg->getAPValue());
-#endif
uint64_t value = 0;
bool isExact = true;
Arg.convertToInteger(&value, resultType, false,
@@ -2392,12 +2262,8 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
"floating point");
if (!fpWidthToSemantics(arg->getWidth()) || resultType > 64)
return terminateStateOnExecError(state, "Unsupported FPToSI operation");
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
llvm::APFloat Arg(*fpWidthToSemantics(arg->getWidth()), arg->getAPValue());
-#else
- llvm::APFloat Arg(arg->getAPValue());
-#endif
uint64_t value = 0;
bool isExact = true;
Arg.convertToInteger(&value, resultType, true,
@@ -2448,13 +2314,8 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
!fpWidthToSemantics(right->getWidth()))
return terminateStateOnExecError(state, "Unsupported FCmp operation");
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
APFloat LHS(*fpWidthToSemantics(left->getWidth()),left->getAPValue());
APFloat RHS(*fpWidthToSemantics(right->getWidth()),right->getAPValue());
-#else
- APFloat LHS(left->getAPValue());
- APFloat RHS(right->getAPValue());
-#endif
APFloat::cmpResult CmpRes = LHS.compare(RHS);
bool Result = false;
@@ -2572,12 +2433,10 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
bindLocal(ki, state, result);
break;
}
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
case Instruction::Fence: {
// Ignore for now
break;
}
-#endif
case Instruction::InsertElement: {
InsertElementInst *iei = cast<InsertElementInst>(i);
ref<Expr> vec = eval(ki, 0, state).value;
@@ -2697,7 +2556,7 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) {
ConstantExpr::alloc(0, Context::get().getPointerWidth());
uint64_t index = 1;
for (TypeIt ii = ib; ii != ie; ++ii) {
- if (LLVM_TYPE_Q StructType *st = dyn_cast<StructType>(*ii)) {
+ if (StructType *st = dyn_cast<StructType>(*ii)) {
const StructLayout *sl = kmodule->targetData->getStructLayout(st);
const ConstantInt *ci = cast<ConstantInt>(ii.getOperand());
uint64_t addend = sl->getElementOffset((unsigned) ci->getZExtValue());
@@ -3189,7 +3048,7 @@ void Executor::callExternalFunction(ExecutionState &state,
return;
}
- LLVM_TYPE_Q Type *resultType = target->inst->getType();
+ Type *resultType = target->inst->getType();
if (resultType != Type::getVoidTy(function->getContext())) {
ref<Expr> e = ConstantExpr::fromMemory((void*) args,
getWidthForLLVMType(resultType));
@@ -3860,7 +3719,7 @@ void Executor::doImpliedValueConcretization(ExecutionState &state,
}
}
-Expr::Width Executor::getWidthForLLVMType(LLVM_TYPE_Q llvm::Type *type) const {
+Expr::Width Executor::getWidthForLLVMType(llvm::Type *type) const {
return kmodule->targetData->getTypeSizeInBits(type);
}
@@ -3869,13 +3728,13 @@ size_t Executor::getAllocationAlignment(const llvm::Value *allocSite) const {
// and should fetch the default from elsewhere.
const size_t forcedAlignment = 8;
size_t alignment = 0;
- LLVM_TYPE_Q llvm::Type *type = NULL;
+ llvm::Type *type = NULL;
std::string allocationSiteName(allocSite->getName().str());
if (const GlobalValue *GV = dyn_cast<GlobalValue>(allocSite)) {
alignment = GV->getAlignment();
if (const GlobalVariable *globalVar = dyn_cast<GlobalVariable>(GV)) {
// All GlobalVariables's have pointer type
- LLVM_TYPE_Q llvm::PointerType *ptrType =
+ llvm::PointerType *ptrType =
dyn_cast<llvm::PointerType>(globalVar->getType());
assert(ptrType && "globalVar's type is not a pointer");
type = ptrType->getElementType();
diff --git a/lib/Core/Executor.h b/lib/Core/Executor.h
index b3bb6864..b8411a20 100644
--- a/lib/Core/Executor.h
+++ b/lib/Core/Executor.h
@@ -42,11 +42,7 @@ namespace llvm {
class GlobalValue;
class Instruction;
class LLVMContext;
-#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1)
- class TargetData;
-#else
class DataLayout;
-#endif
class Twine;
class Value;
}
@@ -509,7 +505,7 @@ public:
virtual void getCoveredLines(const ExecutionState &state,
std::map<const std::string*, std::set<unsigned> > &res);
- Expr::Width getWidthForLLVMType(LLVM_TYPE_Q llvm::Type *type) const;
+ Expr::Width getWidthForLLVMType(llvm::Type *type) const;
size_t getAllocationAlignment(const llvm::Value *allocSite) const;
};
diff --git a/lib/Core/ExecutorTimers.cpp b/lib/Core/ExecutorTimers.cpp
index f1c45105..dd0d824e 100644
--- a/lib/Core/ExecutorTimers.cpp
+++ b/lib/Core/ExecutorTimers.cpp
@@ -20,12 +20,7 @@
#include "klee/Internal/System/Time.h"
#include "klee/Internal/Support/ErrorHandling.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
#include "llvm/IR/Function.h"
-#else
-#include "llvm/Function.h"
-#endif
-
#include "llvm/Support/CommandLine.h"
#include <unistd.h>
diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp
index b91b5dee..bd7c0711 100644
--- a/lib/Core/ExecutorUtil.cpp
+++ b/lib/Core/ExecutorUtil.cpp
@@ -20,23 +20,11 @@
#include "klee/util/GetElementPtrTypeIterator.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
#include "llvm/IR/Function.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/DataLayout.h"
-#else
-#include "llvm/Constants.h"
-#include "llvm/Function.h"
-#include "llvm/Instructions.h"
-#include "llvm/Module.h"
-#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1)
-#include "llvm/Target/TargetData.h"
-#else
-#include "llvm/DataLayout.h"
-#endif
-#endif
#include <cassert>
@@ -46,7 +34,7 @@ using namespace llvm;
namespace klee {
ref<ConstantExpr> Executor::evalConstantExpr(const llvm::ConstantExpr *ce) {
- LLVM_TYPE_Q llvm::Type *type = ce->getType();
+ llvm::Type *type = ce->getType();
ref<ConstantExpr> op1(0), op2(0), op3(0);
int numOperands = ce->getNumOperands();
@@ -95,7 +83,7 @@ namespace klee {
ref<ConstantExpr> addend =
ConstantExpr::alloc(0, Context::get().getPointerWidth());
- if (LLVM_TYPE_Q StructType *st = dyn_cast<StructType>(*ii)) {
+ if (StructType *st = dyn_cast<StructType>(*ii)) {
const StructLayout *sl = kmodule->targetData->getStructLayout(st);
const ConstantInt *ci = cast<ConstantInt>(ii.getOperand());
@@ -153,11 +141,7 @@ namespace klee {
case Instruction::FCmp:
assert(0 && "floating point ConstantExprs unsupported");
}
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 1)
llvm_unreachable("Unsupported expression in evalConstantExpr");
-#else
- assert(0 && "Unsupported expression in evalConstantExpr");
-#endif
return op1;
}
}
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index df0dd9a9..6c54d34b 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -10,19 +10,11 @@
#include "ExternalDispatcher.h"
#include "klee/Config/Version.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
-#else
-#include "llvm/Constants.h"
-#include "llvm/DerivedTypes.h"
-#include "llvm/Instructions.h"
-#include "llvm/LLVMContext.h"
-#include "llvm/Module.h"
-#endif
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
#include "llvm/ExecutionEngine/MCJIT.h"
#else
@@ -33,11 +25,7 @@
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/raw_ostream.h"
-#if LLVM_VERSION_CODE < LLVM_VERSION(3, 0)
-#include "llvm/Target/TargetSelect.h"
-#else
#include "llvm/Support/TargetSelect.h"
-#endif
#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5)
#include "llvm/Support/CallSite.h"
@@ -297,7 +285,7 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
Value **args = new Value *[cs.arg_size()];
- std::vector<LLVM_TYPE_Q Type *> nullary;
+ std::vector<Type *> nullary;
// MCJIT functions need unique names, or wrong function can be called.
// The module identifier is included because for the MCJIT we need
@@ -318,7 +306,7 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
Instruction *argI64s = new LoadInst(argI64sp, "args", dBB);
// Get the target function type.
- LLVM_TYPE_Q FunctionType *FTy = cast<FunctionType>(
+ FunctionType *FTy = cast<FunctionType>(
cast<PointerType>(target->getType())->getElementType());
// Each argument will be passed by writing it into gTheArgsP[i].
@@ -328,7 +316,7 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
// Determine the type the argument will be passed as. This accomodates for
// the corresponding code in Executor.cpp for handling calls to bitcasted
// functions.
- LLVM_TYPE_Q Type *argTy =
+ Type *argTy =
(i < FTy->getNumParams() ? FTy->getParamType(i) : (*ai)->getType());
Instruction *argI64p = GetElementPtrInst::Create(
argI64s, ConstantInt::get(Type::getInt32Ty(ctx), idx), "", dBB);
@@ -343,13 +331,8 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
Constant *dispatchTarget = module->getOrInsertFunction(
target->getName(), FTy, target->getAttributes());
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
Instruction *result = CallInst::Create(
dispatchTarget, llvm::ArrayRef<Value *>(args, args + i), "", dBB);
-#else
- Instruction *result =
- CallInst::Create(dispatchTarget, args, args + i, "", dBB);
-#endif
if (result->getType() != Type::getVoidTy(ctx)) {
Instruction *resp = new BitCastInst(
argI64s, PointerType::getUnqual(result->getType()), "", dBB);
diff --git a/lib/Core/Memory.cpp b/lib/Core/Memory.cpp
index 72f0a1fb..0d354bf3 100644
--- a/lib/Core/Memory.cpp
+++ b/lib/Core/Memory.cpp
@@ -19,15 +19,9 @@
#include "ObjectHolder.h"
#include "MemoryManager.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
-#include <llvm/IR/Function.h>
-#include <llvm/IR/Instruction.h>
-#include <llvm/IR/Value.h>
-#else
-#include <llvm/Function.h>
-#include <llvm/Instruction.h>
-#include <llvm/Value.h>
-#endif
+#include "llvm/IR/Function.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/Value.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/lib/Core/Searcher.cpp b/lib/Core/Searcher.cpp
index d15226b3..0e7aa685 100644
--- a/lib/Core/Searcher.cpp
+++ b/lib/Core/Searcher.cpp
@@ -24,15 +24,9 @@
#include "klee/Internal/Support/ModuleUtil.h"
#include "klee/Internal/System/Time.h"
#include "klee/Internal/Support/ErrorHandling.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
#include "llvm/IR/Constants.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
-#else
-#include "llvm/Constants.h"
-#include "llvm/Instructions.h"
-#include "llvm/Module.h"
-#endif
#include "llvm/Support/CommandLine.h"
#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5)
diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp
index 0ecbdd07..aaa26922 100644
--- a/lib/Core/SpecialFunctionHandler.cpp
+++ b/lib/Core/SpecialFunctionHandler.cpp
@@ -23,20 +23,9 @@
#include "klee/CommandLine.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
#include "llvm/IR/Module.h"
-#else
-#include "llvm/Module.h"
-#endif
#include "llvm/ADT/Twine.h"
-
-#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1)
-#include "llvm/Target/TargetData.h"
-#elif LLVM_VERSION_CODE <= LLVM_VERSION(3, 2)
-#include "llvm/DataLayout.h"
-#else
#include "llvm/IR/DataLayout.h"
-#endif
#include <errno.h>
@@ -187,13 +176,7 @@ void SpecialFunctionHandler::prepare() {
// Make sure NoReturn attribute is set, for optimization and
// coverage counting.
if (hi.doesNotReturn)
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
- f->addFnAttr(Attribute::NoReturn);
-#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
- f->addFnAttr(Attributes::NoReturn);
-#else
f->addFnAttr(Attribute::NoReturn);
-#endif
// Change to a declaration since we handle internally (simplifies
// module and allows deleting dead code).
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index addb3de6..3a87f57a 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -27,7 +27,6 @@
#include "MemoryManager.h"
#include "UserSearcher.h"
-#if LLVM_VERSION_CODE > LLVM_VERSION(3, 2)
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
@@ -35,15 +34,6 @@
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
-#else
-#include "llvm/BasicBlock.h"
-#include "llvm/Function.h"
-#include "llvm/Instructions.h"
-#include "llvm/IntrinsicInst.h"
-#include "llvm/InlineAsm.h"
-#include "llvm/Module.h"
-#include "llvm/Type.h"
-#endif
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Path.h"
@@ -743,9 +733,6 @@ void StatsTracker::computeReachableUncovered() {
sm.setIndexedValue(stats::minDistToReturn,
id,
isa<ReturnInst>(inst)
-#if LLVM_VERSION_CODE < LLVM_VERSION(3, 1)
- || isa<UnwindInst>(inst)
-#endif
);
}
}