[llvm-commits] [llvm] r165212 - in /llvm/trunk: include/llvm/Instructions.h include/llvm/Support/CallSite.h lib/VMCore/Instructions.cpp

Bill Wendling isanbard at gmail.com
Thu Oct 4 00:18:13 PDT 2012


Author: void
Date: Thu Oct  4 02:18:12 2012
New Revision: 165212

URL: http://llvm.org/viewvc/llvm-project?rev=165212&view=rev
Log:
Add method to query for NoCapture attribute.

Modified:
    llvm/trunk/include/llvm/Instructions.h
    llvm/trunk/include/llvm/Support/CallSite.h
    llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=165212&r1=165211&r2=165212&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Thu Oct  4 02:18:12 2012
@@ -1280,6 +1280,7 @@
   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 @@
   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;

Modified: llvm/trunk/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=165212&r1=165211&r2=165212&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Thu Oct  4 02:18:12 2012
@@ -211,6 +211,9 @@
   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 @@
 
   /// @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

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=165212&r1=165211&r2=165212&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Thu Oct  4 02:18:12 2012
@@ -398,6 +398,14 @@
   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 @@
   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;





More information about the llvm-commits mailing list