diff options
author | Hal Finkel <hfinkel@anl.gov> | 2016-07-11 01:28:42 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2016-07-11 01:28:42 +0000 |
commit | b7a19e9429fa42d08aa040fd86d21159d511f38e (patch) | |
tree | cd077cef7c3c9cfb39856b6e0734fe617c7b31f9 | |
parent | 8b01a2f64cf52b5696faaba32d9513d22ec796f9 (diff) |
Add a 'Returned' intrinsic property corresponding to the 'returned' argument attribute
This will be used by the upcoming llvm.noalias intrinsic.
Differential Revision: http://reviews.llvm.org/D22201
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275034 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/IR/Intrinsics.td | 6 | ||||
-rw-r--r-- | utils/TableGen/CodeGenIntrinsics.h | 2 | ||||
-rw-r--r-- | utils/TableGen/CodeGenTarget.cpp | 3 | ||||
-rw-r--r-- | utils/TableGen/IntrinsicEmitter.cpp | 6 |
4 files changed, 16 insertions, 1 deletions
diff --git a/include/llvm/IR/Intrinsics.td b/include/llvm/IR/Intrinsics.td index e543ef56ef3..5ece731fa14 100644 --- a/include/llvm/IR/Intrinsics.td +++ b/include/llvm/IR/Intrinsics.td @@ -54,6 +54,12 @@ class NoCapture<int argNo> : IntrinsicProperty { int ArgNo = argNo; } +// Returned - The specified argument is always the return value of the +// intrinsic. +class Returned<int argNo> : IntrinsicProperty { + int ArgNo = argNo; +} + // ReadOnly - The specified argument pointer is not written to through the // pointer by the intrinsic. class ReadOnly<int argNo> : IntrinsicProperty { diff --git a/utils/TableGen/CodeGenIntrinsics.h b/utils/TableGen/CodeGenIntrinsics.h index 1c82e05d1a5..76554a52a15 100644 --- a/utils/TableGen/CodeGenIntrinsics.h +++ b/utils/TableGen/CodeGenIntrinsics.h @@ -108,7 +108,7 @@ struct CodeGenIntrinsic { /// True if the intrinsic is marked as convergent. bool isConvergent; - enum ArgAttribute { NoCapture, ReadOnly, WriteOnly, ReadNone }; + enum ArgAttribute { NoCapture, Returned, ReadOnly, WriteOnly, ReadNone }; std::vector<std::pair<unsigned, ArgAttribute>> ArgumentAttributes; CodeGenIntrinsic(Record *R); diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index 1367e24bb2d..85fc4be901e 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -592,6 +592,9 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) { else if (Property->isSubClassOf("NoCapture")) { unsigned ArgNo = Property->getValueAsInt("ArgNo"); ArgumentAttributes.push_back(std::make_pair(ArgNo, NoCapture)); + } else if (Property->isSubClassOf("Returned")) { + unsigned ArgNo = Property->getValueAsInt("ArgNo"); + ArgumentAttributes.push_back(std::make_pair(ArgNo, Returned)); } else if (Property->isSubClassOf("ReadOnly")) { unsigned ArgNo = Property->getValueAsInt("ArgNo"); ArgumentAttributes.push_back(std::make_pair(ArgNo, ReadOnly)); diff --git a/utils/TableGen/IntrinsicEmitter.cpp b/utils/TableGen/IntrinsicEmitter.cpp index bee7fbf715b..062d25c6a4e 100644 --- a/utils/TableGen/IntrinsicEmitter.cpp +++ b/utils/TableGen/IntrinsicEmitter.cpp @@ -548,6 +548,12 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) { OS << "Attribute::NoCapture"; addComma = true; break; + case CodeGenIntrinsic::Returned: + if (addComma) + OS << ","; + OS << "Attribute::Returned"; + addComma = true; + break; case CodeGenIntrinsic::ReadOnly: if (addComma) OS << ","; |