s/ParameterAttributes/Attributes/g
authorDevang Patel <dpatel@apple.com>
Tue, 23 Sep 2008 23:03:40 +0000 (23:03 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 23 Sep 2008 23:03:40 +0000 (23:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56513 91177308-0d34-0410-b5e6-96231b3b80d8

30 files changed:
include/llvm/Argument.h
include/llvm/Attributes.h [new file with mode: 0644]
include/llvm/Function.h
include/llvm/Instructions.h
include/llvm/ParameterAttributes.h [deleted file]
include/llvm/Support/CallSite.h
lib/Analysis/BasicAliasAnalysis.cpp
lib/AsmParser/ParserInternals.h
lib/Bitcode/Reader/BitcodeReader.h
lib/Bitcode/Writer/ValueEnumerator.h
lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/ExecutionEngine/Interpreter/Execution.cpp
lib/Target/CppBackend/CPPBackend.cpp
lib/Target/MSIL/MSILWriter.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Transforms/IPO/ArgumentPromotion.cpp
lib/Transforms/IPO/DeadArgumentElimination.cpp
lib/Transforms/IPO/PruneEH.cpp
lib/Transforms/IPO/StructRetPromotion.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
lib/Transforms/Scalar/MemCpyOptimizer.cpp
lib/Transforms/Scalar/SimplifyCFGPass.cpp
lib/Transforms/Utils/InlineFunction.cpp
lib/VMCore/AsmWriter.cpp
lib/VMCore/Attributes.cpp [new file with mode: 0644]
lib/VMCore/Function.cpp
lib/VMCore/Instructions.cpp
lib/VMCore/ParameterAttributes.cpp [deleted file]
lib/VMCore/Verifier.cpp

index ce81a94a6379d31308b821c41981e47701b47430..0ad5431018ae6563f454e5b9c3ac3376dcecacce 100644 (file)
@@ -15,7 +15,7 @@
 #define LLVM_ARGUMENT_H
 
 #include "llvm/Value.h"
-#include "llvm/ParameterAttributes.h"
+#include "llvm/Attributes.h"
 #include "llvm/ADT/ilist_node.h"
 
 namespace llvm {
@@ -61,10 +61,10 @@ public:
   bool hasStructRetAttr() const;
 
   /// addAttr - Add a ParamAttr to an argument
-  void addAttr(ParameterAttributes);
+  void addAttr(Attributes);
   
   /// removeAttr - Remove a ParamAttr from an argument
-  void removeAttr(ParameterAttributes);
+  void removeAttr(Attributes);
 
   /// classof - Methods for support type inquiry through isa, cast, and
   /// dyn_cast:
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h
new file mode 100644 (file)
index 0000000..cdd810b
--- /dev/null
@@ -0,0 +1,211 @@
+//===-- llvm/Attributes.h - Container for ParamAttrs ---*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains the simple types necessary to represent the parameter
+// attributes associated with functions and their calls.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_PARAMETER_ATTRIBUTES_H
+#define LLVM_PARAMETER_ATTRIBUTES_H
+
+#include <string>
+
+namespace llvm {
+class Type;
+
+/// Attributes - A bitset of attributes for a parameter.
+typedef unsigned Attributes;
+  
+namespace ParamAttr {
+
+/// Function parameters and results can have attributes to indicate how they 
+/// should be treated by optimizations and code generation. This enumeration 
+/// lists the attributes that can be associated with parameters or function 
+/// results.
+/// @brief Function parameter attributes.
+
+const Attributes None      = 0;     ///< No attributes have been set
+const Attributes ZExt      = 1<<0;  ///< Zero extended before/after call
+const Attributes SExt      = 1<<1;  ///< Sign extended before/after call
+const Attributes NoReturn  = 1<<2;  ///< Mark the function as not returning
+const Attributes InReg     = 1<<3;  ///< Force argument to be passed in register
+const Attributes StructRet = 1<<4;  ///< Hidden pointer to structure to return
+const Attributes NoUnwind  = 1<<5;  ///< Function doesn't unwind stack
+const Attributes NoAlias   = 1<<6;  ///< Considered to not alias after call
+const Attributes ByVal     = 1<<7;  ///< Pass structure by value
+const Attributes Nest      = 1<<8;  ///< Nested function static chain
+const Attributes ReadNone  = 1<<9;  ///< Function does not access memory
+const Attributes ReadOnly  = 1<<10; ///< Function only reads from memory
+const Attributes Alignment = 0xffff<<16; ///< Alignment of parameter (16 bits)
+                                    // 0 = unknown, else in clear (not log)
+                                    
+/// Function notes are implemented as attributes stored at index ~0 in 
+/// parameter attribute list.
+const Attributes FN_NOTE_None            = 0;    
+const Attributes FN_NOTE_NoInline        = 1<<0; // inline=never 
+const Attributes FN_NOTE_AlwaysInline    = 1<<1; // inline=always
+const Attributes FN_NOTE_OptimizeForSize = 1<<2; // opt_size
+
+/// @brief Attributes that only apply to function parameters.
+const Attributes ParameterOnly = ByVal | Nest | StructRet;
+
+/// @brief Attributes that only apply to function return values.
+const Attributes ReturnOnly = NoReturn | NoUnwind | ReadNone | ReadOnly;
+
+/// @brief Parameter attributes that do not apply to vararg call arguments.
+const Attributes VarArgsIncompatible = StructRet;
+
+/// @brief Attributes that are mutually incompatible.
+const Attributes MutuallyIncompatible[3] = {
+  ByVal | InReg | Nest  | StructRet,
+  ZExt  | SExt,
+  ReadNone | ReadOnly
+};
+
+/// @brief Which attributes cannot be applied to a type.
+Attributes typeIncompatible(const Type *Ty);
+
+/// This turns an int alignment (a power of 2, normally) into the
+/// form used internally in Attributes.
+inline Attributes constructAlignmentFromInt(unsigned i) {
+  return (i << 16);
+}
+
+/// The set of Attributes set in Attributes is converted to a
+/// string of equivalent mnemonics. This is, presumably, for writing out
+/// the mnemonics for the assembly writer. 
+/// @brief Convert parameter attribute bits to text
+std::string getAsString(Attributes Attrs);
+} // end namespace ParamAttr
+
+
+/// This is just a pair of values to associate a set of parameter attributes
+/// with a parameter index. 
+struct ParamAttrsWithIndex {
+  Attributes Attrs; ///< The attributes that are set, or'd together.
+  unsigned Index; ///< Index of the parameter for which the attributes apply.
+  
+  static ParamAttrsWithIndex get(unsigned Idx, Attributes Attrs) {
+    ParamAttrsWithIndex P;
+    P.Index = Idx;
+    P.Attrs = Attrs;
+    return P;
+  }
+};
+  
+//===----------------------------------------------------------------------===//
+// PAListPtr Smart Pointer
+//===----------------------------------------------------------------------===//
+
+class ParamAttributeListImpl;
+  
+/// PAListPtr - This class manages the ref count for the opaque 
+/// ParamAttributeListImpl object and provides accessors for it.
+class PAListPtr {
+  /// PAList - The parameter attributes that we are managing.  This can be null
+  /// to represent the empty parameter attributes list.
+  ParamAttributeListImpl *PAList;
+public:
+  PAListPtr() : PAList(0) {}
+  PAListPtr(const PAListPtr &P);
+  const PAListPtr &operator=(const PAListPtr &RHS);
+  ~PAListPtr();
+  
+  //===--------------------------------------------------------------------===//
+  // Parameter Attribute List Construction and Mutation
+  //===--------------------------------------------------------------------===//
+  
+  /// get - Return a ParamAttrs list with the specified parameter in it.
+  static PAListPtr get(const ParamAttrsWithIndex *Attr, unsigned NumAttrs);
+  
+  /// get - Return a ParamAttr list with the parameters specified by the
+  /// consecutive random access iterator range.
+  template <typename Iter>
+  static PAListPtr get(const Iter &I, const Iter &E) {
+    if (I == E) return PAListPtr();  // Empty list.
+    return get(&*I, static_cast<unsigned>(E-I));
+  }
+
+  /// addAttr - Add the specified attribute at the specified index to this
+  /// attribute list.  Since parameter attribute lists are immutable, this
+  /// returns the new list.
+  PAListPtr addAttr(unsigned Idx, Attributes Attrs) const;
+  
+  /// removeAttr - Remove the specified attribute at the specified index from
+  /// this attribute list.  Since parameter attribute lists are immutable, this
+  /// returns the new list.
+  PAListPtr removeAttr(unsigned Idx, Attributes Attrs) const;
+  
+  //===--------------------------------------------------------------------===//
+  // Parameter Attribute List Accessors
+  //===--------------------------------------------------------------------===//
+  
+  /// getParamAttrs - The parameter attributes for the specified parameter are
+  /// returned.  Parameters for the result are denoted with Idx = 0.
+  Attributes getParamAttrs(unsigned Idx) const;
+  
+  /// paramHasAttr - Return true if the specified parameter index has the
+  /// specified attribute set.
+  bool paramHasAttr(unsigned Idx, Attributes Attr) const {
+    return getParamAttrs(Idx) & Attr;
+  }
+  
+  /// getParamAlignment - Return the alignment for the specified function
+  /// parameter.
+  unsigned getParamAlignment(unsigned Idx) const {
+    return (getParamAttrs(Idx) & ParamAttr::Alignment) >> 16;
+  }
+  
+  /// hasAttrSomewhere - Return true if the specified attribute is set for at
+  /// least one parameter or for the return value.
+  bool hasAttrSomewhere(Attributes Attr) const;
+
+  /// operator==/!= - Provide equality predicates.
+  bool operator==(const PAListPtr &RHS) const { return PAList == RHS.PAList; }
+  bool operator!=(const PAListPtr &RHS) const { return PAList != RHS.PAList; }
+  
+  void dump() const;
+
+  //===--------------------------------------------------------------------===//
+  // Parameter Attribute List Introspection
+  //===--------------------------------------------------------------------===//
+  
+  /// getRawPointer - Return a raw pointer that uniquely identifies this
+  /// parameter attribute list. 
+  void *getRawPointer() const {
+    return PAList;
+  }
+  
+  // Parameter attributes are stored as a dense set of slots, where there is one
+  // slot for each argument that has an attribute.  This allows walking over the
+  // dense set instead of walking the sparse list of attributes.
+  
+  /// isEmpty - Return true if no parameters have an attribute.
+  ///
+  bool isEmpty() const {
+    return PAList == 0;
+  }
+  
+  /// getNumSlots - Return the number of slots used in this attribute list. 
+  /// This is the number of arguments that have an attribute set on them
+  /// (including the function itself).
+  unsigned getNumSlots() const;
+  
+  /// getSlot - Return the ParamAttrsWithIndex at the specified slot.  This
+  /// holds a parameter number plus a set of attributes.
+  const ParamAttrsWithIndex &getSlot(unsigned Slot) const;
+  
+private:
+  explicit PAListPtr(ParamAttributeListImpl *L);
+};
+
+} // End llvm namespace
+
+#endif
index fea9e0fc48bb92409141e8c9b8ba9544601867bc..3efce3b11e8fdceaead5f85af866b92321cd5f91 100644 (file)
@@ -22,7 +22,7 @@
 #include "llvm/BasicBlock.h"
 #include "llvm/Argument.h"
 #include "llvm/Support/Annotation.h"
-#include "llvm/ParameterAttributes.h"
+#include "llvm/Attributes.h"
 
 namespace llvm {
 
@@ -150,14 +150,14 @@ public:
 
 
   /// hasNote - Return true if this function has given note.
-  bool hasNote(ParameterAttributes N) const {
+  bool hasNote(Attributes N) const {
        // Notes are stored at ~0 index in parameter attribute list
     return (!isDeclaration() && paramHasAttr(~0, N));
   }
 
   /// setNotes - Set notes for this function
   ///
-  void setNotes(const ParameterAttributes N) { 
+  void setNotes(const Attributes N) { 
        // Notes are stored at ~0 index in parameter attribute list
        addParamAttr(~0, N);
   }
@@ -170,15 +170,15 @@ public:
   void clearGC();
 
   /// @brief Determine whether the function has the given attribute.
-  bool paramHasAttr(unsigned i, ParameterAttributes attr) const {
+  bool paramHasAttr(unsigned i, Attributes attr) const {
     return ParamAttrs.paramHasAttr(i, attr);
   }
 
   /// addParamAttr - adds the attribute to the list of attributes.
-  void addParamAttr(unsigned i, ParameterAttributes attr);
+  void addParamAttr(unsigned i, Attributes attr);
   
   /// removeParamAttr - removes the attribute from the list of attributes.
-  void removeParamAttr(unsigned i, ParameterAttributes attr);
+  void removeParamAttr(unsigned i, Attributes attr);
 
   /// @brief Extract the alignment for a call or parameter (0=unknown).
   unsigned getParamAlignment(unsigned i) const {
index 272ccecfc418bf64f4571c5adcd5137a9f963f2c..b897a39fad732e054af3218631571a5322db4deb 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "llvm/InstrTypes.h"
 #include "llvm/DerivedTypes.h"
-#include "llvm/ParameterAttributes.h"
+#include "llvm/Attributes.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/ADT/SmallVector.h"
 
@@ -1081,10 +1081,10 @@ public:
   void setParamAttrs(const PAListPtr &Attrs) { ParamAttrs = Attrs; }
   
   /// addParamAttr - adds the attribute to the list of attributes.
-  void addParamAttr(unsigned i, ParameterAttributes attr);
+  void addParamAttr(unsigned i, Attributes attr);
 
   /// removeParamAttr - removes the attribute from the list of attributes.
-  void removeParamAttr(unsigned i, ParameterAttributes attr);
+  void removeParamAttr(unsigned i, Attributes attr);
 
   /// @brief Determine whether the call or the callee has the given attribute.
   bool paramHasAttr(unsigned i, unsigned attr) const;
@@ -2440,13 +2440,13 @@ public:
   void setParamAttrs(const PAListPtr &Attrs) { ParamAttrs = Attrs; }
 
   /// @brief Determine whether the call or the callee has the given attribute.
-  bool paramHasAttr(unsigned i, ParameterAttributes attr) const;
+  bool paramHasAttr(unsigned i, Attributes attr) const;
   
   /// addParamAttr - adds the attribute to the list of attributes.
-  void addParamAttr(unsigned i, ParameterAttributes attr);
+  void addParamAttr(unsigned i, Attributes attr);
 
   /// removeParamAttr - removes the attribute from the list of attributes.
-  void removeParamAttr(unsigned i, ParameterAttributes attr);
+  void removeParamAttr(unsigned i, Attributes attr);
 
   /// @brief Extract the alignment for a call or parameter (0=unknown).
   unsigned getParamAlignment(unsigned i) const {
diff --git a/include/llvm/ParameterAttributes.h b/include/llvm/ParameterAttributes.h
deleted file mode 100644 (file)
index 848bb50..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-//===-- llvm/ParameterAttributes.h - Container for ParamAttrs ---*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains the simple types necessary to represent the parameter
-// attributes associated with functions and their calls.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_PARAMETER_ATTRIBUTES_H
-#define LLVM_PARAMETER_ATTRIBUTES_H
-
-#include <string>
-
-namespace llvm {
-class Type;
-
-/// ParameterAttributes - A bitset of attributes for a parameter.
-typedef unsigned ParameterAttributes;
-  
-namespace ParamAttr {
-
-/// Function parameters and results can have attributes to indicate how they 
-/// should be treated by optimizations and code generation. This enumeration 
-/// lists the attributes that can be associated with parameters or function 
-/// results.
-/// @brief Function parameter attributes.
-typedef ParameterAttributes Attributes;
-
-const Attributes None      = 0;     ///< No attributes have been set
-const Attributes ZExt      = 1<<0;  ///< Zero extended before/after call
-const Attributes SExt      = 1<<1;  ///< Sign extended before/after call
-const Attributes NoReturn  = 1<<2;  ///< Mark the function as not returning
-const Attributes InReg     = 1<<3;  ///< Force argument to be passed in register
-const Attributes StructRet = 1<<4;  ///< Hidden pointer to structure to return
-const Attributes NoUnwind  = 1<<5;  ///< Function doesn't unwind stack
-const Attributes NoAlias   = 1<<6;  ///< Considered to not alias after call
-const Attributes ByVal     = 1<<7;  ///< Pass structure by value
-const Attributes Nest      = 1<<8;  ///< Nested function static chain
-const Attributes ReadNone  = 1<<9;  ///< Function does not access memory
-const Attributes ReadOnly  = 1<<10; ///< Function only reads from memory
-const Attributes Alignment = 0xffff<<16; ///< Alignment of parameter (16 bits)
-                                    // 0 = unknown, else in clear (not log)
-                                    
-/// Function notes are implemented as attributes stored at index ~0 in 
-/// parameter attribute list.
-const Attributes FN_NOTE_None            = 0;    
-const Attributes FN_NOTE_NoInline        = 1<<0; // inline=never 
-const Attributes FN_NOTE_AlwaysInline    = 1<<1; // inline=always
-const Attributes FN_NOTE_OptimizeForSize = 1<<2; // opt_size
-
-/// @brief Attributes that only apply to function parameters.
-const Attributes ParameterOnly = ByVal | Nest | StructRet;
-
-/// @brief Attributes that only apply to function return values.
-const Attributes ReturnOnly = NoReturn | NoUnwind | ReadNone | ReadOnly;
-
-/// @brief Parameter attributes that do not apply to vararg call arguments.
-const Attributes VarArgsIncompatible = StructRet;
-
-/// @brief Attributes that are mutually incompatible.
-const Attributes MutuallyIncompatible[3] = {
-  ByVal | InReg | Nest  | StructRet,
-  ZExt  | SExt,
-  ReadNone | ReadOnly
-};
-
-/// @brief Which attributes cannot be applied to a type.
-Attributes typeIncompatible(const Type *Ty);
-
-/// This turns an int alignment (a power of 2, normally) into the
-/// form used internally in ParameterAttributes.
-inline ParamAttr::Attributes constructAlignmentFromInt(unsigned i) {
-  return (i << 16);
-}
-
-/// The set of ParameterAttributes set in Attributes is converted to a
-/// string of equivalent mnemonics. This is, presumably, for writing out
-/// the mnemonics for the assembly writer. 
-/// @brief Convert parameter attribute bits to text
-std::string getAsString(ParameterAttributes Attrs);
-} // end namespace ParamAttr
-
-
-/// This is just a pair of values to associate a set of parameter attributes
-/// with a parameter index. 
-struct ParamAttrsWithIndex {
-  ParameterAttributes Attrs; ///< The attributes that are set, or'd together.
-  unsigned Index; ///< Index of the parameter for which the attributes apply.
-  
-  static ParamAttrsWithIndex get(unsigned Idx, ParameterAttributes Attrs) {
-    ParamAttrsWithIndex P;
-    P.Index = Idx;
-    P.Attrs = Attrs;
-    return P;
-  }
-};
-  
-//===----------------------------------------------------------------------===//
-// PAListPtr Smart Pointer
-//===----------------------------------------------------------------------===//
-
-class ParamAttributeListImpl;
-  
-/// PAListPtr - This class manages the ref count for the opaque 
-/// ParamAttributeListImpl object and provides accessors for it.
-class PAListPtr {
-  /// PAList - The parameter attributes that we are managing.  This can be null
-  /// to represent the empty parameter attributes list.
-  ParamAttributeListImpl *PAList;
-public:
-  PAListPtr() : PAList(0) {}
-  PAListPtr(const PAListPtr &P);
-  const PAListPtr &operator=(const PAListPtr &RHS);
-  ~PAListPtr();
-  
-  //===--------------------------------------------------------------------===//
-  // Parameter Attribute List Construction and Mutation
-  //===--------------------------------------------------------------------===//
-  
-  /// get - Return a ParamAttrs list with the specified parameter in it.
-  static PAListPtr get(const ParamAttrsWithIndex *Attr, unsigned NumAttrs);
-  
-  /// get - Return a ParamAttr list with the parameters specified by the
-  /// consecutive random access iterator range.
-  template <typename Iter>
-  static PAListPtr get(const Iter &I, const Iter &E) {
-    if (I == E) return PAListPtr();  // Empty list.
-    return get(&*I, static_cast<unsigned>(E-I));
-  }
-
-  /// addAttr - Add the specified attribute at the specified index to this
-  /// attribute list.  Since parameter attribute lists are immutable, this
-  /// returns the new list.
-  PAListPtr addAttr(unsigned Idx, ParameterAttributes Attrs) const;
-  
-  /// removeAttr - Remove the specified attribute at the specified index from
-  /// this attribute list.  Since parameter attribute lists are immutable, this
-  /// returns the new list.
-  PAListPtr removeAttr(unsigned Idx, ParameterAttributes Attrs) const;
-  
-  //===--------------------------------------------------------------------===//
-  // Parameter Attribute List Accessors
-  //===--------------------------------------------------------------------===//
-  
-  /// getParamAttrs - The parameter attributes for the specified parameter are
-  /// returned.  Parameters for the result are denoted with Idx = 0.
-  ParameterAttributes getParamAttrs(unsigned Idx) const;
-  
-  /// paramHasAttr - Return true if the specified parameter index has the
-  /// specified attribute set.
-  bool paramHasAttr(unsigned Idx, ParameterAttributes Attr) const {
-    return getParamAttrs(Idx) & Attr;
-  }
-  
-  /// getParamAlignment - Return the alignment for the specified function
-  /// parameter.
-  unsigned getParamAlignment(unsigned Idx) const {
-    return (getParamAttrs(Idx) & ParamAttr::Alignment) >> 16;
-  }
-  
-  /// hasAttrSomewhere - Return true if the specified attribute is set for at
-  /// least one parameter or for the return value.
-  bool hasAttrSomewhere(ParameterAttributes Attr) const;
-
-  /// operator==/!= - Provide equality predicates.
-  bool operator==(const PAListPtr &RHS) const { return PAList == RHS.PAList; }
-  bool operator!=(const PAListPtr &RHS) const { return PAList != RHS.PAList; }
-  
-  void dump() const;
-
-  //===--------------------------------------------------------------------===//
-  // Parameter Attribute List Introspection
-  //===--------------------------------------------------------------------===//
-  
-  /// getRawPointer - Return a raw pointer that uniquely identifies this
-  /// parameter attribute list. 
-  void *getRawPointer() const {
-    return PAList;
-  }
-  
-  // Parameter attributes are stored as a dense set of slots, where there is one
-  // slot for each argument that has an attribute.  This allows walking over the
-  // dense set instead of walking the sparse list of attributes.
-  
-  /// isEmpty - Return true if no parameters have an attribute.
-  ///
-  bool isEmpty() const {
-    return PAList == 0;
-  }
-  
-  /// getNumSlots - Return the number of slots used in this attribute list. 
-  /// This is the number of arguments that have an attribute set on them
-  /// (including the function itself).
-  unsigned getNumSlots() const;
-  
-  /// getSlot - Return the ParamAttrsWithIndex at the specified slot.  This
-  /// holds a parameter number plus a set of attributes.
-  const ParamAttrsWithIndex &getSlot(unsigned Slot) const;
-  
-private:
-  explicit PAListPtr(ParamAttributeListImpl *L);
-};
-
-} // End llvm namespace
-
-#endif
index ce95cc5aaac0ed91e5a45394a6851161389caf83..2e258a59d37dff00da850d0ce079a283b0390785 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "llvm/Instruction.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ParameterAttributes.h"
+#include "llvm/Attributes.h"
 
 namespace llvm {
 
@@ -68,7 +68,7 @@ public:
   void setParamAttrs(const PAListPtr &PAL);
 
   /// paramHasAttr - whether the call or the callee has the given attribute.
-  bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
+  bool paramHasAttr(uint16_t i, Attributes attr) const;
 
   /// @brief Extract the alignment for a call or parameter (0=unknown).
   uint16_t getParamAlignment(uint16_t i) const;
index 7d4309353a40d046837eb9d2eeb738511a209d1f..aa47fb3be5085006d68bb28d11bd14a4210d97c7 100644 (file)
@@ -18,7 +18,6 @@
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Function.h"
-#include "llvm/ParameterAttributes.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/Instructions.h"
 #include "llvm/IntrinsicInst.h"
index cc35038a4189a85b669843d211f9f4e08481084b..168d9baa3a020af097b85693db1a1fbc41bf7d5d 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
-#include "llvm/ParameterAttributes.h"
+#include "llvm/Attributes.h"
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
 #include "llvm/Assembly/Parser.h"
@@ -232,13 +232,13 @@ struct ValID {
 
 struct TypeWithAttrs {
   llvm::PATypeHolder *Ty;
-  ParameterAttributes Attrs;
+  Attributes Attrs;
 };
 
 typedef std::vector<TypeWithAttrs> TypeWithAttrsList;
 
 struct ArgListEntry {
-  ParameterAttributes Attrs;
+  Attributes Attrs;
   llvm::PATypeHolder *Ty;
   std::string *Name;
 };
@@ -247,7 +247,7 @@ typedef std::vector<struct ArgListEntry> ArgListType;
 
 struct ParamListEntry {
   Value *Val;
-  ParameterAttributes Attrs;
+  Attributes Attrs;
 };
 
 typedef std::vector<ParamListEntry> ParamList;
index 7bd05cfd2d28a2208ce4acd3f9ef5cbfdf095373..9eac14fd99e7be40a2b01fddefc354617084a70e 100644 (file)
@@ -15,7 +15,7 @@
 #define BITCODE_READER_H
 
 #include "llvm/ModuleProvider.h"
-#include "llvm/ParameterAttributes.h"
+#include "llvm/Attributes.h"
 #include "llvm/Type.h"
 #include "llvm/OperandTraits.h"
 #include "llvm/Bitcode/BitstreamReader.h"
index dc40d016dcaaef94e7d203ab095f7d48a5ad9087..405aec7016943973c1e634d8df6eab4597d79b58 100644 (file)
@@ -15,7 +15,7 @@
 #define VALUE_ENUMERATOR_H
 
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/ParameterAttributes.h"
+#include "llvm/Attributes.h"
 #include <vector>
 
 namespace llvm {
index 5c0b07315d6c86e172900e1a12dddb1ec8507a17..416d3395688dd9093c3a1bfc0d30e32f2a79096e 100644 (file)
@@ -25,7 +25,6 @@
 #include "llvm/Instructions.h"
 #include "llvm/Intrinsics.h"
 #include "llvm/IntrinsicInst.h"
-#include "llvm/ParameterAttributes.h"
 #include "llvm/CodeGen/FastISel.h"
 #include "llvm/CodeGen/GCStrategy.h"
 #include "llvm/CodeGen/GCMetadata.h"
index c1e80fc78894979fbca4cc21cb81d9e5d19456e5..a91cb1fe9338f382fc5c61224da07b7d419e44e7 100644 (file)
@@ -25,7 +25,6 @@
 #include "llvm/Instructions.h"
 #include "llvm/Intrinsics.h"
 #include "llvm/IntrinsicInst.h"
-#include "llvm/ParameterAttributes.h"
 #include "llvm/CodeGen/FastISel.h"
 #include "llvm/CodeGen/GCStrategy.h"
 #include "llvm/CodeGen/GCMetadata.h"
index 29837ffcfec74a1aa9f295f1c4123cce545f922b..d73ec062f586f375b745330a1d5a6e91510cafce 100644 (file)
@@ -16,7 +16,6 @@
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Instructions.h"
-#include "llvm/ParameterAttributes.h"
 #include "llvm/CodeGen/IntrinsicLowering.h"
 #include "llvm/Support/GetElementPtrTypeIterator.h"
 #include "llvm/ADT/APInt.h"
index b39d77493207ef6aab22f3339614879b3120db55..dc4e8754f7cb9739839db435c872a67cb95cb1a5 100644 (file)
@@ -438,7 +438,7 @@ namespace {
       Out << "ParamAttrsWithIndex PAWI;"; nl(Out);
       for (unsigned i = 0; i < PAL.getNumSlots(); ++i) {
         uint16_t index = PAL.getSlot(i).Index;
-        ParameterAttributes attrs = PAL.getSlot(i).Attrs;
+        Attributes attrs = PAL.getSlot(i).Attrs;
         Out << "PAWI.Index = " << index << "; PAWI.Attrs = 0 ";
         if (attrs & ParamAttr::SExt)
           Out << " | ParamAttr::SExt";
index 35eec842a3c19115b722ee217aea1a508cced8e7..79661b0882d83fb0da2fa2a96fb59b8a4df887f4 100644 (file)
@@ -16,7 +16,6 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Intrinsics.h"
 #include "llvm/IntrinsicInst.h"
-#include "llvm/ParameterAttributes.h"
 #include "llvm/TypeSymbolTable.h"
 #include "llvm/Analysis/ConstantsScanner.h"
 #include "llvm/Support/CallSite.h"
index cc700eb99fa63a9d5d3b37f3555127f6dc2df88e..cfffa8610466bf9b84aa479560b6ebdad2431683 100644 (file)
@@ -29,7 +29,6 @@
 #include "llvm/Constants.h"
 #include "llvm/Function.h"
 #include "llvm/Intrinsics.h"
-#include "llvm/ParameterAttributes.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Support/CommandLine.h"
index f3b29fe61bc09cb3bf92ab2112d24a11884a0903..a1d8c75bd3f257257ccfbb9b7114c38e55cac4ff 100644 (file)
@@ -508,7 +508,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
   const PAListPtr &PAL = F->getParamAttrs();
 
   // Add any return attributes.
-  if (ParameterAttributes attrs = PAL.getParamAttrs(0))
+  if (Attributes attrs = PAL.getParamAttrs(0))
     ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, attrs));
 
   // First, determine the new argument list
@@ -525,7 +525,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
     } else if (!ArgsToPromote.count(I)) {
       // Unchanged argument
       Params.push_back(I->getType());
-      if (ParameterAttributes attrs = PAL.getParamAttrs(ArgIndex))
+      if (Attributes attrs = PAL.getParamAttrs(ArgIndex))
         ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Params.size(), attrs));
     } else if (I->use_empty()) {
       // Dead argument (which are always marked as promotable)
@@ -621,7 +621,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
     const PAListPtr &CallPAL = CS.getParamAttrs();
 
     // Add any return attributes.
-    if (ParameterAttributes attrs = CallPAL.getParamAttrs(0))
+    if (Attributes attrs = CallPAL.getParamAttrs(0))
       ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, attrs));
 
     // Loop over the operands, inserting GEP and loads in the caller as
@@ -633,7 +633,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
       if (!ArgsToPromote.count(I) && !ByValArgsToTransform.count(I)) {
         Args.push_back(*AI);          // Unmodified argument
 
-        if (ParameterAttributes Attrs = CallPAL.getParamAttrs(ArgIndex))
+        if (Attributes Attrs = CallPAL.getParamAttrs(ArgIndex))
           ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs));
 
       } else if (ByValArgsToTransform.count(I)) {
@@ -688,7 +688,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
     // Push any varargs arguments on the list
     for (; AI != CS.arg_end(); ++AI, ++ArgIndex) {
       Args.push_back(*AI);
-      if (ParameterAttributes Attrs = CallPAL.getParamAttrs(ArgIndex))
+      if (Attributes Attrs = CallPAL.getParamAttrs(ArgIndex))
         ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs));
     }
 
index ec8f1364e8233166b8d3cd29f4edd2aa84f95881..724d2b36d0f35edfe1c7f755e5d38b3ecd365bc5 100644 (file)
@@ -593,7 +593,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
   const PAListPtr &PAL = F->getParamAttrs();
 
   // The existing function return attributes.
-  ParameterAttributes RAttrs = PAL.getParamAttrs(0);
+  Attributes RAttrs = PAL.getParamAttrs(0);
 
 
   // Find out the new return value.
@@ -678,7 +678,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
 
       // Get the original parameter attributes (skipping the first one, that is
       // for the return value.
-      if (ParameterAttributes Attrs = PAL.getParamAttrs(i + 1))
+      if (Attributes Attrs = PAL.getParamAttrs(i + 1))
         ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Params.size(), Attrs));
     } else {
       ++NumArgumentsEliminated;
@@ -730,7 +730,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
     const PAListPtr &CallPAL = CS.getParamAttrs();
 
     // The call return attributes.
-    ParameterAttributes RAttrs = CallPAL.getParamAttrs(0);
+    Attributes RAttrs = CallPAL.getParamAttrs(0);
     // Adjust in case the function was changed to return void.
     RAttrs &= ~ParamAttr::typeIncompatible(NF->getReturnType());
     if (RAttrs)
@@ -746,7 +746,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
       if (ArgAlive[i]) {
         Args.push_back(*I);
         // Get original parameter attributes, but skip return attributes.
-        if (ParameterAttributes Attrs = CallPAL.getParamAttrs(i + 1))
+        if (Attributes Attrs = CallPAL.getParamAttrs(i + 1))
           ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs));
       }
 
@@ -756,7 +756,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
     // Push any varargs arguments on the list. Don't forget their attributes.
     for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) {
       Args.push_back(*I);
-      if (ParameterAttributes Attrs = CallPAL.getParamAttrs(i + 1))
+      if (Attributes Attrs = CallPAL.getParamAttrs(i + 1))
         ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs));
     }
 
index 297c6c15414e38f6a50e1c5ff3108173a448e65b..9968d59451fa7743a7a5e072d9cf2d0eb6fa7626 100644 (file)
@@ -125,7 +125,7 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
   // If the SCC doesn't unwind or doesn't throw, note this fact.
   if (!SCCMightUnwind || !SCCMightReturn)
     for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
-      ParameterAttributes NewAttributes = ParamAttr::None;
+      Attributes NewAttributes = ParamAttr::None;
 
       if (!SCCMightUnwind)
         NewAttributes |= ParamAttr::NoUnwind;
index 8e6415b2ab8bcd67e2a45f38860337bf06f0c593..68f20eaf9fe6a77751eed809623b1ec855d3f796 100644 (file)
@@ -210,7 +210,7 @@ Function *SRETPromotion::cloneFunctionBody(Function *F,
   const PAListPtr &PAL = F->getParamAttrs();
 
   // Add any return attributes.
-  if (ParameterAttributes attrs = PAL.getParamAttrs(0))
+  if (Attributes attrs = PAL.getParamAttrs(0))
     ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, attrs));
 
   // Skip first argument.
@@ -221,7 +221,7 @@ Function *SRETPromotion::cloneFunctionBody(Function *F,
   unsigned ParamIndex = 2; 
   while (I != E) {
     Params.push_back(I->getType());
-    if (ParameterAttributes Attrs = PAL.getParamAttrs(ParamIndex))
+    if (Attributes Attrs = PAL.getParamAttrs(ParamIndex))
       ParamAttrsVec.push_back(ParamAttrsWithIndex::get(ParamIndex - 1, Attrs));
     ++I;
     ++ParamIndex;
@@ -264,7 +264,7 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) {
 
     const PAListPtr &PAL = F->getParamAttrs();
     // Add any return attributes.
-    if (ParameterAttributes attrs = PAL.getParamAttrs(0))
+    if (Attributes attrs = PAL.getParamAttrs(0))
       ArgAttrsVec.push_back(ParamAttrsWithIndex::get(0, attrs));
 
     // Copy arguments, however skip first one.
@@ -276,7 +276,7 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) {
     unsigned ParamIndex = 2; 
     while (AI != AE) {
       Args.push_back(*AI); 
-      if (ParameterAttributes Attrs = PAL.getParamAttrs(ParamIndex))
+      if (Attributes Attrs = PAL.getParamAttrs(ParamIndex))
         ArgAttrsVec.push_back(ParamAttrsWithIndex::get(ParamIndex - 1, Attrs));
       ++ParamIndex;
       ++AI;
index e68e646b809eb6370e56ddd5badaede51afef801..8a3ecbc448dd84b730c43a36f5331081f1e4d6a0 100644 (file)
@@ -9127,7 +9127,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
       return false;   // Cannot transform this return value.
 
     if (!CallerPAL.isEmpty() && !Caller->use_empty()) {
-      ParameterAttributes RAttrs = CallerPAL.getParamAttrs(0);
+      Attributes RAttrs = CallerPAL.getParamAttrs(0);
       if (RAttrs & ParamAttr::typeIncompatible(NewRetTy))
         return false;   // Attribute not compatible with transformed value.
     }
@@ -9180,7 +9180,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
     for (unsigned i = CallerPAL.getNumSlots(); i; --i) {
       if (CallerPAL.getSlot(i - 1).Index <= FT->getNumParams())
         break;
-      ParameterAttributes PAttrs = CallerPAL.getSlot(i - 1).Attrs;
+      Attributes PAttrs = CallerPAL.getSlot(i - 1).Attrs;
       if (PAttrs & ParamAttr::VarArgsIncompatible)
         return false;
     }
@@ -9193,7 +9193,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
   attrVec.reserve(NumCommonArgs);
 
   // Get any return attributes.
-  ParameterAttributes RAttrs = CallerPAL.getParamAttrs(0);
+  Attributes RAttrs = CallerPAL.getParamAttrs(0);
 
   // If the return value is not being used, the type may not be compatible
   // with the existing attributes.  Wipe out any problematic attributes.
@@ -9216,7 +9216,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
     }
 
     // Add any parameter attributes.
-    if (ParameterAttributes PAttrs = CallerPAL.getParamAttrs(i + 1))
+    if (Attributes PAttrs = CallerPAL.getParamAttrs(i + 1))
       attrVec.push_back(ParamAttrsWithIndex::get(i + 1, PAttrs));
   }
 
@@ -9246,7 +9246,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
         }
 
         // Add any parameter attributes.
-        if (ParameterAttributes PAttrs = CallerPAL.getParamAttrs(i + 1))
+        if (Attributes PAttrs = CallerPAL.getParamAttrs(i + 1))
           attrVec.push_back(ParamAttrsWithIndex::get(i + 1, PAttrs));
       }
     }
@@ -9329,7 +9329,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) {
   if (!NestAttrs.isEmpty()) {
     unsigned NestIdx = 1;
     const Type *NestTy = 0;
-    ParameterAttributes NestAttr = ParamAttr::None;
+    Attributes NestAttr = ParamAttr::None;
 
     // Look for a parameter marked with the 'nest' attribute.
     for (FunctionType::param_iterator I = NestFTy->param_begin(),
@@ -9353,7 +9353,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) {
       // mean appending it.  Likewise for attributes.
 
       // Add any function result attributes.
-      if (ParameterAttributes Attr = Attrs.getParamAttrs(0))
+      if (Attributes Attr = Attrs.getParamAttrs(0))
         NewAttrs.push_back(ParamAttrsWithIndex::get(0, Attr));
 
       {
@@ -9374,7 +9374,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) {
 
           // Add the original argument and attributes.
           NewArgs.push_back(*I);
-          if (ParameterAttributes Attr = Attrs.getParamAttrs(Idx))
+          if (Attributes Attr = Attrs.getParamAttrs(Idx))
             NewAttrs.push_back
               (ParamAttrsWithIndex::get(Idx + (Idx >= NestIdx), Attr));
 
index 8810edb53323d9478948a8db73ef014dc50029dc..7ccca0023984e4c0701df32992f593a5e9540da4 100644 (file)
@@ -16,7 +16,6 @@
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/IntrinsicInst.h"
 #include "llvm/Instructions.h"
-#include "llvm/ParameterAttributes.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/Dominators.h"
index de04fda91509ad99622658083b2a62f748970af1..1246afcfc0e4e3d4bbdb52ef1548bc94bc388daa 100644 (file)
@@ -27,7 +27,7 @@
 #include "llvm/Constants.h"
 #include "llvm/Instructions.h"
 #include "llvm/Module.h"
-#include "llvm/ParameterAttributes.h"
+#include "llvm/Attributes.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Pass.h"
index b0e70bb89ad360cafef8b04bd2868e151aefbdfd..1339740c37884a7197091c5039cc71f2ea6735df 100644 (file)
@@ -18,7 +18,7 @@
 #include "llvm/Module.h"
 #include "llvm/Instructions.h"
 #include "llvm/Intrinsics.h"
-#include "llvm/ParameterAttributes.h"
+#include "llvm/Attributes.h"
 #include "llvm/Analysis/CallGraph.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/ADT/SmallVector.h"
index 32c468b4809c118aec27ba3ce49ca23ca8b5dd58..68335974d45176f80164b6aa11b9d251e28c69d6 100644 (file)
@@ -1006,7 +1006,7 @@ public:
   void write(const Type *Ty)          { printType(Ty);        }
 
   void writeOperand(const Value *Op, bool PrintType);
-  void writeParamOperand(const Value *Operand, ParameterAttributes Attrs);
+  void writeParamOperand(const Value *Operand, Attributes Attrs);
 
   const Module* getModule() { return TheModule; }
 
@@ -1016,7 +1016,7 @@ private:
   void printGlobal(const GlobalVariable *GV);
   void printAlias(const GlobalAlias *GV);
   void printFunction(const Function *F);
-  void printArgument(const Argument *FA, ParameterAttributes Attrs);
+  void printArgument(const Argument *FA, Attributes Attrs);
   void printBasicBlock(const BasicBlock *BB);
   void printInstruction(const Instruction &I);
 
@@ -1126,7 +1126,7 @@ void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType) {
 }
 
 void AssemblyWriter::writeParamOperand(const Value *Operand, 
-                                       ParameterAttributes Attrs) {
+                                       Attributes Attrs) {
   if (Operand == 0) {
     Out << "<null operand!>";
   } else {
@@ -1386,7 +1386,7 @@ void AssemblyWriter::printFunction(const Function *F) {
       // Output type...
       printType(FT->getParamType(i));
       
-      ParameterAttributes ArgAttrs = Attrs.getParamAttrs(i+1);
+      Attributes ArgAttrs = Attrs.getParamAttrs(i+1);
       if (ArgAttrs != ParamAttr::None)
         Out << ' ' << ParamAttr::getAsString(ArgAttrs);
     }
@@ -1398,7 +1398,7 @@ void AssemblyWriter::printFunction(const Function *F) {
     Out << "...";  // Output varargs portion of signature!
   }
   Out << ')';
-  ParameterAttributes RetAttrs = Attrs.getParamAttrs(0);
+  Attributes RetAttrs = Attrs.getParamAttrs(0);
   if (RetAttrs != ParamAttr::None)
     Out << ' ' << ParamAttr::getAsString(Attrs.getParamAttrs(0));
   if (F->hasSection())
@@ -1454,7 +1454,7 @@ void AssemblyWriter::printFunction(const Function *F) {
 /// the function.  Simply print it out
 ///
 void AssemblyWriter::printArgument(const Argument *Arg, 
-                                   ParameterAttributes Attrs) {
+                                   Attributes Attrs) {
   // Output type...
   printType(Arg->getType());
 
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
new file mode 100644 (file)
index 0000000..690eb48
--- /dev/null
@@ -0,0 +1,297 @@
+//===-- Attributes.cpp - Implement ParamAttrsList ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the ParamAttrsList class and ParamAttr utilities.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Attributes.h"
+#include "llvm/Type.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/FoldingSet.h"
+#include "llvm/Support/Streams.h"
+#include "llvm/Support/ManagedStatic.h"
+using namespace llvm;
+
+//===----------------------------------------------------------------------===//
+// ParamAttr Function Definitions
+//===----------------------------------------------------------------------===//
+
+std::string ParamAttr::getAsString(Attributes Attrs) {
+  std::string Result;
+  if (Attrs & ParamAttr::ZExt)
+    Result += "zeroext ";
+  if (Attrs & ParamAttr::SExt)
+    Result += "signext ";
+  if (Attrs & ParamAttr::NoReturn)
+    Result += "noreturn ";
+  if (Attrs & ParamAttr::NoUnwind)
+    Result += "nounwind ";
+  if (Attrs & ParamAttr::InReg)
+    Result += "inreg ";
+  if (Attrs & ParamAttr::NoAlias)
+    Result += "noalias ";
+  if (Attrs & ParamAttr::StructRet)
+    Result += "sret ";  
+  if (Attrs & ParamAttr::ByVal)
+    Result += "byval ";
+  if (Attrs & ParamAttr::Nest)
+    Result += "nest ";
+  if (Attrs & ParamAttr::ReadNone)
+    Result += "readnone ";
+  if (Attrs & ParamAttr::ReadOnly)
+    Result += "readonly ";
+  if (Attrs & ParamAttr::Alignment) {
+    Result += "align ";
+    Result += utostr((Attrs & ParamAttr::Alignment) >> 16);
+    Result += " ";
+  }
+  // Trim the trailing space.
+  Result.erase(Result.end()-1);
+  return Result;
+}
+
+Attributes ParamAttr::typeIncompatible(const Type *Ty) {
+  Attributes Incompatible = None;
+  
+  if (!Ty->isInteger())
+    // Attributes that only apply to integers.
+    Incompatible |= SExt | ZExt;
+  
+  if (!isa<PointerType>(Ty))
+    // Attributes that only apply to pointers.
+    Incompatible |= ByVal | Nest | NoAlias | StructRet;
+  
+  return Incompatible;
+}
+
+//===----------------------------------------------------------------------===//
+// ParamAttributeListImpl Definition
+//===----------------------------------------------------------------------===//
+
+namespace llvm {
+class ParamAttributeListImpl : public FoldingSetNode {
+  unsigned RefCount;
+  
+  // ParamAttrsList is uniqued, these should not be publicly available.
+  void operator=(const ParamAttributeListImpl &); // Do not implement
+  ParamAttributeListImpl(const ParamAttributeListImpl &); // Do not implement
+  ~ParamAttributeListImpl();                        // Private implementation
+public:
+  SmallVector<ParamAttrsWithIndex, 4> Attrs;
+  
+  ParamAttributeListImpl(const ParamAttrsWithIndex *Attr, unsigned NumAttrs)
+    : Attrs(Attr, Attr+NumAttrs) {
+    RefCount = 0;
+  }
+  
+  void AddRef() { ++RefCount; }
+  void DropRef() { if (--RefCount == 0) delete this; }
+  
+  void Profile(FoldingSetNodeID &ID) const {
+    Profile(ID, &Attrs[0], Attrs.size());
+  }
+  static void Profile(FoldingSetNodeID &ID, const ParamAttrsWithIndex *Attr,
+                      unsigned NumAttrs) {
+    for (unsigned i = 0; i != NumAttrs; ++i)
+      ID.AddInteger(uint64_t(Attr[i].Attrs) << 32 | unsigned(Attr[i].Index));
+  }
+};
+}
+
+static ManagedStatic<FoldingSet<ParamAttributeListImpl> > ParamAttrsLists;
+
+ParamAttributeListImpl::~ParamAttributeListImpl() {
+  ParamAttrsLists->RemoveNode(this);
+}
+
+
+PAListPtr PAListPtr::get(const ParamAttrsWithIndex *Attrs, unsigned NumAttrs) {
+  // If there are no attributes then return a null ParamAttrsList pointer.
+  if (NumAttrs == 0)
+    return PAListPtr();
+  
+#ifndef NDEBUG
+  for (unsigned i = 0; i != NumAttrs; ++i) {
+    assert(Attrs[i].Attrs != ParamAttr::None && 
+           "Pointless parameter attribute!");
+    assert((!i || Attrs[i-1].Index < Attrs[i].Index) &&
+           "Misordered ParamAttrsList!");
+  }
+#endif
+  
+  // Otherwise, build a key to look up the existing attributes.
+  FoldingSetNodeID ID;
+  ParamAttributeListImpl::Profile(ID, Attrs, NumAttrs);
+  void *InsertPos;
+  ParamAttributeListImpl *PAL =
+    ParamAttrsLists->FindNodeOrInsertPos(ID, InsertPos);
+  
+  // If we didn't find any existing attributes of the same shape then
+  // create a new one and insert it.
+  if (!PAL) {
+    PAL = new ParamAttributeListImpl(Attrs, NumAttrs);
+    ParamAttrsLists->InsertNode(PAL, InsertPos);
+  }
+  
+  // Return the ParamAttrsList that we found or created.
+  return PAListPtr(PAL);
+}
+
+
+//===----------------------------------------------------------------------===//
+// PAListPtr Method Implementations
+//===----------------------------------------------------------------------===//
+
+PAListPtr::PAListPtr(ParamAttributeListImpl *LI) : PAList(LI) {
+  if (LI) LI->AddRef();
+}
+
+PAListPtr::PAListPtr(const PAListPtr &P) : PAList(P.PAList) {
+  if (PAList) PAList->AddRef();  
+}
+
+const PAListPtr &PAListPtr::operator=(const PAListPtr &RHS) {
+  if (PAList == RHS.PAList) return *this;
+  if (PAList) PAList->DropRef();
+  PAList = RHS.PAList;
+  if (PAList) PAList->AddRef();
+  return *this;
+}
+
+PAListPtr::~PAListPtr() {
+  if (PAList) PAList->DropRef();
+}
+
+/// getNumSlots - Return the number of slots used in this attribute list. 
+/// This is the number of arguments that have an attribute set on them
+/// (including the function itself).
+unsigned PAListPtr::getNumSlots() const {
+  return PAList ? PAList->Attrs.size() : 0;
+}
+
+/// getSlot - Return the ParamAttrsWithIndex at the specified slot.  This
+/// holds a parameter number plus a set of attributes.
+const ParamAttrsWithIndex &PAListPtr::getSlot(unsigned Slot) const {
+  assert(PAList && Slot < PAList->Attrs.size() && "Slot # out of range!");
+  return PAList->Attrs[Slot];
+}
+
+
+/// getParamAttrs - The parameter attributes for the specified parameter are
+/// returned.  Parameters for the result are denoted with Idx = 0.
+/// Function notes are denoted with idx = ~0.
+Attributes PAListPtr::getParamAttrs(unsigned Idx) const {
+  if (PAList == 0) return ParamAttr::None;
+  
+  const SmallVector<ParamAttrsWithIndex, 4> &Attrs = PAList->Attrs;
+  for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
+    if (Attrs[i].Index == Idx)
+      return Attrs[i].Attrs;
+  return ParamAttr::None;
+}
+
+/// hasAttrSomewhere - Return true if the specified attribute is set for at
+/// least one parameter or for the return value.
+bool PAListPtr::hasAttrSomewhere(Attributes Attr) const {
+  if (PAList == 0) return false;
+  
+  const SmallVector<ParamAttrsWithIndex, 4> &Attrs = PAList->Attrs;
+  for (unsigned i = 0, e = Attrs.size(); i != e; ++i)
+    if (Attrs[i].Attrs & Attr)
+      return true;
+  return false;
+}
+
+
+PAListPtr PAListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
+  Attributes OldAttrs = getParamAttrs(Idx);
+#ifndef NDEBUG
+  // FIXME it is not obvious how this should work for alignment.
+  // For now, say we can't change a known alignment.
+  Attributes OldAlign = OldAttrs & ParamAttr::Alignment;
+  Attributes NewAlign = Attrs & ParamAttr::Alignment;
+  assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
+         "Attempt to change alignment!");
+#endif
+  
+  Attributes NewAttrs = OldAttrs | Attrs;
+  if (NewAttrs == OldAttrs)
+    return *this;
+  
+  SmallVector<ParamAttrsWithIndex, 8> NewAttrList;
+  if (PAList == 0)
+    NewAttrList.push_back(ParamAttrsWithIndex::get(Idx, Attrs));
+  else {
+    const SmallVector<ParamAttrsWithIndex, 4> &OldAttrList = PAList->Attrs;
+    unsigned i = 0, e = OldAttrList.size();
+    // Copy attributes for arguments before this one.
+    for (; i != e && OldAttrList[i].Index < Idx; ++i)
+      NewAttrList.push_back(OldAttrList[i]);
+
+    // If there are attributes already at this index, merge them in.
+    if (i != e && OldAttrList[i].Index == Idx) {
+      Attrs |= OldAttrList[i].Attrs;
+      ++i;
+    }
+    
+    NewAttrList.push_back(ParamAttrsWithIndex::get(Idx, Attrs));
+    
+    // Copy attributes for arguments after this one.
+    NewAttrList.insert(NewAttrList.end(), 
+                       OldAttrList.begin()+i, OldAttrList.end());
+  }
+  
+  return get(&NewAttrList[0], NewAttrList.size());
+}
+
+PAListPtr PAListPtr::removeAttr(unsigned Idx, Attributes Attrs) const {
+#ifndef NDEBUG
+  // FIXME it is not obvious how this should work for alignment.
+  // For now, say we can't pass in alignment, which no current use does.
+  assert(!(Attrs & ParamAttr::Alignment) && "Attempt to exclude alignment!");
+#endif
+  if (PAList == 0) return PAListPtr();
+  
+  Attributes OldAttrs = getParamAttrs(Idx);
+  Attributes NewAttrs = OldAttrs & ~Attrs;
+  if (NewAttrs == OldAttrs)
+    return *this;
+
+  SmallVector<ParamAttrsWithIndex, 8> NewAttrList;
+  const SmallVector<ParamAttrsWithIndex, 4> &OldAttrList = PAList->Attrs;
+  unsigned i = 0, e = OldAttrList.size();
+  
+  // Copy attributes for arguments before this one.
+  for (; i != e && OldAttrList[i].Index < Idx; ++i)
+    NewAttrList.push_back(OldAttrList[i]);
+  
+  // If there are attributes already at this index, merge them in.
+  assert(OldAttrList[i].Index == Idx && "Attribute isn't set?");
+  Attrs = OldAttrList[i].Attrs & ~Attrs;
+  ++i;
+  if (Attrs)  // If any attributes left for this parameter, add them.
+    NewAttrList.push_back(ParamAttrsWithIndex::get(Idx, Attrs));
+  
+  // Copy attributes for arguments after this one.
+  NewAttrList.insert(NewAttrList.end(), 
+                     OldAttrList.begin()+i, OldAttrList.end());
+  
+  return get(&NewAttrList[0], NewAttrList.size());
+}
+
+void PAListPtr::dump() const {
+  cerr << "PAL[ ";
+  for (unsigned i = 0; i < getNumSlots(); ++i) {
+    const ParamAttrsWithIndex &PAWI = getSlot(i);
+    cerr << "{" << PAWI.Index << "," << PAWI.Attrs << "} ";
+  }
+  
+  cerr << "]\n";
+}
index 93e39df830789f65d613c16bbf4cb0c70ce9c921..d1e577ed7d888670b0686066854eb021ee9e880a 100644 (file)
@@ -112,12 +112,12 @@ bool Argument::hasStructRetAttr() const {
 }
 
 /// addAttr - Add a ParamAttr to an argument
-void Argument::addAttr(ParameterAttributes attr) {
+void Argument::addAttr(Attributes attr) {
   getParent()->addParamAttr(getArgNo() + 1, attr);
 }
 
 /// removeAttr - Remove a ParamAttr from an argument
-void Argument::removeAttr(ParameterAttributes attr) {
+void Argument::removeAttr(Attributes attr) {
   getParent()->removeParamAttr(getArgNo() + 1, attr);
 }
 
@@ -229,13 +229,13 @@ void Function::dropAllReferences() {
   BasicBlocks.clear();    // Delete all basic blocks...
 }
 
-void Function::addParamAttr(unsigned i, ParameterAttributes attr) {
+void Function::addParamAttr(unsigned i, Attributes attr) {
   PAListPtr PAL = getParamAttrs();
   PAL = PAL.addAttr(i, attr);
   setParamAttrs(PAL);
 }
 
-void Function::removeParamAttr(unsigned i, ParameterAttributes attr) {
+void Function::removeParamAttr(unsigned i, Attributes attr) {
   PAListPtr PAL = getParamAttrs();
   PAL = PAL.removeAttr(i, attr);
   setParamAttrs(PAL);
@@ -356,7 +356,7 @@ const FunctionType *Intrinsic::getType(ID id, const Type **Tys,
 }
 
 PAListPtr Intrinsic::getParamAttrs(ID id) {
-  ParameterAttributes Attr = ParamAttr::None;
+  Attributes Attr = ParamAttr::None;
 
 #define GET_INTRINSIC_ATTRIBUTES
 #include "llvm/Intrinsics.gen"
index 881c23975a1d98ec775a16330cfb32b4943970dc..1366d304d4297cabaa1888ab97952ea5bfb0173a 100644 (file)
@@ -53,7 +53,7 @@ void CallSite::setParamAttrs(const PAListPtr &PAL) {
   else
     cast<InvokeInst>(I)->setParamAttrs(PAL);
 }
-bool CallSite::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
+bool CallSite::paramHasAttr(uint16_t i, Attributes attr) const {
   if (CallInst *CI = dyn_cast<CallInst>(I))
     return CI->paramHasAttr(i, attr);
   else
@@ -402,19 +402,19 @@ CallInst::CallInst(const CallInst &CI)
     OL[i] = InOL[i];
 }
 
-void CallInst::addParamAttr(unsigned i, ParameterAttributes attr) {
+void CallInst::addParamAttr(unsigned i, Attributes attr) {
   PAListPtr PAL = getParamAttrs();
   PAL = PAL.addAttr(i, attr);
   setParamAttrs(PAL);
 }
 
-void CallInst::removeParamAttr(unsigned i, ParameterAttributes attr) {
+void CallInst::removeParamAttr(unsigned i, Attributes attr) {
   PAListPtr PAL = getParamAttrs();
   PAL = PAL.removeAttr(i, attr);
   setParamAttrs(PAL);
 }
 
-bool CallInst::paramHasAttr(unsigned i, ParameterAttributes attr) const {
+bool CallInst::paramHasAttr(unsigned i, Attributes attr) const {
   if (ParamAttrs.paramHasAttr(i, attr))
     return true;
   if (const Function *F = getCalledFunction())
@@ -473,7 +473,7 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
   return setSuccessor(idx, B);
 }
 
-bool InvokeInst::paramHasAttr(unsigned i, ParameterAttributes attr) const {
+bool InvokeInst::paramHasAttr(unsigned i, Attributes attr) const {
   if (ParamAttrs.paramHasAttr(i, attr))
     return true;
   if (const Function *F = getCalledFunction())
@@ -481,13 +481,13 @@ bool InvokeInst::paramHasAttr(unsigned i, ParameterAttributes attr) const {
   return false;
 }
 
-void InvokeInst::addParamAttr(unsigned i, ParameterAttributes attr) {
+void InvokeInst::addParamAttr(unsigned i, Attributes attr) {
   PAListPtr PAL = getParamAttrs();
   PAL = PAL.addAttr(i, attr);
   setParamAttrs(PAL);
 }
 
-void InvokeInst::removeParamAttr(unsigned i, ParameterAttributes attr) {
+void InvokeInst::removeParamAttr(unsigned i, Attributes attr) {
   PAListPtr PAL = getParamAttrs();
   PAL = PAL.removeAttr(i, attr);
   setParamAttrs(PAL);
diff --git a/lib/VMCore/ParameterAttributes.cpp b/lib/VMCore/ParameterAttributes.cpp
deleted file mode 100644 (file)
index f1a38c4..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-//===-- ParameterAttributes.cpp - Implement ParamAttrsList ----------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the ParamAttrsList class and ParamAttr utilities.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ParameterAttributes.h"
-#include "llvm/Type.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/FoldingSet.h"
-#include "llvm/Support/Streams.h"
-#include "llvm/Support/ManagedStatic.h"
-using namespace llvm;
-
-//===----------------------------------------------------------------------===//
-// ParamAttr Function Definitions
-//===----------------------------------------------------------------------===//
-
-std::string ParamAttr::getAsString(ParameterAttributes Attrs) {
-  std::string Result;
-  if (Attrs & ParamAttr::ZExt)
-    Result += "zeroext ";
-  if (Attrs & ParamAttr::SExt)
-    Result += "signext ";
-  if (Attrs & ParamAttr::NoReturn)
-    Result += "noreturn ";
-  if (Attrs & ParamAttr::NoUnwind)
-    Result += "nounwind ";
-  if (Attrs & ParamAttr::InReg)
-    Result += "inreg ";
-  if (Attrs & ParamAttr::NoAlias)
-    Result += "noalias ";
-  if (Attrs & ParamAttr::StructRet)
-    Result += "sret ";  
-  if (Attrs & ParamAttr::ByVal)
-    Result += "byval ";
-  if (Attrs & ParamAttr::Nest)
-    Result += "nest ";
-  if (Attrs & ParamAttr::ReadNone)
-    Result += "readnone ";
-  if (Attrs & ParamAttr::ReadOnly)
-    Result += "readonly ";
-  if (Attrs & ParamAttr::Alignment) {
-    Result += "align ";
-    Result += utostr((Attrs & ParamAttr::Alignment) >> 16);
-    Result += " ";
-  }
-  // Trim the trailing space.
-  Result.erase(Result.end()-1);
-  return Result;
-}
-
-ParameterAttributes ParamAttr::typeIncompatible(const Type *Ty) {
-  ParameterAttributes Incompatible = None;
-  
-  if (!Ty->isInteger())
-    // Attributes that only apply to integers.
-    Incompatible |= SExt | ZExt;
-  
-  if (!isa<PointerType>(Ty))
-    // Attributes that only apply to pointers.
-    Incompatible |= ByVal | Nest | NoAlias | StructRet;
-  
-  return Incompatible;
-}
-
-//===----------------------------------------------------------------------===//
-// ParamAttributeListImpl Definition
-//===----------------------------------------------------------------------===//
-
-namespace llvm {
-class ParamAttributeListImpl : public FoldingSetNode {
-  unsigned RefCount;
-  
-  // ParamAttrsList is uniqued, these should not be publicly available.
-  void operator=(const ParamAttributeListImpl &); // Do not implement
-  ParamAttributeListImpl(const ParamAttributeListImpl &); // Do not implement
-  ~ParamAttributeListImpl();                        // Private implementation
-public:
-  SmallVector<ParamAttrsWithIndex, 4> Attrs;
-  
-  ParamAttributeListImpl(const ParamAttrsWithIndex *Attr, unsigned NumAttrs)
-    : Attrs(Attr, Attr+NumAttrs) {
-    RefCount = 0;
-  }
-  
-  void AddRef() { ++RefCount; }
-  void DropRef() { if (--RefCount == 0) delete this; }
-  
-  void Profile(FoldingSetNodeID &ID) const {
-    Profile(ID, &Attrs[0], Attrs.size());
-  }
-  static void Profile(FoldingSetNodeID &ID, const ParamAttrsWithIndex *Attr,
-                      unsigned NumAttrs) {
-    for (unsigned i = 0; i != NumAttrs; ++i)
-      ID.AddInteger(uint64_t(Attr[i].Attrs) << 32 | unsigned(Attr[i].Index));
-  }
-};
-}
-
-static ManagedStatic<FoldingSet<ParamAttributeListImpl> > ParamAttrsLists;
-
-ParamAttributeListImpl::~ParamAttributeListImpl() {
-  ParamAttrsLists->RemoveNode(this);
-}
-
-
-PAListPtr PAListPtr::get(const ParamAttrsWithIndex *Attrs, unsigned NumAttrs) {
-  // If there are no attributes then return a null ParamAttrsList pointer.
-  if (NumAttrs == 0)
-    return PAListPtr();
-  
-#ifndef NDEBUG
-  for (unsigned i = 0; i != NumAttrs; ++i) {
-    assert(Attrs[i].Attrs != ParamAttr::None && 
-           "Pointless parameter attribute!");
-    assert((!i || Attrs[i-1].Index < Attrs[i].Index) &&
-           "Misordered ParamAttrsList!");
-  }
-#endif
-  
-  // Otherwise, build a key to look up the existing attributes.
-  FoldingSetNodeID ID;
-  ParamAttributeListImpl::Profile(ID, Attrs, NumAttrs);
-  void *InsertPos;
-  ParamAttributeListImpl *PAL =
-    ParamAttrsLists->FindNodeOrInsertPos(ID, InsertPos);
-  
-  // If we didn't find any existing attributes of the same shape then
-  // create a new one and insert it.
-  if (!PAL) {
-    PAL = new ParamAttributeListImpl(Attrs, NumAttrs);
-    ParamAttrsLists->InsertNode(PAL, InsertPos);
-  }
-  
-  // Return the ParamAttrsList that we found or created.
-  return PAListPtr(PAL);
-}
-
-
-//===----------------------------------------------------------------------===//
-// PAListPtr Method Implementations
-//===----------------------------------------------------------------------===//
-
-PAListPtr::PAListPtr(ParamAttributeListImpl *LI) : PAList(LI) {
-  if (LI) LI->AddRef();
-}
-
-PAListPtr::PAListPtr(const PAListPtr &P) : PAList(P.PAList) {
-  if (PAList) PAList->AddRef();  
-}
-
-const PAListPtr &PAListPtr::operator=(const PAListPtr &RHS) {
-  if (PAList == RHS.PAList) return *this;
-  if (PAList) PAList->DropRef();
-  PAList = RHS.PAList;
-  if (PAList) PAList->AddRef();
-  return *this;
-}
-
-PAListPtr::~PAListPtr() {
-  if (PAList) PAList->DropRef();
-}
-
-/// getNumSlots - Return the number of slots used in this attribute list. 
-/// This is the number of arguments that have an attribute set on them
-/// (including the function itself).
-unsigned PAListPtr::getNumSlots() const {
-  return PAList ? PAList->Attrs.size() : 0;
-}
-
-/// getSlot - Return the ParamAttrsWithIndex at the specified slot.  This
-/// holds a parameter number plus a set of attributes.
-const ParamAttrsWithIndex &PAListPtr::getSlot(unsigned Slot) const {
-  assert(PAList && Slot < PAList->Attrs.size() && "Slot # out of range!");
-  return PAList->Attrs[Slot];
-}
-
-
-/// getParamAttrs - The parameter attributes for the specified parameter are
-/// returned.  Parameters for the result are denoted with Idx = 0.
-/// Function notes are denoted with idx = ~0.
-ParameterAttributes PAListPtr::getParamAttrs(unsigned Idx) const {
-  if (PAList == 0) return ParamAttr::None;
-  
-  const SmallVector<ParamAttrsWithIndex, 4> &Attrs = PAList->Attrs;
-  for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
-    if (Attrs[i].Index == Idx)
-      return Attrs[i].Attrs;
-  return ParamAttr::None;
-}
-
-/// hasAttrSomewhere - Return true if the specified attribute is set for at
-/// least one parameter or for the return value.
-bool PAListPtr::hasAttrSomewhere(ParameterAttributes Attr) const {
-  if (PAList == 0) return false;
-  
-  const SmallVector<ParamAttrsWithIndex, 4> &Attrs = PAList->Attrs;
-  for (unsigned i = 0, e = Attrs.size(); i != e; ++i)
-    if (Attrs[i].Attrs & Attr)
-      return true;
-  return false;
-}
-
-
-PAListPtr PAListPtr::addAttr(unsigned Idx, ParameterAttributes Attrs) const {
-  ParameterAttributes OldAttrs = getParamAttrs(Idx);
-#ifndef NDEBUG
-  // FIXME it is not obvious how this should work for alignment.
-  // For now, say we can't change a known alignment.
-  ParameterAttributes OldAlign = OldAttrs & ParamAttr::Alignment;
-  ParameterAttributes NewAlign = Attrs & ParamAttr::Alignment;
-  assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
-         "Attempt to change alignment!");
-#endif
-  
-  ParameterAttributes NewAttrs = OldAttrs | Attrs;
-  if (NewAttrs == OldAttrs)
-    return *this;
-  
-  SmallVector<ParamAttrsWithIndex, 8> NewAttrList;
-  if (PAList == 0)
-    NewAttrList.push_back(ParamAttrsWithIndex::get(Idx, Attrs));
-  else {
-    const SmallVector<ParamAttrsWithIndex, 4> &OldAttrList = PAList->Attrs;
-    unsigned i = 0, e = OldAttrList.size();
-    // Copy attributes for arguments before this one.
-    for (; i != e && OldAttrList[i].Index < Idx; ++i)
-      NewAttrList.push_back(OldAttrList[i]);
-
-    // If there are attributes already at this index, merge them in.
-    if (i != e && OldAttrList[i].Index == Idx) {
-      Attrs |= OldAttrList[i].Attrs;
-      ++i;
-    }
-    
-    NewAttrList.push_back(ParamAttrsWithIndex::get(Idx, Attrs));
-    
-    // Copy attributes for arguments after this one.
-    NewAttrList.insert(NewAttrList.end(), 
-                       OldAttrList.begin()+i, OldAttrList.end());
-  }
-  
-  return get(&NewAttrList[0], NewAttrList.size());
-}
-
-PAListPtr PAListPtr::removeAttr(unsigned Idx, ParameterAttributes Attrs) const {
-#ifndef NDEBUG
-  // FIXME it is not obvious how this should work for alignment.
-  // For now, say we can't pass in alignment, which no current use does.
-  assert(!(Attrs & ParamAttr::Alignment) && "Attempt to exclude alignment!");
-#endif
-  if (PAList == 0) return PAListPtr();
-  
-  ParameterAttributes OldAttrs = getParamAttrs(Idx);
-  ParameterAttributes NewAttrs = OldAttrs & ~Attrs;
-  if (NewAttrs == OldAttrs)
-    return *this;
-
-  SmallVector<ParamAttrsWithIndex, 8> NewAttrList;
-  const SmallVector<ParamAttrsWithIndex, 4> &OldAttrList = PAList->Attrs;
-  unsigned i = 0, e = OldAttrList.size();
-  
-  // Copy attributes for arguments before this one.
-  for (; i != e && OldAttrList[i].Index < Idx; ++i)
-    NewAttrList.push_back(OldAttrList[i]);
-  
-  // If there are attributes already at this index, merge them in.
-  assert(OldAttrList[i].Index == Idx && "Attribute isn't set?");
-  Attrs = OldAttrList[i].Attrs & ~Attrs;
-  ++i;
-  if (Attrs)  // If any attributes left for this parameter, add them.
-    NewAttrList.push_back(ParamAttrsWithIndex::get(Idx, Attrs));
-  
-  // Copy attributes for arguments after this one.
-  NewAttrList.insert(NewAttrList.end(), 
-                     OldAttrList.begin()+i, OldAttrList.end());
-  
-  return get(&NewAttrList[0], NewAttrList.size());
-}
-
-void PAListPtr::dump() const {
-  cerr << "PAL[ ";
-  for (unsigned i = 0; i < getNumSlots(); ++i) {
-    const ParamAttrsWithIndex &PAWI = getSlot(i);
-    cerr << "{" << PAWI.Index << "," << PAWI.Attrs << "} ";
-  }
-  
-  cerr << "]\n";
-}
index f4a59c25242e97db025296b3520d4e9de0a0b813..046c4463acd44bc307caacd968c8133f63713b32 100644 (file)
@@ -268,7 +268,7 @@ namespace {
     void VerifyCallSite(CallSite CS);
     void VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F,
                                   unsigned Count, ...);
-    void VerifyAttrs(ParameterAttributes Attrs, const Type *Ty,
+    void VerifyAttrs(Attributes Attrs, const Type *Ty,
                      bool isReturnValue, const Value *V);
     void VerifyFunctionAttrs(const FunctionType *FT, const PAListPtr &Attrs,
                              const Value *V);
@@ -406,33 +406,33 @@ void Verifier::verifyTypeSymbolTable(TypeSymbolTable &ST) {
 
 // VerifyAttrs - Check the given parameter attributes for an argument or return
 // value of the specified type.  The value V is printed in error messages.
-void Verifier::VerifyAttrs(ParameterAttributes Attrs, const Type *Ty, 
+void Verifier::VerifyAttrs(Attributes Attrs, const Type *Ty, 
                            bool isReturnValue, const Value *V) {
   if (Attrs == ParamAttr::None)
     return;
 
   if (isReturnValue) {
-    ParameterAttributes RetI = Attrs & ParamAttr::ParameterOnly;
+    Attributes RetI = Attrs & ParamAttr::ParameterOnly;
     Assert1(!RetI, "Attribute " + ParamAttr::getAsString(RetI) +
             " does not apply to return values!", V);
   } else {
-    ParameterAttributes ParmI = Attrs & ParamAttr::ReturnOnly;
+    Attributes ParmI = Attrs & ParamAttr::ReturnOnly;
     Assert1(!ParmI, "Attribute " + ParamAttr::getAsString(ParmI) +
             " only applies to return values!", V);
   }
 
   for (unsigned i = 0;
        i < array_lengthof(ParamAttr::MutuallyIncompatible); ++i) {
-    ParameterAttributes MutI = Attrs & ParamAttr::MutuallyIncompatible[i];
+    Attributes MutI = Attrs & ParamAttr::MutuallyIncompatible[i];
     Assert1(!(MutI & (MutI - 1)), "Attributes " +
             ParamAttr::getAsString(MutI) + " are incompatible!", V);
   }
 
-  ParameterAttributes TypeI = Attrs & ParamAttr::typeIncompatible(Ty);
+  Attributes TypeI = Attrs & ParamAttr::typeIncompatible(Ty);
   Assert1(!TypeI, "Wrong type for attribute " +
           ParamAttr::getAsString(TypeI), V);
 
-  ParameterAttributes ByValI = Attrs & ParamAttr::ByVal;
+  Attributes ByValI = Attrs & ParamAttr::ByVal;
   if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
     Assert1(!ByValI || PTy->getElementType()->isSized(),
             "Attribute " + ParamAttr::getAsString(ByValI) +
@@ -976,11 +976,11 @@ void Verifier::VerifyCallSite(CallSite CS) {
   if (FTy->isVarArg())
     // Check attributes on the varargs part.
     for (unsigned Idx = 1 + FTy->getNumParams(); Idx <= CS.arg_size(); ++Idx) {
-      ParameterAttributes Attr = Attrs.getParamAttrs(Idx);
+      Attributes Attr = Attrs.getParamAttrs(Idx);
 
       VerifyAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I);
 
-      ParameterAttributes VArgI = Attr & ParamAttr::VarArgsIncompatible;
+      Attributes VArgI = Attr & ParamAttr::VarArgsIncompatible;
       Assert1(!VArgI, "Attribute " + ParamAttr::getAsString(VArgI) +
               " cannot be used for vararg call arguments!", I);
     }