AMDGPU: Add core backend files for R600/SI codegen v6
[oota-llvm.git] / lib / Target / AMDGPU / SIInstrInfo.h
1 //===-- SIInstrInfo.h - SI Instruction Info Interface ---------------------===//
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 // Interface definition for SIInstrInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14
15 #ifndef SIINSTRINFO_H
16 #define SIINSTRINFO_H
17
18 #include "AMDGPUInstrInfo.h"
19 #include "SIRegisterInfo.h"
20
21 namespace llvm {
22
23 class SIInstrInfo : public AMDGPUInstrInfo {
24 private:
25   const SIRegisterInfo RI;
26
27 public:
28   explicit SIInstrInfo(AMDGPUTargetMachine &tm);
29
30   const SIRegisterInfo &getRegisterInfo() const;
31
32   virtual void copyPhysReg(MachineBasicBlock &MBB,
33                            MachineBasicBlock::iterator MI, DebugLoc DL,
34                            unsigned DestReg, unsigned SrcReg,
35                            bool KillSrc) const;
36
37   /// getEncodingType - Returns the encoding type of this instruction.  
38   unsigned getEncodingType(const MachineInstr &MI) const;
39
40   /// getEncodingBytes - Returns the size of this instructions encoding in
41   /// number of bytes.
42   unsigned getEncodingBytes(const MachineInstr &MI) const;
43
44   virtual MachineInstr * getMovImmInstr(MachineFunction *MF, unsigned DstReg,
45                                         int64_t Imm) const;
46
47   virtual unsigned getIEQOpcode() const { assert(!"Implement"); return 0;}
48   virtual bool isMov(unsigned Opcode) const;
49
50   };
51
52 } // End namespace llvm
53
54 // These must be kept in sync with SIInstructions.td and also the
55 // InstrEncodingInfo array in SIInstrInfo.cpp.
56 //
57 // NOTE: This enum is only used to identify the encoding type within LLVM,
58 // the actual encoding type that is part of the instruction format is different
59 namespace SIInstrEncodingType {
60   enum Encoding {
61     EXP = 0,
62     LDS = 1,
63     MIMG = 2,
64     MTBUF = 3,
65     MUBUF = 4,
66     SMRD = 5,
67     SOP1 = 6,
68     SOP2 = 7,
69     SOPC = 8,
70     SOPK = 9,
71     SOPP = 10,
72     VINTRP = 11,
73     VOP1 = 12,
74     VOP2 = 13,
75     VOP3 = 14,
76     VOPC = 15
77   };
78 }
79
80 #define SI_INSTR_FLAGS_ENCODING_MASK 0xf
81
82 namespace SIInstrFlags {
83   enum Flags {
84     // First 4 bits are the instruction encoding
85     NEED_WAIT = 1 << 4
86   };
87 }
88
89 #endif //SIINSTRINFO_H