1 //===-- BPFInstrInfo.h - BPF Instruction Information ------------*- 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 file contains the BPF implementation of the TargetInstrInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_BPF_BPFINSTRINFO_H
15 #define LLVM_LIB_TARGET_BPF_BPFINSTRINFO_H
16 
17 #include "BPFRegisterInfo.h"
18 #include "llvm/Target/TargetInstrInfo.h"
19 
20 #define GET_INSTRINFO_HEADER
21 #include "BPFGenInstrInfo.inc"
22 
23 namespace llvm {
24 
25 class BPFInstrInfo : public BPFGenInstrInfo {
26   const BPFRegisterInfo RI;
27 
28 public:
29   BPFInstrInfo();
30 
getRegisterInfo()31   const BPFRegisterInfo &getRegisterInfo() const { return RI; }
32 
33   void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
34                    DebugLoc DL, unsigned DestReg, unsigned SrcReg,
35                    bool KillSrc) const override;
36 
37   void storeRegToStackSlot(MachineBasicBlock &MBB,
38                            MachineBasicBlock::iterator MBBI, unsigned SrcReg,
39                            bool isKill, int FrameIndex,
40                            const TargetRegisterClass *RC,
41                            const TargetRegisterInfo *TRI) const override;
42 
43   void loadRegFromStackSlot(MachineBasicBlock &MBB,
44                             MachineBasicBlock::iterator MBBI, unsigned DestReg,
45                             int FrameIndex, const TargetRegisterClass *RC,
46                             const TargetRegisterInfo *TRI) const override;
47   bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
48                      MachineBasicBlock *&FBB,
49                      SmallVectorImpl<MachineOperand> &Cond,
50                      bool AllowModify) const override;
51 
52   unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
53   unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
54                         MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
55                         DebugLoc DL) const override;
56 };
57 }
58 
59 #endif
60