[llvm-commits] [llvm] r62065 - in /llvm/trunk: include/llvm/Intrinsics.td utils/TableGen/CodeGenIntrinsics.h utils/TableGen/CodeGenTarget.cpp

Chris Lattner sabre at nondot.org
Sun Jan 11 17:12:03 PST 2009


Author: lattner
Date: Sun Jan 11 19:12:03 2009
New Revision: 62065

URL: http://llvm.org/viewvc/llvm-project?rev=62065&view=rev
Log:
add nocapture attribute to llvm.mem* intrinsics and have tblgen
parse them.  tblgen doesn't yet do anything with this info though.

Modified:
    llvm/trunk/include/llvm/Intrinsics.td
    llvm/trunk/utils/TableGen/CodeGenIntrinsics.h
    llvm/trunk/utils/TableGen/CodeGenTarget.cpp

Modified: llvm/trunk/include/llvm/Intrinsics.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=62065&r1=62064&r2=62065&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Intrinsics.td (original)
+++ llvm/trunk/include/llvm/Intrinsics.td Sun Jan 11 19:12:03 2009
@@ -51,6 +51,11 @@
 // Commutative - This intrinsic is commutative: X op Y == Y op X.
 def Commutative : IntrinsicProperty;
 
+// NoCapture - The specified argument pointer is not captured by the intrinsic.
+class NoCapture<int argNo> : IntrinsicProperty {
+  int ArgNo = argNo;
+}
+
 //===----------------------------------------------------------------------===//
 // Types used by intrinsics.
 //===----------------------------------------------------------------------===//
@@ -199,17 +204,18 @@
 //===------------------- Standard C Library Intrinsics --------------------===//
 //
 
-let Properties = [IntrWriteArgMem] in {
-  def int_memcpy  : Intrinsic<[llvm_void_ty],
-                               [llvm_ptr_ty, llvm_ptr_ty,
-                                llvm_anyint_ty, llvm_i32_ty]>;
-  def int_memmove : Intrinsic<[llvm_void_ty],
-                                  [llvm_ptr_ty, llvm_ptr_ty,
-                                   llvm_anyint_ty, llvm_i32_ty]>;
-  def int_memset  : Intrinsic<[llvm_void_ty],
-                               [llvm_ptr_ty, llvm_i8_ty,
-                                llvm_anyint_ty, llvm_i32_ty]>;
-}
+def int_memcpy  : Intrinsic<[llvm_void_ty],
+                             [llvm_ptr_ty, llvm_ptr_ty, llvm_anyint_ty,
+                              llvm_i32_ty],
+                            [IntrWriteArgMem, NoCapture<0>, NoCapture<1>]>;
+def int_memmove : Intrinsic<[llvm_void_ty],
+                            [llvm_ptr_ty, llvm_ptr_ty, llvm_anyint_ty,
+                             llvm_i32_ty],
+                            [IntrWriteArgMem, NoCapture<0>, NoCapture<1>]>;
+def int_memset  : Intrinsic<[llvm_void_ty],
+                            [llvm_ptr_ty, llvm_i8_ty, llvm_anyint_ty,
+                             llvm_i32_ty],
+                            [IntrWriteArgMem, NoCapture<0>]>;
 
 // These functions do not actually read memory, but they are sensitive to the
 // rounding mode.  This needs to be modelled separately; in the meantime

Modified: llvm/trunk/utils/TableGen/CodeGenIntrinsics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenIntrinsics.h?rev=62065&r1=62064&r2=62065&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenIntrinsics.h (original)
+++ llvm/trunk/utils/TableGen/CodeGenIntrinsics.h Sun Jan 11 19:12:03 2009
@@ -63,13 +63,17 @@
       NoMem, ReadArgMem, ReadMem, WriteArgMem, WriteMem
     } ModRef;
 
-    // This is set to true if the intrinsic is overloaded by its argument
-    // types.
+    /// This is set to true if the intrinsic is overloaded by its argument
+    /// types.
     bool isOverloaded;
 
-    // isCommutative - True if the intrinsic is commutative.
-    //
+    /// isCommutative - True if the intrinsic is commutative.
     bool isCommutative;
+    
+    enum ArgAttribute {
+      NoCapture
+    };
+    std::vector<std::pair<unsigned, ArgAttribute> > ArgumentAttributes;
 
     CodeGenIntrinsic(Record *R);
   };

Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=62065&r1=62064&r2=62065&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Sun Jan 11 19:12:03 2009
@@ -546,7 +546,10 @@
       ModRef = WriteMem;
     else if (Property->getName() == "Commutative")
       isCommutative = true;
-    else
+    else if (Property->isSubClassOf("NoCapture")) {
+      unsigned ArgNo = Property->getValueAsInt("ArgNo");
+      ArgumentAttributes.push_back(std::make_pair(ArgNo, NoCapture));
+    } else
       assert(0 && "Unknown property!");
   }
 }





More information about the llvm-commits mailing list