[LLVMdev] should PEI::calculateFrameObjectOffsets align the stack?

Rafael EspĂ­ndola rafael.espindola at gmail.com
Sat Oct 7 05:26:59 PDT 2006

> This sounds like the ADJCALLSTACK DOWN/UP 'instructions' around the call
> aren't set right, or you have declared a SP offset.  It doesn't look like
> the ARM backend does this, so this is probably the problem.
The ARM backend currently doesn't use a frame pointer. It uses the
same technique of the PPC backend to avoid add/subs around calls. In
the PPC backend we have:

if (MFI->hasCalls()) {
    NumBytes += MFI->getMaxCallFrameSize();
if ((NumBytes == 0) || (NumBytes <= 224 && !HasFP && !MFI->hasCalls()
&&   MaxAlign <= TargetAlign)) {
  unsigned Align = std::max(TargetAlign, MaxAlign);
  unsigned GPRSize = 4;
  unsigned Size = HasFP ? GPRSize + GPRSize : GPRSize;
  NumBytes = (NumBytes+Size+Align-1)/Align*Align;
Numbytes was correctly aligned before adding getMaxCallFrameSize, but
it must be aligned again afterwards.

> If the PEI stuff knows the right offsets, it should do the alignment for
> you.

It does. The problem is that, when a second alignment must be made,
some stack may be wasted.

> -Chris


More information about the llvm-dev mailing list