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

Variable Spilling #11

Closed
Lol3rrr opened this issue Jan 20, 2022 · 1 comment
Closed

Variable Spilling #11

Lol3rrr opened this issue Jan 20, 2022 · 1 comment
Labels
Backend Everything related to one or more Backends

Comments

@Lol3rrr
Copy link
Owner

Lol3rrr commented Jan 20, 2022

Proposal

Right now the Variable spilling kind of works but breaks down for more complicated Situations and sometimes fails to properly spill Variables leading to the Problem that it just tries to spill Variables over and over again without making any real Progress.
The Way Variables are spilled should therefore be revisited and improved to hopefully mitigate these Problems and provide a more advanced and solid solution

Conditional-Problem

Right now Conditionals and Phi Nodes are causing a lot of Problems with spilling as their interference is not really handled correctly.
Right now the Compiler basically treats them very dumb like this

if (..) {
  x_1 = 5;
} else {
  x_2 = 13;
}
// For the Compiler x_3 only starts existing after this point
x_3 = phi(x_1, x_2);

when in reality the semantics/logic of this is more like this

if (..) {
  x_1 = 5;
  // X_3 exists at this point
  // Implicit: x_3 = x_1
} else {
  x_2 = 13;
  // X_3 exists at this point as well
  // Implicit: x_3 = x_2
}
// This only exists because we need a single Definition but in the final non SSA form this is moved up like shown
x_3 = phi(x_1, x_2);

This mainly causes Problems when the compiler attempts to insert a spill before the Phi Node, because it needs a Register for the x_3 Variable but handles it incorrectly as it has wrong assumptions about the interference

@Lol3rrr Lol3rrr added the Backend Everything related to one or more Backends label Jan 20, 2022
@Lol3rrr
Copy link
Owner Author

Lol3rrr commented Apr 6, 2022

I think this issue is no longer relevant with the new spilling and register allocation being implemented and mostly working as well

@Lol3rrr Lol3rrr closed this as completed Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend Everything related to one or more Backends
Projects
None yet
Development

No branches or pull requests

1 participant