forked from OSchip/llvm-project
Pass the return value slot to all call exprs.
llvm-svn: 92145
This commit is contained in:
parent
1f21000902
commit
bfb3671b25
|
@ -460,7 +460,8 @@ const llvm::Type *BlockModule::getGenericExtendedBlockLiteralType() {
|
|||
return GenericExtendedBlockLiteralType;
|
||||
}
|
||||
|
||||
RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) {
|
||||
RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E,
|
||||
ReturnValueSlot ReturnValue) {
|
||||
const BlockPointerType *BPT =
|
||||
E->getCallee()->getType()->getAs<BlockPointerType>();
|
||||
|
||||
|
@ -509,7 +510,7 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) {
|
|||
Func = Builder.CreateBitCast(Func, BlockFTyPtr);
|
||||
|
||||
// And call the block.
|
||||
return EmitCall(FnInfo, Func, ReturnValueSlot(), Args);
|
||||
return EmitCall(FnInfo, Func, ReturnValue, Args);
|
||||
}
|
||||
|
||||
uint64_t CodeGenFunction::AllocateBlockDecl(const BlockDeclRefExpr *E) {
|
||||
|
|
|
@ -28,6 +28,7 @@ using namespace CodeGen;
|
|||
|
||||
RValue CodeGenFunction::EmitCXXMemberCall(const CXXMethodDecl *MD,
|
||||
llvm::Value *Callee,
|
||||
ReturnValueSlot ReturnValue,
|
||||
llvm::Value *This,
|
||||
CallExpr::const_arg_iterator ArgBeg,
|
||||
CallExpr::const_arg_iterator ArgEnd) {
|
||||
|
@ -47,7 +48,7 @@ RValue CodeGenFunction::EmitCXXMemberCall(const CXXMethodDecl *MD,
|
|||
|
||||
QualType ResultType = MD->getType()->getAs<FunctionType>()->getResultType();
|
||||
return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee,
|
||||
ReturnValueSlot(), Args, MD);
|
||||
ReturnValue, Args, MD);
|
||||
}
|
||||
|
||||
/// canDevirtualizeMemberFunctionCalls - Checks whether virtual calls on given
|
||||
|
@ -78,9 +79,10 @@ static bool canDevirtualizeMemberFunctionCalls(const Expr *Base) {
|
|||
return false;
|
||||
}
|
||||
|
||||
RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) {
|
||||
RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE,
|
||||
ReturnValueSlot ReturnValue) {
|
||||
if (isa<BinaryOperator>(CE->getCallee()->IgnoreParens()))
|
||||
return EmitCXXMemberPointerCallExpr(CE);
|
||||
return EmitCXXMemberPointerCallExpr(CE, ReturnValue);
|
||||
|
||||
const MemberExpr *ME = cast<MemberExpr>(CE->getCallee()->IgnoreParens());
|
||||
const CXXMethodDecl *MD = cast<CXXMethodDecl>(ME->getMemberDecl());
|
||||
|
@ -89,7 +91,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) {
|
|||
// The method is static, emit it as we would a regular call.
|
||||
llvm::Value *Callee = CGM.GetAddrOfFunction(MD);
|
||||
return EmitCall(getContext().getPointerType(MD->getType()), Callee,
|
||||
ReturnValueSlot(), CE->arg_begin(), CE->arg_end());
|
||||
ReturnValue, CE->arg_begin(), CE->arg_end());
|
||||
}
|
||||
|
||||
const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
|
||||
|
@ -138,12 +140,13 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) {
|
|||
Callee = CGM.GetAddrOfFunction(MD, Ty);
|
||||
}
|
||||
|
||||
return EmitCXXMemberCall(MD, Callee, This,
|
||||
return EmitCXXMemberCall(MD, Callee, ReturnValue, This,
|
||||
CE->arg_begin(), CE->arg_end());
|
||||
}
|
||||
|
||||
RValue
|
||||
CodeGenFunction::EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E) {
|
||||
CodeGenFunction::EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E,
|
||||
ReturnValueSlot ReturnValue) {
|
||||
const BinaryOperator *BO =
|
||||
cast<BinaryOperator>(E->getCallee()->IgnoreParens());
|
||||
const Expr *BaseExpr = BO->getLHS();
|
||||
|
@ -247,12 +250,13 @@ CodeGenFunction::EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E) {
|
|||
EmitCallArgs(Args, FPT, E->arg_begin(), E->arg_end());
|
||||
QualType ResultType = BO->getType()->getAs<FunctionType>()->getResultType();
|
||||
return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee,
|
||||
ReturnValueSlot(), Args);
|
||||
ReturnValue, Args);
|
||||
}
|
||||
|
||||
RValue
|
||||
CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
|
||||
const CXXMethodDecl *MD) {
|
||||
const CXXMethodDecl *MD,
|
||||
ReturnValueSlot ReturnValue) {
|
||||
assert(MD->isInstance() &&
|
||||
"Trying to emit a member call expr on a static method!");
|
||||
|
||||
|
@ -282,7 +286,7 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
|
|||
else
|
||||
Callee = CGM.GetAddrOfFunction(MD, Ty);
|
||||
|
||||
return EmitCXXMemberCall(MD, Callee, This,
|
||||
return EmitCXXMemberCall(MD, Callee, ReturnValue, This,
|
||||
E->arg_begin() + 1, E->arg_end());
|
||||
}
|
||||
|
||||
|
@ -526,7 +530,7 @@ CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D,
|
|||
|
||||
llvm::Value *Callee = CGM.GetAddrOfCXXConstructor(D, Type);
|
||||
|
||||
EmitCXXMemberCall(D, Callee, This, ArgBeg, ArgEnd);
|
||||
EmitCXXMemberCall(D, Callee, ReturnValueSlot(), This, ArgBeg, ArgEnd);
|
||||
}
|
||||
|
||||
void CodeGenFunction::EmitCXXDestructorCall(const CXXDestructorDecl *DD,
|
||||
|
|
|
@ -1522,10 +1522,10 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
|
|||
ReturnValueSlot ReturnValue) {
|
||||
// Builtins never have block type.
|
||||
if (E->getCallee()->getType()->isBlockPointerType())
|
||||
return EmitBlockCallExpr(E);
|
||||
return EmitBlockCallExpr(E, ReturnValue);
|
||||
|
||||
if (const CXXMemberCallExpr *CE = dyn_cast<CXXMemberCallExpr>(E))
|
||||
return EmitCXXMemberCallExpr(CE);
|
||||
return EmitCXXMemberCallExpr(CE, ReturnValue);
|
||||
|
||||
const Decl *TargetDecl = 0;
|
||||
if (const ImplicitCastExpr *CE = dyn_cast<ImplicitCastExpr>(E->getCallee())) {
|
||||
|
@ -1539,7 +1539,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
|
|||
|
||||
if (const CXXOperatorCallExpr *CE = dyn_cast<CXXOperatorCallExpr>(E))
|
||||
if (const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(TargetDecl))
|
||||
return EmitCXXOperatorMemberCallExpr(CE, MD);
|
||||
return EmitCXXOperatorMemberCallExpr(CE, MD, ReturnValue);
|
||||
|
||||
if (isa<CXXPseudoDestructorExpr>(E->getCallee()->IgnoreParens())) {
|
||||
// C++ [expr.pseudo]p1:
|
||||
|
|
|
@ -406,7 +406,7 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) {
|
|||
/*isVariadic=*/false);
|
||||
|
||||
llvm::Value *Callee = BuildVirtualCall(Dtor, Dtor_Deleting, Ptr, Ty);
|
||||
EmitCXXMemberCall(Dtor, Callee, Ptr, 0, 0);
|
||||
EmitCXXMemberCall(Dtor, Callee, ReturnValueSlot(), Ptr, 0, 0);
|
||||
|
||||
// The dtor took care of deleting the object.
|
||||
ShouldCallDelete = false;
|
||||
|
|
|
@ -1055,20 +1055,24 @@ public:
|
|||
|
||||
RValue EmitCXXMemberCall(const CXXMethodDecl *MD,
|
||||
llvm::Value *Callee,
|
||||
ReturnValueSlot ReturnValue,
|
||||
llvm::Value *This,
|
||||
CallExpr::const_arg_iterator ArgBeg,
|
||||
CallExpr::const_arg_iterator ArgEnd);
|
||||
RValue EmitCXXMemberCallExpr(const CXXMemberCallExpr *E);
|
||||
RValue EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E);
|
||||
RValue EmitCXXMemberCallExpr(const CXXMemberCallExpr *E,
|
||||
ReturnValueSlot ReturnValue);
|
||||
RValue EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E,
|
||||
ReturnValueSlot ReturnValue);
|
||||
|
||||
RValue EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
|
||||
const CXXMethodDecl *MD);
|
||||
const CXXMethodDecl *MD,
|
||||
ReturnValueSlot ReturnValue);
|
||||
|
||||
|
||||
RValue EmitBuiltinExpr(const FunctionDecl *FD,
|
||||
unsigned BuiltinID, const CallExpr *E);
|
||||
|
||||
RValue EmitBlockCallExpr(const CallExpr *E);
|
||||
RValue EmitBlockCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue);
|
||||
|
||||
/// EmitTargetBuiltinExpr - Emit the given builtin call. Returns 0 if the call
|
||||
/// is unhandled by the current target.
|
||||
|
|
Loading…
Reference in New Issue