Call-used registers (r18-r27, r30-r31): May be allocated by gcc for local data. You may use them freely in assembler subroutines. Calling C subroutines can clobber any of them - the caller is responsible for saving and restoring.
So I have a program (the Optiboot bootloader) where the compiler is apparently going to some lengths to some lengths to avoid putting "long-term" data into call-used registers. Instead it seems to go to some length to use the 2nd-class low-registers, instead. In fact, the final program includes:
7e40: 35 e0 ldi r19, 0x05 ; 5 7e42: c3 2e mov r12, r19
Even though r19 is not used anywhere else in the program! Apparently, since the call-used registers could be obliterated by any function call, and my code does indeed occasionally call functions, avr-gcc avoids even trying to use these registers.
Is there any way that I can mess with the compiler's idea of which registers are actually used by subroutines? I would sort-of expected this to be done by -flto, but that doesn't seem to be the case. :-(
(and yes, I'm at a stage where having the 510-byte program be a dozen bytes shorter would be helpful...)