Skip to content
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

Shuffle parts of the register allocator around a bit #1546

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

ltratt
Copy link
Contributor

@ltratt ltratt commented Jan 14, 2025

This PR tidies up some parts of the register allocator (and those bits that use it) so that future work has a slightly more satisfactory base to work upon. There is still a lot more tidying up that we could do here (and, as is not uncommon, this PR exposes more things we should tackle in the future), but this is better than nothing.

Mostly one can assign GP/FP regs in isolation. However, because x64
requires some FP operations to use a temporary GP register, we currently
find ourselves in the uncomfortable position where we have to `push` a
GP register in order to be certain that we aren't accidentally
clobbering something.

This commit introduces a new function in the API `assign_regs` which
specifies FP and GP registers in one go. Although we don't take
advantage of this yet, it will allow us (one day!) to safely deal with
the "I need a temporary GP register" case.
Some queries the codegen and register allocator need to make are
"reverse analysis" queries. This commit makes clearer that these are
queries on `rev_an` rather than the register allocator.

Doing this means allowing another public(ish) field, which looks ugly,
but at least makes clearer what the "real" structure is. I increasingly
think we need to think of a "proper" fix for this, but our existing
structure is unfortunate in several different places, and I can't
immediately see an easy migration strategy.
@ptersilie ptersilie added this pull request to the merge queue Jan 15, 2025
Merged via the queue into ykjit:master with commit e200818 Jan 15, 2025
2 checks passed
@ltratt ltratt deleted the regalloc_shuffle branch January 15, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants