aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/MSP430/MSP430FrameInfo.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2010-11-18 21:19:35 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2010-11-18 21:19:35 +0000
commitd0c38176690e9602a93a20a43f1bd084564a8116 (patch)
treed4c7a39ff5665d4adb34f193c2256f1c6d033181 /lib/Target/MSP430/MSP430FrameInfo.cpp
parentb9064bb96458ab48a878e1a7e678cada2e22ab7a (diff)
downloadexternal_llvm-d0c38176690e9602a93a20a43f1bd084564a8116.tar.gz
external_llvm-d0c38176690e9602a93a20a43f1bd084564a8116.tar.bz2
external_llvm-d0c38176690e9602a93a20a43f1bd084564a8116.zip
Move hasFP() and few related hooks to TargetFrameInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119740 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MSP430/MSP430FrameInfo.cpp')
-rw-r--r--lib/Target/MSP430/MSP430FrameInfo.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/Target/MSP430/MSP430FrameInfo.cpp b/lib/Target/MSP430/MSP430FrameInfo.cpp
index 42a44a7517..0a39a3629f 100644
--- a/lib/Target/MSP430/MSP430FrameInfo.cpp
+++ b/lib/Target/MSP430/MSP430FrameInfo.cpp
@@ -26,12 +26,22 @@
using namespace llvm;
+bool MSP430FrameInfo::hasFP(const MachineFunction &MF) const {
+ const MachineFrameInfo *MFI = MF.getFrameInfo();
+
+ return (DisableFramePointerElim(MF) ||
+ MF.getFrameInfo()->hasVarSizedObjects() ||
+ MFI->isFrameAddressTaken());
+}
+
+bool MSP430FrameInfo::hasReservedCallFrame(const MachineFunction &MF) const {
+ return !MF.getFrameInfo()->hasVarSizedObjects();
+}
+
void MSP430FrameInfo::emitPrologue(MachineFunction &MF) const {
MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB
MachineFrameInfo *MFI = MF.getFrameInfo();
MSP430MachineFunctionInfo *MSP430FI = MF.getInfo<MSP430MachineFunctionInfo>();
- const MSP430RegisterInfo *RegInfo =
- static_cast<const MSP430RegisterInfo*>(MF.getTarget().getRegisterInfo());
const MSP430InstrInfo &TII =
*static_cast<const MSP430InstrInfo*>(MF.getTarget().getInstrInfo());
@@ -42,7 +52,7 @@ void MSP430FrameInfo::emitPrologue(MachineFunction &MF) const {
uint64_t StackSize = MFI->getStackSize();
uint64_t NumBytes = 0;
- if (RegInfo->hasFP(MF)) {
+ if (hasFP(MF)) {
// Calculate required stack adjustment
uint64_t FrameSize = StackSize - 2;
NumBytes = FrameSize - MSP430FI->getCalleeSavedFrameSize();
@@ -97,8 +107,6 @@ void MSP430FrameInfo::emitEpilogue(MachineFunction &MF,
MachineBasicBlock &MBB) const {
const MachineFrameInfo *MFI = MF.getFrameInfo();
MSP430MachineFunctionInfo *MSP430FI = MF.getInfo<MSP430MachineFunctionInfo>();
- const MSP430RegisterInfo *RegInfo =
- static_cast<const MSP430RegisterInfo*>(MF.getTarget().getRegisterInfo());
const MSP430InstrInfo &TII =
*static_cast<const MSP430InstrInfo*>(MF.getTarget().getInstrInfo());
@@ -118,7 +126,7 @@ void MSP430FrameInfo::emitEpilogue(MachineFunction &MF,
unsigned CSSize = MSP430FI->getCalleeSavedFrameSize();
uint64_t NumBytes = 0;
- if (RegInfo->hasFP(MF)) {
+ if (hasFP(MF)) {
// Calculate required stack adjustment
uint64_t FrameSize = StackSize - 2;
NumBytes = FrameSize - CSSize;