-
Notifications
You must be signed in to change notification settings - Fork 38
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
Limit operand to a set of physical registers #107
Comments
This is an interesting requirement, and it would certainly be useful, I agree! It seems technically feasible-ish, and the general solution would be to (i) modify the There may be some subtle forward-progress issues with that; I'm not sure and would have to think a bit more. Also there are potentially interactions with the way that multiple conflicting requirements on one vreg at one time are handled (the "multi-fixed-reg fixup" logic). Anyway, I invite anyone to experiment with this; I don't have the bandwidth or motivating use-case (from things I'm tasked to work on) to be able to spend time on it unfortunately but I'm happy to point to the appropriate parts of the implementation and/or review code! |
One issue I came across when thinking about this some more is the size of Another solution is to only allow a predefined set of register sets to be used as defined in I'll think about this some more, and look into the internals of |
Another use case for this would be supporting the RISCV C extension where instructions can only reference 8 registers (either integer or floating point) instead of the 32 available in the regular ISA. |
Actually this could completely replace register classes (and fix #47), just annotate each def/usage with the right set of physical registers. Of course that still requires figuring out the bit packing. And maybe it's not very efficient since this would artificially entangle the integer and float register allocation problems. |
In the end it's possible we might need to grow |
It seems like there are currently two options when expressing which registers an
Operand
can use:reg_def
/reg_use
/..., in this case the operand can be allocated to any physical register.reg_fixed_def
/reg_fixed_use
, in this case the operand can only be a single physical register.This does not seem to cover the case where only of a limited set of physical registers can be used as an operand.
This is often the case on x86 (32-bit), where some of the general purpose registers don't expose their lower 8 bits as a pseudoregister. This means that
setcc
and other instructions dealing with a byte can only use the first 4 registers, not eg.esi
.My current workaround is to always use fixed operands for these instructions, but that is a bit too limiting. The other solution is to completely remove the additional registers from the
MachineEnv
, but that has even bigger drawbacks. Is there a better solution? It seems none of the ISAs supported bywasmtime
have this issue, so I can't steal any ideas there.The text was updated successfully, but these errors were encountered: