@@ -7501,6 +7501,38 @@ class MarkUnresolvedMoveAddrInst
75017501 MutableArrayRef<Operand> getAllOperands () { return Operands.asArray (); }
75027502};
75037503
7504+ // / This is a marker instruction that has no effect that is consumed by a
7505+ // / diagnostic based semantic checker. Example: no implicit copy. Only legal in
7506+ // / Raw SIL so that we can guarantee canonical SIL has had all SSA based
7507+ // / checking by the checkers that rely upon this instruction.
7508+ class MarkMustCheckInst
7509+ : public UnaryInstructionBase<SILInstructionKind::MarkMustCheckInst,
7510+ SingleValueInstruction>,
7511+ public OwnershipForwardingMixin {
7512+ friend class SILBuilder ;
7513+
7514+ public:
7515+ enum class CheckKind : unsigned {
7516+ Invalid = 0 ,
7517+ NoImplicitCopy,
7518+ };
7519+
7520+ private:
7521+ CheckKind kind;
7522+
7523+ MarkMustCheckInst (SILDebugLocation DebugLoc, SILValue operand,
7524+ CheckKind checkKind)
7525+ : UnaryInstructionBase(DebugLoc, operand, operand->getType ()),
7526+ OwnershipForwardingMixin(SILInstructionKind::MarkMustCheckInst,
7527+ operand->getOwnershipKind ()),
7528+ kind(checkKind) {}
7529+
7530+ public:
7531+ CheckKind getCheckKind () const { return kind; }
7532+
7533+ bool isNoImplicitCopy () const { return kind == CheckKind::NoImplicitCopy; }
7534+ };
7535+
75047536// / Given an object reference, return true iff it is non-nil and refers
75057537// / to a native swift object with strong reference count of 1.
75067538class IsUniqueInst
@@ -9683,7 +9715,8 @@ inline bool OwnershipForwardingMixin::isa(SILInstructionKind kind) {
96839715 OwnershipForwardingTermInst::classof (kind) ||
96849716 OwnershipForwardingConversionInst::classof (kind) ||
96859717 OwnershipForwardingSelectEnumInstBase::classof (kind) ||
9686- OwnershipForwardingMultipleValueInstruction::classof (kind);
9718+ OwnershipForwardingMultipleValueInstruction::classof (kind) ||
9719+ kind == SILInstructionKind::MarkMustCheckInst;
96879720}
96889721
96899722inline OwnershipForwardingMixin *
@@ -9705,6 +9738,8 @@ OwnershipForwardingMixin::get(SILInstruction *inst) {
97059738 if (auto *result =
97069739 dyn_cast<OwnershipForwardingMultipleValueInstruction>(inst))
97079740 return result;
9741+ if (auto *result = dyn_cast<MarkMustCheckInst>(inst))
9742+ return result;
97089743 return nullptr ;
97099744}
97109745
0 commit comments