aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Instructions.h
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-11-28 17:07:01 +0000
committerDuncan Sands <baldrick@free.fr>2007-11-28 17:07:01 +0000
commitafa3b6da11bc05281bcf09e45de9e037e0ee5011 (patch)
treebad8f7480a6ea8ab2cbce2ad3427e8173247f68e /include/llvm/Instructions.h
parent1e7b1bbd9c939ce1581862a6e0f8961279ea5992 (diff)
downloadexternal_llvm-afa3b6da11bc05281bcf09e45de9e037e0ee5011.tar.gz
external_llvm-afa3b6da11bc05281bcf09e45de9e037e0ee5011.tar.bz2
external_llvm-afa3b6da11bc05281bcf09e45de9e037e0ee5011.zip
Add some convenience methods for querying attributes, and
use them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44403 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Instructions.h')
-rw-r--r--include/llvm/Instructions.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 96ca43d6ca..34b22c7802 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -20,6 +20,7 @@
#include "llvm/InstrTypes.h"
#include "llvm/DerivedTypes.h"
+#include "llvm/ParameterAttributes.h"
namespace llvm {
@@ -923,8 +924,14 @@ public:
/// @brief Set the parameter attributes.
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;
+
/// @brief Determine if the call returns a structure.
- bool isStructReturn() const;
+ bool isStructReturn() const {
+ // Be friendly and also check the callee.
+ return paramHasAttr(1, ParamAttr::StructRet);
+ }
/// getCalledFunction - Return the function being called by this instruction
/// if it is a direct call. If it is a call through a function pointer,
@@ -1701,8 +1708,14 @@ public:
/// @brief Set the parameter attributes.
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;
+
/// @brief Determine if the call returns a structure.
- bool isStructReturn() const;
+ bool isStructReturn() 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.