NVPTXInstrInfo.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //===- NVPTXInstrInfo.h - NVPTX 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 NVPTX implementation of the TargetInstrInfo class.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXINSTRINFO_H
  13. #define LLVM_LIB_TARGET_NVPTX_NVPTXINSTRINFO_H
  14. #include "NVPTX.h"
  15. #include "NVPTXRegisterInfo.h"
  16. #include "llvm/CodeGen/TargetInstrInfo.h"
  17. #define GET_INSTRINFO_HEADER
  18. #include "NVPTXGenInstrInfo.inc"
  19. namespace llvm {
  20. class NVPTXInstrInfo : public NVPTXGenInstrInfo {
  21. const NVPTXRegisterInfo RegInfo;
  22. virtual void anchor();
  23. public:
  24. explicit NVPTXInstrInfo();
  25. const NVPTXRegisterInfo &getRegisterInfo() const { return RegInfo; }
  26. /* The following virtual functions are used in register allocation.
  27. * They are not implemented because the existing interface and the logic
  28. * at the caller side do not work for the elementized vector load and store.
  29. *
  30. * virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
  31. * int &FrameIndex) const;
  32. * virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
  33. * int &FrameIndex) const;
  34. * virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
  35. * MachineBasicBlock::iterator MBBI,
  36. * unsigned SrcReg, bool isKill, int FrameIndex,
  37. * const TargetRegisterClass *RC) const;
  38. * virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
  39. * MachineBasicBlock::iterator MBBI,
  40. * unsigned DestReg, int FrameIndex,
  41. * const TargetRegisterClass *RC) const;
  42. */
  43. void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
  44. const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
  45. bool KillSrc) const override;
  46. // Branch analysis.
  47. bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
  48. MachineBasicBlock *&FBB,
  49. SmallVectorImpl<MachineOperand> &Cond,
  50. bool AllowModify) const override;
  51. unsigned removeBranch(MachineBasicBlock &MBB,
  52. int *BytesRemoved = nullptr) const override;
  53. unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
  54. MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
  55. const DebugLoc &DL,
  56. int *BytesAdded = nullptr) const override;
  57. };
  58. } // namespace llvm
  59. #endif