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 : IntrinsicProperty { int ArgNo = argNo; } +// Returned - The specified argument is always the return value of the +// intrinsic. +class Returned : IntrinsicProperty { + int ArgNo = argNo; +} + // ReadOnly - The specified argument pointer is not written to through the // pointer by the intrinsic. class ReadOnly : 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> 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 &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 << ",";