xref: /llvm-project/llvm/lib/Target/BPF/BPFFrameLowering.h (revision ad4a582fd938c933e784f0052bd773676b37b690)
1 //===-- BPFFrameLowering.h - Define frame lowering for BPF -----*- 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 // This class implements BPF-specific bits of TargetFrameLowering class.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_BPF_BPFFRAMELOWERING_H
14 #define LLVM_LIB_TARGET_BPF_BPFFRAMELOWERING_H
15 
16 #include "llvm/CodeGen/TargetFrameLowering.h"
17 
18 namespace llvm {
19 class BPFSubtarget;
20 
21 class BPFFrameLowering : public TargetFrameLowering {
22 public:
23   explicit BPFFrameLowering(const BPFSubtarget &sti)
24       : TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align(8), 0) {}
25 
26   void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
27   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
28 
29   void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
30                             RegScavenger *RS) const override;
31 
32   MachineBasicBlock::iterator
33   eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
34                                 MachineBasicBlock::iterator MI) const override {
35     return MBB.erase(MI);
36   }
37 
38 protected:
39   bool hasFPImpl(const MachineFunction &MF) const override;
40 };
41 }
42 #endif
43