1 //==- MSP430FrameLowering.h - Define frame lowering for MSP430 --*- C++ -*--==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_MSP430_MSP430FRAMELOWERING_H
15 #define LLVM_LIB_TARGET_MSP430_MSP430FRAMELOWERING_H
16 
17 #include "MSP430.h"
18 #include "llvm/Target/TargetFrameLowering.h"
19 
20 namespace llvm {
21 class MSP430FrameLowering : public TargetFrameLowering {
22 protected:
23 
24 public:
MSP430FrameLowering()25   explicit MSP430FrameLowering()
26       : TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 2, -2, 2) {}
27 
28   /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
29   /// the function.
30   void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
31   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
32 
33   MachineBasicBlock::iterator
34   eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
35                                 MachineBasicBlock::iterator I) const override;
36 
37   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
38                                  MachineBasicBlock::iterator MI,
39                                  const std::vector<CalleeSavedInfo> &CSI,
40                                  const TargetRegisterInfo *TRI) const override;
41   bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
42                                   MachineBasicBlock::iterator MI,
43                                   const std::vector<CalleeSavedInfo> &CSI,
44                                   const TargetRegisterInfo *TRI) const override;
45 
46   bool hasFP(const MachineFunction &MF) const override;
47   bool hasReservedCallFrame(const MachineFunction &MF) const override;
48   void processFunctionBeforeFrameFinalized(MachineFunction &MF,
49                                      RegScavenger *RS = nullptr) const override;
50 };
51 
52 } // End llvm namespace
53 
54 #endif
55