Steve Ellcey wrote: > Yes, I see where I missed this in aarch64_push_regs > and aarch64_pop_regs. I think that is why the second of > Wilco's two examples (f2) is wrong. I am unclear about > exactly what is meant by writeback and why we have it and > how that and callee_adjust are used. Any chance someone > could help me understand this part of the prologue/epilogue > code better? The comments in aarch64.c/aarch64.h aren't > really helping me understand what the code is doing or > why it is doing it.
Writeback is the same as a base update in a load or store. When creating the frame there are 3 stack adjustments to be made: creating stack for locals, pushing callee-saves and reserving space for outgoing arguments. We merge these stack adjustments as much as possible and use load/store with writeback for codesize and performance. See the last part in layout_frame for the different cases. In many common cases the frame is small and there are no outgoing arguments, so we emit an STP with writeback to store the first 2 callee saves and create th full frame in a single instruction. In this case callee_adjust will be the frame size and initial_adjust will be zero. push_regs and pop_regs need to be passed a mode since layout_frame will use STP with writeback of floating point callee-saves if there are no integer callee-saves. Note if there is only 1 or odd number of callee-save it may use LDR/STR with writeback, so we need to support TFmode for these too. Wilco