Merged
Conversation
These were previous displayed as a Use with a very large vreg number.
cfallin
approved these changes
Apr 30, 2023
Member
cfallin
left a comment
There was a problem hiding this comment.
Thanks! Just a few requests below but basically looks good.
src/lib.rs
Outdated
| debug_assert!(reg.index() < 256); | ||
| let bit = reg.index() & 127; | ||
| let index = reg.index() >> 7; | ||
| self.bits[index] & 1u128 << bit != 0 |
Member
There was a problem hiding this comment.
This is correct wrt operator precedence but it causes me to pause for a moment -- for easier mental parsing, could we add parens around 1u128 << bit ?
| let index = reg.index() >> 7; | ||
| let mut out = self; | ||
| out.bits[index] |= 1u128 << bit; | ||
| out |
Member
There was a problem hiding this comment.
Now that this logic has become slightly more complex, perhaps we could delegate to add with something like
let mut out = self;
out.add(reg);
out
?
Contributor
Author
There was a problem hiding this comment.
I tried that at first, but it's not possible since with is a const fn. add can't be made const because it uses &mut self.
cfallin
reviewed
Apr 30, 2023
| #[inline(always)] | ||
| pub const fn class(self) -> RegClass { | ||
| match self.bits & (0b11 << Self::MAX_BITS) { | ||
| match (self.bits >> Self::MAX_BITS) & 0b11 { |
Member
There was a problem hiding this comment.
And, yikes, thanks for catching this -- sorry I missed it in review!
Amanieu
added a commit
to Amanieu/regalloc2
that referenced
this pull request
May 1, 2023
This contains the bug fixes from bytecodealliance#129.
Merged
cfallin
pushed a commit
that referenced
this pull request
May 1, 2023
This contains the bug fixes from #129.
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.
This PR fixes 3 issues:
PReg::classwas broken by Add a third register class #126.PRegSetneeds more than 128 bits for 3 register classes.impl Display for Operandwas incorrect for fixed-non-allocatable operands.