summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-04 07:18:12 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-04 07:18:12 +0000
commitdaf8e38ba87cc4defe6604f37f5af61719ed01a2 (patch)
tree0d9dea81fde3650da78f2d441d5ebff7917dbb57 /llvm
parent5d637b7d5b02e351877eaf97fe3e780ff56e0d1d (diff)
downloadbcm5719-llvm-daf8e38ba87cc4defe6604f37f5af61719ed01a2.tar.gz
bcm5719-llvm-daf8e38ba87cc4defe6604f37f5af61719ed01a2.zip
Add method to query for NoCapture attribute.
llvm-svn: 165212
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Instructions.h2
-rw-r--r--llvm/include/llvm/Support/CallSite.h7
-rw-r--r--llvm/lib/VMCore/Instructions.cpp16
3 files changed, 23 insertions, 2 deletions
diff --git a/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h
index 711bced70ff..5ff1c37ae6c 100644
--- a/llvm/include/llvm/Instructions.h
+++ b/llvm/include/llvm/Instructions.h
@@ -1280,6 +1280,7 @@ public:
bool paramHasNestAttr(unsigned i) const;
bool paramHasByValAttr(unsigned i) const;
bool paramHasNoAliasAttr(unsigned i) const;
+ bool paramHasNoCaptureAttr(unsigned i) const;
/// @brief Determine whether the call or the callee has the given attribute.
bool paramHasAttr(unsigned i, Attributes attr) const;
@@ -3051,6 +3052,7 @@ public:
bool paramHasNestAttr(unsigned i) const;
bool paramHasByValAttr(unsigned i) const;
bool paramHasNoAliasAttr(unsigned i) const;
+ bool paramHasNoCaptureAttr(unsigned i) const;
/// @brief Determine whether the call or the callee has the given attribute.
bool paramHasAttr(unsigned i, Attributes attr) const;
diff --git a/llvm/include/llvm/Support/CallSite.h b/llvm/include/llvm/Support/CallSite.h
index 98c48d9aaaf..3c5a8d4dc47 100644
--- a/llvm/include/llvm/Support/CallSite.h
+++ b/llvm/include/llvm/Support/CallSite.h
@@ -211,6 +211,9 @@ public:
bool paramHasNoAliasAttr(unsigned i) const {
CALLSITE_DELEGATE_GETTER(paramHasNoAliasAttr(i));
}
+ bool paramHasNoCaptureAttr(unsigned i) const {
+ CALLSITE_DELEGATE_GETTER(paramHasNoCaptureAttr(i));
+ }
/// paramHasAttr - whether the call or the callee has the given attribute.
bool paramHasAttr(uint16_t i, Attributes attr) const {
@@ -267,12 +270,12 @@ public:
/// @brief Determine whether this argument is not captured.
bool doesNotCapture(unsigned ArgNo) const {
- return paramHasAttr(ArgNo + 1, Attribute::NoCapture);
+ return paramHasNoCaptureAttr(ArgNo + 1);
}
/// @brief Determine whether this argument is passed by value.
bool isByValArgument(unsigned ArgNo) const {
- return paramHasAttr(ArgNo + 1, Attribute::ByVal);
+ return paramHasByValAttr(ArgNo + 1);
}
/// hasArgument - Returns true if this CallSite passes the given Value* as an
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 9b700451bee..e3cbf220d4a 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -398,6 +398,14 @@ bool CallInst::paramHasNoAliasAttr(unsigned i) const {
return false;
}
+bool CallInst::paramHasNoCaptureAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasNoCaptureAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasNoCaptureAttr();
+ return false;
+}
+
bool CallInst::paramHasAttr(unsigned i, Attributes attr) const {
if (AttributeList.paramHasAttr(i, attr))
return true;
@@ -674,6 +682,14 @@ bool InvokeInst::paramHasNoAliasAttr(unsigned i) const {
return false;
}
+bool InvokeInst::paramHasNoCaptureAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasNoCaptureAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasNoCaptureAttr();
+ return false;
+}
+
bool InvokeInst::paramHasAttr(unsigned i, Attributes attr) const {
if (AttributeList.paramHasAttr(i, attr))
return true;
OpenPOWER on IntegriCloud