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

Devang Patel dpatel at apple.com
Thu Sep 25 14:02:23 PDT 2008


Author: dpatel
Date: Thu Sep 25 16:02:23 2008
New Revision: 56623

URL: http://llvm.org/viewvc/llvm-project?rev=56623&view=rev
Log:
 Large mechanical patch.

s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.


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

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Sep 25 16:02:23 2008
@@ -508,17 +508,17 @@
   return getABIReturnInfo(RetTy, getContext()).isStructRet();
 }
 
-void CodeGenModule::ConstructParamAttrList(const Decl *TargetDecl,
+void CodeGenModule::ConstructAttributeList(const Decl *TargetDecl,
                                            ArgTypeIterator begin,
                                            ArgTypeIterator end,
-                                           ParamAttrListType &PAL) {
+                                           AttributeListType &PAL) {
   unsigned FuncAttrs = 0;
 
   if (TargetDecl) {
     if (TargetDecl->getAttr<NoThrowAttr>())
-      FuncAttrs |= llvm::ParamAttr::NoUnwind;
+      FuncAttrs |= llvm::Attribute::NoUnwind;
     if (TargetDecl->getAttr<NoReturnAttr>())
-      FuncAttrs |= llvm::ParamAttr::NoReturn;
+      FuncAttrs |= llvm::Attribute::NoReturn;
   }
 
   QualType RetTy = *begin;
@@ -528,17 +528,17 @@
   case ABIArgInfo::Default:
     if (RetTy->isPromotableIntegerType()) {
       if (RetTy->isSignedIntegerType()) {
-        FuncAttrs |= llvm::ParamAttr::SExt;
+        FuncAttrs |= llvm::Attribute::SExt;
       } else if (RetTy->isUnsignedIntegerType()) {
-        FuncAttrs |= llvm::ParamAttr::ZExt;
+        FuncAttrs |= llvm::Attribute::ZExt;
       }
     }
     break;
 
   case ABIArgInfo::StructRet:
-    PAL.push_back(llvm::FnAttributeWithIndex::get(Index, 
-                                                  llvm::ParamAttr::StructRet|
-                                                  llvm::ParamAttr::NoAlias));
+    PAL.push_back(llvm::AttributeWithIndex::get(Index, 
+                                                  llvm::Attribute::StructRet|
+                                                  llvm::Attribute::NoAlias));
     ++Index;
     break;
 
@@ -551,10 +551,10 @@
   }
 
   if (FuncAttrs)
-    PAL.push_back(llvm::FnAttributeWithIndex::get(0, FuncAttrs));
+    PAL.push_back(llvm::AttributeWithIndex::get(0, FuncAttrs));
   for (++begin; begin != end; ++begin) {
     QualType ParamType = *begin;
-    unsigned ParamAttrs = 0;
+    unsigned Attributes = 0;
     ABIArgInfo AI = getABIArgumentInfo(ParamType, getContext());
     
     switch (AI.getKind()) {
@@ -563,16 +563,16 @@
       assert(0 && "Invalid ABI kind for non-return argument");
     
     case ABIArgInfo::ByVal:
-      ParamAttrs |= llvm::ParamAttr::ByVal;
+      Attributes |= llvm::Attribute::ByVal;
       assert(AI.getByValAlignment() == 0 && "FIXME: alignment unhandled");
       break;
       
     case ABIArgInfo::Default:
       if (ParamType->isPromotableIntegerType()) {
         if (ParamType->isSignedIntegerType()) {
-          ParamAttrs |= llvm::ParamAttr::SExt;
+          Attributes |= llvm::Attribute::SExt;
         } else if (ParamType->isUnsignedIntegerType()) {
-          ParamAttrs |= llvm::ParamAttr::ZExt;
+          Attributes |= llvm::Attribute::ZExt;
         }
       }
       break;
@@ -588,8 +588,8 @@
     }
     }
       
-    if (ParamAttrs)
-      PAL.push_back(llvm::FnAttributeWithIndex::get(Index, ParamAttrs));
+    if (Attributes)
+      PAL.push_back(llvm::AttributeWithIndex::get(Index, Attributes));
     ++Index;
   }
 }
@@ -749,12 +749,12 @@
   CGCallInfo CallInfo(RetTy, CallArgs);
 
   // FIXME: Provide TargetDecl so nounwind, noreturn, etc, etc get set.
-  CodeGen::ParamAttrListType ParamAttrList;
-  CGM.ConstructParamAttrList(0, 
+  CodeGen::AttributeListType AttributeList;
+  CGM.ConstructAttributeList(0, 
                              CallInfo.argtypes_begin(), CallInfo.argtypes_end(),
-                             ParamAttrList);
-  CI->setParamAttrs(llvm::PAListPtr::get(ParamAttrList.begin(), 
-                                         ParamAttrList.size()));  
+                             AttributeList);
+  CI->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(), 
+                                         AttributeList.size()));  
 
   if (const llvm::Function *F = dyn_cast<llvm::Function>(Callee))
     CI->setCallingConv(F->getCallingConv());

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.h (original)
+++ cfe/trunk/lib/CodeGen/CGCall.h Thu Sep 25 16:02:23 2008
@@ -21,7 +21,7 @@
 
 namespace llvm {
   class Function;
-  struct FnAttributeWithIndex;
+  struct AttributeWithIndex;
   class Value;
 
   template<typename T, unsigned> class SmallVector;
@@ -35,7 +35,7 @@
   class VarDecl;
 
 namespace CodeGen {
-  typedef llvm::SmallVector<llvm::FnAttributeWithIndex, 8> ParamAttrListType;
+  typedef llvm::SmallVector<llvm::AttributeWithIndex, 8> AttributeListType;
 
   /// CallArgList - Type for representing both the value and type of
   /// arguments in a call.

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Sep 25 16:02:23 2008
@@ -212,15 +212,15 @@
   }
 }
 
-void CodeGenModule::SetFunctionParamAttrs(const Decl *D,
+void CodeGenModule::SetFunctionAttributes(const Decl *D,
                                           const CGFunctionInfo &Info, 
                                           llvm::Function *F) {
-  ParamAttrListType ParamAttrList;
-  ConstructParamAttrList(D, Info.argtypes_begin(), Info.argtypes_end(),
-                         ParamAttrList);
+  AttributeListType AttributeList;
+  ConstructAttributeList(D, Info.argtypes_begin(), Info.argtypes_end(),
+                         AttributeList);
 
-  F->setParamAttrs(llvm::PAListPtr::get(ParamAttrList.begin(),
-                                        ParamAttrList.size()));
+  F->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(),
+                                        AttributeList.size()));
 
   // Set the appropriate calling convention for the Function.
   if (D->getAttr<FastCallAttr>())
@@ -240,19 +240,19 @@
   }
                              
   if (!Features.Exceptions)
-    F->addParamAttr(0, llvm::ParamAttr::NoUnwind);  
+    F->addAttribute(0, llvm::Attribute::NoUnwind);  
 }
 
 void CodeGenModule::SetMethodAttributes(const ObjCMethodDecl *MD,
                                         llvm::Function *F) {
-  SetFunctionParamAttrs(MD, CGFunctionInfo(MD, Context), F);
+  SetFunctionAttributes(MD, CGFunctionInfo(MD, Context), F);
   
   SetFunctionAttributesForDefinition(MD, F);
 }
 
 void CodeGenModule::SetFunctionAttributes(const FunctionDecl *FD,
                                           llvm::Function *F) {
-  SetFunctionParamAttrs(FD, CGFunctionInfo(FD), F);
+  SetFunctionAttributes(FD, CGFunctionInfo(FD), F);
   
   SetGlobalValueAttributes(FD, FD->getStorageClass() == FunctionDecl::Static,
                            FD->isInline(), F, false);

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Thu Sep 25 16:02:23 2008
@@ -217,7 +217,7 @@
   void SetMethodAttributes(const ObjCMethodDecl *MD,
                            llvm::Function *F);
 
-  void SetFunctionParamAttrs(const Decl *D,
+  void SetFunctionAttributes(const Decl *D,
                              const CGFunctionInfo &Info, 
                              llvm::Function *F);
 
@@ -225,10 +225,10 @@
   /// when used as a return type.
   bool ReturnTypeUsesSret(QualType RetTy);
 
-  void ConstructParamAttrList(const Decl *TargetDecl,
+  void ConstructAttributeList(const Decl *TargetDecl,
                               const ArgTypeIterator begin,
                               const ArgTypeIterator end,
-                              ParamAttrListType &PAL);
+                              AttributeListType &PAL);
 
 private:
   /// SetFunctionAttributesForDefinition - Set function attributes





More information about the cfe-commits mailing list