R600: Remove unused method declaration.
[oota-llvm.git] / lib / Target / R600 / SIInstrInfo.h
1 //===-- SIInstrInfo.h - SI Instruction Info Interface -----------*- 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 /// \file
11 /// \brief Interface definition for SIInstrInfo.
12 //
13 //===----------------------------------------------------------------------===//
14
15
16 #ifndef SIINSTRINFO_H
17 #define SIINSTRINFO_H
18
19 #include "AMDGPUInstrInfo.h"
20 #include "SIRegisterInfo.h"
21
22 namespace llvm {
23
24 class SIInstrInfo : public AMDGPUInstrInfo {
25 private:
26   const SIRegisterInfo RI;
27
28 public:
29   explicit SIInstrInfo(AMDGPUTargetMachine &tm);
30
31   const SIRegisterInfo &getRegisterInfo() const {
32     return RI;
33   }
34
35   virtual void copyPhysReg(MachineBasicBlock &MBB,
36                            MachineBasicBlock::iterator MI, DebugLoc DL,
37                            unsigned DestReg, unsigned SrcReg,
38                            bool KillSrc) const;
39
40   void storeRegToStackSlot(MachineBasicBlock &MBB,
41                            MachineBasicBlock::iterator MI,
42                            unsigned SrcReg, bool isKill, int FrameIndex,
43                            const TargetRegisterClass *RC,
44                            const TargetRegisterInfo *TRI) const;
45
46   void loadRegFromStackSlot(MachineBasicBlock &MBB,
47                             MachineBasicBlock::iterator MI,
48                             unsigned DestReg, int FrameIndex,
49                             const TargetRegisterClass *RC,
50                             const TargetRegisterInfo *TRI) const;
51
52   unsigned commuteOpcode(unsigned Opcode) const;
53
54   virtual MachineInstr *commuteInstruction(MachineInstr *MI,
55                                            bool NewMI=false) const;
56
57   virtual unsigned getIEQOpcode() const {
58     llvm_unreachable("Unimplemented");
59   }
60
61   MachineInstr *buildMovInstr(MachineBasicBlock *MBB,
62                               MachineBasicBlock::iterator I,
63                               unsigned DstReg, unsigned SrcReg) const;
64   virtual bool isMov(unsigned Opcode) const;
65
66   virtual bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const;
67   bool isDS(uint16_t Opcode) const;
68   int isMIMG(uint16_t Opcode) const;
69   int isSMRD(uint16_t Opcode) const;
70   bool isVOP1(uint16_t Opcode) const;
71   bool isVOP2(uint16_t Opcode) const;
72   bool isVOP3(uint16_t Opcode) const;
73   bool isVOPC(uint16_t Opcode) const;
74   bool isInlineConstant(const MachineOperand &MO) const;
75   bool isLiteralConstant(const MachineOperand &MO) const;
76
77   virtual bool verifyInstruction(const MachineInstr *MI,
78                                  StringRef &ErrInfo) const;
79
80   bool isSALUInstr(const MachineInstr &MI) const;
81   static unsigned getVALUOp(const MachineInstr &MI);
82   bool isSALUOpSupportedOnVALU(const MachineInstr &MI) const;
83
84   /// \brief Return the correct register class for \p OpNo.  For target-specific
85   /// instructions, this will return the register class that has been defined
86   /// in tablegen.  For generic instructions, like REG_SEQUENCE it will return
87   /// the register class of its machine operand.
88   /// to infer the correct register class base on the other operands.
89   const TargetRegisterClass *getOpRegClass(const MachineInstr &MI,
90                                            unsigned OpNo) const;\
91
92   /// \returns true if it is legal for the operand at index \p OpNo
93   /// to read a VGPR.
94   bool canReadVGPR(const MachineInstr &MI, unsigned OpNo) const;
95
96   /// \brief Legalize the \p OpIndex operand of this instruction by inserting
97   /// a MOV.  For example:
98   /// ADD_I32_e32 VGPR0, 15
99   /// to
100   /// MOV VGPR1, 15
101   /// ADD_I32_e32 VGPR0, VGPR1
102   ///
103   /// If the operand being legalized is a register, then a COPY will be used
104   /// instead of MOV.
105   void legalizeOpWithMove(MachineInstr *MI, unsigned OpIdx) const;
106
107   /// \brief Legalize all operands in this instruction.  This function may
108   /// create new instruction and insert them before \p MI.
109   void legalizeOperands(MachineInstr *MI) const;
110
111   /// \brief Replace this instruction's opcode with the equivalent VALU
112   /// opcode.  This function will also move the users of \p MI to the
113   /// VALU if necessary.
114   void moveToVALU(MachineInstr &MI) const;
115
116   virtual unsigned calculateIndirectAddress(unsigned RegIndex,
117                                             unsigned Channel) const;
118
119   virtual const TargetRegisterClass *getIndirectAddrRegClass() const;
120
121   virtual MachineInstrBuilder buildIndirectWrite(MachineBasicBlock *MBB,
122                                                  MachineBasicBlock::iterator I,
123                                                  unsigned ValueReg,
124                                                  unsigned Address,
125                                                  unsigned OffsetReg) const;
126
127   virtual MachineInstrBuilder buildIndirectRead(MachineBasicBlock *MBB,
128                                                 MachineBasicBlock::iterator I,
129                                                 unsigned ValueReg,
130                                                 unsigned Address,
131                                                 unsigned OffsetReg) const;
132   void reserveIndirectRegisters(BitVector &Reserved,
133                                 const MachineFunction &MF) const;
134
135   void LoadM0(MachineInstr *MoveRel, MachineBasicBlock::iterator I,
136               unsigned SavReg, unsigned IndexReg) const;
137 };
138
139 namespace AMDGPU {
140
141   int getVOPe64(uint16_t Opcode);
142   int getCommuteRev(uint16_t Opcode);
143   int getCommuteOrig(uint16_t Opcode);
144
145 } // End namespace AMDGPU
146
147 } // End namespace llvm
148
149 namespace SIInstrFlags {
150   enum Flags {
151     // First 4 bits are the instruction encoding
152     VM_CNT = 1 << 0,
153     EXP_CNT = 1 << 1,
154     LGKM_CNT = 1 << 2
155   };
156 }
157
158 #endif //SIINSTRINFO_H