1 //===-- BPFFrameLowering.h - Define frame lowering for BPF -----*- C++ -*--===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This class implements BPF-specific bits of TargetFrameLowering class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_BPF_BPFFRAMELOWERING_H
15 #define LLVM_LIB_TARGET_BPF_BPFFRAMELOWERING_H
16 
17 #include "llvm/Target/TargetFrameLowering.h"
18 
19 namespace llvm {
20 class BPFSubtarget;
21 
22 class BPFFrameLowering : public TargetFrameLowering {
23 public:
BPFFrameLowering(const BPFSubtarget & sti)24   explicit BPFFrameLowering(const BPFSubtarget &sti)
25       : TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 8, 0) {}
26 
27   void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
28   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
29 
30   bool hasFP(const MachineFunction &MF) const override;
31   void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
32                             RegScavenger *RS) const override;
33 
34   void
eliminateCallFramePseudoInstr(MachineFunction & MF,MachineBasicBlock & MBB,MachineBasicBlock::iterator MI)35   eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
36                                 MachineBasicBlock::iterator MI) const override {
37     MBB.erase(MI);
38   }
39 };
40 }
41 #endif
42