Skip to content
Daan Sprenkels edited this page Jun 22, 2022 · 4 revisions

FAQ

How to debug compilation errors?

Register allocation

register allocation: no more register to allocate “ ra.357”

This message says that there are no free registers for storing the return address of some function (its name is a white space followed by ra). Which function? With the command-line flag -debug on, the compiler will output the required information (grep for the actual name of the variable to filter the too verbose output).

There are two possible kinds of fix to this kind of issue: either spill some registers to ensure there is at least one register that is free at all call sites; or change the calling-convention of the function so that return address is passed on the stack (this can be achieved through the #returnaddress=stack annotation before the function declaration).

How do I set a register to zero?

For setting variables to zero, Jasmin has the special #set0() intrinsic. For example:

reg u64 i;

i = #set0();
while (i < 256) {
    // ...
    i += 1;
}
Clone this wiki locally