[cfe-commits] r130699 - in /cfe/trunk/lib/CodeGen: CGBlocks.cpp CGClass.cpp CGDecl.cpp CGExprCXX.cpp CGObjC.cpp CGObjCGNU.cpp CGObjCMac.cpp CGVTables.cpp

Eli Friedman eli.friedman at gmail.com
Mon May 2 10:57:46 PDT 2011


Author: efriedma
Date: Mon May  2 12:57:46 2011
New Revision: 130699

URL: http://llvm.org/viewvc/llvm-project?rev=130699&view=rev
Log:
Simplify code a bit by using CallArgList::add.  No intended functionality change.


Modified:
    cfe/trunk/lib/CodeGen/CGBlocks.cpp
    cfe/trunk/lib/CodeGen/CGClass.cpp
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CGExprCXX.cpp
    cfe/trunk/lib/CodeGen/CGObjC.cpp
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/CodeGen/CGVTables.cpp

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=130699&r1=130698&r2=130699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon May  2 12:57:46 2011
@@ -722,7 +722,7 @@
   // Add the block literal.
   QualType VoidPtrTy = getContext().getPointerType(getContext().VoidTy);
   CallArgList Args;
-  Args.push_back(std::make_pair(RValue::get(BlockLiteral), VoidPtrTy));
+  Args.add(RValue::get(BlockLiteral), VoidPtrTy);
 
   QualType FnType = BPT->getPointeeType();
 

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=130699&r1=130698&r2=130699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Mon May  2 12:57:46 2011
@@ -1199,15 +1199,14 @@
   CallArgList Args;
   
   // Push the this ptr.
-  Args.push_back(std::make_pair(RValue::get(This),
-                                D->getThisType(getContext())));
+  Args.add(RValue::get(This), D->getThisType(getContext()));
   
   
   // Push the src ptr.
   QualType QT = *(FPT->arg_type_begin());
   const llvm::Type *t = CGM.getTypes().ConvertType(QT);
   Src = Builder.CreateBitCast(Src, t);
-  Args.push_back(std::make_pair(RValue::get(Src), QT));
+  Args.add(RValue::get(Src), QT);
   
   // Skip over first argument (Src).
   ++ArgBeg;
@@ -1243,15 +1242,14 @@
   assert(I != E && "no parameters to constructor");
 
   // this
-  DelegateArgs.push_back(std::make_pair(RValue::get(LoadCXXThis()),
-                                        (*I)->getType()));
+  DelegateArgs.add(RValue::get(LoadCXXThis()), (*I)->getType());
   ++I;
 
   // vtt
   if (llvm::Value *VTT = GetVTTParameter(*this, GlobalDecl(Ctor, CtorType),
                                          /*ForVirtualBase=*/false)) {
     QualType VoidPP = getContext().getPointerType(getContext().VoidPtrTy);
-    DelegateArgs.push_back(std::make_pair(RValue::get(VTT), VoidPP));
+    DelegateArgs.add(RValue::get(VTT), VoidPP);
 
     if (CodeGenVTables::needsVTTParameter(CurGD)) {
       assert(I != E && "cannot skip vtt parameter, already done with args");

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=130699&r1=130698&r2=130699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Mon May  2 12:57:46 2011
@@ -392,8 +392,8 @@
         CGF.Builder.CreateBitCast(Addr, CGF.ConvertType(ArgTy));
 
       CallArgList Args;
-      Args.push_back(std::make_pair(RValue::get(Arg),
-                            CGF.getContext().getPointerType(Var.getType())));
+      Args.add(RValue::get(Arg),
+               CGF.getContext().getPointerType(Var.getType()));
       CGF.EmitCall(FnInfo, CleanupFn, ReturnValueSlot(), Args);
     }
   };

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=130699&r1=130698&r2=130699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Mon May  2 12:57:46 2011
@@ -37,13 +37,12 @@
   CallArgList Args;
 
   // Push the this ptr.
-  Args.push_back(std::make_pair(RValue::get(This),
-                                MD->getThisType(getContext())));
+  Args.add(RValue::get(This), MD->getThisType(getContext()));
 
   // If there is a VTT parameter, emit it.
   if (VTT) {
     QualType T = getContext().getPointerType(getContext().VoidPtrTy);
-    Args.push_back(std::make_pair(RValue::get(VTT), T));
+    Args.add(RValue::get(VTT), T);
   }
   
   // And the rest of the call args
@@ -317,7 +316,7 @@
     getContext().getPointerType(getContext().getTagDeclType(RD));
 
   // Push the this ptr.
-  Args.push_back(std::make_pair(RValue::get(This), ThisType));
+  Args.add(RValue::get(This), ThisType);
   
   // And the rest of the call args
   EmitCallArgs(Args, FPT, E->arg_begin(), E->arg_end());
@@ -837,15 +836,15 @@
 
       // The first argument is always a void*.
       FunctionProtoType::arg_type_iterator AI = FPT->arg_type_begin();
-      DeleteArgs.push_back(std::make_pair(RValue::get(Ptr), *AI++));
+      DeleteArgs.add(RValue::get(Ptr), *AI++);
 
       // A member 'operator delete' can take an extra 'size_t' argument.
       if (FPT->getNumArgs() == NumPlacementArgs + 2)
-        DeleteArgs.push_back(std::make_pair(RValue::get(AllocSize), *AI++));
+        DeleteArgs.add(RValue::get(AllocSize), *AI++);
 
       // Pass the rest of the arguments, which must match exactly.
       for (unsigned I = 0; I != NumPlacementArgs; ++I)
-        DeleteArgs.push_back(std::make_pair(getPlacementArgs()[I], *AI++));
+        DeleteArgs.add(getPlacementArgs()[I], *AI++);
 
       // Call 'operator delete'.
       CGF.EmitCall(CGF.CGM.getTypes().getFunctionInfo(DeleteArgs, FPT),
@@ -894,18 +893,18 @@
 
       // The first argument is always a void*.
       FunctionProtoType::arg_type_iterator AI = FPT->arg_type_begin();
-      DeleteArgs.push_back(std::make_pair(Ptr.restore(CGF), *AI++));
+      DeleteArgs.add(Ptr.restore(CGF), *AI++);
 
       // A member 'operator delete' can take an extra 'size_t' argument.
       if (FPT->getNumArgs() == NumPlacementArgs + 2) {
         RValue RV = AllocSize.restore(CGF);
-        DeleteArgs.push_back(std::make_pair(RV, *AI++));
+        DeleteArgs.add(RV, *AI++);
       }
 
       // Pass the rest of the arguments, which must match exactly.
       for (unsigned I = 0; I != NumPlacementArgs; ++I) {
         RValue RV = getPlacementArgs()[I].restore(CGF);
-        DeleteArgs.push_back(std::make_pair(RV, *AI++));
+        DeleteArgs.add(RV, *AI++);
       }
 
       // Call 'operator delete'.
@@ -976,7 +975,7 @@
     EmitCXXNewAllocSize(getContext(), *this, E, numElements,
                         allocSizeWithoutCookie);
   
-  allocatorArgs.push_back(std::make_pair(RValue::get(allocSize), sizeType));
+  allocatorArgs.add(RValue::get(allocSize), sizeType);
 
   // Emit the rest of the arguments.
   // FIXME: Ideally, this should just use EmitCallArgs.
@@ -1123,10 +1122,10 @@
   
   QualType ArgTy = DeleteFTy->getArgType(0);
   llvm::Value *DeletePtr = Builder.CreateBitCast(Ptr, ConvertType(ArgTy));
-  DeleteArgs.push_back(std::make_pair(RValue::get(DeletePtr), ArgTy));
+  DeleteArgs.add(RValue::get(DeletePtr), ArgTy);
 
   if (Size)
-    DeleteArgs.push_back(std::make_pair(RValue::get(Size), SizeTy));
+    DeleteArgs.add(RValue::get(Size), SizeTy);
 
   // Emit the call to delete.
   EmitCall(CGM.getTypes().getFunctionInfo(DeleteArgs, DeleteFTy),
@@ -1223,7 +1222,7 @@
       QualType VoidPtrTy = DeleteFTy->getArgType(0);
       llvm::Value *DeletePtr
         = CGF.Builder.CreateBitCast(Ptr, CGF.ConvertType(VoidPtrTy));
-      Args.push_back(std::make_pair(RValue::get(DeletePtr), VoidPtrTy));
+      Args.add(RValue::get(DeletePtr), VoidPtrTy);
 
       // Pass the original requested size as the second argument.
       if (DeleteFTy->getNumArgs() == 2) {
@@ -1246,7 +1245,7 @@
           Size = CGF.Builder.CreateAdd(Size, CookieSizeV);
         }
 
-        Args.push_back(std::make_pair(RValue::get(Size), size_t));
+        Args.add(RValue::get(Size), size_t);
       }
 
       // Emit the call to delete.

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=130699&r1=130698&r2=130699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Mon May  2 12:57:46 2011
@@ -153,27 +153,24 @@
   CallArgList Args;
   RValue RV = RValue::get(Builder.CreateBitCast(ReturnValue,
                                                 Types.ConvertType(getContext().VoidPtrTy)));
-  Args.push_back(std::make_pair(RV, getContext().VoidPtrTy));
+  Args.add(RV, getContext().VoidPtrTy);
   RV = RValue::get(Builder.CreateBitCast(LV.getAddress(),
                                          Types.ConvertType(getContext().VoidPtrTy)));
-  Args.push_back(std::make_pair(RV, getContext().VoidPtrTy));
+  Args.add(RV, getContext().VoidPtrTy);
   // sizeof (Type of Ivar)
   CharUnits Size =  getContext().getTypeSizeInChars(Ivar->getType());
   llvm::Value *SizeVal =
   llvm::ConstantInt::get(Types.ConvertType(getContext().LongTy), 
                          Size.getQuantity());
-  Args.push_back(std::make_pair(RValue::get(SizeVal),
-                                getContext().LongTy));
+  Args.add(RValue::get(SizeVal), getContext().LongTy);
   llvm::Value *isAtomic =
   llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 
                          IsAtomic ? 1 : 0);
-  Args.push_back(std::make_pair(RValue::get(isAtomic), 
-                                getContext().BoolTy));
+  Args.add(RValue::get(isAtomic), getContext().BoolTy);
   llvm::Value *hasStrong =
   llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 
                          IsStrong ? 1 : 0);
-  Args.push_back(std::make_pair(RValue::get(hasStrong), 
-                                getContext().BoolTy));
+  Args.add(RValue::get(hasStrong), getContext().BoolTy);
   EmitCall(Types.getFunctionInfo(getContext().VoidTy, Args,
                                  FunctionType::ExtInfo()),
            GetCopyStructFn, ReturnValueSlot(), Args);
@@ -234,11 +231,10 @@
     llvm::Value *True =
       llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 1);
     CallArgList Args;
-    Args.push_back(std::make_pair(RValue::get(SelfAsId), IdTy));
-    Args.push_back(std::make_pair(RValue::get(CmdVal), Cmd->getType()));
-    Args.push_back(std::make_pair(RValue::get(Offset),
-                getContext().getPointerDiffType()));
-    Args.push_back(std::make_pair(RValue::get(True), getContext().BoolTy));
+    Args.add(RValue::get(SelfAsId), IdTy);
+    Args.add(RValue::get(CmdVal), Cmd->getType());
+    Args.add(RValue::get(Offset), getContext().getPointerDiffType());
+    Args.add(RValue::get(True), getContext().BoolTy);
     // 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,
@@ -357,26 +353,25 @@
   RValue RV =
     RValue::get(Builder.CreateBitCast(LV.getAddress(),
                 Types.ConvertType(getContext().VoidPtrTy)));
-  Args.push_back(std::make_pair(RV, getContext().VoidPtrTy));
+  Args.add(RV, getContext().VoidPtrTy);
   llvm::Value *Arg = LocalDeclMap[*OMD->param_begin()];
   llvm::Value *ArgAsPtrTy =
   Builder.CreateBitCast(Arg,
                       Types.ConvertType(getContext().VoidPtrTy));
   RV = RValue::get(ArgAsPtrTy);
-  Args.push_back(std::make_pair(RV, getContext().VoidPtrTy));
+  Args.add(RV, getContext().VoidPtrTy);
   // sizeof (Type of Ivar)
   CharUnits Size =  getContext().getTypeSizeInChars(Ivar->getType());
   llvm::Value *SizeVal =
   llvm::ConstantInt::get(Types.ConvertType(getContext().LongTy), 
                          Size.getQuantity());
-  Args.push_back(std::make_pair(RValue::get(SizeVal),
-                                getContext().LongTy));
+  Args.add(RValue::get(SizeVal), getContext().LongTy);
   llvm::Value *True =
   llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 1);
-  Args.push_back(std::make_pair(RValue::get(True), getContext().BoolTy));
+  Args.add(RValue::get(True), getContext().BoolTy);
   llvm::Value *False =
   llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 0);
-  Args.push_back(std::make_pair(RValue::get(False), getContext().BoolTy));
+  Args.add(RValue::get(False), getContext().BoolTy);
   EmitCall(Types.getFunctionInfo(getContext().VoidTy, Args,
                                  FunctionType::ExtInfo()),
            GetCopyStructFn, ReturnValueSlot(), Args);
@@ -446,15 +441,12 @@
     llvm::Value *False =
       llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 0);
     CallArgList Args;
-    Args.push_back(std::make_pair(RValue::get(SelfAsId), IdTy));
-    Args.push_back(std::make_pair(RValue::get(CmdVal), Cmd->getType()));
-    Args.push_back(std::make_pair(RValue::get(Offset),
-                getContext().getPointerDiffType()));
-    Args.push_back(std::make_pair(RValue::get(ArgAsId), IdTy));
-    Args.push_back(std::make_pair(RValue::get(IsAtomic ? True : False),
-                                  getContext().BoolTy));
-    Args.push_back(std::make_pair(RValue::get(IsCopy ? True : False),
-                                  getContext().BoolTy));
+    Args.add(RValue::get(SelfAsId), IdTy);
+    Args.add(RValue::get(CmdVal), Cmd->getType());
+    Args.add(RValue::get(Offset), getContext().getPointerDiffType());
+    Args.add(RValue::get(ArgAsId), IdTy);
+    Args.add(RValue::get(IsAtomic ? True : False),  getContext().BoolTy);
+    Args.add(RValue::get(IsCopy ? True : False), 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,
@@ -760,7 +752,7 @@
   }
   
   CallArgList Args;
-  Args.push_back(std::make_pair(Src, ArgType));
+  Args.add(Src, ArgType);
 
   llvm::Value *Receiver = Dst.getPropertyRefBaseAddr();
   QualType ResultType = getContext().VoidTy;
@@ -832,22 +824,19 @@
   CallArgList Args;
 
   // The first argument is a temporary of the enumeration-state type.
-  Args.push_back(std::make_pair(RValue::get(StatePtr),
-                                getContext().getPointerType(StateTy)));
+  Args.add(RValue::get(StatePtr), getContext().getPointerType(StateTy));
 
   // The second argument is a temporary array with space for NumItems
   // pointers.  We'll actually be loading elements from the array
   // pointer written into the control state; this buffer is so that
   // collections that *aren't* backed by arrays can still queue up
   // batches of elements.
-  Args.push_back(std::make_pair(RValue::get(ItemsPtr),
-                                getContext().getPointerType(ItemsTy)));
+  Args.add(RValue::get(ItemsPtr), getContext().getPointerType(ItemsTy));
 
   // The third argument is the capacity of that temporary array.
   const llvm::Type *UnsignedLongLTy = ConvertType(getContext().UnsignedLongTy);
   llvm::Constant *Count = llvm::ConstantInt::get(UnsignedLongLTy, NumItems);
-  Args.push_back(std::make_pair(RValue::get(Count),
-                                getContext().UnsignedLongTy));
+  Args.add(RValue::get(Count), getContext().UnsignedLongTy);
 
   // Start the enumeration.
   RValue CountRV =
@@ -916,8 +905,7 @@
                           ConvertType(getContext().getObjCIdType()),
                           "tmp");
   CallArgList Args2;
-  Args2.push_back(std::make_pair(RValue::get(V),
-                                getContext().getObjCIdType()));
+  Args2.add(RValue::get(V), getContext().getObjCIdType());
   // 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,

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=130699&r1=130698&r2=130699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Mon May  2 12:57:46 2011
@@ -960,11 +960,8 @@
 
   CallArgList ActualArgs;
 
-  ActualArgs.push_back(
-      std::make_pair(RValue::get(EnforceType(Builder, Receiver, IdTy)),
-      ASTIdTy));
-  ActualArgs.push_back(std::make_pair(RValue::get(cmd),
-                                      CGF.getContext().getObjCSelType()));
+  ActualArgs.add(RValue::get(EnforceType(Builder, Receiver, IdTy)), ASTIdTy);
+  ActualArgs.add(RValue::get(cmd), CGF.getContext().getObjCSelType());
   ActualArgs.insert(ActualArgs.end(), CallArgs.begin(), CallArgs.end());
 
   CodeGenTypes &Types = CGM.getTypes();
@@ -1116,10 +1113,8 @@
   llvm::Value *imp = LookupIMP(CGF, Receiver, cmd, node);
 
   CallArgList ActualArgs;
-  ActualArgs.push_back(
-    std::make_pair(RValue::get(Receiver), ASTIdTy));
-  ActualArgs.push_back(std::make_pair(RValue::get(cmd),
-                                      CGF.getContext().getObjCSelType()));
+  ActualArgs.add(RValue::get(Receiver), ASTIdTy);
+  ActualArgs.add(RValue::get(cmd), CGF.getContext().getObjCSelType());
   ActualArgs.insert(ActualArgs.end(), CallArgs.begin(), CallArgs.end());
 
   CodeGenTypes &Types = CGM.getTypes();

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=130699&r1=130698&r2=130699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon May  2 12:57:46 2011
@@ -1522,9 +1522,8 @@
   CallArgList ActualArgs;
   if (!IsSuper)
     Arg0 = CGF.Builder.CreateBitCast(Arg0, ObjCTypes.ObjectPtrTy, "tmp");
-  ActualArgs.push_back(std::make_pair(RValue::get(Arg0), Arg0Ty));
-  ActualArgs.push_back(std::make_pair(RValue::get(Sel),
-                                      CGF.getContext().getObjCSelType()));
+  ActualArgs.add(RValue::get(Arg0), Arg0Ty);
+  ActualArgs.add(RValue::get(Sel), CGF.getContext().getObjCSelType());
   ActualArgs.insert(ActualArgs.end(), CallArgs.begin(), CallArgs.end());
 
   CodeGenTypes &Types = CGM.getTypes();
@@ -5596,9 +5595,8 @@
   llvm::Value *Arg1 = CGF.Builder.CreateBitCast(GV, ObjCTypes.MessageRefPtrTy);
 
   CallArgList ActualArgs;
-  ActualArgs.push_back(std::make_pair(RValue::get(Arg0), Arg0Ty));
-  ActualArgs.push_back(std::make_pair(RValue::get(Arg1),
-                                      ObjCTypes.MessageRefCPtrTy));
+  ActualArgs.add(RValue::get(Arg0), Arg0Ty);
+  ActualArgs.add(RValue::get(Arg1), ObjCTypes.MessageRefCPtrTy);
   ActualArgs.insert(ActualArgs.end(), CallArgs.begin(), CallArgs.end());
   const CGFunctionInfo &FnInfo1 = Types.getFunctionInfo(ResultType, ActualArgs,
                                                       FunctionType::ExtInfo());

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=130699&r1=130698&r2=130699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Mon May  2 12:57:46 2011
@@ -2675,7 +2675,7 @@
   CallArgList CallArgs;
   
   // Add our adjusted 'this' pointer.
-  CallArgs.push_back(std::make_pair(RValue::get(AdjustedThisPtr), ThisType));
+  CallArgs.add(RValue::get(AdjustedThisPtr), ThisType);
 
   // Add the rest of the parameters.
   for (FunctionDecl::param_const_iterator I = MD->param_begin(),





More information about the cfe-commits mailing list