1218885Sdim//==- MSP430FrameLowering.h - Define frame lowering for MSP430 --*- C++ -*--==//
2218885Sdim//
3218885Sdim//                     The LLVM Compiler Infrastructure
4218885Sdim//
5218885Sdim// This file is distributed under the University of Illinois Open Source
6218885Sdim// License. See LICENSE.TXT for details.
7218885Sdim//
8218885Sdim//===----------------------------------------------------------------------===//
9218885Sdim//
10218885Sdim//
11218885Sdim//
12218885Sdim//===----------------------------------------------------------------------===//
13218885Sdim
14218885Sdim#ifndef MSP430_FRAMEINFO_H
15218885Sdim#define MSP430_FRAMEINFO_H
16218885Sdim
17218885Sdim#include "MSP430.h"
18218885Sdim#include "MSP430Subtarget.h"
19218885Sdim#include "llvm/Target/TargetFrameLowering.h"
20218885Sdim
21218885Sdimnamespace llvm {
22218885Sdim  class MSP430Subtarget;
23218885Sdim
24218885Sdimclass MSP430FrameLowering : public TargetFrameLowering {
25218885Sdimprotected:
26218885Sdim  const MSP430Subtarget &STI;
27218885Sdim
28218885Sdimpublic:
29218885Sdim  explicit MSP430FrameLowering(const MSP430Subtarget &sti)
30263508Sdim    : TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 2, -2, 2),
31263508Sdim      STI(sti) {}
32218885Sdim
33218885Sdim  /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
34218885Sdim  /// the function.
35218885Sdim  void emitPrologue(MachineFunction &MF) const;
36218885Sdim  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
37218885Sdim
38249423Sdim  void eliminateCallFramePseudoInstr(MachineFunction &MF,
39249423Sdim                                     MachineBasicBlock &MBB,
40249423Sdim                                     MachineBasicBlock::iterator I) const;
41249423Sdim
42218885Sdim  bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
43218885Sdim                                 MachineBasicBlock::iterator MI,
44218885Sdim                                 const std::vector<CalleeSavedInfo> &CSI,
45218885Sdim                                 const TargetRegisterInfo *TRI) const;
46218885Sdim  bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
47218885Sdim                                   MachineBasicBlock::iterator MI,
48218885Sdim                                   const std::vector<CalleeSavedInfo> &CSI,
49218885Sdim                                   const TargetRegisterInfo *TRI) const;
50218885Sdim
51218885Sdim  bool hasFP(const MachineFunction &MF) const;
52218885Sdim  bool hasReservedCallFrame(const MachineFunction &MF) const;
53249423Sdim  void processFunctionBeforeFrameFinalized(MachineFunction &MF,
54249423Sdim                                       RegScavenger *RS = NULL) const;
55218885Sdim};
56218885Sdim
57218885Sdim} // End llvm namespace
58218885Sdim
59218885Sdim#endif
60