1 //===-- BPFInstrInfo.h - BPF Instruction Information ------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file contains the BPF implementation of the TargetInstrInfo class.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_BPF_BPFINSTRINFO_H
14 #define LLVM_LIB_TARGET_BPF_BPFINSTRINFO_H
16 #include "BPFRegisterInfo.h"
17 #include "llvm/CodeGen/TargetInstrInfo.h"
19 #define GET_INSTRINFO_HEADER
20 #include "BPFGenInstrInfo.inc"
24 class BPFInstrInfo
: public BPFGenInstrInfo
{
25 const BPFRegisterInfo RI
;
30 const BPFRegisterInfo
&getRegisterInfo() const { return RI
; }
32 void copyPhysReg(MachineBasicBlock
&MBB
, MachineBasicBlock::iterator I
,
33 const DebugLoc
&DL
, unsigned DestReg
, unsigned SrcReg
,
34 bool KillSrc
) const override
;
36 bool expandPostRAPseudo(MachineInstr
&MI
) const override
;
38 void storeRegToStackSlot(MachineBasicBlock
&MBB
,
39 MachineBasicBlock::iterator MBBI
, unsigned SrcReg
,
40 bool isKill
, int FrameIndex
,
41 const TargetRegisterClass
*RC
,
42 const TargetRegisterInfo
*TRI
) const override
;
44 void loadRegFromStackSlot(MachineBasicBlock
&MBB
,
45 MachineBasicBlock::iterator MBBI
, unsigned DestReg
,
46 int FrameIndex
, const TargetRegisterClass
*RC
,
47 const TargetRegisterInfo
*TRI
) const override
;
48 bool analyzeBranch(MachineBasicBlock
&MBB
, MachineBasicBlock
*&TBB
,
49 MachineBasicBlock
*&FBB
,
50 SmallVectorImpl
<MachineOperand
> &Cond
,
51 bool AllowModify
) const override
;
53 unsigned removeBranch(MachineBasicBlock
&MBB
,
54 int *BytesRemoved
= nullptr) const override
;
55 unsigned insertBranch(MachineBasicBlock
&MBB
, MachineBasicBlock
*TBB
,
56 MachineBasicBlock
*FBB
, ArrayRef
<MachineOperand
> Cond
,
58 int *BytesAdded
= nullptr) const override
;
60 void expandMEMCPY(MachineBasicBlock::iterator
) const;