xref: /llvm-project/llvm/lib/Target/AVR/AVRFrameLowering.h (revision ad4a582fd938c933e784f0052bd773676b37b690)
1 //===-- AVRFrameLowering.h - Define frame lowering for AVR ------*- 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_AVR_FRAME_LOWERING_H
10 #define LLVM_AVR_FRAME_LOWERING_H
11 
12 #include "llvm/CodeGen/TargetFrameLowering.h"
13 
14 namespace llvm {
15 
16 /// Utilities for creating function call frames.
17 class AVRFrameLowering : public TargetFrameLowering {
18 public:
19   explicit AVRFrameLowering();
20 
21 public:
22   void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
23   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
24   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
25                                  MachineBasicBlock::iterator MI,
26                                  ArrayRef<CalleeSavedInfo> CSI,
27                                  const TargetRegisterInfo *TRI) const override;
28   bool
29   restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
30                               MachineBasicBlock::iterator MI,
31                               MutableArrayRef<CalleeSavedInfo> CSI,
32                               const TargetRegisterInfo *TRI) const override;
33   bool hasReservedCallFrame(const MachineFunction &MF) const override;
34   bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
35   void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
36                             RegScavenger *RS = nullptr) const override;
37   MachineBasicBlock::iterator
38   eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
39                                 MachineBasicBlock::iterator MI) const override;
40 
41 protected:
42   bool hasFPImpl(const MachineFunction &MF) const override;
43 };
44 
45 } // end namespace llvm
46 
47 #endif // LLVM_AVR_FRAME_LOWERING_H
48