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
14namespace llvm {
15
16/// Utilities for creating function call frames.
17class AVRFrameLowering : public TargetFrameLowering {
18public:
19 explicit AVRFrameLowering();
20
21public:
22 void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
23 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
24
25 StackOffset getFrameIndexReference(const MachineFunction &MF, int FI,
26 Register &FrameReg) const override;
27
28 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
29 MachineBasicBlock::iterator MI,
30 ArrayRef<CalleeSavedInfo> CSI,
31 const TargetRegisterInfo *TRI) const override;
32 bool
33 restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
34 MachineBasicBlock::iterator MI,
35 MutableArrayRef<CalleeSavedInfo> CSI,
36 const TargetRegisterInfo *TRI) const override;
37 bool hasReservedCallFrame(const MachineFunction &MF) const override;
38 bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
39 void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
40 RegScavenger *RS = nullptr) const override;
41 MachineBasicBlock::iterator
42 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
43 MachineBasicBlock::iterator MI) const override;
44
45protected:
46 bool hasFPImpl(const MachineFunction &MF) const override;
47};
48
49} // end namespace llvm
50
51#endif // LLVM_AVR_FRAME_LOWERING_H
52