BPFInstrInfo.h 2.5 KB

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