-
Notifications
You must be signed in to change notification settings - Fork 1.4k
ISLE: add support for multi-extractors and multi-constructors. #4908
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
Conversation
This support allows for rules that process multiple matching values per extractor call on the left-hand side, and as a result, can produce multiple values from the constructor whose body they define. This is useful in situations where we are matching on an input data structure that can have multiple "nodes" for a given value or ID, for example in an e-graph.
Subscribe to Label Action
This issue or pull request has been labeled: "cranelift", "isle"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
cranelift/isle/isle/isle_examples/link/multi_constructor_main.rs
Outdated
Show resolved
Hide resolved
Updated, thanks! |
aac03d8
to
84236a6
Compare
I still need to read this more carefully, but I think it looks good. One question so far: what's the intended difference between returning I don't see any documentation for how someone writing an external multi-extractor should implement the auto-generated traits. I don't think that's strictly necessary before merging this, but if that documentation existed then I would look for the answer to the above question there. |
That's a good question. Functionally there is no difference, and the main reason is just to manage complexity: otherwise we have a special case wherever we have a match failure in that we have to invent an empty iterator rather than return |
… consistent with new islec output.
I asked Chris to show me a diff of the generated code for existing uses of ISLE. We verified that the only difference was additional types and traits related to |
This support allows for rules that process multiple matching values per extractor call on the left-hand side, and as a result, can produce multiple values from the constructor whose body they define.
This is useful in situations where we are matching on an input data structure that can have multiple "nodes" for a given value or ID, for example in an e-graph.
This is the first piece of the implementation of bytecodealliance/rfcs#27.