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

Introduce cutsets in StackLang and LabLang #1078

Open
myreen opened this issue Nov 4, 2024 · 0 comments
Open

Introduce cutsets in StackLang and LabLang #1078

myreen opened this issue Nov 4, 2024 · 0 comments

Comments

@myreen
Copy link
Contributor

myreen commented Nov 4, 2024

At the moment, WordLang is the last language with cutsets, i.e. annotations which state that only local variables in this set are to survive this line in the code. These annotations are useful when optimising because they give optimisations the freedom to write anything to any other value without danger of having some effect on code elsewhere by such update to local variables.

Example:

v0 := (v1 + 1) * 3;
v1 := (v1 + 1) & 7;
cut {v0, v1, v2}

With the cutset annotation, an optimisation can locally make the decision to that it's safe to assign to v5 since the cutset at the end ensures that its value never makes it past the last line in the example.

v5 := v1 + 1;
v0 := v5 * 3;
v1 := v5 & 7;
cut {v0, v1, v2}

This issue is about adding cutset annotations to StackLang and LabLang so that future peephole optimisers at these levels can make use of new temporaries.

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

No branches or pull requests

1 participant