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
PRegis only one byte whileVRegis four bytes, so the arrays where we record collections ofRealRegbecome smaller.There was an implementation of
From<VReg> for RealRegwhich was not a sensible conversion, because not allVRegs are validRealRegs. I could have replaced it with aTryFromimplementation but it wasn't used anywhere important, so I'm just deleting it instead.Winch was using that
VReg->RealRegconversion, 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 WinchRegtype 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
RealRegandVRegwhen emitting clobber saves and restores. Just using the generic conversions betweenRealRegandRegis 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 06 2025 at 06:05 UTC