Change CodeGen to emit calls using (RValue,Type) list:
 - Add CodeGenFunction::EmitAnyExprToTemp
   o Like EmitAnyExpr, but emits aggregates to a temporary location if
     none is available. Seems like this should be simpler (even aside
     from using first class aggregates).

 - Killed CodeGenFunction::EmitCallArg (just append the pair)

 - Conversion of RValues to actual call arguments is now isolated in
   CodeGenFunction::EmitCall.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55970 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 8660d96..7242d01 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -83,7 +83,7 @@
   CallArgList Args;
   for (CallExpr::const_arg_iterator i = E->arg_begin(), e = E->arg_end(); 
        i != e; ++i)
-    EmitCallArg(*i, Args);
+    Args.push_back(std::make_pair(EmitAnyExprToTemp(*i), (*i)->getType()));
   
   if (isSuperMessage) {
     // super is only valid in an Objective-C method
@@ -268,7 +268,7 @@
   }
 
   CallArgList Args;
-  EmitCallArg(Src, E->getType(), Args);
+  Args.push_back(std::make_pair(Src, E->getType()));
   CGM.getObjCRuntime().GenerateMessageSend(*this, getContext().VoidTy, S, 
                                            EmitScalarExpr(E->getBase()), 
                                            false, Args);
@@ -316,15 +316,16 @@
   llvm::Value *Collection = EmitScalarExpr(S.getCollection());
   
   CallArgList Args;
-  Args.push_back(std::make_pair(StatePtr, 
+  Args.push_back(std::make_pair(RValue::get(StatePtr), 
                                 getContext().getPointerType(StateTy)));
   
-  Args.push_back(std::make_pair(ItemsPtr, 
+  Args.push_back(std::make_pair(RValue::get(ItemsPtr), 
                                 getContext().getPointerType(ItemsTy)));
   
   const llvm::Type *UnsignedLongLTy = ConvertType(getContext().UnsignedLongTy);
   llvm::Constant *Count = llvm::ConstantInt::get(UnsignedLongLTy, NumItems);
-  Args.push_back(std::make_pair(Count, getContext().UnsignedLongTy));
+  Args.push_back(std::make_pair(RValue::get(Count), 
+                                getContext().UnsignedLongTy));
   
   RValue CountRV = 
     CGM.getObjCRuntime().GenerateMessageSend(*this,