Add functions to enable adding a single attribute to a function and
authorEric Christopher <echristo@apple.com>
Fri, 16 May 2008 20:39:43 +0000 (20:39 +0000)
committerEric Christopher <echristo@apple.com>
Fri, 16 May 2008 20:39:43 +0000 (20:39 +0000)
its associated call site.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51204 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Function.h
include/llvm/Instructions.h
lib/VMCore/Function.cpp
lib/VMCore/Instructions.cpp

index 28c301fe2f6f62dfd0cc9268b76abff510fd1673..5dd8502d3ab33510fab4fbfaa1bf1c0a7f09b5cf 100644 (file)
@@ -170,6 +170,9 @@ public:
   bool paramHasAttr(unsigned i, ParameterAttributes attr) const {
     return ParamAttrs.paramHasAttr(i, attr);
   }
+
+  /// addParamAttr - adds the attribute to the list of attributes.
+  void addParamAttr(unsigned i, ParameterAttributes attr);
   
   /// @brief Extract the alignment for a call or parameter (0=unknown).
   unsigned getParamAlignment(unsigned i) const {
index ba46b2031e0a59b5e191943c68f89fbaf650a70e..1bd2cba21955be8776a5f46ed86e7f556cd3db0a 100644 (file)
@@ -1109,6 +1109,9 @@ public:
 
   /// setParamAttrs - Sets the parameter attributes for this call.
   void setParamAttrs(const PAListPtr &Attrs) { ParamAttrs = Attrs; }
+  
+  /// addParamAttr - adds the attribute to the list of attributes.
+  void addParamAttr(unsigned i, ParameterAttributes attr);
 
   /// @brief Determine whether the call or the callee has the given attribute.
   bool paramHasAttr(unsigned i, unsigned attr) const;
@@ -2428,6 +2431,9 @@ public:
 
   /// @brief Determine whether the call or the callee has the given attribute.
   bool paramHasAttr(unsigned i, ParameterAttributes attr) const;
+  
+  /// addParamAttr - adds the attribute to the list of attributes.
+  void addParamAttr(unsigned i, ParameterAttributes attr);
 
   /// @brief Extract the alignment for a call or parameter (0=unknown).
   unsigned getParamAlignment(unsigned i) const {
index 9f7eefe1a6bfdb1eb060cd30e021c71e6b9ad4d9..49e69e1b2c1f75445c977fc3cb803642ca7c4ff5 100644 (file)
@@ -240,6 +240,12 @@ void Function::setDoesNotThrow(bool doesNotThrow) {
   setParamAttrs(PAL);
 }
 
+void Function::addParamAttr(unsigned i, ParameterAttributes attr) {
+  PAListPtr PAL = getParamAttrs();
+  PAL = PAL.addAttr(i, attr);
+  setParamAttrs(PAL);
+}
+
 // Maintain the collector name for each function in an on-the-side table. This
 // saves allocating an additional word in Function for programs which do not use
 // GC (i.e., most programs) at the cost of increased overhead for clients which
index ff3b8b546f0cf44461bc85eea98a2ceb74208d70..40eea138350671f694927ee0a218801e93ea5412 100644 (file)
@@ -373,6 +373,12 @@ CallInst::CallInst(const CallInst &CI)
     OL[i].init(InOL[i], this);
 }
 
+void CallInst::addParamAttr(unsigned i, ParameterAttributes attr) {
+  PAListPtr PAL = getParamAttrs();
+  PAL = PAL.addAttr(i, attr);
+  setParamAttrs(PAL);
+}
+
 bool CallInst::paramHasAttr(unsigned i, ParameterAttributes attr) const {
   if (ParamAttrs.paramHasAttr(i, attr))
     return true;
@@ -449,6 +455,12 @@ bool InvokeInst::paramHasAttr(unsigned i, ParameterAttributes attr) const {
   return false;
 }
 
+void InvokeInst::addParamAttr(unsigned i, ParameterAttributes attr) {
+  PAListPtr PAL = getParamAttrs();
+  PAL = PAL.addAttr(i, attr);
+  setParamAttrs(PAL);
+}
+
 void InvokeInst::setDoesNotThrow(bool doesNotThrow) {
   PAListPtr PAL = getParamAttrs();
   if (doesNotThrow)