diff options
Diffstat (limited to 'lib/Target/Blackfin/BlackfinFrameInfo.cpp')
-rw-r--r-- | lib/Target/Blackfin/BlackfinFrameInfo.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Target/Blackfin/BlackfinFrameInfo.cpp b/lib/Target/Blackfin/BlackfinFrameInfo.cpp index 83f28b0..4f9054b 100644 --- a/lib/Target/Blackfin/BlackfinFrameInfo.cpp +++ b/lib/Target/Blackfin/BlackfinFrameInfo.cpp @@ -16,10 +16,20 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/Target/TargetOptions.h" using namespace llvm; +// hasFP - Return true if the specified function should have a dedicated frame +// pointer register. This is true if the function has variable sized allocas or +// if frame pointer elimination is disabled. +bool BlackfinFrameInfo::hasFP(const MachineFunction &MF) const { + const MachineFrameInfo *MFI = MF.getFrameInfo(); + return DisableFramePointerElim(MF) || + MFI->adjustsStack() || MFI->hasVarSizedObjects(); +} + // Emit a prologue that sets up a stack frame. // On function entry, R0-R2 and P0 may hold arguments. // R3, P1, and P2 may be used as scratch registers @@ -40,7 +50,7 @@ void BlackfinFrameInfo::emitPrologue(MachineFunction &MF) const { MFI->setStackSize(FrameSize); } - if (!RegInfo->hasFP(MF)) { + if (!hasFP(MF)) { assert(!MFI->adjustsStack() && "FP elimination on a non-leaf function is not supported"); RegInfo->adjustRegister(MBB, MBBI, dl, BF::SP, BF::P1, -FrameSize); @@ -85,7 +95,7 @@ void BlackfinFrameInfo::emitEpilogue(MachineFunction &MF, int FrameSize = MFI->getStackSize(); assert(FrameSize%4 == 0 && "Misaligned frame size"); - if (!RegInfo->hasFP(MF)) { + if (!hasFP(MF)) { assert(!MFI->adjustsStack() && "FP elimination on a non-leaf function is not supported"); RegInfo->adjustRegister(MBB, MBBI, dl, BF::SP, BF::P1, FrameSize); |