bytecodealliance / bytecodealliance/regalloc2

Limit operand to a set of physical registers

オープン
#107 コメント 5 件 リアクション 0 件 担当者 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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by reviewing the Operand constraint forms (`reg_def`, `reg_use`, `reg_fixed_def`, and `reg_fixed_use`) and how MachineEnv represents physical registers. Compare the x86 32-bit byte-register limitation described for setcc with the existing supported ISAs. Done means a bounded set of physical registers can be expressed and its allocation behavior is covered by tests.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。