-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
Description
This issue steps from this comment: #179 (comment)
Given a C program like this:
int a;
void f()
{
if (a < 2)
{
a=2;
}
}
int main()
{
a = 1;
f();
}
The generated assembly for the function f() is:
.....
_f:
move #_a,R11
cmp 2,@R11
abra @R13++,!v
move #_a,R12
move 2,@R12
l4:
move @R13++,R15
.....
What if we force the compiler to use register bank switching instead of the stack?
Would the compiler still generate abra @R13++,!v to return?
For the return itself, on the first glance this seems correct. BUT:
As described in #179 (comment), this would be wrong, because in case of register banking, the "return statement" aka abra @R13++,!v would need to do a DECRB first.