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

[BitcodeReader] Simplify raw attribute handling (NFC)

Every new attribute we add from now on will not be supported in the
raw format, because we ran out of space. Don't bother listing each
affected attribute twice.
This commit is contained in:
Nikita Popov 2020-04-30 18:45:04 +02:00
parent a9b8b02156
commit c3ca12f72e

View File

@ -1284,28 +1284,10 @@ static uint64_t getRawAttributeMask(Attribute::AttrKind Val) {
return 1ULL << 62;
case Attribute::NoFree:
return 1ULL << 63;
case Attribute::NoSync:
llvm_unreachable("nosync attribute not supported in raw format");
break;
case Attribute::Dereferenceable:
llvm_unreachable("dereferenceable attribute not supported in raw format");
break;
case Attribute::DereferenceableOrNull:
llvm_unreachable("dereferenceable_or_null attribute not supported in raw "
"format");
break;
case Attribute::ArgMemOnly:
llvm_unreachable("argmemonly attribute not supported in raw format");
break;
case Attribute::AllocSize:
llvm_unreachable("allocsize not supported in raw format");
break;
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;
default:
// Other attributes are not supported in the raw format,
// as we ran out of space.
return 0;
}
llvm_unreachable("Unsupported attribute type");
}
@ -1315,11 +1297,6 @@ 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 ||
I == Attribute::Preallocated)
continue;
if (uint64_t A = (Val & getRawAttributeMask(I))) {
if (I == Attribute::Alignment)
B.addAlignmentAttr(1ULL << ((A >> 16) - 1));