SPlatten:
Registers are only used when available which depends entirely on what else the CPU is doing at the time, at all other times the stack is used, so you should not rely on the use of registers, but you should factor the stack into your operation as this is the worst case senario.
Yes, but if you dump the .elf file and you find that registers are being used, then that won't change. Which, it appears, happens for simple functions. Which I believe the original question was about.
tuxduino:
My (I guess wrong) assumption was that debug information has to be stored into the final executable, thus making it bigger. But we are optimizing for size as we are on small devices... What am I missing here ?
I'm not sure what debug information would be stuck in the executable. Some optimisation options just make the object easier to follow, that's all (by not moving instructions around, like out of loops).