Skip to content

Commit 93c884e

Browse files
committed
Comment OperandOwnership
1 parent bc01d97 commit 93c884e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

include/swift/SIL/SILValue.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,15 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
634634
/// Used to verify completeness of the ownership use model and exhaustively
635635
/// switch over any category of ownership use. Implies ownership constraints and
636636
/// lifetime constraints.
637+
///
638+
/// OperandOwnership may be statically determined by the user's opcode alone, or
639+
/// by the opcode and operand type. Or it may be dynamically determined by an
640+
/// ownership kind variable in the user's state. However, it may never be
641+
/// inferred from the ownership of the incoming value. This way, the logic for
642+
/// determining which ValueOwnershipKind an operand may accept is reliable.
643+
///
644+
/// Any use that takes an Owned or Guaranteed value may also take a trivial
645+
/// value (ownership None), because the ownership semantics are irrelevant.
637646
struct OperandOwnership {
638647
enum innerty : uint8_t {
639648
/// Operands that do not use the value. They only represent a dependence
@@ -680,7 +689,7 @@ struct OperandOwnership {
680689
/// (begin_borrow, begin_apply with @guaranteed argument)
681690
Borrow,
682691

683-
/// MARK: Uses of Owned values:
692+
/// MARK: Uses of Owned (or None) values:
684693

685694
/// Destroying Consume. Destroys the owned value immediately.
686695
/// (store, destroy, @owned destructure).
@@ -689,7 +698,7 @@ struct OperandOwnership {
689698
/// (br, destructure, tuple, struct, cast, switch).
690699
ForwardingConsume,
691700

692-
/// MARK: Uses of Guaranteed values:
701+
/// MARK: Uses of Guaranteed (or None) values:
693702

694703
/// Interior Pointer. Propagates a trivial value (e.g. address, pointer, or
695704
/// no-escape closure) that depends on the guaranteed value within the

0 commit comments

Comments
 (0)