Skip to content

VBCC: Check edge case around abra @R13++,!v #186

@sy2002

Description

@sy2002

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.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions