Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 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" |
David Blaikie | 3f833ed | 2017-11-08 01:01:31 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/TargetInstrInfo.h" |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 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 | |
| 31 | const BPFRegisterInfo &getRegisterInfo() const { return RI; } |
| 32 | |
| 33 | void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 34 | const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 35 | bool KillSrc) const override; |
| 36 | |
Yonghong Song | 71d81e5 | 2018-07-25 22:40:02 +0000 | [diff] [blame] | 37 | bool expandPostRAPseudo(MachineInstr &MI) const override; |
| 38 | |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 39 | void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 40 | MachineBasicBlock::iterator MBBI, unsigned SrcReg, |
| 41 | bool isKill, int FrameIndex, |
| 42 | const TargetRegisterClass *RC, |
| 43 | const TargetRegisterInfo *TRI) const override; |
| 44 | |
| 45 | void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 46 | MachineBasicBlock::iterator MBBI, unsigned DestReg, |
| 47 | int FrameIndex, const TargetRegisterClass *RC, |
| 48 | const TargetRegisterInfo *TRI) const override; |
Jacques Pienaar | 71c30a1 | 2016-07-15 14:41:04 +0000 | [diff] [blame] | 49 | bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 50 | MachineBasicBlock *&FBB, |
| 51 | SmallVectorImpl<MachineOperand> &Cond, |
| 52 | bool AllowModify) const override; |
| 53 | |
Matt Arsenault | 1b9fc8e | 2016-09-14 20:43:16 +0000 | [diff] [blame] | 54 | unsigned removeBranch(MachineBasicBlock &MBB, |
Matt Arsenault | a2b036e | 2016-09-14 17:23:48 +0000 | [diff] [blame] | 55 | int *BytesRemoved = nullptr) const override; |
Matt Arsenault | e8e0f5c | 2016-09-14 17:24:15 +0000 | [diff] [blame] | 56 | unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
Ahmed Bougacha | c88bf54 | 2015-06-11 19:30:37 +0000 | [diff] [blame] | 57 | MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond, |
Matt Arsenault | a2b036e | 2016-09-14 17:23:48 +0000 | [diff] [blame] | 58 | const DebugLoc &DL, |
| 59 | int *BytesAdded = nullptr) const override; |
Yonghong Song | 71d81e5 | 2018-07-25 22:40:02 +0000 | [diff] [blame] | 60 | private: |
| 61 | void expandMEMCPY(MachineBasicBlock::iterator) const; |
| 62 | |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 63 | }; |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 64 | } |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 65 | |
| 66 | #endif |