]> granicus.if.org Git - clang/commitdiff
Pass ReturnValueSlot to EmitCall. No functionality change yet.
authorAnders Carlsson <andersca@mac.com>
Thu, 24 Dec 2009 19:25:24 +0000 (19:25 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 24 Dec 2009 19:25:24 +0000 (19:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92138 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBlocks.cpp
lib/CodeGen/CGCXX.cpp
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CGException.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGExprCXX.cpp
lib/CodeGen/CGObjC.cpp
lib/CodeGen/CGObjCGNU.cpp
lib/CodeGen/CGObjCMac.cpp
lib/CodeGen/CodeGenFunction.h

index 9e44db0aa0a75a47094d80eb1d65d41891eefbf7..2270f84b5be51b3dcf62ff999c091675df6e01cb 100644 (file)
@@ -509,7 +509,7 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) {
   Func = Builder.CreateBitCast(Func, BlockFTyPtr);
 
   // And call the block.
-  return EmitCall(FnInfo, Func, Args);
+  return EmitCall(FnInfo, Func, ReturnValueSlot(), Args);
 }
 
 uint64_t CodeGenFunction::AllocateBlockDecl(const BlockDeclRefExpr *E) {
index 5b13ff831a4869ace342fc3f35b7eda889b61dae..40d41d9165dad2893671575ace05ce8fe52f7ebf 100644 (file)
@@ -46,8 +46,8 @@ RValue CodeGenFunction::EmitCXXMemberCall(const CXXMethodDecl *MD,
   EmitCallArgs(Args, FPT, ArgBeg, ArgEnd);
 
   QualType ResultType = MD->getType()->getAs<FunctionType>()->getResultType();
-  return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args),
-                  Callee, Args, MD);
+  return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee, 
+                  ReturnValueSlot(), Args, MD);
 }
 
 /// canDevirtualizeMemberFunctionCalls - Checks whether virtual calls on given
@@ -246,8 +246,8 @@ CodeGenFunction::EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E) {
   // And the rest of the call args
   EmitCallArgs(Args, FPT, E->arg_begin(), E->arg_end());
   QualType ResultType = BO->getType()->getAs<FunctionType>()->getResultType();
-  return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args),
-                  Callee, Args, 0);
+  return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee, 
+                  ReturnValueSlot(), Args);
 }
 
 RValue
@@ -551,7 +551,8 @@ void CodeGenFunction::EmitCXXDestructorCall(const CXXDestructorDecl *DD,
   // FIXME: We should try to share this code with EmitCXXMemberCall.
   
   QualType ResultType = DD->getType()->getAs<FunctionType>()->getResultType();
-  EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee, Args, DD);
+  EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee, 
+           ReturnValueSlot(), Args, DD);
 }
 
 void
@@ -801,7 +802,7 @@ CodeGenFunction::GenerateCovariantThunk(llvm::Function *Fn,
   }
 
   RValue RV = EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
-                       Callee, CallArgs, MD);
+                       Callee, ReturnValueSlot(), CallArgs, MD);
   if (ShouldAdjustReturnPointer && !Adjustment.ReturnAdjustment.isEmpty()) {
     bool CanBeZero = !(ResultType->isReferenceType()
     // FIXME: attr nonnull can't be zero either
@@ -1111,7 +1112,7 @@ void CodeGenFunction::EmitClassAggrMemberwiseCopy(llvm::Value *Dest,
     QualType ResultType =
       BaseCopyCtor->getType()->getAs<FunctionType>()->getResultType();
     EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
-             Callee, CallArgs, BaseCopyCtor);
+             Callee, ReturnValueSlot(), CallArgs, BaseCopyCtor);
   }
   EmitBlock(ContinueBlock);
 
@@ -1195,7 +1196,7 @@ void CodeGenFunction::EmitClassAggrCopyAssignment(llvm::Value *Dest,
                                       MD->getParamDecl(0)->getType()));
     QualType ResultType = MD->getType()->getAs<FunctionType>()->getResultType();
     EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
-             Callee, CallArgs, MD);
+             Callee, ReturnValueSlot(), CallArgs, MD);
   }
   EmitBlock(ContinueBlock);
 
@@ -1245,7 +1246,7 @@ void CodeGenFunction::EmitClassMemberwiseCopy(
     QualType ResultType =
     BaseCopyCtor->getType()->getAs<FunctionType>()->getResultType();
     EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
-             Callee, CallArgs, BaseCopyCtor);
+             Callee, ReturnValueSlot(), CallArgs, BaseCopyCtor);
   }
 }
 
@@ -1292,7 +1293,7 @@ void CodeGenFunction::EmitClassCopyAssignment(
   QualType ResultType =
     MD->getType()->getAs<FunctionType>()->getResultType();
   EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
-           Callee, CallArgs, MD);
+           Callee, ReturnValueSlot(), CallArgs, MD);
 }
 
 /// SynthesizeDefaultConstructor - synthesize a default constructor
index 4856f5404c1aeb5bad015f7c457825bee004caf6..33692ca35afa54df62d2efa08067a8b1a5178695 100644 (file)
@@ -809,6 +809,7 @@ RValue CodeGenFunction::EmitCallArg(const Expr *E, QualType ArgType) {
 
 RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
                                  llvm::Value *Callee,
+                                 ReturnValueSlot ReturnValue,
                                  const CallArgList &CallArgs,
                                  const Decl *TargetDecl) {
   // FIXME: We no longer need the types from CallArgs; lift up and simplify.
index 23af59c2b42bf31004d12c260de624fdc30a1b20..602cc9efc7a0be8d659f67616ac254cac8b9fe15 100644 (file)
@@ -643,7 +643,7 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
       Args.push_back(std::make_pair(RValue::get(Builder.CreateBitCast(DeclPtr,
                                                            ConvertType(ArgTy))),
                                     getContext().getPointerType(D.getType())));
-      EmitCall(Info, F, Args);
+      EmitCall(Info, F, ReturnValueSlot(), Args);
     }
     if (Exceptions) {
       EHCleanupBlock Cleanup(*this);
@@ -652,7 +652,7 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
       Args.push_back(std::make_pair(RValue::get(Builder.CreateBitCast(DeclPtr,
                                                            ConvertType(ArgTy))),
                                     getContext().getPointerType(D.getType())));
-      EmitCall(Info, F, Args);
+      EmitCall(Info, F, ReturnValueSlot(), Args);
     }
   }
 
index 63e8679408e4d228c903bdeb352df6e4b226ffb0..8b37457ccdf4ca707931d6f3e327f389b6bf3b72 100644 (file)
@@ -197,7 +197,7 @@ static void CopyObject(CodeGenFunction &CGF, const Expr *E,
       QualType ResultType =
         CopyCtor->getType()->getAs<FunctionType>()->getResultType();
       CGF.EmitCall(CGF.CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
-                   Callee, CallArgs, CopyCtor);
+                   Callee, ReturnValueSlot(), CallArgs, CopyCtor);
       CGF.setInvokeDest(PrevLandingPad);
     } else
       llvm_unreachable("uncopyable object");
@@ -239,7 +239,7 @@ static void CopyObject(CodeGenFunction &CGF, QualType ObjectType,
       QualType ResultType =
         CopyCtor->getType()->getAs<FunctionType>()->getResultType();
       CGF.EmitCall(CGF.CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
-                   Callee, CallArgs, CopyCtor);
+                   Callee, ReturnValueSlot(), CallArgs, CopyCtor);
     } else
       llvm_unreachable("uncopyable object");
   }
index cda348fefb7c7331e9e064684f9a58984d673381..add6dc5310fc0fdef0b90eb28fc1b96fae202c68 100644 (file)
@@ -1737,7 +1737,7 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, llvm::Value *Callee,
     CallingConvention = F->getCallingConv();
   return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args,
                                                  CallingConvention),
-                  Callee, Args, TargetDecl);
+                  Callee, ReturnValueSlot(), Args, TargetDecl);
 }
 
 LValue CodeGenFunction::
index 54e6b0141fe8fdc44210175815b8b224ccb2ca49..f16c7a2f453719d85c5a0ffcc4918e78e606ab84 100644 (file)
@@ -212,7 +212,7 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
   // Emit the call to new.
   RValue RV =
     EmitCall(CGM.getTypes().getFunctionInfo(NewFTy->getResultType(), NewArgs),
-             CGM.GetAddrOfFunction(NewFD), NewArgs, NewFD);
+             CGM.GetAddrOfFunction(NewFD), ReturnValueSlot(), NewArgs, NewFD);
 
   // If an allocation function is declared with an empty exception specification
   // it returns null to indicate failure to allocate storage. [expr.new]p13.
@@ -354,7 +354,7 @@ void CodeGenFunction::EmitDeleteCall(const FunctionDecl *DeleteFD,
   // Emit the call to delete.
   EmitCall(CGM.getTypes().getFunctionInfo(DeleteFTy->getResultType(),
                                           DeleteArgs),
-           CGM.GetAddrOfFunction(DeleteFD),
+           CGM.GetAddrOfFunction(DeleteFD), ReturnValueSlot(), 
            DeleteArgs, DeleteFD);
 }
 
index 2fe3f5b1b443430cf7508be531eb44ba601e2ebf..ac391d99a150dfd334ff1e5ac618da83758b83ab 100644 (file)
@@ -190,7 +190,7 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP,
     // FIXME: We shouldn't need to get the function info here, the
     // runtime already should have computed it to build the function.
     RValue RV = EmitCall(Types.getFunctionInfo(PD->getType(), Args),
-                         GetPropertyFn, Args);
+                         GetPropertyFn, ReturnValueSlot(), Args);
     // We need to fix the type here. Ivars with copy & retain are
     // always objects so we don't need to worry about complex or
     // aggregates.
@@ -277,8 +277,8 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP,
                                   getContext().BoolTy));
     // FIXME: We shouldn't need to get the function info here, the runtime
     // already should have computed it to build the function.
-    EmitCall(Types.getFunctionInfo(getContext().VoidTy, Args),
-             SetPropertyFn, Args);
+    EmitCall(Types.getFunctionInfo(getContext().VoidTy, Args), SetPropertyFn, 
+             ReturnValueSlot(), Args);
   } else {
     // FIXME: Find a clean way to avoid AST node creation.
     SourceLocation Loc = PD->getLocation();
@@ -553,7 +553,7 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
   // FIXME: We shouldn't need to get the function info here, the runtime already
   // should have computed it to build the function.
   EmitCall(CGM.getTypes().getFunctionInfo(getContext().VoidTy, Args2),
-           EnumerationMutationFn, Args2);
+           EnumerationMutationFn, ReturnValueSlot(), Args2);
 
   EmitBlock(WasNotMutated);
 
index fce0cf18db276b9ec23113da60026905eaae33f2..95f67ae36a1e0bb408bb91f8c91088ed1ff9f788 100644 (file)
@@ -450,7 +450,7 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF,
   llvm::Value *imp = CGF.Builder.CreateCall(lookupFunction, lookupArgs,
       lookupArgs+2);
 
-  return CGF.EmitCall(FnInfo, imp, ActualArgs);
+  return CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs);
 }
 
 /// Generate code for a message send expression.
@@ -536,7 +536,7 @@ CGObjCGNU::GenerateMessageSend(CodeGen::CodeGenFunction &CGF,
     imp = Builder.CreateCall2(lookupFunction, Receiver, cmd);
   }
 
-  return CGF.EmitCall(FnInfo, imp, ActualArgs);
+  return CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs);
 }
 
 /// Generates a MethodList.  Used in construction of a objc_class and
index fb920f0b09ee53e956f09d0e2e4e3cf3d303ffbb..90df7a350104de73f282e89e6a742552772d8490 100644 (file)
@@ -1581,7 +1581,7 @@ CGObjCCommonMac::EmitLegacyMessageSend(CodeGen::CodeGenFunction &CGF,
   assert(Fn && "EmitLegacyMessageSend - unknown API");
   Fn = llvm::ConstantExpr::getBitCast(Fn,
                                       llvm::PointerType::getUnqual(FTy));
-  return CGF.EmitCall(FnInfo, Fn, ActualArgs);
+  return CGF.EmitCall(FnInfo, Fn, ReturnValueSlot(), ActualArgs);
 }
 
 llvm::Value *CGObjCMac::GenerateProtocolRef(CGBuilderTy &Builder,
@@ -5169,7 +5169,7 @@ CodeGen::RValue CGObjCNonFragileABIMac::EmitMessageSend(
   const llvm::FunctionType *FTy = Types.GetFunctionType(FnInfo1, true);
   Callee = CGF.Builder.CreateBitCast(Callee,
                                      llvm::PointerType::getUnqual(FTy));
-  return CGF.EmitCall(FnInfo1, Callee, ActualArgs);
+  return CGF.EmitCall(FnInfo1, Callee, ReturnValueSlot(), ActualArgs);
 }
 
 /// Generate code for a message send expression in the nonfragile abi.
index d28dd47ea57673148f72093cd8f587c100178e90..b530a919ef306bc3839e59b0ef4c95c3020fe979 100644 (file)
@@ -1036,6 +1036,7 @@ public:
   /// used to set attributes on the call (noreturn, etc.).
   RValue EmitCall(const CGFunctionInfo &FnInfo,
                   llvm::Value *Callee,
+                  ReturnValueSlot ReturnValue,
                   const CallArgList &Args,
                   const Decl *TargetDecl = 0);