From 641b0b5a21b7c5a8c7cc0bf90ff5bc53de02d68a Mon Sep 17 00:00:00 2001 From: Venkatraman Govindaraju Date: Fri, 17 May 2013 15:14:34 +0000 Subject: [Sparc] Implements hasReservedCallFrame and hasFP. This is to generate correct framesetup code when the function has variable sized allocas. llvm-svn: 182108 --- llvm/lib/Target/Sparc/SparcFrameLowering.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'llvm/lib/Target/Sparc/SparcFrameLowering.cpp') diff --git a/llvm/lib/Target/Sparc/SparcFrameLowering.cpp b/llvm/lib/Target/Sparc/SparcFrameLowering.cpp index 7874240f598..afa8411802d 100644 --- a/llvm/lib/Target/Sparc/SparcFrameLowering.cpp +++ b/llvm/lib/Target/Sparc/SparcFrameLowering.cpp @@ -106,3 +106,18 @@ void SparcFrameLowering::emitEpilogue(MachineFunction &MF, BuildMI(MBB, MBBI, dl, TII.get(SP::RESTORErr), SP::G0).addReg(SP::G0) .addReg(SP::G0); } + +bool SparcFrameLowering::hasReservedCallFrame(const MachineFunction &MF) const { + //Reserve call frame if there are no variable sized objects on the stack + return !MF.getFrameInfo()->hasVarSizedObjects(); +} + +// 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 SparcFrameLowering::hasFP(const MachineFunction &MF) const { + const MachineFrameInfo *MFI = MF.getFrameInfo(); + return MF.getTarget().Options.DisableFramePointerElim(MF) || + MFI->hasVarSizedObjects() || MFI->isFrameAddressTaken(); +} + -- cgit v1.2.3