forked from OSchip/llvm-project
Cleanup: replace uses of CallSite with CallBase.
llvm-svn: 352595
This commit is contained in:
parent
045bc9a4a6
commit
3933addd30
|
@ -22,7 +22,6 @@
|
|||
#include "clang/AST/DeclObjC.h"
|
||||
#include "clang/CodeGen/ConstantInitBuilder.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "clang/CodeGen/CGFunctionInfo.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
|
@ -799,9 +798,9 @@ static RValue EmitMSVCRTSetJmp(CodeGenFunction &CGF, MSVCSetJmpKind SJKind,
|
|||
llvm::Value *Buf = CGF.Builder.CreateBitOrPointerCast(
|
||||
CGF.EmitScalarExpr(E->getArg(0)), CGF.Int8PtrTy);
|
||||
llvm::Value *Args[] = {Buf, Arg1};
|
||||
llvm::CallSite CS = CGF.EmitRuntimeCallOrInvoke(SetJmpFn, Args);
|
||||
CS.setAttributes(ReturnsTwiceAttr);
|
||||
return RValue::get(CS.getInstruction());
|
||||
llvm::CallBase *CB = CGF.EmitRuntimeCallOrInvoke(SetJmpFn, Args);
|
||||
CB->setAttributes(ReturnsTwiceAttr);
|
||||
return RValue::get(CB);
|
||||
}
|
||||
|
||||
// Many of MSVC builtins are on x64, ARM and AArch64; to avoid repeating code,
|
||||
|
@ -1002,9 +1001,9 @@ Value *CodeGenFunction::EmitMSVCBuiltinExpr(MSVCIntrin BuiltinID,
|
|||
llvm::AttributeList NoReturnAttr = llvm::AttributeList::get(
|
||||
getLLVMContext(), llvm::AttributeList::FunctionIndex,
|
||||
llvm::Attribute::NoReturn);
|
||||
CallSite CS = Builder.CreateCall(IA, EmitScalarExpr(E->getArg(0)));
|
||||
CS.setAttributes(NoReturnAttr);
|
||||
return CS.getInstruction();
|
||||
llvm::CallInst *CI = Builder.CreateCall(IA, EmitScalarExpr(E->getArg(0)));
|
||||
CI->setAttributes(NoReturnAttr);
|
||||
return CI;
|
||||
}
|
||||
}
|
||||
llvm_unreachable("Incorrect MSVC intrinsic!");
|
||||
|
@ -11851,9 +11850,9 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
|
|||
llvm::AttributeList NoReturnAttr = llvm::AttributeList::get(
|
||||
getLLVMContext(), llvm::AttributeList::FunctionIndex,
|
||||
llvm::Attribute::NoReturn);
|
||||
CallSite CS = Builder.CreateCall(IA);
|
||||
CS.setAttributes(NoReturnAttr);
|
||||
return CS.getInstruction();
|
||||
llvm::CallInst *CI = Builder.CreateCall(IA);
|
||||
CI->setAttributes(NoReturnAttr);
|
||||
return CI;
|
||||
}
|
||||
case X86::BI__readfsbyte:
|
||||
case X86::BI__readfsword:
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "clang/AST/Decl.h"
|
||||
#include "clang/CodeGen/ConstantInitBuilder.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
|
@ -208,11 +207,11 @@ void CGNVCUDARuntime::emitDeviceStubBody(CodeGenFunction &CGF,
|
|||
llvm::ConstantInt::get(SizeTy, TyWidth.getQuantity()),
|
||||
llvm::ConstantInt::get(SizeTy, Offset.getQuantity()),
|
||||
};
|
||||
llvm::CallSite CS = CGF.EmitRuntimeCallOrInvoke(cudaSetupArgFn, Args);
|
||||
llvm::CallBase *CB = CGF.EmitRuntimeCallOrInvoke(cudaSetupArgFn, Args);
|
||||
llvm::Constant *Zero = llvm::ConstantInt::get(IntTy, 0);
|
||||
llvm::Value *CSZero = CGF.Builder.CreateICmpEQ(CS.getInstruction(), Zero);
|
||||
llvm::Value *CBZero = CGF.Builder.CreateICmpEQ(CB, Zero);
|
||||
llvm::BasicBlock *NextBlock = CGF.createBasicBlock("setup.next");
|
||||
CGF.Builder.CreateCondBr(CSZero, NextBlock, EndBlock);
|
||||
CGF.Builder.CreateCondBr(CBZero, NextBlock, EndBlock);
|
||||
CGF.EmitBlock(NextBlock);
|
||||
Offset += TyWidth;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/IR/Attributes.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/CallingConv.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
|
@ -3760,33 +3759,29 @@ void CodeGenFunction::EmitNoreturnRuntimeCallOrInvoke(llvm::Value *callee,
|
|||
}
|
||||
|
||||
/// Emits a call or invoke instruction to the given nullary runtime function.
|
||||
llvm::CallSite
|
||||
CodeGenFunction::EmitRuntimeCallOrInvoke(llvm::Value *callee,
|
||||
const Twine &name) {
|
||||
llvm::CallBase *CodeGenFunction::EmitRuntimeCallOrInvoke(llvm::Value *callee,
|
||||
const Twine &name) {
|
||||
return EmitRuntimeCallOrInvoke(callee, None, name);
|
||||
}
|
||||
|
||||
/// Emits a call or invoke instruction to the given runtime function.
|
||||
llvm::CallSite
|
||||
CodeGenFunction::EmitRuntimeCallOrInvoke(llvm::Value *callee,
|
||||
ArrayRef<llvm::Value*> args,
|
||||
const Twine &name) {
|
||||
llvm::CallSite callSite = EmitCallOrInvoke(callee, args, name);
|
||||
callSite.setCallingConv(getRuntimeCC());
|
||||
return callSite;
|
||||
llvm::CallBase *CodeGenFunction::EmitRuntimeCallOrInvoke(
|
||||
llvm::Value *callee, ArrayRef<llvm::Value *> args, const Twine &name) {
|
||||
llvm::CallBase *call = EmitCallOrInvoke(callee, args, name);
|
||||
call->setCallingConv(getRuntimeCC());
|
||||
return call;
|
||||
}
|
||||
|
||||
/// Emits a call or invoke instruction to the given function, depending
|
||||
/// on the current state of the EH stack.
|
||||
llvm::CallSite
|
||||
CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee,
|
||||
ArrayRef<llvm::Value *> Args,
|
||||
const Twine &Name) {
|
||||
llvm::CallBase *CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee,
|
||||
ArrayRef<llvm::Value *> Args,
|
||||
const Twine &Name) {
|
||||
llvm::BasicBlock *InvokeDest = getInvokeDest();
|
||||
SmallVector<llvm::OperandBundleDef, 1> BundleList =
|
||||
getBundlesForFunclet(Callee);
|
||||
|
||||
llvm::Instruction *Inst;
|
||||
llvm::CallBase *Inst;
|
||||
if (!InvokeDest)
|
||||
Inst = Builder.CreateCall(Callee, Args, BundleList, Name);
|
||||
else {
|
||||
|
@ -3801,7 +3796,7 @@ CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee,
|
|||
if (CGM.getLangOpts().ObjCAutoRefCount)
|
||||
AddObjCARCExceptionMetadata(Inst);
|
||||
|
||||
return llvm::CallSite(Inst);
|
||||
return Inst;
|
||||
}
|
||||
|
||||
void CodeGenFunction::deferPlaceholderReplacement(llvm::Instruction *Old,
|
||||
|
@ -3813,7 +3808,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|||
const CGCallee &Callee,
|
||||
ReturnValueSlot ReturnValue,
|
||||
const CallArgList &CallArgs,
|
||||
llvm::Instruction **callOrInvoke,
|
||||
llvm::CallBase **callOrInvoke,
|
||||
SourceLocation Loc) {
|
||||
// FIXME: We no longer need the types from CallArgs; lift up and simplify.
|
||||
|
||||
|
@ -4346,22 +4341,21 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|||
getBundlesForFunclet(CalleePtr);
|
||||
|
||||
// Emit the actual call/invoke instruction.
|
||||
llvm::CallSite CS;
|
||||
llvm::CallBase *CI;
|
||||
if (!InvokeDest) {
|
||||
CS = Builder.CreateCall(CalleePtr, IRCallArgs, BundleList);
|
||||
CI = Builder.CreateCall(CalleePtr, IRCallArgs, BundleList);
|
||||
} else {
|
||||
llvm::BasicBlock *Cont = createBasicBlock("invoke.cont");
|
||||
CS = Builder.CreateInvoke(CalleePtr, Cont, InvokeDest, IRCallArgs,
|
||||
CI = Builder.CreateInvoke(CalleePtr, Cont, InvokeDest, IRCallArgs,
|
||||
BundleList);
|
||||
EmitBlock(Cont);
|
||||
}
|
||||
llvm::Instruction *CI = CS.getInstruction();
|
||||
if (callOrInvoke)
|
||||
*callOrInvoke = CI;
|
||||
|
||||
// Apply the attributes and calling convention.
|
||||
CS.setAttributes(Attrs);
|
||||
CS.setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv));
|
||||
CI->setAttributes(Attrs);
|
||||
CI->setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv));
|
||||
|
||||
// Apply various metadata.
|
||||
|
||||
|
@ -4376,7 +4370,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|||
// Insert instrumentation or attach profile metadata at indirect call sites.
|
||||
// For more details, see the comment before the definition of
|
||||
// IPVK_IndirectCallTarget in InstrProfData.inc.
|
||||
if (!CS.getCalledFunction())
|
||||
if (!CI->getCalledFunction())
|
||||
PGO.valueProfile(Builder, llvm::IPVK_IndirectCallTarget,
|
||||
CI, CalleePtr);
|
||||
|
||||
|
@ -4397,16 +4391,16 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|||
// If the call doesn't return, finish the basic block and clear the
|
||||
// insertion point; this allows the rest of IRGen to discard
|
||||
// unreachable code.
|
||||
if (CS.doesNotReturn()) {
|
||||
if (CI->doesNotReturn()) {
|
||||
if (UnusedReturnSizePtr)
|
||||
PopCleanupBlock();
|
||||
|
||||
// Strip away the noreturn attribute to better diagnose unreachable UB.
|
||||
if (SanOpts.has(SanitizerKind::Unreachable)) {
|
||||
if (auto *F = CS.getCalledFunction())
|
||||
if (auto *F = CI->getCalledFunction())
|
||||
F->removeFnAttr(llvm::Attribute::NoReturn);
|
||||
CS.removeAttribute(llvm::AttributeList::FunctionIndex,
|
||||
llvm::Attribute::NoReturn);
|
||||
CI->removeAttribute(llvm::AttributeList::FunctionIndex,
|
||||
llvm::Attribute::NoReturn);
|
||||
}
|
||||
|
||||
EmitUnreachable(Loc);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "clang/AST/StmtObjC.h"
|
||||
#include "clang/AST/StmtVisitor.h"
|
||||
#include "clang/Basic/TargetBuiltins.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/Support/SaveAndRestore.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "ConstantEmitter.h"
|
||||
#include "clang/Basic/CodeGenOptions.h"
|
||||
#include "clang/CodeGen/CGFunctionInfo.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
|
||||
using namespace clang;
|
||||
|
@ -1292,7 +1291,7 @@ static RValue EmitNewDeleteCall(CodeGenFunction &CGF,
|
|||
const FunctionDecl *CalleeDecl,
|
||||
const FunctionProtoType *CalleeType,
|
||||
const CallArgList &Args) {
|
||||
llvm::Instruction *CallOrInvoke;
|
||||
llvm::CallBase *CallOrInvoke;
|
||||
llvm::Constant *CalleePtr = CGF.CGM.GetAddrOfFunction(CalleeDecl);
|
||||
CGCallee Callee = CGCallee::forDirect(CalleePtr, GlobalDecl(CalleeDecl));
|
||||
RValue RV =
|
||||
|
@ -1308,15 +1307,8 @@ static RValue EmitNewDeleteCall(CodeGenFunction &CGF,
|
|||
llvm::Function *Fn = dyn_cast<llvm::Function>(CalleePtr);
|
||||
if (CalleeDecl->isReplaceableGlobalAllocationFunction() &&
|
||||
Fn && Fn->hasFnAttribute(llvm::Attribute::NoBuiltin)) {
|
||||
// FIXME: Add addAttribute to CallSite.
|
||||
if (llvm::CallInst *CI = dyn_cast<llvm::CallInst>(CallOrInvoke))
|
||||
CI->addAttribute(llvm::AttributeList::FunctionIndex,
|
||||
llvm::Attribute::Builtin);
|
||||
else if (llvm::InvokeInst *II = dyn_cast<llvm::InvokeInst>(CallOrInvoke))
|
||||
II->addAttribute(llvm::AttributeList::FunctionIndex,
|
||||
llvm::Attribute::Builtin);
|
||||
else
|
||||
llvm_unreachable("unexpected kind of call instruction");
|
||||
CallOrInvoke->addAttribute(llvm::AttributeList::FunctionIndex,
|
||||
llvm::Attribute::Builtin);
|
||||
}
|
||||
|
||||
return RV;
|
||||
|
|
|
@ -630,9 +630,9 @@ ComplexPairTy ComplexExprEmitter::EmitComplexBinOpLibCall(StringRef LibCallName,
|
|||
llvm::Constant *Func = CGF.CGM.CreateBuiltinFunction(FTy, LibCallName);
|
||||
CGCallee Callee = CGCallee::forDirect(Func, FQTy->getAs<FunctionProtoType>());
|
||||
|
||||
llvm::Instruction *Call;
|
||||
llvm::CallBase *Call;
|
||||
RValue Res = CGF.EmitCall(FuncInfo, Callee, ReturnValueSlot(), Args, &Call);
|
||||
cast<llvm::CallInst>(Call)->setCallingConv(CGF.CGM.getRuntimeCC());
|
||||
Call->setCallingConv(CGF.CGM.getRuntimeCC());
|
||||
return Res.getComplexVal();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "clang/CodeGen/CGFunctionInfo.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
using namespace clang;
|
||||
|
@ -1051,7 +1050,7 @@ CodeGenFunction::generateObjCGetterBody(const ObjCImplementationDecl *classImpl,
|
|||
|
||||
// FIXME: We shouldn't need to get the function info here, the
|
||||
// runtime already should have computed it to build the function.
|
||||
llvm::Instruction *CallInstruction;
|
||||
llvm::CallBase *CallInstruction;
|
||||
RValue RV = EmitCall(
|
||||
getTypes().arrangeBuiltinFunctionCall(propType, args),
|
||||
callee, ReturnValueSlot(), args, &CallInstruction);
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "clang/Basic/SourceManager.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
|
@ -690,9 +689,9 @@ protected:
|
|||
llvm::Value *args[] = {
|
||||
EnforceType(Builder, Receiver, IdTy),
|
||||
EnforceType(Builder, cmd, SelectorTy) };
|
||||
llvm::CallSite imp = CGF.EmitRuntimeCallOrInvoke(MsgLookupFn, args);
|
||||
llvm::CallBase *imp = CGF.EmitRuntimeCallOrInvoke(MsgLookupFn, args);
|
||||
imp->setMetadata(msgSendMDKind, node);
|
||||
return imp.getInstruction();
|
||||
return imp;
|
||||
}
|
||||
|
||||
llvm::Value *LookupIMPSuper(CodeGenFunction &CGF, Address ObjCSuper,
|
||||
|
@ -771,14 +770,13 @@ class CGObjCGNUstep : public CGObjCGNU {
|
|||
EnforceType(Builder, ReceiverPtr.getPointer(), PtrToIdTy),
|
||||
EnforceType(Builder, cmd, SelectorTy),
|
||||
EnforceType(Builder, self, IdTy) };
|
||||
llvm::CallSite slot = CGF.EmitRuntimeCallOrInvoke(LookupFn, args);
|
||||
slot.setOnlyReadsMemory();
|
||||
llvm::CallBase *slot = CGF.EmitRuntimeCallOrInvoke(LookupFn, args);
|
||||
slot->setOnlyReadsMemory();
|
||||
slot->setMetadata(msgSendMDKind, node);
|
||||
|
||||
// Load the imp from the slot
|
||||
llvm::Value *imp = Builder.CreateAlignedLoad(
|
||||
Builder.CreateStructGEP(nullptr, slot.getInstruction(), 4),
|
||||
CGF.getPointerAlign());
|
||||
Builder.CreateStructGEP(nullptr, slot, 4), CGF.getPointerAlign());
|
||||
|
||||
// The lookup function may have changed the receiver, so make sure we use
|
||||
// the new one.
|
||||
|
@ -1937,14 +1935,14 @@ protected:
|
|||
EnforceType(Builder, Receiver, IdTy),
|
||||
EnforceType(Builder, cmd, SelectorTy) };
|
||||
|
||||
llvm::CallSite imp;
|
||||
llvm::CallBase *imp;
|
||||
if (CGM.ReturnTypeUsesSRet(MSI.CallInfo))
|
||||
imp = CGF.EmitRuntimeCallOrInvoke(MsgLookupFnSRet, args);
|
||||
else
|
||||
imp = CGF.EmitRuntimeCallOrInvoke(MsgLookupFn, args);
|
||||
|
||||
imp->setMetadata(msgSendMDKind, node);
|
||||
return imp.getInstruction();
|
||||
return imp;
|
||||
}
|
||||
|
||||
llvm::Value *LookupIMPSuper(CodeGenFunction &CGF, Address ObjCSuper,
|
||||
|
@ -2500,7 +2498,7 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGenFunction &CGF,
|
|||
|
||||
CGCallee callee(CGCalleeInfo(), imp);
|
||||
|
||||
llvm::Instruction *call;
|
||||
llvm::CallBase *call;
|
||||
RValue msgRet = CGF.EmitCall(MSI.CallInfo, callee, Return, ActualArgs, &call);
|
||||
call->setMetadata(msgSendMDKind, node);
|
||||
return msgRet;
|
||||
|
@ -2612,7 +2610,7 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
|
|||
|
||||
imp = EnforceType(Builder, imp, MSI.MessengerType);
|
||||
|
||||
llvm::Instruction *call;
|
||||
llvm::CallBase *call;
|
||||
CGCallee callee(CGCalleeInfo(), imp);
|
||||
RValue msgRet = CGF.EmitCall(MSI.CallInfo, callee, Return, ActualArgs, &call);
|
||||
call->setMetadata(msgSendMDKind, node);
|
||||
|
@ -3843,13 +3841,14 @@ void CGObjCGNU::EmitThrowStmt(CodeGenFunction &CGF,
|
|||
// that was passed into the `@catch` block, then this code path is not
|
||||
// reached and we will instead call `objc_exception_throw` with an explicit
|
||||
// argument.
|
||||
CGF.EmitRuntimeCallOrInvoke(ExceptionReThrowFn).setDoesNotReturn();
|
||||
llvm::CallBase *Throw = CGF.EmitRuntimeCallOrInvoke(ExceptionReThrowFn);
|
||||
Throw->setDoesNotReturn();
|
||||
}
|
||||
else {
|
||||
ExceptionAsObject = CGF.Builder.CreateBitCast(ExceptionAsObject, IdTy);
|
||||
llvm::CallSite Throw =
|
||||
llvm::CallBase *Throw =
|
||||
CGF.EmitRuntimeCallOrInvoke(ExceptionThrowFn, ExceptionAsObject);
|
||||
Throw.setDoesNotReturn();
|
||||
Throw->setDoesNotReturn();
|
||||
}
|
||||
CGF.Builder.CreateUnreachable();
|
||||
if (ClearInsertionPoint)
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
|
@ -2177,7 +2176,7 @@ CGObjCCommonMac::EmitMessageSend(CodeGen::CodeGenFunction &CGF,
|
|||
nullReturn.init(CGF, Arg0);
|
||||
}
|
||||
|
||||
llvm::Instruction *CallSite;
|
||||
llvm::CallBase *CallSite;
|
||||
Fn = llvm::ConstantExpr::getBitCast(Fn, MSI.MessengerType);
|
||||
CGCallee Callee = CGCallee::forDirect(Fn);
|
||||
RValue rvalue = CGF.EmitCall(MSI.CallInfo, Callee, Return, ActualArgs,
|
||||
|
@ -2186,7 +2185,7 @@ CGObjCCommonMac::EmitMessageSend(CodeGen::CodeGenFunction &CGF,
|
|||
// Mark the call as noreturn if the method is marked noreturn and the
|
||||
// receiver cannot be null.
|
||||
if (Method && Method->hasAttr<NoReturnAttr>() && !ReceiverCanBeNull) {
|
||||
llvm::CallSite(CallSite).setDoesNotReturn();
|
||||
CallSite->setDoesNotReturn();
|
||||
}
|
||||
|
||||
return nullReturn.complete(CGF, Return, rvalue, ResultType, CallArgs,
|
||||
|
@ -4224,14 +4223,15 @@ void FragileHazards::emitHazardsInNewBlocks() {
|
|||
|
||||
// Ignore instructions that aren't non-intrinsic calls.
|
||||
// These are the only calls that can possibly call longjmp.
|
||||
if (!isa<llvm::CallInst>(I) && !isa<llvm::InvokeInst>(I)) continue;
|
||||
if (!isa<llvm::CallInst>(I) && !isa<llvm::InvokeInst>(I))
|
||||
continue;
|
||||
if (isa<llvm::IntrinsicInst>(I))
|
||||
continue;
|
||||
|
||||
// Ignore call sites marked nounwind. This may be questionable,
|
||||
// since 'nounwind' doesn't necessarily mean 'does not call longjmp'.
|
||||
llvm::CallSite CS(&I);
|
||||
if (CS.doesNotThrow()) continue;
|
||||
if (cast<llvm::CallBase>(I).doesNotThrow())
|
||||
continue;
|
||||
|
||||
// Insert a read hazard before the call. This will ensure that
|
||||
// any writes to the locals are performed before making the
|
||||
|
@ -7576,11 +7576,13 @@ void CGObjCNonFragileABIMac::EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
|
|||
if (const Expr *ThrowExpr = S.getThrowExpr()) {
|
||||
llvm::Value *Exception = CGF.EmitObjCThrowOperand(ThrowExpr);
|
||||
Exception = CGF.Builder.CreateBitCast(Exception, ObjCTypes.ObjectPtrTy);
|
||||
CGF.EmitRuntimeCallOrInvoke(ObjCTypes.getExceptionThrowFn(), Exception)
|
||||
.setDoesNotReturn();
|
||||
llvm::CallBase *Call =
|
||||
CGF.EmitRuntimeCallOrInvoke(ObjCTypes.getExceptionThrowFn(), Exception);
|
||||
Call->setDoesNotReturn();
|
||||
} else {
|
||||
CGF.EmitRuntimeCallOrInvoke(ObjCTypes.getExceptionRethrowFn())
|
||||
.setDoesNotReturn();
|
||||
llvm::CallBase *Call =
|
||||
CGF.EmitRuntimeCallOrInvoke(ObjCTypes.getExceptionRethrowFn());
|
||||
Call->setDoesNotReturn();
|
||||
}
|
||||
|
||||
CGF.Builder.CreateUnreachable();
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "clang/AST/RecordLayout.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
#include "clang/CodeGen/CGFunctionInfo.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/Support/SaveAndRestore.h"
|
||||
|
||||
using namespace clang;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "clang/Basic/BitmaskEnum.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Bitcode/BitcodeReader.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "CGOpenMPRuntime.h"
|
||||
#include "CodeGenFunction.h"
|
||||
#include "clang/AST/StmtOpenMP.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
|
||||
namespace clang {
|
||||
namespace CodeGen {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "clang/Basic/PrettyStackTrace.h"
|
||||
#include "clang/Basic/TargetInfo.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "clang/AST/Stmt.h"
|
||||
#include "clang/AST/StmtOpenMP.h"
|
||||
#include "clang/AST/DeclOpenMP.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
using namespace clang;
|
||||
using namespace CodeGen;
|
||||
|
||||
|
@ -5076,4 +5075,3 @@ void CodeGenFunction::EmitSimpleOMPExecutableDirective(
|
|||
: D.getDirectiveKind(),
|
||||
CodeGen);
|
||||
}
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ void CodeGenFunction::EmitCallAndReturnForThunk(llvm::Constant *CalleePtr,
|
|||
Slot = ReturnValueSlot(ReturnValue, ResultType.isVolatileQualified());
|
||||
|
||||
// Now emit our call.
|
||||
llvm::Instruction *CallOrInvoke;
|
||||
llvm::CallBase *CallOrInvoke;
|
||||
CGCallee Callee = CGCallee::forDirect(CalleePtr, CurGD);
|
||||
RValue RV = EmitCall(*CurFnInfo, Callee, Slot, CallArgs, &CallOrInvoke);
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ class Module;
|
|||
class SwitchInst;
|
||||
class Twine;
|
||||
class Value;
|
||||
class CallSite;
|
||||
}
|
||||
|
||||
namespace clang {
|
||||
|
@ -3583,10 +3582,10 @@ public:
|
|||
/// LLVM arguments and the types they were derived from.
|
||||
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee,
|
||||
ReturnValueSlot ReturnValue, const CallArgList &Args,
|
||||
llvm::Instruction **callOrInvoke, SourceLocation Loc);
|
||||
llvm::CallBase **callOrInvoke, SourceLocation Loc);
|
||||
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee,
|
||||
ReturnValueSlot ReturnValue, const CallArgList &Args,
|
||||
llvm::Instruction **callOrInvoke = nullptr) {
|
||||
llvm::CallBase **callOrInvoke = nullptr) {
|
||||
return EmitCall(CallInfo, Callee, ReturnValue, Args, callOrInvoke,
|
||||
SourceLocation());
|
||||
}
|
||||
|
@ -3613,14 +3612,14 @@ public:
|
|||
SmallVector<llvm::OperandBundleDef, 1>
|
||||
getBundlesForFunclet(llvm::Value *Callee);
|
||||
|
||||
llvm::CallSite EmitCallOrInvoke(llvm::Value *Callee,
|
||||
ArrayRef<llvm::Value *> Args,
|
||||
const Twine &Name = "");
|
||||
llvm::CallSite EmitRuntimeCallOrInvoke(llvm::Value *callee,
|
||||
ArrayRef<llvm::Value*> args,
|
||||
const Twine &name = "");
|
||||
llvm::CallSite EmitRuntimeCallOrInvoke(llvm::Value *callee,
|
||||
const Twine &name = "");
|
||||
llvm::CallBase *EmitCallOrInvoke(llvm::Value *Callee,
|
||||
ArrayRef<llvm::Value *> Args,
|
||||
const Twine &Name = "");
|
||||
llvm::CallBase *EmitRuntimeCallOrInvoke(llvm::Value *callee,
|
||||
ArrayRef<llvm::Value *> args,
|
||||
const Twine &name = "");
|
||||
llvm::CallBase *EmitRuntimeCallOrInvoke(llvm::Value *callee,
|
||||
const Twine &name = "");
|
||||
void EmitNoreturnRuntimeCallOrInvoke(llvm::Value *callee,
|
||||
ArrayRef<llvm::Value*> args);
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/Analysis/TargetLibraryInfo.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/CallingConv.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
|
@ -3897,9 +3896,10 @@ static void replaceUsesOfNonProtoConstant(llvm::Constant *old,
|
|||
}
|
||||
|
||||
// Recognize calls to the function.
|
||||
llvm::CallSite callSite(user);
|
||||
llvm::CallBase *callSite = dyn_cast<llvm::CallBase>(user);
|
||||
if (!callSite) continue;
|
||||
if (!callSite.isCallee(&*use)) continue;
|
||||
if (!callSite->isCallee(&*use))
|
||||
continue;
|
||||
|
||||
// If the return types don't match exactly, then we can't
|
||||
// transform this call unless it's dead.
|
||||
|
@ -3908,18 +3908,19 @@ static void replaceUsesOfNonProtoConstant(llvm::Constant *old,
|
|||
|
||||
// Get the call site's attribute list.
|
||||
SmallVector<llvm::AttributeSet, 8> newArgAttrs;
|
||||
llvm::AttributeList oldAttrs = callSite.getAttributes();
|
||||
llvm::AttributeList oldAttrs = callSite->getAttributes();
|
||||
|
||||
// If the function was passed too few arguments, don't transform.
|
||||
unsigned newNumArgs = newFn->arg_size();
|
||||
if (callSite.arg_size() < newNumArgs) continue;
|
||||
if (callSite->arg_size() < newNumArgs)
|
||||
continue;
|
||||
|
||||
// If extra arguments were passed, we silently drop them.
|
||||
// If any of the types mismatch, we don't transform.
|
||||
unsigned argNo = 0;
|
||||
bool dontTransform = false;
|
||||
for (llvm::Argument &A : newFn->args()) {
|
||||
if (callSite.getArgument(argNo)->getType() != A.getType()) {
|
||||
if (callSite->getArgOperand(argNo)->getType() != A.getType()) {
|
||||
dontTransform = true;
|
||||
break;
|
||||
}
|
||||
|
@ -3933,35 +3934,33 @@ static void replaceUsesOfNonProtoConstant(llvm::Constant *old,
|
|||
|
||||
// Okay, we can transform this. Create the new call instruction and copy
|
||||
// over the required information.
|
||||
newArgs.append(callSite.arg_begin(), callSite.arg_begin() + argNo);
|
||||
newArgs.append(callSite->arg_begin(), callSite->arg_begin() + argNo);
|
||||
|
||||
// Copy over any operand bundles.
|
||||
callSite.getOperandBundlesAsDefs(newBundles);
|
||||
callSite->getOperandBundlesAsDefs(newBundles);
|
||||
|
||||
llvm::CallSite newCall;
|
||||
if (callSite.isCall()) {
|
||||
newCall = llvm::CallInst::Create(newFn, newArgs, newBundles, "",
|
||||
callSite.getInstruction());
|
||||
llvm::CallBase *newCall;
|
||||
if (dyn_cast<llvm::CallInst>(callSite)) {
|
||||
newCall =
|
||||
llvm::CallInst::Create(newFn, newArgs, newBundles, "", callSite);
|
||||
} else {
|
||||
auto *oldInvoke = cast<llvm::InvokeInst>(callSite.getInstruction());
|
||||
newCall = llvm::InvokeInst::Create(newFn,
|
||||
oldInvoke->getNormalDest(),
|
||||
oldInvoke->getUnwindDest(),
|
||||
newArgs, newBundles, "",
|
||||
callSite.getInstruction());
|
||||
auto *oldInvoke = cast<llvm::InvokeInst>(callSite);
|
||||
newCall = llvm::InvokeInst::Create(newFn, oldInvoke->getNormalDest(),
|
||||
oldInvoke->getUnwindDest(), newArgs,
|
||||
newBundles, "", callSite);
|
||||
}
|
||||
newArgs.clear(); // for the next iteration
|
||||
|
||||
if (!newCall->getType()->isVoidTy())
|
||||
newCall->takeName(callSite.getInstruction());
|
||||
newCall.setAttributes(llvm::AttributeList::get(
|
||||
newCall->takeName(callSite);
|
||||
newCall->setAttributes(llvm::AttributeList::get(
|
||||
newFn->getContext(), oldAttrs.getFnAttributes(),
|
||||
oldAttrs.getRetAttributes(), newArgAttrs));
|
||||
newCall.setCallingConv(callSite.getCallingConv());
|
||||
newCall->setCallingConv(callSite->getCallingConv());
|
||||
|
||||
// Finally, remove the old call, replacing any uses with the new one.
|
||||
if (!callSite->use_empty())
|
||||
callSite->replaceAllUsesWith(newCall.getInstruction());
|
||||
callSite->replaceAllUsesWith(newCall);
|
||||
|
||||
// Copy debug location attached to CI.
|
||||
if (callSite->getDebugLoc())
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "clang/AST/Mangle.h"
|
||||
#include "clang/AST/Type.h"
|
||||
#include "clang/AST/StmtCXX.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
|
@ -1314,7 +1313,8 @@ bool ItaniumCXXABI::shouldTypeidBeNullChecked(bool IsDeref,
|
|||
|
||||
void ItaniumCXXABI::EmitBadTypeidCall(CodeGenFunction &CGF) {
|
||||
llvm::Value *Fn = getBadTypeidFn(CGF);
|
||||
CGF.EmitRuntimeCallOrInvoke(Fn).setDoesNotReturn();
|
||||
llvm::CallBase *Call = CGF.EmitRuntimeCallOrInvoke(Fn);
|
||||
Call->setDoesNotReturn();
|
||||
CGF.Builder.CreateUnreachable();
|
||||
}
|
||||
|
||||
|
@ -1411,7 +1411,8 @@ llvm::Value *ItaniumCXXABI::EmitDynamicCastToVoid(CodeGenFunction &CGF,
|
|||
|
||||
bool ItaniumCXXABI::EmitBadCastCall(CodeGenFunction &CGF) {
|
||||
llvm::Value *Fn = getBadCastFn(CGF);
|
||||
CGF.EmitRuntimeCallOrInvoke(Fn).setDoesNotReturn();
|
||||
llvm::CallBase *Call = CGF.EmitRuntimeCallOrInvoke(Fn);
|
||||
Call->setDoesNotReturn();
|
||||
CGF.Builder.CreateUnreachable();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "clang/AST/VTableBuilder.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
|
||||
using namespace clang;
|
||||
|
@ -926,8 +925,8 @@ bool MicrosoftCXXABI::shouldTypeidBeNullChecked(bool IsDeref,
|
|||
!getContext().getASTRecordLayout(SrcDecl).hasExtendableVFPtr();
|
||||
}
|
||||
|
||||
static llvm::CallSite emitRTtypeidCall(CodeGenFunction &CGF,
|
||||
llvm::Value *Argument) {
|
||||
static llvm::CallBase *emitRTtypeidCall(CodeGenFunction &CGF,
|
||||
llvm::Value *Argument) {
|
||||
llvm::Type *ArgTypes[] = {CGF.Int8PtrTy};
|
||||
llvm::FunctionType *FTy =
|
||||
llvm::FunctionType::get(CGF.Int8PtrTy, ArgTypes, false);
|
||||
|
@ -937,9 +936,9 @@ static llvm::CallSite emitRTtypeidCall(CodeGenFunction &CGF,
|
|||
}
|
||||
|
||||
void MicrosoftCXXABI::EmitBadTypeidCall(CodeGenFunction &CGF) {
|
||||
llvm::CallSite Call =
|
||||
llvm::CallBase *Call =
|
||||
emitRTtypeidCall(CGF, llvm::Constant::getNullValue(CGM.VoidPtrTy));
|
||||
Call.setDoesNotReturn();
|
||||
Call->setDoesNotReturn();
|
||||
CGF.Builder.CreateUnreachable();
|
||||
}
|
||||
|
||||
|
@ -949,7 +948,7 @@ llvm::Value *MicrosoftCXXABI::EmitTypeid(CodeGenFunction &CGF,
|
|||
llvm::Type *StdTypeInfoPtrTy) {
|
||||
std::tie(ThisPtr, std::ignore, std::ignore) =
|
||||
performBaseAdjustment(CGF, ThisPtr, SrcRecordTy);
|
||||
auto Typeid = emitRTtypeidCall(CGF, ThisPtr.getPointer()).getInstruction();
|
||||
llvm::CallBase *Typeid = emitRTtypeidCall(CGF, ThisPtr.getPointer());
|
||||
return CGF.Builder.CreateBitCast(Typeid, StdTypeInfoPtrTy);
|
||||
}
|
||||
|
||||
|
@ -990,7 +989,7 @@ llvm::Value *MicrosoftCXXABI::EmitDynamicCastCall(
|
|||
llvm::Value *Args[] = {
|
||||
ThisPtr, Offset, SrcRTTI, DestRTTI,
|
||||
llvm::ConstantInt::get(CGF.Int32Ty, DestTy->isReferenceType())};
|
||||
ThisPtr = CGF.EmitRuntimeCallOrInvoke(Function, Args).getInstruction();
|
||||
ThisPtr = CGF.EmitRuntimeCallOrInvoke(Function, Args);
|
||||
return CGF.Builder.CreateBitCast(ThisPtr, DestLTy);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue