blob: 015cfb37812ff620bbdfe066054f13db4e2f99db [file] [log] [blame]
Tom Stellardf98f2ce2012-12-11 21:25:42 +00001//===-- 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/// \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
22namespace llvm {
23
24class SIInstrInfo : public AMDGPUInstrInfo {
25private:
26 const SIRegisterInfo RI;
27
28public:
29 explicit SIInstrInfo(AMDGPUTargetMachine &tm);
30
31 const SIRegisterInfo &getRegisterInfo() const;
32
33 virtual void copyPhysReg(MachineBasicBlock &MBB,
34 MachineBasicBlock::iterator MI, DebugLoc DL,
35 unsigned DestReg, unsigned SrcReg,
36 bool KillSrc) const;
37
Christian Konigb3d1ead2013-02-26 17:52:29 +000038 virtual MachineInstr *commuteInstruction(MachineInstr *MI,
39 bool NewMI=false) const;
40
Tom Stellardf98f2ce2012-12-11 21:25:42 +000041 virtual MachineInstr * getMovImmInstr(MachineFunction *MF, unsigned DstReg,
42 int64_t Imm) const;
43
44 virtual unsigned getIEQOpcode() const { assert(!"Implement"); return 0;}
45 virtual bool isMov(unsigned Opcode) const;
46
47 virtual bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const;
Tom Stellardc0b0c672013-02-06 17:32:29 +000048
49 virtual int getIndirectIndexBegin(const MachineFunction &MF) const;
50
51 virtual int getIndirectIndexEnd(const MachineFunction &MF) const;
52
53 virtual unsigned calculateIndirectAddress(unsigned RegIndex,
54 unsigned Channel) const;
55
56 virtual const TargetRegisterClass *getIndirectAddrStoreRegClass(
57 unsigned SourceReg) const;
58
59 virtual const TargetRegisterClass *getIndirectAddrLoadRegClass() const;
60
61 virtual MachineInstrBuilder buildIndirectWrite(MachineBasicBlock *MBB,
62 MachineBasicBlock::iterator I,
63 unsigned ValueReg,
64 unsigned Address,
65 unsigned OffsetReg) const;
66
67 virtual MachineInstrBuilder buildIndirectRead(MachineBasicBlock *MBB,
68 MachineBasicBlock::iterator I,
69 unsigned ValueReg,
70 unsigned Address,
71 unsigned OffsetReg) const;
72
73 virtual const TargetRegisterClass *getSuperIndirectRegClass() const;
Tom Stellardf98f2ce2012-12-11 21:25:42 +000074 };
75
76} // End namespace llvm
77
78namespace SIInstrFlags {
79 enum Flags {
80 // First 4 bits are the instruction encoding
Tom Stellard184f5c12013-02-07 19:39:45 +000081 VM_CNT = 1 << 0,
82 EXP_CNT = 1 << 1,
83 LGKM_CNT = 1 << 2
Tom Stellardf98f2ce2012-12-11 21:25:42 +000084 };
85}
86
87#endif //SIINSTRINFO_H