BPFInstrInfo.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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) const override;
  33. void loadRegFromStackSlot(MachineBasicBlock &MBB,
  34. MachineBasicBlock::iterator MBBI, Register DestReg,
  35. int FrameIndex, const TargetRegisterClass *RC,
  36. const TargetRegisterInfo *TRI) const override;
  37. bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
  38. MachineBasicBlock *&FBB,
  39. SmallVectorImpl<MachineOperand> &Cond,
  40. bool AllowModify) const override;
  41. unsigned removeBranch(MachineBasicBlock &MBB,
  42. int *BytesRemoved = nullptr) const override;
  43. unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
  44. MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
  45. const DebugLoc &DL,
  46. int *BytesAdded = nullptr) const override;
  47. private:
  48. void expandMEMCPY(MachineBasicBlock::iterator) const;
  49. };
  50. }
  51. #endif