1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

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

llvm-svn: 275034
This commit is contained in:
Hal Finkel 2016-07-11 01:28:42 +00:00
parent 94d6a0faef
commit ad4e59155b
4 changed files with 16 additions and 1 deletions

View File

@ -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 {

View File

@ -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);

View File

@ -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));

View File

@ -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 << ",";