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