riscv64: Add Newtype Wrappers for Register Classes#6459
Merged
Conversation
Subscribe to Label ActionDetailsThis 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 |
`gen_select_reg` can only compare X registers, but can move F registers based on that decision. Adjust the type signature to reflect that. Also add some lowering tests to cover these cases.
Contributor
Author
|
Can we leave this open overnight to let the fuzzer have some time to explore this? I'm not totally confident that the existing tests explore all of this. (i.e. see the latest commit about |
Contributor
Author
|
Fuzzing hasn't caught anything else, so I think this is probably ok to merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
👋 Hey,
This PR is a followup to a suggestion made by @alexcrichton, it adds newtype wrappers for the different register classes that we have in the RISC-V Backend.
These are
XReg,FRegandVReg, for Integer, Float and Vector. The newtypes are contained only to the ISLE layer, and do not propagate throughout the rest of the backend. However It would be a good idea to iteratively do so, I just felt that it would be too big a step for a first PR.This change was further complicated by a rule that we have in the backend where we auto convert
ValueRegsintoReg. This rule has caused issues in the past (1, 2), and was also conflicting with the newtype wrappers. Instead of adding similar rules to the newtypes, I've removed the rule and all usages of it.Most of this change was in
ext_int_if_needwhich returns ValueRegs, but most of its uses don't actually need more than one register. To that end I've repurposed thezextandsextrules, to act as single register zero or sign extends, and replaced the uses where only one register was necessary with those. Extends that do need multiple registers can useext_int_if_needorextend.These changes haven't changed any of the golden lowerings, but since it's such a broad change, I suspect we might be missing some coverage and I'm going to be fuzzing this overnight to doublecheck.