xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Xtensa/XtensaFrameLowering.h (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
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   bool hasFP(const MachineFunction &MF) const override;
28 
29   /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
30   /// the function.
31   void emitPrologue(MachineFunction &, MachineBasicBlock &) const override;
32   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
33 
34   MachineBasicBlock::iterator
35   eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
36                                 MachineBasicBlock::iterator I) const override;
37 
38   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
39                                  MachineBasicBlock::iterator MI,
40                                  ArrayRef<CalleeSavedInfo> CSI,
41                                  const TargetRegisterInfo *TRI) const override;
42   bool
43   restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
44                               MachineBasicBlock::iterator MI,
45                               MutableArrayRef<CalleeSavedInfo> CSI,
46                               const TargetRegisterInfo *TRI) const override;
47 
48   void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
49                             RegScavenger *RS) const override;
50 
51   void processFunctionBeforeFrameFinalized(MachineFunction &MF,
52                                            RegScavenger *RS) const override;
53 };
54 
55 } // namespace llvm
56 
57 #endif /* LLVM_LIB_TARGET_XTENSA_XTENSAFRAMELOWERING_H */
58