diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-04-08 22:30:27 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-04-08 22:30:27 +0000 |
commit | a3c4112a0ecd50ad89c87a32993834dc91b5898a (patch) | |
tree | 4a07631131fb2fa334e244e9cf289d99062ea853 /include/llvm/ParameterAttributes.h | |
parent | 921169b103497001e1d22927f4fd1682d43eba57 (diff) | |
download | external_llvm-a3c4112a0ecd50ad89c87a32993834dc91b5898a.zip external_llvm-a3c4112a0ecd50ad89c87a32993834dc91b5898a.tar.gz external_llvm-a3c4112a0ecd50ad89c87a32993834dc91b5898a.tar.bz2 |
Implement more feedback:
* Allow attributes to be added and removed singly or jointly so that in
the future something like -pruneh can manipulate them more easily.
* Move functions generally only useful for LLVM internals to the end of
the accessors list instead of the beginning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ParameterAttributes.h')
-rw-r--r-- | include/llvm/ParameterAttributes.h | 78 |
1 files changed, 54 insertions, 24 deletions
diff --git a/include/llvm/ParameterAttributes.h b/include/llvm/ParameterAttributes.h index 7ef2c42..897512d 100644 --- a/include/llvm/ParameterAttributes.h +++ b/include/llvm/ParameterAttributes.h @@ -48,15 +48,6 @@ class ParamAttrsList { /// @name Accessors /// @{ public: - /// Returns the parameter index of a particular parameter attribute in this - /// list of attributes. Note that the attr_index is an index into this - /// class's list of attributes, not the index of the parameter. The result - /// is the index of the parameter. - /// @brief Get a parameter index - uint16_t getParamIndex(unsigned attr_index) const { - return attrs[attr_index].index; - } - /// The parameter attributes for the \p indexth parameter are returned. /// The 0th parameter refers to the return type of the function. Note that /// the \p param_index is an index into the function's parameters, not an @@ -75,17 +66,6 @@ class ParamAttrsList { return getParamAttrs(i) & attr; } - /// Determines how many parameter attributes are set in this ParamAttrsList. - /// This says nothing about how many parameters the function has. It also - /// says nothing about the highest parameter index that has attributes. - /// @returns the number of parameter attributes in this ParamAttrsList. - /// @brief Return the number of parameter attributes this type has. - unsigned size() const { return attrs.size(); } - - /// @returns true if this ParamAttrsList is empty. - /// @brief Determine emptiness of ParamAttrsList. - unsigned empty() const { return attrs.empty(); } - /// 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. @@ -116,15 +96,65 @@ class ParamAttrsList { } return false; } + + /// Returns the parameter index of a particular parameter attribute in this + /// list of attributes. Note that the attr_index is an index into this + /// class's list of attributes, not the index of a parameter. The result + /// is the index of the parameter. Clients generally should not use this + /// method. It is used internally by LLVM. + /// @brief Get a parameter index + uint16_t getParamIndex(unsigned attr_index) const { + return attrs[attr_index].index; + } + + /// Determines how many parameter attributes are set in this ParamAttrsList. + /// This says nothing about how many parameters the function has. It also + /// says nothing about the highest parameter index that has attributes. + /// Clients generally should not use this method. It is used internally by + /// LLVM. + /// @returns the number of parameter attributes in this ParamAttrsList. + /// @brief Return the number of parameter attributes this type has. + unsigned size() const { return attrs.size(); } + + /// Clients generally should not use this method. It is used internally by + /// LLVM. + /// @returns true if this ParamAttrsList is empty. + /// @brief Determine emptiness of ParamAttrsList. + unsigned empty() const { return attrs.empty(); } + /// @} /// @name Mutators /// @{ public: - /// This adds a pair to the list of parameter index and attribute pairs - /// represented by this class. If the parameter index already exists then - /// its attributes are overwritten. Otherwise it is added to the list. + /// This method will add the \p attr to the parameter with index + /// \p param_index. If the parameter index does not exist it will be created + /// and the \p will be the only attribute set. Otherwise, any existing + /// attributes for the specified parameter remain set and the attribute + /// given by \p attr is also set. + /// @brief Add a single ParameterAttribute + void addAttribute(uint16_t param_index, ParameterAttribute attr); + + /// This method will remove the \p attr to the parameter with index + /// \p param_index. If the parameter index does not exist in the list, + /// an assertion will occur. If the specified attribute is the last + /// attribute set for the specified parameter index, the attributes for + /// that index are removed completely from the list (size is decremented). + /// Otherwise, the specified attribute is removed from the set of attributes + /// for the given index. + /// @brief Remove a single ParameterAttribute + void removeAttribute(uint16_t param_index, ParameterAttribute attr); + + /// This is identical to addAttribute but permits you to set multiple + /// attributes at the same time. The \p attrs value is expected to be a + /// bitwise OR of the attributes you would like to have added. /// @brief Insert ParameterAttributes for an index - void setAttributes(uint16_t param_index, uint16_t attrs); + void addAttributes(uint16_t param_index, uint16_t attrs); + + /// This is identical to removeAttribute but permits you to remove multiple + /// attributes at the same time. The\p attrs value is expected to be a + /// bitwise OR of the attribute syou would like to have removed. + /// @brief Remove ParameterAttributes for an index + void removeAttributes(uint16_t param_index, uint16_t attrs); /// @} /// @name Data |