Code like
int array[4];
void array_access(unsigned char index)
{
array[index] = 0;
}
Results in a temporary for the array address for most ports. This increases register pressure. However, mcs51 can optimize out the temporary in register packing. This optimization should be ported to stm8 (and maybe z80 and related, but that's less important, since z80 has more registers than stm8).
Philipp
P.S.: See also https://github.com/tenbaht/sduino/issues/14#issuecomment-330904012
Diff:
Implemented in [r10280] by implementing basic support for rematerialization.
And not just for once-used addresses. Rematerialization is handled in the register allocator, which can decide to even rematerialize addresses used multiple times, if the cost of rematerialization is less than the gain from reduced register pressure.
Philipp