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

Devang Patel dpatel at apple.com
Fri Sep 26 15:53:57 PDT 2008


Author: dpatel
Date: Fri Sep 26 17:53:57 2008
New Revision: 56705

URL: http://llvm.org/viewvc/llvm-project?rev=56705&view=rev
Log:
Now Attributes are divided in three groups
- return attributes - inreg, zext and sext
- parameter attributes
- function attributes - nounwind, readonly, readnone, noreturn

Return attributes use 0 as the index.
Function attributes use ~0U as the index.


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

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Sep 26 17:53:57 2008
@@ -513,6 +513,7 @@
                                            ArgTypeIterator end,
                                            AttributeListType &PAL) {
   unsigned FuncAttrs = 0;
+  unsigned RetAttrs = 0;
 
   if (TargetDecl) {
     if (TargetDecl->getAttr<NoThrowAttr>())
@@ -528,9 +529,9 @@
   case ABIArgInfo::Default:
     if (RetTy->isPromotableIntegerType()) {
       if (RetTy->isSignedIntegerType()) {
-        FuncAttrs |= llvm::Attribute::SExt;
+        RetAttrs |= llvm::Attribute::SExt;
       } else if (RetTy->isUnsignedIntegerType()) {
-        FuncAttrs |= llvm::Attribute::ZExt;
+        RetAttrs |= llvm::Attribute::ZExt;
       }
     }
     break;
@@ -550,8 +551,8 @@
     assert(0 && "Invalid ABI kind for return argument");    
   }
 
-  if (FuncAttrs)
-    PAL.push_back(llvm::AttributeWithIndex::get(0, FuncAttrs));
+  if (RetAttrs)
+    PAL.push_back(llvm::AttributeWithIndex::get(0, RetAttrs));
   for (++begin; begin != end; ++begin) {
     QualType ParamType = *begin;
     unsigned Attributes = 0;
@@ -592,6 +593,9 @@
       PAL.push_back(llvm::AttributeWithIndex::get(Index, Attributes));
     ++Index;
   }
+  if (FuncAttrs)
+    PAL.push_back(llvm::AttributeWithIndex::get(~0, FuncAttrs));
+
 }
 
 void CodeGenFunction::EmitFunctionProlog(llvm::Function *Fn,

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Sep 26 17:53:57 2008
@@ -240,7 +240,7 @@
   }
                              
   if (!Features.Exceptions)
-    F->addAttribute(0, llvm::Attribute::NoUnwind);  
+    F->addAttribute(~0, llvm::Attribute::NoUnwind);  
 }
 
 void CodeGenModule::SetMethodAttributes(const ObjCMethodDecl *MD,





More information about the cfe-commits mailing list