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 {
640
640
func set( to value: Value , _ context: some MutatingContext ) {
641
641
instruction. setOperand ( at: index, to: value, context)
642
642
}
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
+ }
643
649
}
644
650
645
651
extension Instruction {
Original file line number Diff line number Diff line change @@ -415,6 +415,7 @@ struct BridgedOperand {
415
415
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedValue getValue () const ;
416
416
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction getUser () const ;
417
417
BRIDGED_INLINE OperandOwnership getOperandOwnership () const ;
418
+ void changeOwnership (BridgedValue::Ownership from, BridgedValue::Ownership to) const ;
418
419
};
419
420
420
421
struct OptionalBridgedOperand {
Original file line number Diff line number Diff line change @@ -303,6 +303,16 @@ static_assert((int)BridgedLinkage::PublicExternal == (int)swift::SILLinkage::Pub
303
303
static_assert ((int )BridgedLinkage::PackageExternal == (int )swift::SILLinkage::PackageExternal);
304
304
static_assert ((int )BridgedLinkage::HiddenExternal == (int )swift::SILLinkage::HiddenExternal);
305
305
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
+
306
316
// ===----------------------------------------------------------------------===//
307
317
// SILGlobalVariable
308
318
// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments