On Thu, Apr 05, 2012 at 07:23:20PM +0200, Olivier Hainque wrote: > IIUC (please correct me if I'm wrong), every time we need to emit a tie, we > must ensure that it references all the base regs that were used before to > restore regs from the frame (to prevent the sp adjustment past the tie from > moving prior to any of these accesses)
The minimal requirement is: In the prologue, the next frame write must be prevented from moving before the stack adjust. In the epilogue, the previous frame read must be prevented from moving after the stack adjust. If the adjacent write/read uses r1 as a base reg, then we don't need a stack tie at all. Writes/reads further away won't be reordered over the adjacent write/read. At least, I've never seen gcc do so, even with older versions known to have bugs in aliasing analysis. Every single case I've seen of improper reordering had a stack tie that didn't mention the base reg used by the adjacent write/read (or no tie). (Hah! In writing this, I remember why I took out that assert. What happens prior to the tie in the prologue is of no concern.) -- Alan Modra Australia Development Lab, IBM