Nicholas Piggin's on August 30, 2019 1:49 am: >> This doesn't do what you think, or what you want, or what you think you >> want ;-) > > After reading gcc docs from gcc 4 to 9, I think it does. > > We want this to apply to all functions in the compilaition unit. It's > fine to use the regs temporarily, and so it's fine for called functions > in other units to call them (because they will be restored), and we > don't want them restored for our caller. > >> (And if you make all those regs -ffixed-* you are in for a world of hurt). > > From the look of it, -ffixed would be a little bit stronger in that it > will never allow the register to be used, wheras the global register > variable allows it to be allocated and used elsewhere so long as its > observable value is not affected. The latter is actually preferred > because it's fine for the compiler to use the regs if it wants to. It > does not even have to use r15 register when I reference r15 variable, > only whatever value it had.
Ah, of course that means all of them need to be inputs to the stmw asm (which makes sense and is documented in gcc-9 doc, which is when the compiler was allowed to allocate them for other things. Thanks, Nick