Skip to content

Commit d9a8a0e

Browse files
committed
Added SourceDestAddrInstruction
1 parent e7a3ceb commit d9a8a0e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,18 @@ final public class AssignByWrapperInst : Instruction {}
307307

308308
final public class AssignOrInitInst : Instruction {}
309309

310-
final public class CopyAddrInst : Instruction {
310+
/// Instruction that copy or move from a source to destination address.
311+
public protocol SourceDestAddrInstruction : Instruction {
312+
var sourceOperand: Operand { get }
313+
var destinationOperand: Operand { get }
314+
}
315+
316+
extension SourceDestAddrInstruction {
311317
public var sourceOperand: Operand { return operands[0] }
312318
public var destinationOperand: Operand { return operands[1] }
319+
}
320+
321+
final public class CopyAddrInst : Instruction, SourceDestAddrInstruction {
313322
public var source: Value { return sourceOperand.value }
314323
public var destination: Value { return destinationOperand.value }
315324

@@ -321,9 +330,7 @@ final public class CopyAddrInst : Instruction {
321330
}
322331
}
323332

324-
final public class ExplicitCopyAddrInst : Instruction {
325-
public var sourceOperand: Operand { return operands[0] }
326-
public var destinationOperand: Operand { return operands[1] }
333+
final public class ExplicitCopyAddrInst : Instruction, SourceDestAddrInstruction {
327334
public var source: Value { return sourceOperand.value }
328335
public var destination: Value { return destinationOperand.value }
329336
}
@@ -583,7 +590,7 @@ class UncheckedRefCastInst : SingleValueInstruction, ConversionInstruction {
583590
}
584591

585592
final public
586-
class UncheckedRefCastAddrInst : Instruction {}
593+
class UncheckedRefCastAddrInst : Instruction, SourceDestAddrInstruction {}
587594

588595
final public class UncheckedAddrCastInst : SingleValueInstruction, UnaryInstruction {
589596
public var fromAddress: Value { operand.value }
@@ -1020,8 +1027,7 @@ final public class IsEscapingClosureInst : SingleValueInstruction, UnaryInstruct
10201027
final public
10211028
class MarkUnresolvedNonCopyableValueInst : SingleValueInstruction, UnaryInstruction {}
10221029

1023-
final public
1024-
class MarkUnresolvedMoveAddrInst : Instruction {}
1030+
final public class MarkUnresolvedMoveAddrInst : Instruction, SourceDestAddrInstruction {}
10251031

10261032
final public
10271033
class CopyableToMoveOnlyWrapperAddrInst : SingleValueInstruction, UnaryInstruction {}

0 commit comments

Comments
 (0)