XCoreFrameLowering.h revision dce4a407a24b04eebc6a376f8e62b41aaa7b071f
1//===-- XCoreFrameLowering.h - Frame info for XCore Target ------*- 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// This file contains XCore frame information that doesn't fit anywhere else
11// cleanly...
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef XCOREFRAMEINFO_H
16#define XCOREFRAMEINFO_H
17
18#include "llvm/Target/TargetFrameLowering.h"
19#include "llvm/Target/TargetMachine.h"
20
21namespace llvm {
22  class XCoreSubtarget;
23
24  class XCoreFrameLowering: public TargetFrameLowering {
25  public:
26    XCoreFrameLowering(const XCoreSubtarget &STI);
27
28    /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
29    /// the function.
30    void emitPrologue(MachineFunction &MF) const override;
31    void emitEpilogue(MachineFunction &MF,
32                      MachineBasicBlock &MBB) const override;
33
34    bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
35                                  MachineBasicBlock::iterator MI,
36                                  const std::vector<CalleeSavedInfo> &CSI,
37                                  const TargetRegisterInfo *TRI) const override;
38    bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
39                                  MachineBasicBlock::iterator MI,
40                                  const std::vector<CalleeSavedInfo> &CSI,
41                                  const TargetRegisterInfo *TRI) const override;
42
43    void eliminateCallFramePseudoInstr(MachineFunction &MF,
44                                  MachineBasicBlock &MBB,
45                                  MachineBasicBlock::iterator I) const override;
46
47    bool hasFP(const MachineFunction &MF) const override;
48
49    void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
50                                     RegScavenger *RS = nullptr) const override;
51
52    void processFunctionBeforeFrameFinalized(MachineFunction &MF,
53                                     RegScavenger *RS = nullptr) const override;
54
55    //! Stack slot size (4 bytes)
56    static int stackSlotSize() {
57      return 4;
58    }
59  };
60}
61
62#endif // XCOREFRAMEINFO_H
63