diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-17 00:54:57 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-17 00:54:57 +0000 |
commit | 36c9fe87bb38d20850ca50d60facd019af54aa30 (patch) | |
tree | 6c26f044da7a248b497fd9e362f1344b87189844 /lib | |
parent | 1d539296be5701036e8c48dac75add46eaf03a3f (diff) | |
download | klee-36c9fe87bb38d20850ca50d60facd019af54aa30.tar.gz |
Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@79217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Core/Executor.cpp | 4 | ||||
-rw-r--r-- | lib/Core/ExternalDispatcher.cpp | 16 | ||||
-rw-r--r-- | lib/Module/Checks.cpp | 7 | ||||
-rw-r--r-- | lib/Module/IntrinsicCleaner.cpp | 6 | ||||
-rw-r--r-- | lib/Module/KModule.cpp | 40 | ||||
-rw-r--r-- | lib/Module/LowerSwitch.cpp | 4 | ||||
-rw-r--r-- | lib/Module/RaiseAsm.cpp | 4 |
7 files changed, 43 insertions, 38 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index c69570ae..35238793 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -1337,7 +1337,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { if (!isVoidReturn) { const Type *t = caller->getType(); - if (t != Type::VoidTy) { + if (t != Type::getVoidTy(getGlobalContext())) { // may need to do coercion due to bitcasts Expr::Width from = result->getWidth(); Expr::Width to = Expr::getWidthForLLVMType(t); @@ -2623,7 +2623,7 @@ void Executor::callExternalFunction(ExecutionState &state, } const Type *resultType = target->inst->getType(); - if (resultType != Type::VoidTy) { + if (resultType != Type::getVoidTy(getGlobalContext())) { ref<Expr> e = ConstantExpr::fromMemory((void*) args, Expr::getWidthForLLVMType(resultType)); bindLocal(target, state, e); diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp index 767fafda..e5b00b7f 100644 --- a/lib/Core/ExternalDispatcher.cpp +++ b/lib/Core/ExternalDispatcher.cpp @@ -188,20 +188,20 @@ Function *ExternalDispatcher::createDispatcher(Function *target, Instruction *in std::vector<const Type*> nullary; - Function *dispatcher = Function::Create(FunctionType::get(Type::VoidTy, + Function *dispatcher = Function::Create(FunctionType::get(Type::getVoidTy(getGlobalContext()), nullary, false), GlobalVariable::ExternalLinkage, "", dispatchModule); - BasicBlock *dBB = BasicBlock::Create("entry", dispatcher); + BasicBlock *dBB = BasicBlock::Create(getGlobalContext(), "entry", dispatcher); // Get a Value* for &gTheArgsP, as an i64**. Instruction *argI64sp = - new IntToPtrInst(ConstantInt::get(Type::Int64Ty, + new IntToPtrInst(ConstantInt::get(Type::getInt64Ty(getGlobalContext()), (uintptr_t) (void*) &gTheArgsP), - PointerType::getUnqual(PointerType::getUnqual(Type::Int64Ty)), + PointerType::getUnqual(PointerType::getUnqual(Type::getInt64Ty(getGlobalContext()))), "argsp", dBB); Instruction *argI64s = new LoadInst(argI64sp, "args", dBB); @@ -219,7 +219,9 @@ Function *ExternalDispatcher::createDispatcher(Function *target, Instruction *in const Type *argTy = (i < FTy->getNumParams() ? FTy->getParamType(i) : (*ai)->getType()); Instruction *argI64p = - GetElementPtrInst::Create(argI64s, ConstantInt::get(Type::Int32Ty, i+1), + GetElementPtrInst::Create(argI64s, + ConstantInt::get(Type::getInt32Ty(getGlobalContext()), + i+1), "", dBB); Instruction *argp = new BitCastInst(argI64p, PointerType::getUnqual(argTy), @@ -228,14 +230,14 @@ Function *ExternalDispatcher::createDispatcher(Function *target, Instruction *in } Instruction *result = CallInst::Create(target, args, args+i, "", dBB); - if (result->getType() != Type::VoidTy) { + if (result->getType() != Type::getVoidTy(getGlobalContext())) { Instruction *resp = new BitCastInst(argI64s, PointerType::getUnqual(result->getType()), "", dBB); new StoreInst(result, resp, dBB); } - ReturnInst::Create(dBB); + ReturnInst::Create(getGlobalContext(), dBB); delete[] args; diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp index ca4eeb44..ee7029c7 100644 --- a/lib/Module/Checks.cpp +++ b/lib/Module/Checks.cpp @@ -44,7 +44,7 @@ bool DivCheckPass::runOnModule(Module &M) { CastInst *denominator = CastInst::CreateIntegerCast(i->getOperand(1), - (Type*)Type::Int64Ty, + Type::getInt64Ty(getGlobalContext()), false, /* sign doesn't matter */ "int_cast_to_i64", i); @@ -52,8 +52,9 @@ bool DivCheckPass::runOnModule(Module &M) { // Lazily bind the function to avoid always importing it. if (!divZeroCheckFunction) { Constant *fc = M.getOrInsertFunction("klee_div_zero_check", - Type::VoidTy, - Type::Int64Ty, NULL); + Type::getVoidTy(getGlobalContext()), + Type::getInt64Ty(getGlobalContext()), + NULL); divZeroCheckFunction = cast<Function>(fc); } diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index 4f490e8e..a73d8ca6 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -61,18 +61,18 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b) { Value *src = ii->getOperand(2); if (WordSize == 4) { - Type *i8pp = PointerType::getUnqual(PointerType::getUnqual(Type::Int8Ty)); + Type *i8pp = PointerType::getUnqual(PointerType::getUnqual(Type::getInt8Ty(getGlobalContext()))); Value *castedDst = CastInst::CreatePointerCast(dst, i8pp, "vacopy.cast.dst", ii); Value *castedSrc = CastInst::CreatePointerCast(src, i8pp, "vacopy.cast.src", ii); Value *load = new LoadInst(castedSrc, "vacopy.read", ii); new StoreInst(load, castedDst, false, ii); } else { assert(WordSize == 8 && "Invalid word size!"); - Type *i64p = PointerType::getUnqual(Type::Int64Ty); + Type *i64p = PointerType::getUnqual(Type::getInt64Ty(getGlobalContext())); Value *pDst = CastInst::CreatePointerCast(dst, i64p, "vacopy.cast.dst", ii); Value *pSrc = CastInst::CreatePointerCast(src, i64p, "vacopy.cast.src", ii); Value *val = new LoadInst(pSrc, std::string(), ii); new StoreInst(val, pDst, ii); - Value *off = ConstantInt::get(Type::Int64Ty, 1); + Value *off = ConstantInt::get(Type::getInt64Ty(getGlobalContext()), 1); pDst = GetElementPtrInst::Create(pDst, off, std::string(), ii); pSrc = GetElementPtrInst::Create(pSrc, off, std::string(), ii); val = new LoadInst(pSrc, std::string(), ii); new StoreInst(val, pDst, ii); diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp index 78ecf4d1..37e869c8 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -112,12 +112,12 @@ static Function *getStubFunctionForCtorList(Module *m, std::vector<const Type*> nullary; - Function *fn = Function::Create(FunctionType::get(Type::VoidTy, + Function *fn = Function::Create(FunctionType::get(Type::getVoidTy(getGlobalContext()), nullary, false), GlobalVariable::InternalLinkage, name, m); - BasicBlock *bb = BasicBlock::Create("entry", fn); + BasicBlock *bb = BasicBlock::Create(getGlobalContext(), "entry", fn); // From lli: // Should be an array of '{ int, void ()* }' structs. The first value is @@ -142,7 +142,7 @@ static Function *getStubFunctionForCtorList(Module *m, } } - ReturnInst::Create(bb); + ReturnInst::Create(getGlobalContext(), bb); return fn; } @@ -197,7 +197,8 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, Function *mergeFn = module->getFunction("klee_merge"); if (!mergeFn) { const llvm::FunctionType *Ty = - FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false); + FunctionType::get(Type::getVoidTy(getGlobalContext()), + std::vector<const Type*>(), false); mergeFn = Function::Create(Ty, GlobalVariable::ExternalLinkage, "klee_merge", module); @@ -215,12 +216,12 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, name.c_str()); } - BasicBlock *exit = BasicBlock::Create("exit", f); + BasicBlock *exit = BasicBlock::Create(getGlobalContext(), "exit", f); PHINode *result = 0; - if (f->getReturnType() != Type::VoidTy) + if (f->getReturnType() != Type::getVoidTy(getGlobalContext())) result = PHINode::Create(f->getReturnType(), "retval", exit); CallInst::Create(mergeFn, "", exit); - ReturnInst::Create(result, exit); + ReturnInst::Create(getGlobalContext(), result, exit); llvm::errs() << "KLEE: adding klee_merge at exit of: " << name << "\n"; for (llvm::Function::iterator bbit = f->begin(), bbie = f->end(); @@ -263,18 +264,19 @@ 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. - forceImport(module, "memcpy", PointerType::getUnqual(Type::Int8Ty), - PointerType::getUnqual(Type::Int8Ty), - PointerType::getUnqual(Type::Int8Ty), - targetData->getIntPtrType(), (Type*) 0); - forceImport(module, "memmove", PointerType::getUnqual(Type::Int8Ty), - PointerType::getUnqual(Type::Int8Ty), - PointerType::getUnqual(Type::Int8Ty), - targetData->getIntPtrType(), (Type*) 0); - forceImport(module, "memset", PointerType::getUnqual(Type::Int8Ty), - PointerType::getUnqual(Type::Int8Ty), - Type::Int32Ty, - targetData->getIntPtrType(), (Type*) 0); + const llvm::Type *i8Ty = Type::getInt8Ty(getGlobalContext()); + forceImport(module, "memcpy", PointerType::getUnqual(i8Ty), + PointerType::getUnqual(i8Ty), + PointerType::getUnqual(i8Ty), + targetData->getIntPtrType(getGlobalContext()), (Type*) 0); + forceImport(module, "memmove", PointerType::getUnqual(i8Ty), + PointerType::getUnqual(i8Ty), + PointerType::getUnqual(i8Ty), + targetData->getIntPtrType(getGlobalContext()), (Type*) 0); + forceImport(module, "memset", PointerType::getUnqual(i8Ty), + PointerType::getUnqual(i8Ty), + Type::getInt32Ty(getGlobalContext()), + targetData->getIntPtrType(getGlobalContext()), (Type*) 0); // FIXME: Missing force import for various math functions. diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp index a2033eae..381ebd29 100644 --- a/lib/Module/LowerSwitch.cpp +++ b/lib/Module/LowerSwitch.cpp @@ -60,7 +60,7 @@ void LowerSwitchPass::switchConvert(CaseItr begin, CaseItr end, // iterate through all the cases, creating a new BasicBlock for each for (CaseItr it = begin; it < end; ++it) { - BasicBlock *newBlock = BasicBlock::Create("NodeBlock"); + BasicBlock *newBlock = BasicBlock::Create(getGlobalContext(), "NodeBlock"); Function::iterator FI = origBlock; F->getBasicBlockList().insert(++FI, newBlock); @@ -96,7 +96,7 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) { // Create a new, empty default block so that the new hierarchy of // if-then statements go to this and the PHI nodes are happy. - BasicBlock* newDefault = BasicBlock::Create("newDefault"); + BasicBlock* newDefault = BasicBlock::Create(getGlobalContext(), "newDefault"); F->getBasicBlockList().insert(defaultBlock, newDefault); BranchInst::Create(defaultBlock, newDefault); diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp index 67fbf8ae..b62338a6 100644 --- a/lib/Module/RaiseAsm.cpp +++ b/lib/Module/RaiseAsm.cpp @@ -35,10 +35,10 @@ bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) { // bswaps if (ci->getNumOperands() == 2 && T == ci->getOperand(1)->getType() && - ((T == llvm::Type::Int16Ty && + ((T == llvm::Type::getInt16Ty(getGlobalContext()) && as == "rorw $$8, ${0:w}" && cs == "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}") || - (T == llvm::Type::Int32Ty && + (T == llvm::Type::getInt32Ty(getGlobalContext()) && as == "rorw $$8, ${0:w};rorl $$16, $0;rorw $$8, ${0:w}" && cs == "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}"))) { llvm::Value *Arg0 = ci->getOperand(1); |