You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a function fn f (reg ptr u8[N] r) -> reg ptr u8[N] that uses a lot of registers, so I want to spill the argument before the call and unspill it after the call.
stack ptr u8[N] s;
s = r;
r = f(r);
r = s;
But in this code, the region associated to variable s, and then to variable r is partial. I have to copy back r into s after the call. This spurious assignment will be removed by stack alloc, there is code dedicated to it.
stack ptr u8[N] s;
s = r;
r = f(r);
s = r; // new line
r = s;
This is accepted by the compiler, but does not do what I want at all. The first s = r is removed, since s is dead. Here is a solution.
stack ptr u8[N] s;
s = r;
r = f(r);
s[0:N] = r; // s is updated, not overwritten, so "s = r" will not be removed
r = s;
This works as expected, but is not so natural.
The text was updated successfully, but these errors were encountered:
Note that there is a file testing this feature, namely tests/success/pointers/x86-64/test_spill_loop.jazz and it does not need the trick of using a subarray, but I think it is because of the while loop. The stack ptr is not dead and thus not removed.
I have a function
fn f (reg ptr u8[N] r) -> reg ptr u8[N]
that uses a lot of registers, so I want to spill the argument before the call and unspill it after the call.But in this code, the region associated to variable
s
, and then to variabler
is partial. I have to copy backr
intos
after the call. This spurious assignment will be removed by stack alloc, there is code dedicated to it.This is accepted by the compiler, but does not do what I want at all. The first
s = r
is removed, sinces
is dead. Here is a solution.This works as expected, but is not so natural.
The text was updated successfully, but these errors were encountered: