[cfe-commits] r63571 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGCall.h

Daniel Dunbar daniel at zuster.org
Mon Feb 2 15:43:58 PST 2009


Author: ddunbar
Date: Mon Feb  2 17:43:58 2009
New Revision: 63571

URL: http://llvm.org/viewvc/llvm-project?rev=63571&view=rev
Log:
Change CGFunctionInfo args iterator to not include the return type.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CGCall.h

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=63571&r1=63570&r2=63571&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Feb  2 17:43:58 2009
@@ -97,11 +97,11 @@
   ArgTypes.insert(ArgTypes.end(), ArgTys.begin(), ArgTys.end());
 }
 
-ArgTypeIterator CGFunctionInfo::argtypes_begin() const {
-  return ArgTypes.begin();
+CGFunctionInfo::arg_iterator CGFunctionInfo::arg_begin() const {
+  return ArgTypes.begin()+1;
 }
 
-ArgTypeIterator CGFunctionInfo::argtypes_end() const {
+CGFunctionInfo::arg_iterator CGFunctionInfo::arg_end() const {
   return ArgTypes.end();
 }
 
@@ -965,8 +965,7 @@
 
   const llvm::Type *ResultType = 0;
 
-  ArgTypeIterator begin = FI.argtypes_begin(), end = FI.argtypes_end();  
-  QualType RetTy = *begin;
+  QualType RetTy = FI.getReturnType();
   ABIArgInfo RetAI = getABIReturnInfo(RetTy, *this);
   switch (RetAI.getKind()) {
   case ABIArgInfo::ByVal:
@@ -997,9 +996,10 @@
     break;
   }
   
-  for (++begin; begin != end; ++begin) {
-    ABIArgInfo AI = getABIArgumentInfo(*begin, *this);
-    const llvm::Type *Ty = ConvertType(*begin);
+  for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end(); 
+       it != ie; ++it) {
+    ABIArgInfo AI = getABIArgumentInfo(*it, *this);
+    const llvm::Type *Ty = ConvertType(*it);
     
     switch (AI.getKind()) {
     case ABIArgInfo::Ignore:
@@ -1020,7 +1020,7 @@
       break;
      
     case ABIArgInfo::Expand:
-      GetExpandedTypes(*begin, ArgTys);
+      GetExpandedTypes(*it, ArgTys);
       break;
     }
   }
@@ -1028,7 +1028,7 @@
   return llvm::FunctionType::get(ResultType, ArgTys, IsVariadic);
 }
 
-void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &Info,
+void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
                                            const Decl *TargetDecl,
                                            AttributeListType &PAL) {
   unsigned FuncAttrs = 0;
@@ -1045,8 +1045,7 @@
       FuncAttrs |= llvm::Attribute::ReadNone;
   }
 
-  ArgTypeIterator begin = Info.argtypes_begin(), end = Info.argtypes_end();
-  QualType RetTy = *begin;
+  QualType RetTy = FI.getReturnType();
   unsigned Index = 1;
   ABIArgInfo RetAI = getABIReturnInfo(RetTy, getTypes());
   switch (RetAI.getKind()) {
@@ -1078,8 +1077,9 @@
 
   if (RetAttrs)
     PAL.push_back(llvm::AttributeWithIndex::get(0, RetAttrs));
-  for (++begin; begin != end; ++begin) {
-    QualType ParamType = *begin;
+  for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end(); 
+       it != ie; ++it) {
+    QualType ParamType = *it;
     unsigned Attributes = 0;
     ABIArgInfo AI = getABIArgumentInfo(ParamType, getTypes());
     

Modified: cfe/trunk/lib/CodeGen/CGCall.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.h?rev=63571&r1=63570&r2=63571&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.h (original)
+++ cfe/trunk/lib/CodeGen/CGCall.h Mon Feb  2 17:43:58 2009
@@ -47,21 +47,19 @@
   typedef llvm::SmallVector<std::pair<const VarDecl*, QualType>, 
                             16> FunctionArgList;
   
-  // FIXME: This should be a better iterator type so that we can avoid
-  // construction of the ArgTypes smallvectors.
-  typedef llvm::SmallVector<QualType, 16>::const_iterator ArgTypeIterator;
-
   /// CGFunctionInfo - Class to encapsulate the information about a
   /// function definition.
   class CGFunctionInfo {
     llvm::SmallVector<QualType, 16> ArgTypes;
 
   public:
+    typedef llvm::SmallVector<QualType, 16>::const_iterator arg_iterator;
+
     CGFunctionInfo(QualType ResTy, 
                    const llvm::SmallVector<QualType, 16> &ArgTys);
 
-    ArgTypeIterator argtypes_begin() const;
-    ArgTypeIterator argtypes_end() const;
+    arg_iterator arg_begin() const;
+    arg_iterator arg_end() const;
 
     QualType getReturnType() const { return ArgTypes[0]; }
   };





More information about the cfe-commits mailing list