Skip to content

Commit e064ff3

Browse files
committed
docs: Document the store_borrow instruction
1 parent d6736e9 commit e064ff3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/SIL.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3547,6 +3547,27 @@ by an `end_borrow`_ instruction. All `load_borrow`_ instructions must be
35473547
paired with exactly one `end_borrow`_ instruction along any path through the
35483548
program. Until `end_borrow`_, it is illegal to invalidate or store to ``%0``.
35493549

3550+
store_borrow
3551+
````````````
3552+
3553+
::
3554+
3555+
sil-instruction ::= 'store_borrow' sil-value 'to' sil-operand
3556+
3557+
store_borrow %0 to %1 : $*T
3558+
// $T must be a loadable type
3559+
// %1 must be an alloc_stack $T
3560+
3561+
Stores the value ``%0`` to a stack location ``%1``, which must be an
3562+
``alloc_stack $T``.
3563+
The stored value is alive until the ``dealloc_stack`` or until another
3564+
``store_borrow`` overwrites the value. During the its lifetime, the stored
3565+
value must not be modified or destroyed.
3566+
The source value ``%0`` is borrowed (i.e. not copied) and it's borrow scope
3567+
must outlive the lifetime of the stored value.
3568+
3569+
Note: This is the current implementation and the design is not final.
3570+
35503571
begin_borrow
35513572
````````````
35523573

0 commit comments

Comments
 (0)