зеркало из https://github.com/microsoft/clang-1.git
Convert CallInst and InvokeInst APIs to use ArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135265 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
4e9272de54
Коммит
4c7d9f1507
|
@ -38,8 +38,7 @@ static void EmitMemoryBarrier(CodeGenFunction &CGF,
|
|||
StoreLoad ? True : False,
|
||||
StoreStore ? True : False,
|
||||
Device ? True : False };
|
||||
CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::memory_barrier),
|
||||
C, C + 5);
|
||||
CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::memory_barrier), C);
|
||||
}
|
||||
|
||||
/// Emit the conversions required to turn the given value into an
|
||||
|
@ -69,14 +68,14 @@ static Value *EmitFromInt(CodeGenFunction &CGF, llvm::Value *V,
|
|||
// The atomic builtins are also full memory barriers. This is a utility for
|
||||
// wrapping a call to the builtins with memory barriers.
|
||||
static Value *EmitCallWithBarrier(CodeGenFunction &CGF, Value *Fn,
|
||||
Value **ArgBegin, Value **ArgEnd) {
|
||||
ArrayRef<Value *> Args) {
|
||||
// FIXME: We need a target hook for whether this applies to device memory or
|
||||
// not.
|
||||
bool Device = true;
|
||||
|
||||
// Create barriers both before and after the call.
|
||||
EmitMemoryBarrier(CGF, true, true, true, true, Device);
|
||||
Value *Result = CGF.Builder.CreateCall(Fn, ArgBegin, ArgEnd);
|
||||
Value *Result = CGF.Builder.CreateCall(Fn, Args);
|
||||
EmitMemoryBarrier(CGF, true, true, true, true, Device);
|
||||
return Result;
|
||||
}
|
||||
|
@ -109,7 +108,7 @@ static RValue EmitBinaryAtomic(CodeGenFunction &CGF,
|
|||
const llvm::Type *ValueType = Args[1]->getType();
|
||||
Args[1] = EmitToInt(CGF, Args[1], T, IntType);
|
||||
|
||||
llvm::Value *Result = EmitCallWithBarrier(CGF, AtomF, Args, Args + 2);
|
||||
llvm::Value *Result = EmitCallWithBarrier(CGF, AtomF, Args);
|
||||
Result = EmitFromInt(CGF, Result, T, ValueType);
|
||||
return RValue::get(Result);
|
||||
}
|
||||
|
@ -144,7 +143,7 @@ static RValue EmitBinaryAtomicPost(CodeGenFunction &CGF,
|
|||
Args[1] = EmitToInt(CGF, Args[1], T, IntType);
|
||||
Args[0] = CGF.Builder.CreateBitCast(DestPtr, IntPtrType);
|
||||
|
||||
llvm::Value *Result = EmitCallWithBarrier(CGF, AtomF, Args, Args + 2);
|
||||
llvm::Value *Result = EmitCallWithBarrier(CGF, AtomF, Args);
|
||||
Result = CGF.Builder.CreateBinOp(Op, Result, Args[1]);
|
||||
Result = EmitFromInt(CGF, Result, T, ValueType);
|
||||
return RValue::get(Result);
|
||||
|
@ -879,7 +878,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
Args[1] = EmitToInt(*this, Args[1], T, IntType);
|
||||
Args[2] = EmitToInt(*this, EmitScalarExpr(E->getArg(2)), T, IntType);
|
||||
|
||||
Value *Result = EmitCallWithBarrier(*this, AtomF, Args, Args + 3);
|
||||
Value *Result = EmitCallWithBarrier(*this, AtomF, Args);
|
||||
Result = EmitFromInt(*this, Result, T, ValueType);
|
||||
return RValue::get(Result);
|
||||
}
|
||||
|
@ -908,7 +907,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
Args[2] = EmitToInt(*this, EmitScalarExpr(E->getArg(2)), T, IntType);
|
||||
|
||||
Value *OldVal = Args[1];
|
||||
Value *PrevVal = EmitCallWithBarrier(*this, AtomF, Args, Args + 3);
|
||||
Value *PrevVal = EmitCallWithBarrier(*this, AtomF, Args);
|
||||
Value *Result = Builder.CreateICmpEQ(PrevVal, OldVal);
|
||||
// zext bool to int.
|
||||
Result = Builder.CreateZExt(Result, ConvertType(E->getType()));
|
||||
|
@ -957,7 +956,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
EmitScalarExpr(E->getArg(3)),
|
||||
EmitScalarExpr(E->getArg(4))
|
||||
};
|
||||
Builder.CreateCall(CGM.getIntrinsic(Intrinsic::memory_barrier), C, C + 5);
|
||||
Builder.CreateCall(CGM.getIntrinsic(Intrinsic::memory_barrier), C);
|
||||
return RValue::get(0);
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1074,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
Args.push_back(ArgValue);
|
||||
}
|
||||
|
||||
Value *V = Builder.CreateCall(F, Args.data(), Args.data() + Args.size());
|
||||
Value *V = Builder.CreateCall(F, Args);
|
||||
QualType BuiltinRetType = E->getType();
|
||||
|
||||
const llvm::Type *RetTy = llvm::Type::getVoidTy(getLLVMContext());
|
||||
|
@ -1152,7 +1151,7 @@ Value *CodeGenFunction::EmitNeonCall(Function *F, SmallVectorImpl<Value*> &Ops,
|
|||
else
|
||||
Ops[j] = Builder.CreateBitCast(Ops[j], ai->getType(), name);
|
||||
|
||||
return Builder.CreateCall(F, Ops.begin(), Ops.end(), name);
|
||||
return Builder.CreateCall(F, Ops, name);
|
||||
}
|
||||
|
||||
Value *CodeGenFunction::EmitNeonShiftVector(Value *V, const llvm::Type *Ty,
|
||||
|
@ -1200,8 +1199,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
|
|||
const llvm::Type *Ty = CGM.getTypes().ConvertType(FD->getType());
|
||||
const llvm::FunctionType *FTy = cast<llvm::FunctionType>(Ty);
|
||||
llvm::StringRef Name = FD->getName();
|
||||
return Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name),
|
||||
Ops.begin(), Ops.end());
|
||||
return Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name), Ops);
|
||||
}
|
||||
|
||||
if (BuiltinID == ARM::BI__builtin_arm_ldrexd) {
|
||||
|
@ -1262,7 +1260,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
|
|||
|
||||
// Call the appropriate intrinsic.
|
||||
Function *F = CGM.getIntrinsic(Int, Ty);
|
||||
return Builder.CreateCall(F, Ops.begin(), Ops.end(), "vcvtr");
|
||||
return Builder.CreateCall(F, Ops, "vcvtr");
|
||||
}
|
||||
|
||||
// Determine the type of this overloaded NEON intrinsic.
|
||||
|
@ -1459,7 +1457,9 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
|
|||
Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
|
||||
Ops[3] = Builder.CreateBitCast(Ops[3], Ty);
|
||||
Ops.push_back(GetPointeeAlignment(*this, E->getArg(1)));
|
||||
Ops[1] = Builder.CreateCall(F, Ops.begin() + 1, Ops.end(), "vld2_lane");
|
||||
Ops[1] = Builder.CreateCall(F,
|
||||
ArrayRef<Value *>(Ops.begin() + 1, Ops.end()),
|
||||
"vld2_lane");
|
||||
Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
|
||||
Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
|
||||
return Builder.CreateStore(Ops[1], Ops[0]);
|
||||
|
@ -1471,7 +1471,9 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
|
|||
Ops[3] = Builder.CreateBitCast(Ops[3], Ty);
|
||||
Ops[4] = Builder.CreateBitCast(Ops[4], Ty);
|
||||
Ops.push_back(GetPointeeAlignment(*this, E->getArg(1)));
|
||||
Ops[1] = Builder.CreateCall(F, Ops.begin() + 1, Ops.end(), "vld3_lane");
|
||||
Ops[1] = Builder.CreateCall(F,
|
||||
ArrayRef<Value *>(Ops.begin() + 1, Ops.end()),
|
||||
"vld3_lane");
|
||||
Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
|
||||
Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
|
||||
return Builder.CreateStore(Ops[1], Ops[0]);
|
||||
|
@ -1484,7 +1486,9 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
|
|||
Ops[4] = Builder.CreateBitCast(Ops[4], Ty);
|
||||
Ops[5] = Builder.CreateBitCast(Ops[5], Ty);
|
||||
Ops.push_back(GetPointeeAlignment(*this, E->getArg(1)));
|
||||
Ops[1] = Builder.CreateCall(F, Ops.begin() + 1, Ops.end(), "vld3_lane");
|
||||
Ops[1] = Builder.CreateCall(F,
|
||||
ArrayRef<Value *>(Ops.begin() + 1, Ops.end()),
|
||||
"vld3_lane");
|
||||
Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
|
||||
Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
|
||||
return Builder.CreateStore(Ops[1], Ops[0]);
|
||||
|
@ -1536,7 +1540,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
|
|||
Args.push_back(CI);
|
||||
Args.push_back(GetPointeeAlignment(*this, E->getArg(1)));
|
||||
|
||||
Ops[1] = Builder.CreateCall(F, Args.begin(), Args.end(), "vld_dup");
|
||||
Ops[1] = Builder.CreateCall(F, Args, "vld_dup");
|
||||
// splat lane 0 to all elts in each vector of the result.
|
||||
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
|
||||
Value *Val = Builder.CreateExtractValue(Ops[1], i);
|
||||
|
@ -2023,7 +2027,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
|
|||
break;
|
||||
}
|
||||
llvm::Function *F = CGM.getIntrinsic(ID);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), name);
|
||||
return Builder.CreateCall(F, Ops, name);
|
||||
}
|
||||
case X86::BI__builtin_ia32_vec_init_v8qi:
|
||||
case X86::BI__builtin_ia32_vec_init_v4hi:
|
||||
|
@ -2083,15 +2087,15 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
|
|||
break;
|
||||
}
|
||||
llvm::Function *F = CGM.getIntrinsic(ID);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), name);
|
||||
return Builder.CreateCall(F, Ops, name);
|
||||
}
|
||||
case X86::BI__builtin_ia32_cmpps: {
|
||||
llvm::Function *F = CGM.getIntrinsic(Intrinsic::x86_sse_cmp_ps);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), "cmpps");
|
||||
return Builder.CreateCall(F, Ops, "cmpps");
|
||||
}
|
||||
case X86::BI__builtin_ia32_cmpss: {
|
||||
llvm::Function *F = CGM.getIntrinsic(Intrinsic::x86_sse_cmp_ss);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), "cmpss");
|
||||
return Builder.CreateCall(F, Ops, "cmpss");
|
||||
}
|
||||
case X86::BI__builtin_ia32_ldmxcsr: {
|
||||
const llvm::Type *PtrTy = Int8PtrTy;
|
||||
|
@ -2111,11 +2115,11 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
|
|||
}
|
||||
case X86::BI__builtin_ia32_cmppd: {
|
||||
llvm::Function *F = CGM.getIntrinsic(Intrinsic::x86_sse2_cmp_pd);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), "cmppd");
|
||||
return Builder.CreateCall(F, Ops, "cmppd");
|
||||
}
|
||||
case X86::BI__builtin_ia32_cmpsd: {
|
||||
llvm::Function *F = CGM.getIntrinsic(Intrinsic::x86_sse2_cmp_sd);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), "cmpsd");
|
||||
return Builder.CreateCall(F, Ops, "cmpsd");
|
||||
}
|
||||
case X86::BI__builtin_ia32_storehps:
|
||||
case X86::BI__builtin_ia32_storelps: {
|
||||
|
@ -2159,7 +2163,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
|
|||
|
||||
// create i32 constant
|
||||
llvm::Function *F = CGM.getIntrinsic(Intrinsic::x86_mmx_psrl_q);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + 2, "palignr");
|
||||
return Builder.CreateCall(F, ArrayRef<Value *>(&Ops[0], 2), "palignr");
|
||||
}
|
||||
|
||||
// If palignr is shifting the pair of vectors more than 32 bytes, emit zero.
|
||||
|
@ -2189,7 +2193,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
|
|||
|
||||
// create i32 constant
|
||||
llvm::Function *F = CGM.getIntrinsic(Intrinsic::x86_sse2_psrl_dq);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + 2, "palignr");
|
||||
return Builder.CreateCall(F, ArrayRef<Value *>(&Ops[0], 2), "palignr");
|
||||
}
|
||||
|
||||
// If palignr is shifting the pair of vectors more than 32 bytes, emit zero.
|
||||
|
@ -2341,7 +2345,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
|
|||
break;
|
||||
}
|
||||
llvm::Function *F = CGM.getIntrinsic(ID);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), name);
|
||||
return Builder.CreateCall(F, Ops, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2397,7 +2401,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
|
|||
break;
|
||||
}
|
||||
llvm::Function *F = CGM.getIntrinsic(ID);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), "");
|
||||
return Builder.CreateCall(F, Ops, "");
|
||||
}
|
||||
|
||||
// vec_st
|
||||
|
@ -2430,7 +2434,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
|
|||
break;
|
||||
}
|
||||
llvm::Function *F = CGM.getIntrinsic(ID);
|
||||
return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), "");
|
||||
return Builder.CreateCall(F, Ops, "");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -1427,20 +1427,25 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E,
|
|||
/// on the current state of the EH stack.
|
||||
llvm::CallSite
|
||||
CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee,
|
||||
llvm::Value * const *ArgBegin,
|
||||
llvm::Value * const *ArgEnd,
|
||||
llvm::ArrayRef<llvm::Value *> Args,
|
||||
const llvm::Twine &Name) {
|
||||
llvm::BasicBlock *InvokeDest = getInvokeDest();
|
||||
if (!InvokeDest)
|
||||
return Builder.CreateCall(Callee, ArgBegin, ArgEnd, Name);
|
||||
return Builder.CreateCall(Callee, Args, Name);
|
||||
|
||||
llvm::BasicBlock *ContBB = createBasicBlock("invoke.cont");
|
||||
llvm::InvokeInst *Invoke = Builder.CreateInvoke(Callee, ContBB, InvokeDest,
|
||||
ArgBegin, ArgEnd, Name);
|
||||
Args, Name);
|
||||
EmitBlock(ContBB);
|
||||
return Invoke;
|
||||
}
|
||||
|
||||
llvm::CallSite
|
||||
CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee,
|
||||
const llvm::Twine &Name) {
|
||||
return EmitCallOrInvoke(Callee, llvm::ArrayRef<llvm::Value *>(), Name);
|
||||
}
|
||||
|
||||
static void checkArgMatches(llvm::Value *Elt, unsigned &ArgNo,
|
||||
llvm::FunctionType *FTy) {
|
||||
if (ArgNo < FTy->getNumParams())
|
||||
|
@ -1700,11 +1705,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|||
|
||||
llvm::CallSite CS;
|
||||
if (!InvokeDest) {
|
||||
CS = Builder.CreateCall(Callee, Args.data(), Args.data()+Args.size());
|
||||
CS = Builder.CreateCall(Callee, Args);
|
||||
} else {
|
||||
llvm::BasicBlock *Cont = createBasicBlock("invoke.cont");
|
||||
CS = Builder.CreateInvoke(Callee, Cont, InvokeDest,
|
||||
Args.data(), Args.data()+Args.size());
|
||||
CS = Builder.CreateInvoke(Callee, Cont, InvokeDest, Args);
|
||||
EmitBlock(Cont);
|
||||
}
|
||||
if (callOrInvoke)
|
||||
|
|
|
@ -149,7 +149,7 @@ CodeGenFunction::EmitCXXGlobalDtorRegistration(llvm::Constant *DtorFn,
|
|||
llvm::Value *Args[3] = { llvm::ConstantExpr::getBitCast(DtorFn, DtorFnTy),
|
||||
llvm::ConstantExpr::getBitCast(DeclPtr, Int8PtrTy),
|
||||
llvm::ConstantExpr::getBitCast(Handle, Int8PtrTy) };
|
||||
Builder.CreateCall(AtExitFn, &Args[0], llvm::array_endof(Args));
|
||||
Builder.CreateCall(AtExitFn, Args);
|
||||
}
|
||||
|
||||
void CodeGenFunction::EmitCXXGuardedInit(const VarDecl &D,
|
||||
|
|
|
@ -788,7 +788,7 @@ llvm::BasicBlock *CodeGenFunction::EmitLandingPad() {
|
|||
// Tell the backend how to generate the landing pad.
|
||||
llvm::CallInst *Selection =
|
||||
Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::eh_selector),
|
||||
EHSelector.begin(), EHSelector.end(), "eh.selector");
|
||||
EHSelector, "eh.selector");
|
||||
Selection->setDoesNotThrow();
|
||||
|
||||
// Save the selector value in mandatory-cleanup mode.
|
||||
|
@ -928,7 +928,7 @@ namespace {
|
|||
return;
|
||||
}
|
||||
|
||||
CGF.EmitCallOrInvoke(getEndCatchFn(CGF), 0, 0);
|
||||
CGF.EmitCallOrInvoke(getEndCatchFn(CGF));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1141,7 +1141,7 @@ static void BeginCatch(CodeGenFunction &CGF, const CXXCatchStmt *S) {
|
|||
namespace {
|
||||
struct CallRethrow : EHScopeStack::Cleanup {
|
||||
void Emit(CodeGenFunction &CGF, Flags flags) {
|
||||
CGF.EmitCallOrInvoke(getReThrowFn(CGF), 0, 0);
|
||||
CGF.EmitCallOrInvoke(getReThrowFn(CGF));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1221,7 +1221,7 @@ namespace {
|
|||
CGF.Builder.CreateLoad(ForEHVar, "finally.endcatch");
|
||||
CGF.Builder.CreateCondBr(ShouldEndCatch, EndCatchBB, CleanupContBB);
|
||||
CGF.EmitBlock(EndCatchBB);
|
||||
CGF.EmitCallOrInvoke(EndCatchFn, 0, 0); // catch-all, so might throw
|
||||
CGF.EmitCallOrInvoke(EndCatchFn); // catch-all, so might throw
|
||||
CGF.EmitBlock(CleanupContBB);
|
||||
}
|
||||
};
|
||||
|
@ -1266,10 +1266,9 @@ namespace {
|
|||
|
||||
CGF.EmitBlock(RethrowBB);
|
||||
if (SavedExnVar) {
|
||||
llvm::Value *Args[] = { CGF.Builder.CreateLoad(SavedExnVar) };
|
||||
CGF.EmitCallOrInvoke(RethrowFn, Args, Args+1);
|
||||
CGF.EmitCallOrInvoke(RethrowFn, CGF.Builder.CreateLoad(SavedExnVar));
|
||||
} else {
|
||||
CGF.EmitCallOrInvoke(RethrowFn, 0, 0);
|
||||
CGF.EmitCallOrInvoke(RethrowFn);
|
||||
}
|
||||
CGF.Builder.CreateUnreachable();
|
||||
|
||||
|
@ -1417,7 +1416,7 @@ llvm::BasicBlock *CodeGenFunction::getTerminateLandingPad() {
|
|||
llvm::Value *Args[3] = { Exn, getOpaquePersonalityFn(CGM, Personality),
|
||||
getCatchAllValue(*this) };
|
||||
Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::eh_selector),
|
||||
Args, Args+3, "eh.selector")
|
||||
Args, "eh.selector")
|
||||
->setDoesNotThrow();
|
||||
|
||||
llvm::CallInst *TerminateCall = Builder.CreateCall(getTerminateFn(*this));
|
||||
|
|
|
@ -1448,7 +1448,7 @@ static llvm::Constant *getBadTypeidFn(CodeGenFunction &CGF) {
|
|||
|
||||
static void EmitBadTypeidCall(CodeGenFunction &CGF) {
|
||||
llvm::Value *Fn = getBadTypeidFn(CGF);
|
||||
CGF.EmitCallOrInvoke(Fn, 0, 0).setDoesNotReturn();
|
||||
CGF.EmitCallOrInvoke(Fn).setDoesNotReturn();
|
||||
CGF.Builder.CreateUnreachable();
|
||||
}
|
||||
|
||||
|
@ -1546,7 +1546,7 @@ static llvm::Constant *getBadCastFn(CodeGenFunction &CGF) {
|
|||
|
||||
static void EmitBadCastCall(CodeGenFunction &CGF) {
|
||||
llvm::Value *Fn = getBadCastFn(CGF);
|
||||
CGF.EmitCallOrInvoke(Fn, 0, 0).setDoesNotReturn();
|
||||
CGF.EmitCallOrInvoke(Fn).setDoesNotReturn();
|
||||
CGF.Builder.CreateUnreachable();
|
||||
}
|
||||
|
||||
|
|
|
@ -531,7 +531,7 @@ protected:
|
|||
CGBuilderTy &Builder = CGF.Builder;
|
||||
llvm::Value *lookupArgs[] = {EnforceType(Builder, ObjCSuper,
|
||||
PtrToObjCSuperTy), cmd};
|
||||
return Builder.CreateCall(MsgLookupSuperFn, lookupArgs, lookupArgs+2);
|
||||
return Builder.CreateCall(MsgLookupSuperFn, lookupArgs);
|
||||
}
|
||||
public:
|
||||
CGObjCGCC(CodeGenModule &Mod) : CGObjCGNU(Mod, 8, 2) {
|
||||
|
@ -600,8 +600,7 @@ class CGObjCGNUstep : public CGObjCGNU {
|
|||
CGBuilderTy &Builder = CGF.Builder;
|
||||
llvm::Value *lookupArgs[] = {ObjCSuper, cmd};
|
||||
|
||||
llvm::CallInst *slot = Builder.CreateCall(SlotLookupSuperFn, lookupArgs,
|
||||
lookupArgs+2);
|
||||
llvm::CallInst *slot = Builder.CreateCall(SlotLookupSuperFn, lookupArgs);
|
||||
slot->setOnlyReadsMemory();
|
||||
|
||||
return Builder.CreateLoad(Builder.CreateStructGEP(slot, 4));
|
||||
|
@ -2310,8 +2309,8 @@ void CGObjCGNU::EmitThrowStmt(CodeGenFunction &CGF,
|
|||
CGF.Builder.CreateCall(ExceptionThrowFn, ExceptionAsObject);
|
||||
CGF.Builder.CreateUnreachable();
|
||||
} else {
|
||||
CGF.Builder.CreateInvoke(ExceptionThrowFn, UnwindBB, UnwindBB, &ExceptionAsObject,
|
||||
&ExceptionAsObject+1);
|
||||
CGF.Builder.CreateInvoke(ExceptionThrowFn, UnwindBB, UnwindBB,
|
||||
ExceptionAsObject);
|
||||
}
|
||||
// Clear the insertion point to indicate we are in unreachable code.
|
||||
CGF.Builder.ClearInsertionPoint();
|
||||
|
|
|
@ -2697,14 +2697,12 @@ FragileHazards::FragileHazards(CodeGenFunction &CGF) : CGF(CGF) {
|
|||
void FragileHazards::emitWriteHazard() {
|
||||
if (Locals.empty()) return;
|
||||
|
||||
CGF.Builder.CreateCall(WriteHazard, Locals.begin(), Locals.end())
|
||||
->setDoesNotThrow();
|
||||
CGF.Builder.CreateCall(WriteHazard, Locals)->setDoesNotThrow();
|
||||
}
|
||||
|
||||
void FragileHazards::emitReadHazard(CGBuilderTy &Builder) {
|
||||
assert(!Locals.empty());
|
||||
Builder.CreateCall(ReadHazard, Locals.begin(), Locals.end())
|
||||
->setDoesNotThrow();
|
||||
Builder.CreateCall(ReadHazard, Locals)->setDoesNotThrow();
|
||||
}
|
||||
|
||||
/// Emit read hazards in all the protected blocks, i.e. all the blocks
|
||||
|
@ -6048,12 +6046,10 @@ void CGObjCNonFragileABIMac::EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
|
|||
llvm::Value *Exception = CGF.EmitScalarExpr(ThrowExpr);
|
||||
Exception = CGF.Builder.CreateBitCast(Exception, ObjCTypes.ObjectPtrTy,
|
||||
"tmp");
|
||||
llvm::Value *Args[] = { Exception };
|
||||
CGF.EmitCallOrInvoke(ObjCTypes.getExceptionThrowFn(),
|
||||
Args, Args+1)
|
||||
CGF.EmitCallOrInvoke(ObjCTypes.getExceptionThrowFn(), Exception)
|
||||
.setDoesNotReturn();
|
||||
} else {
|
||||
CGF.EmitCallOrInvoke(ObjCTypes.getExceptionRethrowFn(), 0, 0)
|
||||
CGF.EmitCallOrInvoke(ObjCTypes.getExceptionRethrowFn())
|
||||
.setDoesNotReturn();
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace {
|
|||
return;
|
||||
}
|
||||
|
||||
CGF.EmitCallOrInvoke(Fn, 0, 0);
|
||||
CGF.EmitCallOrInvoke(Fn);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1591,7 +1591,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
|||
llvm::InlineAsm *IA =
|
||||
llvm::InlineAsm::get(FTy, AsmString, Constraints,
|
||||
S.isVolatile() || S.getNumOutputs() == 0);
|
||||
llvm::CallInst *Result = Builder.CreateCall(IA, Args.begin(), Args.end());
|
||||
llvm::CallInst *Result = Builder.CreateCall(IA, Args);
|
||||
Result->addAttribute(~0, llvm::Attribute::NoUnwind);
|
||||
|
||||
// Slap the source location of the inline asm into a !srcloc metadata on the
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "clang/Frontend/CodeGenOptions.h"
|
||||
#include "clang/Basic/ABI.h"
|
||||
#include "clang/Basic/TargetInfo.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Support/ValueHandle.h"
|
||||
|
@ -2073,8 +2074,9 @@ public:
|
|||
ReturnValueSlot ReturnValue = ReturnValueSlot());
|
||||
|
||||
llvm::CallSite EmitCallOrInvoke(llvm::Value *Callee,
|
||||
llvm::Value * const *ArgBegin,
|
||||
llvm::Value * const *ArgEnd,
|
||||
llvm::ArrayRef<llvm::Value *> Args,
|
||||
const llvm::Twine &Name = "");
|
||||
llvm::CallSite EmitCallOrInvoke(llvm::Value *Callee,
|
||||
const llvm::Twine &Name = "");
|
||||
|
||||
llvm::Value *BuildVirtualCall(const CXXMethodDecl *MD, llvm::Value *This,
|
||||
|
|
|
@ -1413,8 +1413,7 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old,
|
|||
// Okay, we can transform this. Create the new call instruction and copy
|
||||
// over the required information.
|
||||
ArgList.append(CS.arg_begin(), CS.arg_begin() + ArgNo);
|
||||
llvm::CallInst *NewCall = llvm::CallInst::Create(NewFn, ArgList.begin(),
|
||||
ArgList.end(), "", CI);
|
||||
llvm::CallInst *NewCall = llvm::CallInst::Create(NewFn, ArgList, "", CI);
|
||||
ArgList.clear();
|
||||
if (!NewCall->getType()->isVoidTy())
|
||||
NewCall->takeName(CI);
|
||||
|
|
Загрузка…
Ссылка в новой задаче