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

Linearization gives bad save-stack when regalloc uses RAX to save the stack pointer #895

Closed
sarranz opened this issue Sep 5, 2024 · 0 comments · Fixed by #937
Closed

Comments

@sarranz
Copy link
Collaborator

sarranz commented Sep 5, 2024

This program

fn f1() -> reg u32 {
    reg u32 r z y;
    r = 0;
    y = 0;
    z = 0;
    r = r ^ y;
    r = r ^ z;
    return r;
}

fn f2(reg u32 _a _b _c) -> reg u32 {
    reg u32 r;
    r = 0;
    return r;
}

fn g(reg ptr u32[12] state, reg u64 column) -> reg ptr u32[12] {
    reg u32 x y z a;
    x = 0;
    y = 0;
    z = 0;
    a = f1();
    state[column] = a;
    a = f2(x,y,z);
    state[column] = a;

    return state;
}

export
fn jazz_g(reg ptr u32[12] state, reg u64 c) -> reg ptr u32[12] {
    #inline state = g(state, c);
    return state;
}

export
fn jazz_g2(reg ptr u32[12] state) -> reg ptr u32[12] {
    reg u64 c;
    c = 0;
    state = g(state, c);
    return state;
}

gives

compilation error in function jazz_g:
linearization: bad save-stack

because registar allocation chooses RAX to save the stack pointer, but linearization does not allow this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant