Add a tuple.drop
text pseudoinstruction
#6170
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We previously overloaded
drop
to mean both normal drops of single values andalso 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 sincewe 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 oftuples. This pseudoinstruction only exists in the text format and it parses to
normal
Drop
expressions.tuple.drop
takes the arity of its operand as animmediate, which will let the new parser parse it correctly in the future.