Remove Function::getParamAttributes and use the AttributeSet accessor methods instead.
authorBill Wendling <isanbard@gmail.com>
Sun, 30 Dec 2012 12:45:13 +0000 (12:45 +0000)
committerBill Wendling <isanbard@gmail.com>
Sun, 30 Dec 2012 12:45:13 +0000 (12:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171255 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Function.h
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp
lib/Transforms/IPO/ArgumentPromotion.cpp
lib/VMCore/Function.cpp
lib/VMCore/Instructions.cpp

index ba04098dfe77cb208321dc601703ed648cf4c50a..1a65950aa80a3ba535fea4d6d92ef2d0a7156f6d 100644 (file)
@@ -189,17 +189,11 @@ public:
   void setGC(const char *Str);
   void clearGC();
 
-
   /// getRetAttributes - Return the return attributes for querying.
   Attribute getRetAttributes() const {
     return AttributeList.getRetAttributes();
   }
 
-  /// getParamAttributes - Return the parameter attributes for querying.
-  Attribute getParamAttributes(unsigned Idx) const {
-    return AttributeList.getParamAttributes(Idx);
-  }
-
   /// addAttribute - adds the attribute to the list of attributes.
   void addAttribute(unsigned i, Attribute attr);
 
@@ -275,13 +269,15 @@ public:
   /// @brief Determine if the function returns a structure through first
   /// pointer argument.
   bool hasStructRetAttr() const {
-    return getParamAttributes(1).hasAttribute(Attribute::StructRet);
+    return AttributeList.getParamAttributes(1).
+      hasAttribute(Attribute::StructRet);
   }
 
   /// @brief Determine if the parameter does not alias other parameters.
   /// @param n The parameter to check. 1 is the first parameter, 0 is the return
   bool doesNotAlias(unsigned n) const {
-    return getParamAttributes(n).hasAttribute(Attribute::NoAlias);
+    return AttributeList.getParamAttributes(n).
+      hasAttribute(Attribute::NoAlias);
   }
   void setDoesNotAlias(unsigned n) {
     addAttribute(n, Attribute::get(getContext(), Attribute::NoAlias));
@@ -290,7 +286,8 @@ public:
   /// @brief Determine if the parameter can be captured.
   /// @param n The parameter to check. 1 is the first parameter, 0 is the return
   bool doesNotCapture(unsigned n) const {
-    return getParamAttributes(n).hasAttribute(Attribute::NoCapture);
+    return AttributeList.getParamAttributes(n).
+      hasAttribute(Attribute::NoCapture);
   }
   void setDoesNotCapture(unsigned n) {
     addAttribute(n, Attribute::get(getContext(), Attribute::NoCapture));
index 23f277ae80eb3edddc13b915f7f73ab2e5c8d5e2..98a8d32df37a02166724d51d1d819b8c999de120 100644 (file)
@@ -6616,15 +6616,15 @@ void SelectionDAGISel::LowerArguments(const BasicBlock *LLVMBB) {
       unsigned OriginalAlignment =
         TD->getABITypeAlignment(ArgTy);
 
-      if (F.getParamAttributes(Idx).hasAttribute(Attribute::ZExt))
+      if (F.getAttributes().hasAttribute(Idx, Attribute::ZExt))
         Flags.setZExt();
-      if (F.getParamAttributes(Idx).hasAttribute(Attribute::SExt))
+      if (F.getAttributes().hasAttribute(Idx, Attribute::SExt))
         Flags.setSExt();
-      if (F.getParamAttributes(Idx).hasAttribute(Attribute::InReg))
+      if (F.getAttributes().hasAttribute(Idx, Attribute::InReg))
         Flags.setInReg();
-      if (F.getParamAttributes(Idx).hasAttribute(Attribute::StructRet))
+      if (F.getAttributes().hasAttribute(Idx, Attribute::StructRet))
         Flags.setSRet();
-      if (F.getParamAttributes(Idx).hasAttribute(Attribute::ByVal)) {
+      if (F.getAttributes().hasAttribute(Idx, Attribute::ByVal)) {
         Flags.setByVal();
         PointerType *Ty = cast<PointerType>(I->getType());
         Type *ElementTy = Ty->getElementType();
@@ -6638,7 +6638,7 @@ void SelectionDAGISel::LowerArguments(const BasicBlock *LLVMBB) {
           FrameAlign = TLI.getByValTypeAlignment(ElementTy);
         Flags.setByValAlign(FrameAlign);
       }
-      if (F.getParamAttributes(Idx).hasAttribute(Attribute::Nest))
+      if (F.getAttributes().hasAttribute(Idx, Attribute::Nest))
         Flags.setNest();
       Flags.setOrigAlign(OriginalAlignment);
 
@@ -6726,9 +6726,9 @@ void SelectionDAGISel::LowerArguments(const BasicBlock *LLVMBB) {
 
       if (!I->use_empty()) {
         ISD::NodeType AssertOp = ISD::DELETED_NODE;
-        if (F.getParamAttributes(Idx).hasAttribute(Attribute::SExt))
+        if (F.getAttributes().hasAttribute(Idx, Attribute::SExt))
           AssertOp = ISD::AssertSext;
-        else if (F.getParamAttributes(Idx).hasAttribute(Attribute::ZExt))
+        else if (F.getAttributes().hasAttribute(Idx, Attribute::ZExt))
           AssertOp = ISD::AssertZext;
 
         ArgValues.push_back(getCopyFromParts(DAG, dl, &InVals[i],
index 455b60ee5ae9c47ce0e9e84a9baaaa5e6167ade7..986bb37b97d3d6d50dcfb22024ff3afe48be7960 100644 (file)
@@ -51,7 +51,7 @@ bool HexagonRemoveExtendArgs::runOnFunction(Function &F) {
   unsigned Idx = 1;
   for (Function::arg_iterator AI = F.arg_begin(), AE = F.arg_end(); AI != AE;
        ++AI, ++Idx) {
-    if (F.getParamAttributes(Idx).hasAttribute(Attribute::SExt)) {
+    if (F.getAttributes().hasAttribute(Idx, Attribute::SExt)) {
       Argument* Arg = AI;
       if (!isa<PointerType>(Arg->getType())) {
         for (Instruction::use_iterator UI = Arg->use_begin();
index 8fb19b09eedcfc657ec5c3bb73a9c27ea779b7c3..5ae12c272611dd037f932e28dfa78f445bcfba1a 100644 (file)
@@ -153,8 +153,8 @@ CallGraphNode *ArgPromotion::PromoteArguments(CallGraphNode *CGN) {
   SmallPtrSet<Argument*, 8> ArgsToPromote;
   SmallPtrSet<Argument*, 8> ByValArgsToTransform;
   for (unsigned i = 0; i != PointerArgs.size(); ++i) {
-    bool isByVal=F->getParamAttributes(PointerArgs[i].second+1).
-      hasAttribute(Attribute::ByVal);
+    bool isByVal=F->getAttributes().
+      hasAttribute(PointerArgs[i].second+1, Attribute::ByVal);
     Argument *PtrArg = PointerArgs[i].first;
     Type *AgTy = cast<PointerType>(PtrArg->getType())->getElementType();
 
index 5ff088e7f5697979ea1e71d4761209f42eacbcd1..3cae4d4837c93f78c1dde26eb968cf724f06c3e4 100644 (file)
@@ -79,8 +79,8 @@ unsigned Argument::getArgNo() const {
 /// in its containing function.
 bool Argument::hasByValAttr() const {
   if (!getType()->isPointerTy()) return false;
-  return getParent()->getParamAttributes(getArgNo()+1).
-    hasAttribute(Attribute::ByVal);
+  return getParent()->getAttributes().
+    hasAttribute(getArgNo()+1, Attribute::ByVal);
 }
 
 unsigned Argument::getParamAlignment() const {
@@ -93,24 +93,24 @@ unsigned Argument::getParamAlignment() const {
 /// it in its containing function.
 bool Argument::hasNestAttr() const {
   if (!getType()->isPointerTy()) return false;
-  return getParent()->getParamAttributes(getArgNo()+1).
-    hasAttribute(Attribute::Nest);
+  return getParent()->getAttributes().
+    hasAttribute(getArgNo()+1, Attribute::Nest);
 }
 
 /// hasNoAliasAttr - Return true if this argument has the noalias attribute on
 /// it in its containing function.
 bool Argument::hasNoAliasAttr() const {
   if (!getType()->isPointerTy()) return false;
-  return getParent()->getParamAttributes(getArgNo()+1).
-    hasAttribute(Attribute::NoAlias);
+  return getParent()->getAttributes().
+    hasAttribute(getArgNo()+1, Attribute::NoAlias);
 }
 
 /// hasNoCaptureAttr - Return true if this argument has the nocapture attribute
 /// on it in its containing function.
 bool Argument::hasNoCaptureAttr() const {
   if (!getType()->isPointerTy()) return false;
-  return getParent()->getParamAttributes(getArgNo()+1).
-    hasAttribute(Attribute::NoCapture);
+  return getParent()->getAttributes().
+    hasAttribute(getArgNo()+1, Attribute::NoCapture);
 }
 
 /// hasSRetAttr - Return true if this argument has the sret attribute on
@@ -119,8 +119,8 @@ bool Argument::hasStructRetAttr() const {
   if (!getType()->isPointerTy()) return false;
   if (this != getParent()->arg_begin())
     return false; // StructRet param must be first param
-  return getParent()->getParamAttributes(1).
-    hasAttribute(Attribute::StructRet);
+  return getParent()->getAttributes().
+    hasAttribute(1, Attribute::StructRet);
 }
 
 /// addAttr - Add a Attribute to an argument
index bb659fc69e9733eba14a251d792c22e7c223a3e7..23db33646e58235f3ed5523d3714cd519108e4a8 100644 (file)
@@ -348,7 +348,7 @@ bool CallInst::hasFnAttr(Attribute::AttrKind A) const {
       .hasAttribute(A))
     return true;
   if (const Function *F = getCalledFunction())
-    return F->getParamAttributes(AttributeSet::FunctionIndex).hasAttribute(A);
+    return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, A);
   return false;
 }
 
@@ -356,7 +356,7 @@ bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const {
   if (AttributeList.getParamAttributes(i).hasAttribute(A))
     return true;
   if (const Function *F = getCalledFunction())
-    return F->getParamAttributes(i).hasAttribute(A);
+    return F->getAttributes().hasAttribute(i, A);
   return false;
 }
 
@@ -577,7 +577,7 @@ bool InvokeInst::hasFnAttr(Attribute::AttrKind A) const {
       hasAttribute(A))
     return true;
   if (const Function *F = getCalledFunction())
-    return F->getParamAttributes(AttributeSet::FunctionIndex).hasAttribute(A);
+    return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, A);
   return false;
 }
 
@@ -585,7 +585,7 @@ bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const {
   if (AttributeList.getParamAttributes(i).hasAttribute(A))
     return true;
   if (const Function *F = getCalledFunction())
-    return F->getParamAttributes(i).hasAttribute(A);
+    return F->getAttributes().hasAttribute(i, A);
   return false;
 }