Two responses inline...<br><div><div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
My current thinking is that an emergency spill slot could be set aside to<br>
hold the original, ABI conforming, frame pointer. Not an ideal solution,<br>
but in my situation where I must cover any code a user throws at me,<br>
breaking the ABI and playing with the stack is preferred.<br>
<br></blockquote><div><br></div><div>Ah, this is not a good idea. I examined this a while back. The issue is that spilling the base pointer causes two levels of indirection to access arguments. </div><div><br></div><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> > Figure 3.3 on page 16 of <a href="http://www.x86-64.org/documentation/abi.pdf" target="_blank">www.x86-64.org/documentation/abi.pdf</a> is not<br>
> > normative.  See foot note 7 in the same page.  Figure 3.4 on page 21<br>
> > confirms that the use of a frame-pointer is optional.<br>
> ><br>
> > So, if one doesn't use ENTER in the prologue and uses RSP to access local<br>
> > variables, RBP may be used as a calee-saved GPR.<br>
><br>
> I am not sure if I am completely following. The issue that required<br>
> aligning the frame to 32 bytes is when there are variable sized objects on<br>
> the stack (e.g. alloca). In that case, the RBP frame pointer is required to<br>
> access the spill slots. If I'm not mistaken, calculating the address of<br>
> spill slots off of RSP would be costly in this case.<br>
<br>
No, stack realignment needs to happen if there are auto variables on the<br>
stack of types that need a larger alignment than the default. This<br>
currently means AVX vectors for x86-64 and SSE/AVX vectors for x86-32<br>
folloing the original sysv ABI. In that case %rbp/%ebp is used to<br>
reference the original arguments on the stack and %rsp/%esp is used to<br>
reference the auto variables.<br></blockquote><div><br></div><div>That sounds about right; my mistake. When I realign the frame in the presence of variable sized objects and AVX spills, I have three pointers sitting around: the real, unaligned frame pointer (let's say RBX and used as the 'base pointer'); the aligned frame pointer (RBP); and the stack pointer (RSP). The arguments are based off of the unaligned frame pointer. Besides the change to make RBX the base pointer in the Emit[Prologue|Epilogue] routines, everything else stayed the same.</div>
<div><br></div><div> -Cameron</div></div></div></div>