[SIL] InitAccessors: Reference "self" in assign_or_init instruction

First step on the path to remove dependence on "setter".
This commit is contained in:
Pavel Yaskevich
2023-06-26 16:03:29 -07:00
parent 50d2f4d3ed
commit 3063e9d778
11 changed files with 76 additions and 74 deletions

View File

@@ -956,12 +956,14 @@ public:
getSILDebugLocation(Loc), Src, Dest, Initializer, Setter, mode));
}
AssignOrInitInst *createAssignOrInit(SILLocation Loc, SILValue Src,
AssignOrInitInst *createAssignOrInit(SILLocation Loc,
SILValue Self,
SILValue Src,
SILValue Initializer,
SILValue Setter,
AssignOrInitInst::Mode Mode) {
return insert(new (getModule()) AssignOrInitInst(
getSILDebugLocation(Loc), Src, Initializer, Setter, Mode));
getSILDebugLocation(Loc), Self, Src, Initializer, Setter, Mode));
}
StoreBorrowInst *createStoreBorrow(SILLocation Loc, SILValue Src,

View File

@@ -1358,6 +1358,7 @@ void SILCloner<ImplClass>::visitAssignOrInitInst(AssignOrInitInst *Inst) {
recordClonedInstruction(
Inst, getBuilder().createAssignOrInit(
getOpLocation(Inst->getLoc()),
getOpValue(Inst->getSelf()),
getOpValue(Inst->getSrc()),
getOpValue(Inst->getInitializer()),
getOpValue(Inst->getSetter()), Inst->getMode()));

View File

@@ -4842,7 +4842,7 @@ class AssignOrInitInst
friend SILBuilder;
USE_SHARED_UINT8;
FixedOperandList<3> Operands;
FixedOperandList<4> Operands;
/// Marks all of the properties in `initializes(...)` list that
/// have been initialized before this intruction to help Raw SIL
@@ -4862,14 +4862,14 @@ public:
};
private:
AssignOrInitInst(SILDebugLocation DebugLoc,
SILValue Src, SILValue Initializer,
SILValue Setter, Mode mode);
AssignOrInitInst(SILDebugLocation DebugLoc, SILValue Self, SILValue Src,
SILValue Initializer, SILValue Setter, Mode mode);
public:
SILValue getSrc() const { return Operands[0].get(); }
SILValue getInitializer() const { return Operands[1].get(); }
SILValue getSetter() { return Operands[2].get(); }
SILValue getSelf() const { return Operands[0].get(); }
SILValue getSrc() const { return Operands[1].get(); }
SILValue getInitializer() const { return Operands[2].get(); }
SILValue getSetter() { return Operands[3].get(); }
Mode getMode() const {
return Mode(sharedUInt8().AssignOrInitInst.mode);