bytecodealliance / bytecodealliance/regalloc2

Limit operand to a set of physical registers

Open
#107 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
265
Forks
53
PR merge metrics
No merged PRs in 30d

Description

It seems like there are currently two options when expressing which registers an `Operand` can use:

* use `reg_def`/`reg_use`/..., in this case the operand can be allocated to any physical register.
* use `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 by `wasmtime` have this issue, so I can't steal any ideas there.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.