diff options
Diffstat (limited to 'lib/Core')
-rw-r--r-- | lib/Core/Executor.cpp | 4 | ||||
-rw-r--r-- | lib/Core/ExternalDispatcher.cpp | 16 |
2 files changed, 11 insertions, 9 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; |