OSDN Git Service

radeonsi: initial WIP SI code
[android-x86/external-mesa.git] / src / gallium / drivers / radeon / SIInstrInfo.h
1 //===-- SIInstrInfo.h - TODO: Add brief description -------===//
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 // TODO: Add full description
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     AMDGPUTargetMachine &TM;
27
28     MachineInstr * convertABS_f32(MachineInstr & absInstr, MachineFunction &MF,
29                                   DebugLoc DL) const;
30
31     MachineInstr * convertCLAMP_f32(MachineInstr & clampInstr,
32                                     MachineFunction &MF, DebugLoc DL) const;
33
34   public:
35     explicit SIInstrInfo(AMDGPUTargetMachine &tm);
36
37     const SIRegisterInfo &getRegisterInfo() const;
38
39     virtual void copyPhysReg(MachineBasicBlock &MBB,
40                            MachineBasicBlock::iterator MI, DebugLoc DL,
41                            unsigned DestReg, unsigned SrcReg,
42                            bool KillSrc) const;
43
44     unsigned getEncodingType(const MachineInstr &MI) const;
45
46     unsigned getEncodingBytes(const MachineInstr &MI) const;
47
48     uint64_t getBinaryCode(const MachineInstr &MI, bool encodOpcode = false) const;
49
50     virtual MachineInstr * convertToISA(MachineInstr & MI, MachineFunction &MF,
51                                         DebugLoc DL) const;
52
53     virtual unsigned getISAOpcode(unsigned AMDILopcode) const;
54
55   };
56
57 } // End namespace llvm
58
59 /* These must be kept in sync with SIInstructions.td and also the
60  * InstrEncodingInfo array in SIInstrInfo.cpp.
61  *
62  * NOTE: This enum is only used to identify the encoding type within LLVM,
63  * the actual encoding type that is part of the instruction format is different
64  */
65 namespace SIInstrEncodingType {
66   enum Encoding {
67     EXP = 0,
68     LDS = 1,
69     MIMG = 2,
70     MTBUF = 3,
71     MUBUF = 4,
72     SMRD = 5,
73     SOP1 = 6,
74     SOP2 = 7,
75     SOPC = 8,
76     SOPK = 9,
77     SOPP = 10,
78     VINTRP = 11,
79     VOP1 = 12,
80     VOP2 = 13,
81     VOP3 = 14,
82     VOPC = 15
83   };
84 }
85
86 #define SI_INSTR_FLAGS_ENCODING_MASK 0xf
87
88 namespace SIInstrFlags {
89   enum Flags {
90     /* First 4 bits are the instruction encoding */
91     NEED_WAIT = 1 << 4
92   };
93 }
94
95 #endif //SIINSTRINFO_H