summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-12 01:12:03 +0000
committerChris Lattner <sabre@nondot.org>2009-01-12 01:12:03 +0000
commit9a3113aeb8b560cf696bbd3684367fedcc10a9b3 (patch)
treeb8f02cf841b1bf84baa52988747e10c91e7f33df
parent5562d19ebeed9d8d0d14aa6eae63baeda9676fdc (diff)
downloadbcm5719-llvm-9a3113aeb8b560cf696bbd3684367fedcc10a9b3.tar.gz
bcm5719-llvm-9a3113aeb8b560cf696bbd3684367fedcc10a9b3.zip
add nocapture attribute to llvm.mem* intrinsics and have tblgen
parse them. tblgen doesn't yet do anything with this info though. llvm-svn: 62065
-rw-r--r--llvm/include/llvm/Intrinsics.td28
-rw-r--r--llvm/utils/TableGen/CodeGenIntrinsics.h12
-rw-r--r--llvm/utils/TableGen/CodeGenTarget.cpp5
3 files changed, 29 insertions, 16 deletions
diff --git a/llvm/include/llvm/Intrinsics.td b/llvm/include/llvm/Intrinsics.td
index a641caa91aa..8145700f399 100644
--- a/llvm/include/llvm/Intrinsics.td
+++ b/llvm/include/llvm/Intrinsics.td
@@ -51,6 +51,11 @@ def IntrWriteMem : IntrinsicProperty;
// 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 @@ def int_stackprotector : Intrinsic<[llvm_void_ty],
//===------------------- 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
diff --git a/llvm/utils/TableGen/CodeGenIntrinsics.h b/llvm/utils/TableGen/CodeGenIntrinsics.h
index 1170da0f359..dd99e319d6c 100644
--- a/llvm/utils/TableGen/CodeGenIntrinsics.h
+++ b/llvm/utils/TableGen/CodeGenIntrinsics.h
@@ -63,13 +63,17 @@ namespace llvm {
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);
};
diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp
index 0039a894972..274cc78c35b 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -546,7 +546,10 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
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!");
}
}
OpenPOWER on IntegriCloud