Skip to content
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

Add a tuple.drop text pseudoinstruction #6170

Merged
merged 1 commit into from
Dec 12, 2023
Merged

Add a tuple.drop text pseudoinstruction #6170

merged 1 commit into from
Dec 12, 2023

Conversation

tlively
Copy link
Member

@tlively tlively commented Dec 12, 2023

We previously overloaded drop to mean both normal drops of single values and
also drops of tuple values. That works fine in the legacy text parser since it
can infer parent-child relationships directly from the s-expression structure of
the input, so it knows that a drop should drop an entire tuple if the
tuple-producing instruction is a child of the drop. The new text parser,
however, is much more like the binary parser in that it uses instruction types
to create parent-child instructions. The new parser always assumes that drop
is meant to drop just a single value because that's what it does in WebAssembly.

Since we want to continue to let Drop IR expressions consume tuples, and since
we will need a way to write tests for that IR pattern that work with the new
parser, introduce a new pseudoinstruction, tuple.drop, to represent drops of
tuples. This pseudoinstruction only exists in the text format and it parses to
normal Drop expressions. tuple.drop takes the arity of its operand as an
immediate, which will let the new parser parse it correctly in the future.

@tlively tlively requested a review from kripken December 12, 2023 08:47
@tlively
Copy link
Member Author

tlively commented Dec 12, 2023

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Base automatically changed from tuple-make-arity to main December 12, 2023 19:25
We previously overloaded `drop` to mean both normal drops of single values and
also drops of tuple values. That works fine in the legacy text parser since it
can infer parent-child relationships directly from the s-expression structure of
the input, so it knows that a drop should drop an entire tuple if the
tuple-producing instruction is a child of the drop. The new text parser,
however, is much more like the binary parser in that it uses instruction types
to create parent-child instructions. The new parser always assumes that `drop`
is meant to drop just a single value because that's what it does in WebAssembly.

Since we want to continue to let `Drop` IR expressions consume tuples, and since
we will need a way to write tests for that IR pattern that work with the new
parser, introduce a new pseudoinstruction, `tuple.drop`, to represent drops of
tuples. This pseudoinstruction only exists in the text format and it parses to
normal `Drop` expressions. `tuple.drop` takes the arity of its operand as an
immediate, which will let the new parser parse it correctly in the future.
@tlively tlively merged commit a6c1165 into main Dec 12, 2023
27 checks passed
@tlively tlively deleted the tuple-drop branch December 12, 2023 22:00
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
We previously overloaded `drop` to mean both normal drops of single values and
also drops of tuple values. That works fine in the legacy text parser since it
can infer parent-child relationships directly from the s-expression structure of
the input, so it knows that a drop should drop an entire tuple if the
tuple-producing instruction is a child of the drop. The new text parser,
however, is much more like the binary parser in that it uses instruction types
to create parent-child instructions. The new parser always assumes that `drop`
is meant to drop just a single value because that's what it does in WebAssembly.

Since we want to continue to let `Drop` IR expressions consume tuples, and since
we will need a way to write tests for that IR pattern that work with the new
parser, introduce a new pseudoinstruction, `tuple.drop`, to represent drops of
tuples. This pseudoinstruction only exists in the text format and it parses to
normal `Drop` expressions. `tuple.drop` takes the arity of its operand as an
immediate, which will let the new parser parse it correctly in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants