xref: /freebsd/contrib/llvm-project/llvm/lib/Target/MSP430/MSP430FrameLowering.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //==- MSP430FrameLowering.h - Define frame lowering for MSP430 --*- C++ -*--==//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric //
9*0b57cec5SDimitry Andric //
10*0b57cec5SDimitry Andric //
11*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
12*0b57cec5SDimitry Andric 
13*0b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_MSP430_MSP430FRAMELOWERING_H
14*0b57cec5SDimitry Andric #define LLVM_LIB_TARGET_MSP430_MSP430FRAMELOWERING_H
15*0b57cec5SDimitry Andric 
16*0b57cec5SDimitry Andric #include "MSP430.h"
17*0b57cec5SDimitry Andric #include "llvm/CodeGen/TargetFrameLowering.h"
18*0b57cec5SDimitry Andric 
19*0b57cec5SDimitry Andric namespace llvm {
20*0b57cec5SDimitry Andric class MSP430FrameLowering : public TargetFrameLowering {
21*0b57cec5SDimitry Andric protected:
22*0b57cec5SDimitry Andric 
23*0b57cec5SDimitry Andric public:
24*0b57cec5SDimitry Andric   explicit MSP430FrameLowering()
25*0b57cec5SDimitry Andric       : TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 2, -2, 2) {}
26*0b57cec5SDimitry Andric 
27*0b57cec5SDimitry Andric   /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
28*0b57cec5SDimitry Andric   /// the function.
29*0b57cec5SDimitry Andric   void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
30*0b57cec5SDimitry Andric   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
31*0b57cec5SDimitry Andric 
32*0b57cec5SDimitry Andric   MachineBasicBlock::iterator
33*0b57cec5SDimitry Andric   eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
34*0b57cec5SDimitry Andric                                 MachineBasicBlock::iterator I) const override;
35*0b57cec5SDimitry Andric 
36*0b57cec5SDimitry Andric   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
37*0b57cec5SDimitry Andric                                  MachineBasicBlock::iterator MI,
38*0b57cec5SDimitry Andric                                  const std::vector<CalleeSavedInfo> &CSI,
39*0b57cec5SDimitry Andric                                  const TargetRegisterInfo *TRI) const override;
40*0b57cec5SDimitry Andric   bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
41*0b57cec5SDimitry Andric                                   MachineBasicBlock::iterator MI,
42*0b57cec5SDimitry Andric                                   std::vector<CalleeSavedInfo> &CSI,
43*0b57cec5SDimitry Andric                                   const TargetRegisterInfo *TRI) const override;
44*0b57cec5SDimitry Andric 
45*0b57cec5SDimitry Andric   bool hasFP(const MachineFunction &MF) const override;
46*0b57cec5SDimitry Andric   bool hasReservedCallFrame(const MachineFunction &MF) const override;
47*0b57cec5SDimitry Andric   void processFunctionBeforeFrameFinalized(MachineFunction &MF,
48*0b57cec5SDimitry Andric                                      RegScavenger *RS = nullptr) const override;
49*0b57cec5SDimitry Andric };
50*0b57cec5SDimitry Andric 
51*0b57cec5SDimitry Andric } // End llvm namespace
52*0b57cec5SDimitry Andric 
53*0b57cec5SDimitry Andric #endif
54