aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Function.h10
-rw-r--r--include/llvm/Instructions.h30
-rw-r--r--include/llvm/Intrinsics.h5
-rw-r--r--include/llvm/Support/CallSite.h6
4 files changed, 51 insertions, 0 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 627b47f..20a43e2 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);
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 34b22c7..2d721bb 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -927,6 +927,21 @@ public:
/// @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 does not access memory.
+ bool doesNotAccessMemory() const {
+ return paramHasAttr(0, ParamAttr::ReadNone);
+ }
+
+ /// @brief Determine if the call does not access or only reads memory.
+ bool onlyReadsMemory() const {
+ return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
+ }
+
+ /// @brief Determine if the call cannot unwind.
+ bool isNoUnwind() const {
+ return paramHasAttr(0, ParamAttr::NoUnwind);
+ }
+
/// @brief Determine if the call returns a structure.
bool isStructReturn() const {
// Be friendly and also check the callee.
@@ -1711,6 +1726,21 @@ public:
/// @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 does not access memory.
+ bool doesNotAccessMemory() const {
+ return paramHasAttr(0, ParamAttr::ReadNone);
+ }
+
+ /// @brief Determine if the call does not access or only reads memory.
+ bool onlyReadsMemory() const {
+ return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
+ }
+
+ /// @brief Determine if the call cannot unwind.
+ bool isNoUnwind() const {
+ return paramHasAttr(0, ParamAttr::NoUnwind);
+ }
+
/// @brief Determine if the call returns a structure.
bool isStructReturn() const {
// Be friendly and also check the callee.
diff --git a/include/llvm/Intrinsics.h b/include/llvm/Intrinsics.h
index 3a97b33..4766250 100644
--- a/include/llvm/Intrinsics.h
+++ b/include/llvm/Intrinsics.h
@@ -22,6 +22,7 @@ class Type;
class FunctionType;
class Function;
class Module;
+class ParamAttrsList;
/// Intrinsic Namespace - This namespace contains an enum with a value for
/// every intrinsic/builtin function known by LLVM. These enum values are
@@ -46,6 +47,10 @@ namespace Intrinsic {
///
const FunctionType *getType(ID id, const Type **Tys = 0, unsigned numTys = 0);
+ /// Intrinsic::getParamAttrs(ID) - Return the attributes for an intrinsic.
+ ///
+ const ParamAttrsList *getParamAttrs(ID id);
+
/// Intrinsic::getDeclaration(M, ID) - Create or insert an LLVM Function
/// declaration for an intrinsic, and return it.
Function *getDeclaration(Module *M, ID id, const Type **Tys = 0,
diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h
index b613dff..5bb60a8 100644
--- a/include/llvm/Support/CallSite.h
+++ b/include/llvm/Support/CallSite.h
@@ -67,6 +67,12 @@ public:
/// paramHasAttr - whether the call or the callee has the given attribute.
bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
+ /// @brief Determine if the call does not access memory.
+ bool doesNotAccessMemory() const;
+
+ /// @brief Determine if the call does not access or only reads memory.
+ bool onlyReadsMemory() const;
+
/// getType - Return the type of the instruction that generated this call site
///
const Type *getType() const { return I->getType(); }