[LLVMdev] Stack alignment on X86 AVX seems incorrect

Jim Grosbach grosbach at apple.com
Fri Mar 2 08:16:57 PST 2012


On Mar 2, 2012, at 3:57 AM, Anton Korobeynikov <anton at korobeynikov.info> wrote:

> Joerg,
> 
>> At least for 32bit x86 reserving another register as alternative frame
>> pointer is very heavy. The above would allow normal spill logic to
>> decide when to keep a reference in register and when not. It also reuses
>> existing functionality as much as possible.
> It does not seem to be enough. Even is there are *no* allocas in the
> function the stack realignment might still be necessary, for example
> due to spill of vector register.
> So, we'll need to decide very late whether we'll need realignment or not.
> 

Absolutely right. Which means it will need to be a heuristic, because regalloc needs to know early whether to reserve the register or not. There's already some of this sort of thing for whether the frame pointer is reserved or not. The ARM backend already does a fair bit of this (see hasBasePointer() and friends) and may be useful as an example of what's involved.

-Jim

> -- 
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list