[LLVMdev] Stack alignment on X86 AVX seems incorrect

Joerg Sonnenberger joerg at britannica.bec.de
Thu Mar 1 14:50:00 PST 2012


On Thu, Mar 01, 2012 at 05:30:40PM -0500, Cameron McInally wrote:
> The x86-64 ABI lays out the stack frame as...
> 
> ...
> 16(%rbp)  mem arg[0]
> 8(%rbp)    return address
> 0(%rbp)    previous %rbp
> -8(%rbp)   stack
> 
> My patch breaks the ABI since the ABI requires the return address to be
> found at 8(%rbp) and mem arg[0] at 16(%rbp). Unfortunately, to align the
> frame at runtime, it's sometimes required to insert padding in between the
> two.

Eh, no. The X86-64 ABI doesn't require the use of a frame pointer, so it
obviously can't require anything relative to %rbp.

Please note that stack realignment is implement unless code requires
dynamic allocas. The conditionals seems to be wrong though as mentioned
in this thread.

Joerg



More information about the llvm-dev mailing list