File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
SwiftCompilerSources/Sources/Optimizer/PassManager Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -640,6 +640,12 @@ extension Operand {
640640 func set( to value: Value , _ context: some MutatingContext ) {
641641 instruction. setOperand ( at: index, to: value, context)
642642 }
643+
644+ func changeOwnership( from: Ownership , to: Ownership , _ context: some MutatingContext ) {
645+ context. notifyInstructionsChanged ( )
646+ bridged. changeOwnership ( from. _bridged, to. _bridged)
647+ context. notifyInstructionChanged ( instruction)
648+ }
643649}
644650
645651extension Instruction {
Original file line number Diff line number Diff line change @@ -415,6 +415,7 @@ struct BridgedOperand {
415415 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedValue getValue () const ;
416416 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction getUser () const ;
417417 BRIDGED_INLINE OperandOwnership getOperandOwnership () const ;
418+ void changeOwnership (BridgedValue::Ownership from, BridgedValue::Ownership to) const ;
418419};
419420
420421struct OptionalBridgedOperand {
Original file line number Diff line number Diff line change @@ -303,6 +303,16 @@ static_assert((int)BridgedLinkage::PublicExternal == (int)swift::SILLinkage::Pub
303303static_assert ((int )BridgedLinkage::PackageExternal == (int )swift::SILLinkage::PackageExternal);
304304static_assert ((int )BridgedLinkage::HiddenExternal == (int )swift::SILLinkage::HiddenExternal);
305305
306+ // ===----------------------------------------------------------------------===//
307+ // Operand
308+ // ===----------------------------------------------------------------------===//
309+
310+ void BridgedOperand::changeOwnership (BridgedValue::Ownership from, BridgedValue::Ownership to) const {
311+ swift::ForwardingOperand forwardingOp (op);
312+ assert (forwardingOp);
313+ forwardingOp.replaceOwnershipKind (BridgedValue::castToOwnership (from), BridgedValue::castToOwnership (to));
314+ }
315+
306316// ===----------------------------------------------------------------------===//
307317// SILGlobalVariable
308318// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments