bytecodealliance / bytecodealliance/regalloc2

Limit operand to a set of physical registers

未关闭
#107 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
265
派生
53
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先查看 Operand 约束形式(`reg_def`、`reg_use`、`reg_fixed_def` 和 `reg_fixed_use`),以及 MachineEnv 如何表示物理寄存器。将 setcc 所描述的 x86 32 位字节寄存器限制与现有支持的 ISA 进行比较。当可以表达一组有界的物理寄存器,并且其分配行为已由测试覆盖时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
compilers
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。