jasmin
jasmin copied to clipboard
Using mmx on ARM produces strange errors
Compiling for ARM the program
export fn main () -> reg u32 {
#mmx reg u32 x;
reg u32 y;
y = 0;
x = y;
y = x;
return y;
}
produces
compilation error:
register allocation: no more free register to allocate variable:
x.180 (defined at "file.jazz", line 6 (2-3))
Conflicts with:
Note that the list of conflicts is empty, so the message is a bit confusing.
Compiling this other program
export fn main () -> reg u32 {
#mmx reg u32 x;
reg u32 x2 y z;
y = 0;
x = y;
x2 = y;
y = x;
z = x2;
y += z;
return y;
}
raises an exception
compilation error:
register allocation: no more free register to allocate variable:
x.192 (defined at "file.jazz", line 6 (2-3))
Conflicts with:
Fatal error: exception Not_found
Maybe related to https://github.com/jasmin-lang/jasmin/issues/601?
I guess the annotation should be ignored, with a warning.
The second example reveals a real problem in the allocator if I'm not mistaken: the fact that registers and extra registers can conflict. The problem does not happen with large registers because they have different types from scalar register. When dealing with a class of registers, we have at our disposal the table of the variables corresponding to that class, so printing a conflict with a variable from another class fails.
For example 1, it depends whether we want to be able to write code working both for ARM and x86. If we do not care, there is no problem rejecting programs that use mmx. We just need a better error message.
I think this is fix with the last commit of #692
No, the conflict may arise also if there are extra registers available. If we use all of them, we end up in this case too. This is just a bit more difficult to craft an example.
Thanks. This crash (Fatal error: exception Not_found
) of the second example is addressed by #694.
Can we close this issus or we still have a pb with the first example.
I think we need a dedicated error message when the bank is empty. Having an error explaining that it conflicts with nothing is really confusing.