Skip to content

Commit

Permalink
Since LM32FrameLowering::hasReservedCallFrame() always
Browse files Browse the repository at this point in the history
returns true, alignment and updating the stacksize in regard
to the maximum call frame is handled by
PEI::calculateFrameObjectOffsets(), so it should not
be necessary to do this manually.

In fact, it is harmful, since the max call frame will be
added twice to stacksize.
Patch from Stefan Kristiansson
  • Loading branch information
JP Bonn committed Jul 13, 2012
1 parent 835537f commit 1ccd614
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions lib/Target/LM32/LM32FrameLowering.cpp
Expand Up @@ -41,43 +41,6 @@ LM32FrameLowering::LM32FrameLowering(const LM32Subtarget &subtarget)
}


/// determineFrameLayout - Align the frame and maximum call frame and
/// updated the sizes. Copied from SPU.
void LM32FrameLowering::
determineFrameLayout(MachineFunction &MF) const {
MachineFrameInfo *MFI = MF.getFrameInfo();

// Get the number of bytes to allocate from the FrameInfo
unsigned FrameSize = MFI->getStackSize();

// Get the alignments provided by the target, and the maximum alignment
// (if any) of the fixed frame objects.
unsigned TargetAlign = getStackAlignment();
unsigned Align = std::max(TargetAlign, MFI->getMaxAlignment());
assert(isPowerOf2_32(Align) && "Alignment is not power of 2");
unsigned AlignMask = Align - 1;

// Get the maximum call frame size of all the calls.
unsigned maxCallFrameSize = MFI->getMaxCallFrameSize();

// If we have dynamic alloca then maxCallFrameSize needs to be aligned so
// that allocations will be aligned.
if (MFI->hasVarSizedObjects())
maxCallFrameSize = (maxCallFrameSize + AlignMask) & ~AlignMask;

// Update maximum call frame size.
MFI->setMaxCallFrameSize(maxCallFrameSize);

// Include call frame size in total.
FrameSize += maxCallFrameSize;

// Make sure the frame is aligned.
FrameSize = (FrameSize + AlignMask) & ~AlignMask;

// Update frame info.
MFI->setStackSize(FrameSize);
}

/// hasFP - Return true if the specified function should have a dedicated frame
/// pointer register. This is true if the stacksize > 0 and either the
/// function has variable sized allocas or frame pointer elimination
Expand Down Expand Up @@ -110,9 +73,6 @@ emitPrologue(MachineFunction &MF) const {

DebugLoc dl = (MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc());

// determineFrameLayout() sets some stack related sizes so do it first.
determineFrameLayout(MF);

// Check the maximum call frame size of all the calls is sensible.
assert(MFrmInf->getMaxCallFrameSize()%4 == 0 && "Misaligned call frame size");

Expand Down

0 comments on commit 1ccd614

Please sign in to comment.