diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-02 23:42:30 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-02 23:42:30 +0000 |
commit | 50ee9ddc8f0633af6cb0a5693a2c706e98f944da (patch) | |
tree | e9d758370876a5e6235f5f0ac307f9b5d598c1cb /include | |
parent | a114b14e5dd1869b8dfcf79736fe05a3616b520a (diff) |
Split param attr implementation out from Function.cpp into its
own file. Don't #include ParameterAttributes.h into any major
public header files: just move methods out of line as appropriate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45517 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Function.h | 27 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 51 | ||||
-rw-r--r-- | include/llvm/ParameterAttributes.h | 2 | ||||
-rw-r--r-- | include/llvm/Support/CallSite.h | 3 |
4 files changed, 23 insertions, 60 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h index d68d5133dc..31ee6d7544 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -21,7 +21,6 @@ #include "llvm/GlobalValue.h" #include "llvm/BasicBlock.h" #include "llvm/Argument.h" -#include "llvm/ParameterAttributes.h" #include "llvm/Support/Annotation.h" namespace llvm { @@ -161,34 +160,22 @@ public: void clearCollector(); /// @brief Determine whether the function has the given attribute. - bool paramHasAttr(uint16_t i, ParameterAttributes attr) const { - return ParamAttrs && ParamAttrs->paramHasAttr(i, attr); - } - + bool paramHasAttr(uint16_t i, unsigned attr) const; + /// @brief Determine if the function cannot return. - bool doesNotReturn() const { - return paramHasAttr(0, ParamAttr::NoReturn); - } + bool doesNotReturn() const; /// @brief Determine if the function cannot unwind. - bool doesNotThrow() const { - return paramHasAttr(0, ParamAttr::NoUnwind); - } + bool doesNotThrow() const; /// @brief Determine if the function does not access memory. - bool doesNotAccessMemory() const { - return paramHasAttr(0, ParamAttr::ReadNone); - } + bool doesNotAccessMemory() const; /// @brief Determine if the function does not access or only reads memory. - bool onlyReadsMemory() const { - return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly); - } + bool onlyReadsMemory() const; /// @brief Determine if the function returns a structure. - bool isStructReturn() const { - return paramHasAttr(1, ParamAttr::StructRet); - } + bool isStructReturn() const; /// deleteBody - This method deletes the body of the function, and converts /// the linkage to external. diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 8b86792a44..1594a0ace6 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -20,7 +20,6 @@ #include "llvm/InstrTypes.h" #include "llvm/DerivedTypes.h" -#include "llvm/ParameterAttributes.h" namespace llvm { @@ -927,34 +926,23 @@ public: void setParamAttrs(const ParamAttrsList *attrs); /// @brief Determine whether the call or the callee has the given attribute. - bool paramHasAttr(uint16_t i, ParameterAttributes attr) const; + bool paramHasAttr(uint16_t i, unsigned attr) const; /// @brief Determine if the call does not access memory. - bool doesNotAccessMemory() const { - return paramHasAttr(0, ParamAttr::ReadNone); - } - + bool doesNotAccessMemory() const; + /// @brief Determine if the call does not access or only reads memory. - bool onlyReadsMemory() const { - return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly); - } - + bool onlyReadsMemory() const; + /// @brief Determine if the call cannot return. - bool doesNotReturn() const { - return paramHasAttr(0, ParamAttr::NoReturn); - } + bool doesNotReturn() const; /// @brief Determine if the call cannot unwind. - bool doesNotThrow() const { - return paramHasAttr(0, ParamAttr::NoUnwind); - } + bool doesNotThrow() const; void setDoesNotThrow(bool doesNotThrow = true); /// @brief Determine if the call returns a structure. - bool isStructReturn() const { - // Be friendly and also check the callee. - return paramHasAttr(1, ParamAttr::StructRet); - } + bool isStructReturn() const; /// getCalledFunction - Return the function being called by this instruction /// if it is a direct call. If it is a call through a function pointer, @@ -1732,34 +1720,23 @@ public: void setParamAttrs(const ParamAttrsList *attrs); /// @brief Determine whether the call or the callee has the given attribute. - bool paramHasAttr(uint16_t i, ParameterAttributes attr) const; + bool paramHasAttr(uint16_t i, unsigned attr) const; /// @brief Determine if the call does not access memory. - bool doesNotAccessMemory() const { - return paramHasAttr(0, ParamAttr::ReadNone); - } + bool doesNotAccessMemory() const; /// @brief Determine if the call does not access or only reads memory. - bool onlyReadsMemory() const { - return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly); - } + bool onlyReadsMemory() const; /// @brief Determine if the call cannot return. - bool doesNotReturn() const { - return paramHasAttr(0, ParamAttr::NoReturn); - } + bool doesNotReturn() const; /// @brief Determine if the call cannot unwind. - bool doesNotThrow() const { - return paramHasAttr(0, ParamAttr::NoUnwind); - } + bool doesNotThrow() const; void setDoesNotThrow(bool doesNotThrow = true); /// @brief Determine if the call returns a structure. - bool isStructReturn() const { - // Be friendly and also check the callee. - return paramHasAttr(1, ParamAttr::StructRet); - } + bool isStructReturn() const; /// getCalledFunction - Return the function called, or null if this is an /// indirect function invocation. diff --git a/include/llvm/ParameterAttributes.h b/include/llvm/ParameterAttributes.h index caeb556a3f..080de46935 100644 --- a/include/llvm/ParameterAttributes.h +++ b/include/llvm/ParameterAttributes.h @@ -73,7 +73,7 @@ const uint16_t MutuallyIncompatible[3] = { ReadNone | ReadOnly }; -} +} // end namespace ParamAttr /// This is just a pair of values to associate a set of parameter attributes /// with a parameter index. diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h index eb678ed0f0..f7d8db6086 100644 --- a/include/llvm/Support/CallSite.h +++ b/include/llvm/Support/CallSite.h @@ -22,7 +22,6 @@ #include "llvm/Instruction.h" #include "llvm/BasicBlock.h" -#include "llvm/ParameterAttributes.h" namespace llvm { @@ -65,7 +64,7 @@ public: void setParamAttrs(const ParamAttrsList *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, unsigned attr) const; /// @brief Determine if the call does not access memory. bool doesNotAccessMemory() const; |