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

Failure in regalloc throws internal compilation error for subroutines #426

Open
sarranz opened this issue May 2, 2023 · 5 comments
Open

Comments

@sarranz
Copy link
Collaborator

sarranz commented May 2, 2023

The following code

fn foo(reg u64 x y) -> reg u64 {
    [x] = 0;
    return y;
}

fails with

"", line 1 (0) to line 4 (1):
internal compilation error in function foo:
  Variable allocation: x (defined at "ble.jazz", line 1 (15-16)) and RAX (defined at "", line -1 (-1)) : variable already set

But if we set it as export, it fails correctly.

@vbgl
Copy link
Member

vbgl commented May 3, 2023

Thanks for the report. Here is a variant:

fn foo(reg u64 x y) -> reg u64 {
    [x] = 0;
    return y;
}

export
fn dummy(reg u64 p) -> reg u64 {
  p = p;
  _ = foo(p, p);
  return p;
}

@vbgl
Copy link
Member

vbgl commented May 3, 2023

I don’t understand why you write that the failure is expected.

@sarranz
Copy link
Collaborator Author

sarranz commented May 3, 2023

I don’t understand why you write that the failure is expected.

I meant that I'd liked to get the behavior we have if it were an export function. If we remove local functions that are not called then yes, I would expect no error and an empty program.

@vbgl
Copy link
Member

vbgl commented May 3, 2023

What if it’s a local function that does get called?

@sarranz
Copy link
Collaborator Author

sarranz commented May 3, 2023

I see now, you're right. This should compile. We don't need to respect the calling convention for local functions.

@sarranz sarranz changed the title Correct failure in regalloc throws internal compilation error for subroutines Failure in regalloc throws internal compilation error for subroutines May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants