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

Additional registers spilled on the stack #63

Open
Mesabloo opened this issue Jul 13, 2022 · 0 comments
Open

Additional registers spilled on the stack #63

Mesabloo opened this issue Jul 13, 2022 · 0 comments
Labels
design Something that influences the language's design discussion When you want to discuss about something
Milestone

Comments

@Mesabloo
Copy link
Member

Mesabloo commented Jul 13, 2022

This idea originally stemed from the fact that x64 has quite a lot more registers than x86.
N⋆ is meant to be a semi-portable assembly language, but it is impossible to restrict the entire language to the smallest register set available across all 32+bits platforms.
This was also recently seen in the magus project:

x86 and x64 code is almost compatible. The main differences are pointer width and number of registers available. Both can be somewhat solved using symbolic register names, f.e. ptr_reg8 can be translated into either r8 or [esp+4*8] depending on CPU

Instead, we propose that the number of registers be either unbounded (meaning that %rN with N ∈ ℕ may be a virtual register depending on the target architecture) or large enough to accomodate to at least x64 (meaning that there would be at least 12 registers %r0 to %r11).
The first registers of this set would be mapped to the architecture's register (eax, etc) and all of the remaining registers would be strategically spilled on the stack. Although there is a very little performance hit from doing so, this allows not to worry too much about which registers are available or not when generating code from a compiler (from a user point of view too, but in this case the user itself could maybe use target-specific blocks — see #37 — for better handling of registers across multiple architectures).

@Mesabloo Mesabloo added discussion When you want to discuss about something design Something that influences the language's design labels Jul 13, 2022
@Mesabloo Mesabloo moved this to Todo in Issue tracker Jul 13, 2022
@Mesabloo Mesabloo added this to the Later milestone Sep 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Something that influences the language's design discussion When you want to discuss about something
Projects
Status: Todo
Development

No branches or pull requests

1 participant