summaryrefslogtreecommitdiff
path: root/include/llvm/Function.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Function.h')
-rw-r--r--include/llvm/Function.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 627b47f9d9..20a43e285c 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -158,6 +158,16 @@ public:
return ParamAttrs && ParamAttrs->paramHasAttr(i, attr);
}
+ /// @brief Determine if the function does not access memory.
+ bool doesNotAccessMemory() const {
+ return paramHasAttr(0, ParamAttr::ReadNone);
+ }
+
+ /// @brief Determine if the function does not access or only reads memory.
+ bool onlyReadsMemory() const {
+ return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
+ }
+
/// @brief Determine if the function returns a structure.
bool isStructReturn() const {
return paramHasAttr(1, ParamAttr::StructRet);