xref: /aosp_15_r20/external/llvm/lib/Target/NVPTX/NVPTXInstrInfo.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===- NVPTXInstrInfo.h - NVPTX Instruction Information----------*- C++ -*-===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the niversity of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This file contains the NVPTX implementation of the TargetInstrInfo class.
11*9880d681SAndroid Build Coastguard Worker //
12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
13*9880d681SAndroid Build Coastguard Worker 
14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXINSTRINFO_H
15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_NVPTX_NVPTXINSTRINFO_H
16*9880d681SAndroid Build Coastguard Worker 
17*9880d681SAndroid Build Coastguard Worker #include "NVPTX.h"
18*9880d681SAndroid Build Coastguard Worker #include "NVPTXRegisterInfo.h"
19*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetInstrInfo.h"
20*9880d681SAndroid Build Coastguard Worker 
21*9880d681SAndroid Build Coastguard Worker #define GET_INSTRINFO_HEADER
22*9880d681SAndroid Build Coastguard Worker #include "NVPTXGenInstrInfo.inc"
23*9880d681SAndroid Build Coastguard Worker 
24*9880d681SAndroid Build Coastguard Worker namespace llvm {
25*9880d681SAndroid Build Coastguard Worker 
26*9880d681SAndroid Build Coastguard Worker class NVPTXInstrInfo : public NVPTXGenInstrInfo {
27*9880d681SAndroid Build Coastguard Worker   const NVPTXRegisterInfo RegInfo;
28*9880d681SAndroid Build Coastguard Worker   virtual void anchor();
29*9880d681SAndroid Build Coastguard Worker public:
30*9880d681SAndroid Build Coastguard Worker   explicit NVPTXInstrInfo();
31*9880d681SAndroid Build Coastguard Worker 
getRegisterInfo()32*9880d681SAndroid Build Coastguard Worker   const NVPTXRegisterInfo &getRegisterInfo() const { return RegInfo; }
33*9880d681SAndroid Build Coastguard Worker 
34*9880d681SAndroid Build Coastguard Worker   /* The following virtual functions are used in register allocation.
35*9880d681SAndroid Build Coastguard Worker    * They are not implemented because the existing interface and the logic
36*9880d681SAndroid Build Coastguard Worker    * at the caller side do not work for the elementized vector load and store.
37*9880d681SAndroid Build Coastguard Worker    *
38*9880d681SAndroid Build Coastguard Worker    * virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
39*9880d681SAndroid Build Coastguard Worker    *                                  int &FrameIndex) const;
40*9880d681SAndroid Build Coastguard Worker    * virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
41*9880d681SAndroid Build Coastguard Worker    *                                 int &FrameIndex) const;
42*9880d681SAndroid Build Coastguard Worker    * virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
43*9880d681SAndroid Build Coastguard Worker    *                              MachineBasicBlock::iterator MBBI,
44*9880d681SAndroid Build Coastguard Worker    *                             unsigned SrcReg, bool isKill, int FrameIndex,
45*9880d681SAndroid Build Coastguard Worker    *                              const TargetRegisterClass *RC) const;
46*9880d681SAndroid Build Coastguard Worker    * virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
47*9880d681SAndroid Build Coastguard Worker    *                               MachineBasicBlock::iterator MBBI,
48*9880d681SAndroid Build Coastguard Worker    *                               unsigned DestReg, int FrameIndex,
49*9880d681SAndroid Build Coastguard Worker    *                               const TargetRegisterClass *RC) const;
50*9880d681SAndroid Build Coastguard Worker    */
51*9880d681SAndroid Build Coastguard Worker 
52*9880d681SAndroid Build Coastguard Worker   void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
53*9880d681SAndroid Build Coastguard Worker                    const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
54*9880d681SAndroid Build Coastguard Worker                    bool KillSrc) const override;
55*9880d681SAndroid Build Coastguard Worker   virtual bool isMoveInstr(const MachineInstr &MI, unsigned &SrcReg,
56*9880d681SAndroid Build Coastguard Worker                            unsigned &DestReg) const;
57*9880d681SAndroid Build Coastguard Worker   bool isLoadInstr(const MachineInstr &MI, unsigned &AddrSpace) const;
58*9880d681SAndroid Build Coastguard Worker   bool isStoreInstr(const MachineInstr &MI, unsigned &AddrSpace) const;
59*9880d681SAndroid Build Coastguard Worker 
60*9880d681SAndroid Build Coastguard Worker   virtual bool CanTailMerge(const MachineInstr *MI) const;
61*9880d681SAndroid Build Coastguard Worker   // Branch analysis.
62*9880d681SAndroid Build Coastguard Worker   bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
63*9880d681SAndroid Build Coastguard Worker                      MachineBasicBlock *&FBB,
64*9880d681SAndroid Build Coastguard Worker                      SmallVectorImpl<MachineOperand> &Cond,
65*9880d681SAndroid Build Coastguard Worker                      bool AllowModify) const override;
66*9880d681SAndroid Build Coastguard Worker   unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
67*9880d681SAndroid Build Coastguard Worker   unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
68*9880d681SAndroid Build Coastguard Worker                         MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
69*9880d681SAndroid Build Coastguard Worker                         const DebugLoc &DL) const override;
getLdStCodeAddrSpace(const MachineInstr & MI)70*9880d681SAndroid Build Coastguard Worker   unsigned getLdStCodeAddrSpace(const MachineInstr &MI) const {
71*9880d681SAndroid Build Coastguard Worker     return MI.getOperand(2).getImm();
72*9880d681SAndroid Build Coastguard Worker   }
73*9880d681SAndroid Build Coastguard Worker 
74*9880d681SAndroid Build Coastguard Worker };
75*9880d681SAndroid Build Coastguard Worker 
76*9880d681SAndroid Build Coastguard Worker } // namespace llvm
77*9880d681SAndroid Build Coastguard Worker 
78*9880d681SAndroid Build Coastguard Worker #endif
79