R0 - R2, R5, R6 are corrupted after printf_fast call.
Option -all-calee-saves on
simple demo, refined
If you want to use --all-callee-saves then you must recompile the whole library. And several assembly implemented functions like printf_fast will not work. So they probably should either warn about that or be double implemented.
Yes, I understand.
But HOW do it ?
I easy can made appropriate modifications myself.
p.s. By my opinion, register(s) saving/restore - must be immanent option for any standard subroutine, simply to avoid code repeating around each call.
Using the default caller-saves is not repeating the same code around each call. Register pressure depends as much on the caller as it does on the callee. It very much depends on the code whether caller-saves or callee-saves is the most optimal.
Further, the default caller-saves is regression tested every day, but callee-saves sees hardly any testing.
Yes, You are right, caller-saves may be more efficient by execution time, if amount of caller's register-based variables are small (more precisely, less, than callee).
But it clearly not too optimal solution in such terms, as total code size, and reliability.
Added --all-callee-saves to generated .optsdcc line so the linker will error on mixed usage in SDCC 3.3.2 #8929. Also generate predefined macro __SDCC_ALL_CALLEE_SAVES so source can check for this.