[cfe-commits] r63466 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGCall.h CGObjCMac.cpp CodeGenModule.cpp CodeGenModule.h CodeGenTypes.h

Daniel Dunbar daniel at zuster.org
Fri Jan 30 18:19:01 PST 2009


Author: ddunbar
Date: Fri Jan 30 20:19:00 2009
New Revision: 63466

URL: http://llvm.org/viewvc/llvm-project?rev=63466&view=rev
Log:
Kill off CGCallInfo, always use CGFunctionInfo for encapsulating
function/call info.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CGCall.h
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.h
    cfe/trunk/lib/CodeGen/CodeGenTypes.h

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Jan 30 20:19:00 2009
@@ -73,27 +73,21 @@
     ArgTypes.push_back((*i)->getType());
 }
 
-ArgTypeIterator CGFunctionInfo::argtypes_begin() const {
-  return ArgTypes.begin();
-}
-
-ArgTypeIterator CGFunctionInfo::argtypes_end() const {
-  return ArgTypes.end();
-}
-
-/***/
-
-CGCallInfo::CGCallInfo(QualType _ResultType, const CallArgList &_Args) {
-  ArgTypes.push_back(_ResultType);
-  for (CallArgList::const_iterator i = _Args.begin(), e = _Args.end(); i!=e; ++i)
+CGFunctionInfo::CGFunctionInfo(QualType ResTy, const CallArgList &Args, 
+                               bool _IsVariadic)
+  : IsVariadic(_IsVariadic)
+{
+  ArgTypes.push_back(ResTy);
+  for (CallArgList::const_iterator i = Args.begin(), e = Args.end(); 
+       i != e; ++i)
     ArgTypes.push_back(i->second);
 }
 
-ArgTypeIterator CGCallInfo::argtypes_begin() const {
+ArgTypeIterator CGFunctionInfo::argtypes_begin() const {
   return ArgTypes.begin();
 }
 
-ArgTypeIterator CGCallInfo::argtypes_end() const {
+ArgTypeIterator CGFunctionInfo::argtypes_end() const {
   return ArgTypes.end();
 }
 
@@ -879,13 +873,9 @@
 /***/
 
 const llvm::FunctionType *
-CodeGenTypes::GetFunctionType(const CGCallInfo &CI, bool IsVariadic) {
-  return GetFunctionType(CI.argtypes_begin(), CI.argtypes_end(), IsVariadic);
-}
-
-const llvm::FunctionType *
 CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI) {
-  return GetFunctionType(FI.argtypes_begin(), FI.argtypes_end(), FI.isVariadic());
+  return GetFunctionType(FI.argtypes_begin(), FI.argtypes_end(), 
+                         FI.isVariadic());
 }
 
 const llvm::FunctionType *
@@ -962,8 +952,7 @@
 }
 
 void CodeGenModule::ConstructAttributeList(const Decl *TargetDecl,
-                                           ArgTypeIterator begin,
-                                           ArgTypeIterator end,
+                                           const CGFunctionInfo &Info,
                                            AttributeListType &PAL) {
   unsigned FuncAttrs = 0;
   unsigned RetAttrs = 0;
@@ -979,6 +968,7 @@
       FuncAttrs |= llvm::Attribute::ReadNone;
   }
 
+  ArgTypeIterator begin = Info.argtypes_begin(), end = Info.argtypes_end();
   QualType RetTy = *begin;
   unsigned Index = 1;
   ABIArgInfo RetAI = getABIReturnInfo(RetTy, getTypes());
@@ -995,8 +985,8 @@
 
   case ABIArgInfo::StructRet:
     PAL.push_back(llvm::AttributeWithIndex::get(Index, 
-                                                  llvm::Attribute::StructRet|
-                                                  llvm::Attribute::NoAlias));
+                                                llvm::Attribute::StructRet |
+                                                llvm::Attribute::NoAlias));
     ++Index;
     break;
 
@@ -1294,16 +1284,15 @@
   }
   
   llvm::CallInst *CI = Builder.CreateCall(Callee,&Args[0],&Args[0]+Args.size());
-  CGCallInfo CallInfo(RetTy, CallArgs);
+  bool isVariadic = cast<llvm::FunctionType>(Callee->getType())->isVarArg();
+  CGFunctionInfo CallInfo(RetTy, CallArgs, isVariadic);
 
   // FIXME: Provide TargetDecl so nounwind, noreturn, etc, etc get set.
   CodeGen::AttributeListType AttributeList;
-  CGM.ConstructAttributeList(0, 
-                             CallInfo.argtypes_begin(), CallInfo.argtypes_end(),
-                             AttributeList);
+  CGM.ConstructAttributeList(0, CallInfo, AttributeList);
   CI->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(), 
-                                         AttributeList.size()));  
-
+                                           AttributeList.size()));  
+  
   if (const llvm::Function *F = dyn_cast<llvm::Function>(Callee))
     CI->setCallingConv(F->getCallingConv());
   if (CI->getType() != llvm::Type::VoidTy)

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.h (original)
+++ cfe/trunk/lib/CodeGen/CGCall.h Fri Jan 30 20:19:00 2009
@@ -64,24 +64,14 @@
     CGFunctionInfo(const FunctionDecl *FD);
     CGFunctionInfo(const ObjCMethodDecl *MD,
                    const ASTContext &Context);
+    CGFunctionInfo(QualType ResTy, const CallArgList &Args, 
+                   bool _IsVariadic);
 
     bool isVariadic() const { return IsVariadic; }
 
     ArgTypeIterator argtypes_begin() const;
     ArgTypeIterator argtypes_end() const;
   };
-
-  /// CGCallInfo - Class to encapsulate the arguments and clang types
-  /// used in a call.
-  class CGCallInfo {
-    llvm::SmallVector<QualType, 16> ArgTypes;
-
-  public:
-    CGCallInfo(QualType _ResultType, const CallArgList &Args);
-
-    ArgTypeIterator argtypes_begin() const;
-    ArgTypeIterator argtypes_end() const;
-  };
 }  // end namespace CodeGen
 }  // end namespace clang
 

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Fri Jan 30 20:19:00 2009
@@ -799,8 +799,8 @@
   ActualArgs.insert(ActualArgs.end(), CallArgs.begin(), CallArgs.end());
 
   const llvm::FunctionType *FTy = 
-    CGM.getTypes().GetFunctionType(CGCallInfo(ResultType, ActualArgs),
-                                   false);
+    CGM.getTypes().GetFunctionType(CGFunctionInfo(ResultType, ActualArgs,
+                                                  false));
 
   llvm::Constant *Fn;
   if (CGM.ReturnTypeUsesSret(ResultType)) {

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Jan 30 20:19:00 2009
@@ -265,8 +265,7 @@
                                           const CGFunctionInfo &Info, 
                                           llvm::Function *F) {
   AttributeListType AttributeList;
-  ConstructAttributeList(D, Info.argtypes_begin(), Info.argtypes_end(),
-                         AttributeList);
+  ConstructAttributeList(D, Info, AttributeList);
 
   F->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(),
                                         AttributeList.size()));

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Fri Jan 30 20:19:00 2009
@@ -247,8 +247,7 @@
   bool ReturnTypeUsesSret(QualType RetTy);
 
   void ConstructAttributeList(const Decl *TargetDecl,
-                              const ArgTypeIterator begin,
-                              const ArgTypeIterator end,
+                              const CGFunctionInfo &Info,
                               AttributeListType &PAL);
 
 private:

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.h Fri Jan 30 20:19:00 2009
@@ -145,10 +145,6 @@
 
   /// GetFunctionType - Get the LLVM function type from Info.
   const llvm::FunctionType *GetFunctionType(const CGFunctionInfo &Info);
-  /// GetFunctionType - Get the LLVM function type from Info. 
-  /// \param IsVariadic Should the resulting type be variadic?
-  const llvm::FunctionType *GetFunctionType(const CGCallInfo &Info,
-                                            bool IsVariadic);
 
   /// GetFunctionType - Get the LLVM function type for the given types
   /// and variadicness.





More information about the cfe-commits mailing list