Implement ADJCALLSTACKUP and ADJCALLSTACKDOWN
[oota-llvm.git] / lib / Target / Mips / Mips16FrameLowering.cpp
index 74cffd202ce47da686e520d6491c5f78e905aea1..4e6b21feb55dddf4dba8dc58bc519225e27cf5c4 100644 (file)
@@ -115,8 +115,10 @@ bool Mips16FrameLowering::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
 
 bool
 Mips16FrameLowering::hasReservedCallFrame(const MachineFunction &MF) const {
-  // FIXME: implement.
-  return true;
+  const MachineFrameInfo *MFI = MF.getFrameInfo();
+  // Reserve call frame if the size of the maximum call frame fits into 15-bit
+  // immediate field and there are no variable sized objects on the stack.
+  return isInt<15>(MFI->getMaxCallFrameSize()) && !MFI->hasVarSizedObjects();
 }
 
 void Mips16FrameLowering::