mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2026-01-31 01:35:20 +01:00
Add IR constructs for preallocated (inalloca replacement)
Add llvm.call.preallocated.{setup,arg} instrinsics.
Add "preallocated" operand bundle which takes a token produced by llvm.call.preallocated.setup.
Add "preallocated" parameter attribute, which is like byval but without the copy.
Verifier changes for these IR constructs.
See https://github.com/rnk/llvm-project/blob/call-setup-docs/llvm/docs/CallSetup.md
Subscribers: hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74651
This commit is contained in:
@@ -1303,6 +1303,9 @@ static uint64_t getRawAttributeMask(Attribute::AttrKind Val) {
|
||||
case Attribute::SanitizeMemTag:
|
||||
llvm_unreachable("sanitize_memtag attribute not supported in raw format");
|
||||
break;
|
||||
case Attribute::Preallocated:
|
||||
llvm_unreachable("preallocated attribute not supported in raw format");
|
||||
break;
|
||||
}
|
||||
llvm_unreachable("Unsupported attribute type");
|
||||
}
|
||||
@@ -1312,12 +1315,10 @@ static void addRawAttributeValue(AttrBuilder &B, uint64_t Val) {
|
||||
|
||||
for (Attribute::AttrKind I = Attribute::None; I != Attribute::EndAttrKinds;
|
||||
I = Attribute::AttrKind(I + 1)) {
|
||||
if (I == Attribute::SanitizeMemTag ||
|
||||
I == Attribute::Dereferenceable ||
|
||||
I == Attribute::DereferenceableOrNull ||
|
||||
I == Attribute::ArgMemOnly ||
|
||||
I == Attribute::AllocSize ||
|
||||
I == Attribute::NoSync)
|
||||
if (I == Attribute::SanitizeMemTag || I == Attribute::Dereferenceable ||
|
||||
I == Attribute::DereferenceableOrNull || I == Attribute::ArgMemOnly ||
|
||||
I == Attribute::AllocSize || I == Attribute::NoSync ||
|
||||
I == Attribute::Preallocated)
|
||||
continue;
|
||||
if (uint64_t A = (Val & getRawAttributeMask(I))) {
|
||||
if (I == Attribute::Alignment)
|
||||
@@ -1544,6 +1545,8 @@ static Attribute::AttrKind getAttrFromCode(uint64_t Code) {
|
||||
return Attribute::ImmArg;
|
||||
case bitc::ATTR_KIND_SANITIZE_MEMTAG:
|
||||
return Attribute::SanitizeMemTag;
|
||||
case bitc::ATTR_KIND_PREALLOCATED:
|
||||
return Attribute::Preallocated;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1659,8 +1662,11 @@ Error BitcodeReader::parseAttributeGroupBlock() {
|
||||
Attribute::AttrKind Kind;
|
||||
if (Error Err = parseAttrKind(Record[++i], &Kind))
|
||||
return Err;
|
||||
if (Kind == Attribute::ByVal)
|
||||
if (Kind == Attribute::ByVal) {
|
||||
B.addByValAttr(HasType ? getTypeByID(Record[++i]) : nullptr);
|
||||
} else if (Kind == Attribute::Preallocated) {
|
||||
B.addPreallocatedAttr(getTypeByID(Record[++i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user