Skip to content

Commit 8bb2e34

Browse files
committed
[embedded] Also fix serialization and bit counts for SILAccessEnforcement
1 parent c4168be commit 8bb2e34

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

lib/Serialization/DeserializeSIL.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,8 +2369,8 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn,
23692369
ValID, getSILType(MF->getType(TyID), (SILValueCategory)TyCategory, Fn));
23702370
auto accessKind = SILAccessKind(Attr & 0x3);
23712371
auto enforcement = SILAccessEnforcement((Attr >> 2) & 0x07);
2372-
bool noNestedConflict = (Attr >> 4) & 0x01;
2373-
bool fromBuiltin = (Attr >> 5) & 0x01;
2372+
bool noNestedConflict = (Attr >> 5) & 0x01;
2373+
bool fromBuiltin = (Attr >> 6) & 0x01;
23742374
ResultInst = Builder.createBeginAccess(Loc, op, accessKind, enforcement,
23752375
noNestedConflict, fromBuiltin);
23762376
break;
@@ -2411,8 +2411,8 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn,
24112411
(SILValueCategory)TyCategory2, Fn));
24122412
auto accessKind = SILAccessKind(Attr & 0x3);
24132413
auto enforcement = SILAccessEnforcement((Attr >> 2) & 0x07);
2414-
bool noNestedConflict = (Attr >> 4) & 0x01;
2415-
bool fromBuiltin = (Attr >> 5) & 0x01;
2414+
bool noNestedConflict = (Attr >> 5) & 0x01;
2415+
bool fromBuiltin = (Attr >> 6) & 0x01;
24162416
ResultInst = Builder.createBeginUnpairedAccess(
24172417
Loc, source, buffer, accessKind, enforcement, noNestedConflict,
24182418
fromBuiltin);
@@ -2423,7 +2423,7 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn,
24232423
ValID, getSILType(MF->getType(TyID), (SILValueCategory)TyCategory, Fn));
24242424
bool aborted = Attr & 0x1;
24252425
auto enforcement = SILAccessEnforcement((Attr >> 1) & 0x07);
2426-
bool fromBuiltin = (Attr >> 3) & 0x01;
2426+
bool fromBuiltin = (Attr >> 4) & 0x01;
24272427
ResultInst = Builder.createEndUnpairedAccess(Loc, op, enforcement, aborted,
24282428
fromBuiltin);
24292429
break;

lib/Serialization/ModuleFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5858
/// describe what change you made. The content of this comment isn't important;
5959
/// it just ensures a conflict if two people change the module format.
6060
/// Don't worry about adhering to the 80-column limit for this line.
61-
const uint16_t SWIFTMODULE_VERSION_MINOR = 809; // typed throws
61+
const uint16_t SWIFTMODULE_VERSION_MINOR = 810; // access enforcement
6262

6363
/// A standard hash seed used for all string hashes in a serialized module.
6464
///

lib/Serialization/SILFormat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ namespace sil_block {
425425
using SILOneOperandExtraAttributeLayout = BCRecordLayout<
426426
SIL_ONE_OPERAND_EXTRA_ATTR,
427427
SILInstOpCodeField,
428-
BCFixed<6>, // Optional attributes
428+
BCFixed<7>, // Optional attributes
429429
TypeIDField, SILTypeCategoryField, ValueIDField
430430
>;
431431

@@ -452,7 +452,7 @@ namespace sil_block {
452452
using SILTwoOperandsExtraAttributeLayout = BCRecordLayout<
453453
SIL_TWO_OPERANDS_EXTRA_ATTR,
454454
SILInstOpCodeField,
455-
BCFixed<6>, // Optional attributes
455+
BCFixed<7>, // Optional attributes
456456
TypeIDField,
457457
SILTypeCategoryField,
458458
ValueIDField,

lib/Serialization/SerializeSIL.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,8 +2029,8 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
20292029
auto *BAI = cast<BeginAccessInst>(&SI);
20302030
unsigned attr = unsigned(BAI->getAccessKind())
20312031
+ (unsigned(BAI->getEnforcement()) << 2)
2032-
+ (BAI->hasNoNestedConflict() << 4)
2033-
+ (BAI->isFromBuiltin() << 5);
2032+
+ (BAI->hasNoNestedConflict() << 5)
2033+
+ (BAI->isFromBuiltin() << 6);
20342034
SILValue operand = BAI->getOperand();
20352035

20362036
SILOneOperandExtraAttributeLayout::emitRecord(
@@ -2094,8 +2094,8 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
20942094
auto *BAI = cast<BeginUnpairedAccessInst>(&SI);
20952095
unsigned attr = unsigned(BAI->getAccessKind())
20962096
+ (unsigned(BAI->getEnforcement()) << 2)
2097-
+ (unsigned(BAI->hasNoNestedConflict()) << 4)
2098-
+ (unsigned(BAI->isFromBuiltin()) << 5);
2097+
+ (unsigned(BAI->hasNoNestedConflict()) << 5)
2098+
+ (unsigned(BAI->isFromBuiltin()) << 6);
20992099
SILValue source = BAI->getSource();
21002100
SILValue buffer = BAI->getBuffer();
21012101

@@ -2115,7 +2115,7 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
21152115
auto *EAI = cast<EndUnpairedAccessInst>(&SI);
21162116
unsigned attr = unsigned(EAI->isAborting())
21172117
+ (unsigned(EAI->getEnforcement()) << 1)
2118-
+ (unsigned(EAI->isFromBuiltin()) << 3);
2118+
+ (unsigned(EAI->isFromBuiltin()) << 4);
21192119
SILValue operand = EAI->getOperand();
21202120

21212121
SILOneOperandExtraAttributeLayout::emitRecord(

0 commit comments

Comments
 (0)