Skip to content

[SIL.rst] Add textual examples for some of the pack instructions. #71221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/SIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7454,6 +7454,8 @@ scalar_pack_index

sil-instruction ::= 'scalar_pack_index' int-literal 'of' sil-type

%index = scalar_pack_index 0 of $Pack{Int, repeat each T, Int}

Produce the dynamic pack index of a scalar (non-pack-expansion)
component of a pack. The type operand is the indexed pack type. The
integer operand is an index into the components of this pack type; it
Expand Down Expand Up @@ -7573,6 +7575,8 @@ pack_element_get

sil-instruction ::= 'pack_element_get' sil-value 'of' sil-operand 'as' sil-type

%addr = pack_element_get %index of %pack : $*Pack{Int, repeat each T} as $*Int

Extracts the value previously stored in a pack at a particular index.
If the pack element is uninitialized, this has undefined behavior.

Expand All @@ -7591,6 +7595,8 @@ pack_element_set

sil-instruction ::= 'pack_element_set' sil-operand 'into' sil-value 'of' sil-operand

pack_element_set %addr : $*@pack_element("...") each U into %index of %pack : $*Pack{Int, repeat each T}

Places a value in a pack at a particular index.

Ownership is unclear for direct packs.
Expand Down