LLVM: lib/Target/AMDGPU/R600InstrInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_LIB_TARGET_AMDGPU_R600INSTRINFO_H
15#define LLVM_LIB_TARGET_AMDGPU_R600INSTRINFO_H
16
19
20#define GET_INSTRINFO_HEADER
21#define GET_INSTRINFO_OPERAND_ENUM
22#include "R600GenInstrInfo.inc"
23
24namespace llvm {
25
32
33class DFAPacketizer;
34class MachineFunction;
35class MachineInstr;
36class MachineInstrBuilder;
37class R600Subtarget;
38
40private:
43
44 std::vector<std::pair<int, unsigned>>
46 unsigned &ConstCount) const;
47
50 unsigned ValueReg, unsigned Address,
51 unsigned OffsetReg,
52 unsigned AddrChan) const;
53
56 unsigned ValueReg, unsigned Address,
57 unsigned OffsetReg,
58 unsigned AddrChan) const;
59public:
68
70
74
77 bool KillSrc, bool RenamableDest = false,
78 bool RenamableSrc = false) const override;
81
83 bool isCubeOp(unsigned opcode) const;
84
85
86 bool isALUInstr(unsigned Opcode) const;
88 bool isLDSInstr(unsigned Opcode) const;
90
91
92
94
99 bool isExport(unsigned Opcode) const;
100
105
110
111
112
113 int getSelIdx(unsigned Opcode, unsigned SrcIdx) const;
114
115
116
117
118
119
122
124 const std::vector<std::vector<std::pair<int, unsigned> > > &IGSrcs,
125 const std::vectorR600InstrInfo::BankSwizzle &Swz,
126 const std::vector<std::pair<int, unsigned> > &TransSrcs,
128
130 const std::vector<std::vector<std::pair<int, unsigned> > > &IGSrcs,
131 std::vectorR600InstrInfo::BankSwizzle &SwzCandidate,
132 const std::vector<std::pair<int, unsigned> > &TransSrcs,
134
135
136
137
138
139
140
141
142
143
146 std::vector &BS,
147 bool isLastAluTrans) const;
148
149
150
151
153
155
156
157
159
160 bool isMov(unsigned Opcode) const;
161
164
167
171 bool AllowModify) const override;
172
176 int *BytesAdded = nullptr) const override;
177
179 int *BytesRemoved = nullptr) const override;
180
182
184
187
189 unsigned ExtraPredCycles,
191
193 unsigned NumTCycles, unsigned ExtraTCycles,
195 unsigned NumFCycles, unsigned ExtraFCycles,
197
199 bool SkipDead) const override;
200
203
206
208
211 unsigned *PredCost = nullptr) const override;
212
214
215
219
220
221
222
223
224
225
226
228
229
230
231
233
234
235
237
238
239
241
242
243
244
247 unsigned ValueReg, unsigned Address,
248 unsigned OffsetReg) const;
249
250
251
252
255 unsigned ValueReg, unsigned Address,
256 unsigned OffsetReg) const;
257
259
260
261
262
263
264
265
266
269 unsigned Opcode,
270 unsigned DstReg,
271 unsigned Src0Reg,
272 unsigned Src1Reg = 0) const;
273
276 unsigned Slot,
277 unsigned DstReg) const;
278
281 unsigned DstReg,
283
286 unsigned DstReg, unsigned SrcReg) const;
287
288
289
290
292
293
294
295
296 int getOperandIdx(unsigned Opcode, R600::OpName Op) const;
297
298
300
301
303
304
306
307
308
309
310
312 unsigned Flag = 0) const;
313
314
316
317
321
325};
326
332
333}
334
335#endif
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
Register const TargetRegisterInfo * TRI
Interface definition for R600RegisterInfo.
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Itinerary data supplied by a subtarget to be used by a target.
MachineInstrBundleIterator< MachineInstr > iterator
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
bool usesVertexCache(unsigned Opcode) const
MachineInstrBuilder buildDefaultInstruction(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned Opcode, unsigned DstReg, unsigned Src0Reg, unsigned Src1Reg=0) const
buildDefaultInstruction - This function returns a MachineInstr with all the instruction modifiers ini...
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
void addFlag(MachineInstr &MI, unsigned SrcIdx, unsigned Flag) const
Add one of the MO_FLAG* flags to the operand at SrcIdx.
bool usesAddressRegister(MachineInstr &MI) const
unsigned calculateIndirectAddress(unsigned RegIndex, unsigned Channel) const
Calculate the "Indirect Address" for the given RegIndex and Channel.
bool hasInstrModifiers(unsigned Opcode) const
const R600RegisterInfo & getRegisterInfo() const
Definition R600InstrInfo.h:71
R600InstrInfo(const R600Subtarget &)
bool isMov(unsigned Opcode) const
bool isRegisterLoad(const MachineInstr &MI) const
Definition R600InstrInfo.h:322
int getIndirectIndexBegin(const MachineFunction &MF) const
bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, BranchProbability Probability) const override
bool usesTextureCache(unsigned Opcode) const
unsigned isLegalUpTo(const std::vector< std::vector< std::pair< int, unsigned > > > &IGSrcs, const std::vector< R600InstrInfo::BankSwizzle > &Swz, const std::vector< std::pair< int, unsigned > > &TransSrcs, R600InstrInfo::BankSwizzle TransSwz) const
returns how many MIs (whose inputs are represented by IGSrcs) can be packed in the same Instruction G...
unsigned int getInstrLatency(const InstrItineraryData *ItinData, const MachineInstr &MI, unsigned *PredCost=nullptr) const override
const TargetRegisterClass * getIndirectAddrRegClass() const
void clearFlag(MachineInstr &MI, unsigned SrcIdx, unsigned Flag) const
Clear the specified flag on the instruction.
MachineInstr * buildMovImm(MachineBasicBlock &BB, MachineBasicBlock::iterator I, unsigned DstReg, uint64_t Imm) const
bool definesAddressRegister(MachineInstr &MI) const
unsigned getMaxAlusPerClause() const
bool PredicateInstruction(MachineInstr &MI, ArrayRef< MachineOperand > Pred) const override
int getOperandIdx(const MachineInstr &MI, R600::OpName Op) const
Get the index of Op in the MachineInstr.
bool isLegalToSplitMBBAt(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const override
bool canBeConsideredALU(const MachineInstr &MI) const
bool isProfitableToUnpredicate(MachineBasicBlock &TMBB, MachineBasicBlock &FMBB) const override
bool fitsConstReadLimitations(const std::vector< MachineInstr * > &) const
An instruction group can only access 2 channel pair (either [XY] or [ZW]) from KCache bank on R700+.
bool isFlagSet(const MachineInstr &MI, unsigned SrcIdx, unsigned Flag) const
Determine if the specified Flag is set on operand at SrcIdx.
bool isVector(const MachineInstr &MI) const
Vector instructions are instructions that must fill all instruction slots within an instruction group...
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
bool mustBeLastInClause(unsigned Opcode) const
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
BankSwizzle
Definition R600InstrInfo.h:60
@ ALU_VEC_012_SCL_210
Definition R600InstrInfo.h:61
@ ALU_VEC_021_SCL_122
Definition R600InstrInfo.h:62
@ ALU_VEC_102_SCL_221
Definition R600InstrInfo.h:64
@ ALU_VEC_210
Definition R600InstrInfo.h:66
@ ALU_VEC_120_SCL_212
Definition R600InstrInfo.h:63
@ ALU_VEC_201
Definition R600InstrInfo.h:65
int getIndirectIndexEnd(const MachineFunction &MF) const
bool isTransOnly(unsigned Opcode) const
DFAPacketizer * CreateTargetScheduleState(const TargetSubtargetInfo &) const override
bool isReductionOp(unsigned opcode) const
bool isRegisterStore(const MachineInstr &MI) const
Definition R600InstrInfo.h:318
bool isCubeOp(unsigned opcode) const
bool isLDSInstr(unsigned Opcode) const
void reserveIndirectRegisters(BitVector &Reserved, const MachineFunction &MF, const R600RegisterInfo &TRI) const
Reserve the registers that may be accessed using indirect addressing.
void setImmOperand(MachineInstr &MI, R600::OpName Op, int64_t Imm) const
Helper function for setting instruction flag values.
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles, BranchProbability Probability) const override
bool isPredicable(const MachineInstr &MI) const override
bool isPredicated(const MachineInstr &MI) const override
bool expandPostRAPseudo(MachineInstr &MI) const override
bool isLDSRetInstr(unsigned Opcode) const
int getSelIdx(unsigned Opcode, unsigned SrcIdx) const
MachineOperand & getFlagOp(MachineInstr &MI, unsigned SrcIdx=0, unsigned Flag=0) const
unsigned int getPredicationCost(const MachineInstr &) const override
MachineInstr * buildSlotOfVectorInstruction(MachineBasicBlock &MBB, MachineInstr *MI, unsigned Slot, unsigned DstReg) const
bool readsLDSSrcReg(const MachineInstr &MI) const
bool FindSwizzleForVectorSlot(const std::vector< std::vector< std::pair< int, unsigned > > > &IGSrcs, std::vector< R600InstrInfo::BankSwizzle > &SwzCandidate, const std::vector< std::pair< int, unsigned > > &TransSrcs, R600InstrInfo::BankSwizzle TransSwz) const
Enumerate all possible Swizzle sequence to find one that can meet all read port requirements.
bool fitsReadPortLimitations(const std::vector< MachineInstr * > &MIs, const DenseMap< unsigned, unsigned > &PV, std::vector< BankSwizzle > &BS, bool isLastAluTrans) const
Given the order VEC_012 < VEC_021 < VEC_120 < VEC_102 < VEC_201 < VEC_210 returns true and the first ...
bool ClobbersPredicate(MachineInstr &MI, std::vector< MachineOperand > &Pred, bool SkipDead) const override
bool isALUInstr(unsigned Opcode) const
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
bool isVectorOnly(unsigned Opcode) const
bool isExport(unsigned Opcode) const
SmallVector< std::pair< MachineOperand *, int64_t >, 3 > getSrcs(MachineInstr &MI) const
MachineInstr * buildMovInstr(MachineBasicBlock *MBB, MachineBasicBlock::iterator I, unsigned DstReg, unsigned SrcReg) const
Wrapper class representing virtual and physical registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetSubtargetInfo - Generic base class for all target subtargets.
Definition R600InstrInfo.h:26
@ REGISTER_STORE
Definition R600InstrInfo.h:28
@ REGISTER_LOAD
Definition R600InstrInfo.h:29
Definition R600InstrInfo.h:327
int getLDSNoRetOp(uint16_t Opcode)
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
DWARFExpression::Operation Op