Skip to content

Commit 2f34dae

Browse files
committed
Swift SIL: add Builder.createUncheckedOwnershipConversion
1 parent bb9829c commit 2f34dae

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

SwiftCompilerSources/Sources/SIL/Builder.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ public struct Builder {
215215
return notifyNew(cast.getAs(UnconditionalCheckedCastAddrInst.self))
216216
}
217217

218+
public func createUncheckedOwnershipConversion(
219+
operand: Value, resultOwnership: Ownership
220+
) -> UncheckedOwnershipConversionInst {
221+
let uoc = bridged.createUncheckedOwnershipConversion(operand.bridged, resultOwnership._bridged)
222+
return notifyNew(uoc.getAs(UncheckedOwnershipConversionInst.self))
223+
}
224+
218225
public func createLoad(fromAddress: Value, ownership: LoadInst.LoadOwnership) -> LoadInst {
219226
let load = bridged.createLoad(fromAddress.bridged, ownership.rawValue)
220227
return notifyNew(load.getAs(LoadInst.self))

include/swift/SIL/SILBridging.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,8 @@ struct BridgedBuilder{
11721172
BridgedInstruction::CastingIsolatedConformances isolatedConformances,
11731173
BridgedValue source, BridgedCanType sourceFormalType,
11741174
BridgedValue destination, BridgedCanType targetFormalType) const;
1175+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createUncheckedOwnershipConversion(
1176+
BridgedValue op, BridgedValue::Ownership ownership) const;
11751177
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createLoad(BridgedValue op, SwiftInt ownership) const;
11761178
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createLoadBorrow(BridgedValue op) const;
11771179
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createBeginDeallocRef(BridgedValue reference,

include/swift/SIL/SILBridgingImpl.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,6 +2190,13 @@ BridgedInstruction BridgedBuilder::createLoad(BridgedValue op, SwiftInt ownershi
21902190
(swift::LoadOwnershipQualifier)ownership)};
21912191
}
21922192

2193+
2194+
BridgedInstruction BridgedBuilder::createUncheckedOwnershipConversion(BridgedValue op,
2195+
BridgedValue::Ownership ownership) const {
2196+
return {unbridged().createUncheckedOwnershipConversion(regularLoc(), op.getSILValue(),
2197+
BridgedValue::unbridge(ownership))};
2198+
}
2199+
21932200
BridgedInstruction BridgedBuilder::createLoadBorrow(BridgedValue op) const {
21942201
return {unbridged().createLoadBorrow(regularLoc(), op.getSILValue())};
21952202
}

0 commit comments

Comments
 (0)