aboutsummaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-13 05:00:21 +0000
committerChris Lattner <sabre@nondot.org>2008-03-13 05:00:21 +0000
commitd5d94df73f2af639a4cffc7e4f3491001817df08 (patch)
tree0a0f95159da3df6c4c5316c0a6efcd68d716a2b7 /include/llvm
parent041221c0972ff575b07f76808c504833d629ae1f (diff)
move a bunch of trivial methods to be inline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48326 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Function.h26
-rw-r--r--include/llvm/Instructions.h58
2 files changed, 62 insertions, 22 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index be7ea91049..36b0dd3df8 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -160,26 +160,38 @@ public:
void clearCollector();
/// @brief Determine whether the function has the given attribute.
- bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
+ bool paramHasAttr(unsigned i, ParameterAttributes attr) const {
+ return ParamAttrs.paramHasAttr(i, attr);
+ }
/// @brief Extract the alignment for a call or parameter (0=unknown).
- uint16_t getParamAlignment(uint16_t i) const;
+ unsigned getParamAlignment(unsigned i) const {
+ return ParamAttrs.getParamAlignment(i);
+ }
/// @brief Determine if the function cannot return.
- bool doesNotReturn() const;
+ bool doesNotReturn() const { return paramHasAttr(0, ParamAttr::NoReturn); }
/// @brief Determine if the function cannot unwind.
- bool doesNotThrow() const;
+ bool doesNotThrow() const {
+ return paramHasAttr(0, ParamAttr::NoUnwind);
+ }
/// @brief Determine if the function does not access memory.
- bool doesNotAccessMemory() const;
+ bool doesNotAccessMemory() const {
+ return paramHasAttr(0, ParamAttr::ReadNone);
+ }
/// @brief Determine if the function does not access or only reads memory.
- bool onlyReadsMemory() const;
+ bool onlyReadsMemory() const {
+ return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
+ }
/// @brief Determine if the function returns a structure through first
/// pointer argument.
- bool hasStructRetAttr() const;
+ bool hasStructRetAttr() const {
+ return paramHasAttr(1, ParamAttr::StructRet);
+ }
/// 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 741153f288..c80154c76d 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -934,30 +934,45 @@ public:
void setParamAttrs(const PAListPtr &Attrs) { ParamAttrs = Attrs; }
/// @brief Determine whether the call or the callee has the given attribute.
- bool paramHasAttr(uint16_t i, unsigned attr) const;
+ bool paramHasAttr(unsigned i, unsigned attr) const;
/// @brief Extract the alignment for a call or parameter (0=unknown).
- uint16_t getParamAlignment(uint16_t i) const;
+ unsigned getParamAlignment(unsigned i) const {
+ return ParamAttrs.getParamAlignment(i);
+ }
/// @brief Determine if the call does not access memory.
- bool doesNotAccessMemory() const;
+ bool doesNotAccessMemory() const {
+ return paramHasAttr(0, ParamAttr::ReadNone);
+ }
/// @brief Determine if the call does not access or only reads memory.
- bool onlyReadsMemory() const;
+ bool onlyReadsMemory() const {
+ return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
+ }
/// @brief Determine if the call cannot return.
- bool doesNotReturn() const;
+ bool doesNotReturn() const {
+ return paramHasAttr(0, ParamAttr::NoReturn);
+ }
/// @brief Determine if the call cannot unwind.
- bool doesNotThrow() const;
+ bool doesNotThrow() const {
+ return paramHasAttr(0, ParamAttr::NoUnwind);
+ }
void setDoesNotThrow(bool doesNotThrow = true);
/// @brief Determine if the call returns a structure through first
/// pointer argument.
- bool hasStructRetAttr() const;
+ bool hasStructRetAttr() const {
+ // Be friendly and also check the callee.
+ return paramHasAttr(1, ParamAttr::StructRet);
+ }
/// @brief Determine if any call argument is an aggregate passed by value.
- bool hasByValArgument() const;
+ bool hasByValArgument() const {
+ return ParamAttrs.hasAttrSomewhere(ParamAttr::ByVal);
+ }
/// getCalledFunction - Return the function being called by this instruction
/// if it is a direct call. If it is a call through a function pointer,
@@ -1749,27 +1764,40 @@ public:
void setParamAttrs(const PAListPtr &Attrs) { ParamAttrs = Attrs; }
/// @brief Determine whether the call or the callee has the given attribute.
- bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
+ bool paramHasAttr(unsigned i, ParameterAttributes attr) const;
/// @brief Extract the alignment for a call or parameter (0=unknown).
- uint16_t getParamAlignment(uint16_t i) const;
+ unsigned getParamAlignment(unsigned i) const {
+ return ParamAttrs.getParamAlignment(i);
+ }
/// @brief Determine if the call does not access memory.
- bool doesNotAccessMemory() const;
+ bool doesNotAccessMemory() const {
+ return paramHasAttr(0, ParamAttr::ReadNone);
+ }
/// @brief Determine if the call does not access or only reads memory.
- bool onlyReadsMemory() const;
+ bool onlyReadsMemory() const {
+ return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
+ }
/// @brief Determine if the call cannot return.
- bool doesNotReturn() const;
+ bool doesNotReturn() const {
+ return paramHasAttr(0, ParamAttr::NoReturn);
+ }
/// @brief Determine if the call cannot unwind.
- bool doesNotThrow() const;
+ bool doesNotThrow() const {
+ return paramHasAttr(0, ParamAttr::NoUnwind);
+ }
void setDoesNotThrow(bool doesNotThrow = true);
/// @brief Determine if the call returns a structure through first
/// pointer argument.
- bool hasStructRetAttr() const;
+ bool hasStructRetAttr() const {
+ // Be friendly and also check the callee.
+ return paramHasAttr(1, ParamAttr::StructRet);
+ }
/// getCalledFunction - Return the function called, or null if this is an
/// indirect function invocation.