jameysharp opened PR #8387 from jameysharp:realreg-is-physical-reg
to bytecodealliance:main
:
Semantically, a "real register" is supposed to be a physical register, so let's use the type dedicated for that purpose.
This has the advantage that
PReg
is only one byte whileVReg
is four bytes, so the arrays where we record collections ofRealReg
become smaller.There was an implementation of
From<VReg> for RealReg
which was not a sensible conversion, because not allVReg
s are validRealReg
s. I could have replaced it with aTryFrom
implementation but it wasn't used anywhere important, so I'm just deleting it instead.Winch was using that
VReg
->RealReg
conversion, but only in the implementation of another conversion that was itself unused, so I'm deleting that conversion as well. It's easy to implement correctly (the WinchReg
type is identical toRealReg
, so all conversions for the latter are readily available) but as far as I can tell Winch doesn't need to use Cranelift's register wrappers or RA2's virtual register type, so it's simpler to just delete those conversions.The riscv64 backend was relying on quirks of the existing conversions between
RealReg
andVReg
when emitting clobber saves and restores. Just using the generic conversions betweenRealReg
andReg
is simpler and works correctly with the rest of these changes.cc: @elliottt
jameysharp requested wasmtime-compiler-reviewers for a review on PR #8387.
jameysharp requested elliottt for a review on PR #8387.
elliottt submitted PR review:
Very nice cleanup, thank you!
github-actions[bot] commented on PR #8387:
Subscribe to Label Action
cc @saulecabrera
<details>
This issue or pull request has been labeled: "cranelift", "cranelift:area:machinst", "winch"Thus the following users have been cc'd because of the following labels:
- saulecabrera: winch
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
jameysharp merged PR #8387.
Last updated: Dec 23 2024 at 12:05 UTC