[LLVMdev] Stack alignment problem

Chris Lattner sabre at nondot.org
Thu Jul 1 12:29:01 PDT 2004


On Thu, 1 Jul 2004, Vladimir Prus wrote:

>
> Hello,
> it seems the Prolog/Epilog insertion does not correctly align stack for me.
> Consider the PEI::calculateFrameObjectOffsets method. It only aligns the
> stack if
>    FFI->hasCalls()
> is true. The only place where

Yup, the idea is that you dno't need to align the outgoign stack for a
leaf function.

>    MachineFrameInfo::setHasCalls
> is invoked is
>    PEI::saveCallerSavedRegisters
> and the value 'true' is only passed when there are instructions with opcodes
> equal to either RegInfo->getCallFrameSetupOpcode() or
> RegInfo->getCallFrameDestroyOpcode(). I don't have such special opcode, so
> hasCalls returns false and the stack is not aligned.

Okay, if you don't want to use this functionality, just call setHasCalls()
on the MFI in your instruction selector.  That should prevent this from
happening on any functions.

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list