13#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRUCTIONSELECTOR_H
14#define LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRUCTIONSELECTOR_H
21#define GET_GLOBALISEL_PREDICATE_BITSET
22#define AMDGPUSubtarget GCNSubtarget
23#include "AMDGPUGenGlobalISel.inc"
24#undef GET_GLOBALISEL_PREDICATE_BITSET
31struct ImageDimIntrinsicInfo;
34class AMDGPURegisterBankInfo;
35class AMDGPUTargetMachine;
36class BlockFrequencyInfo;
37class ProfileSummaryInfo;
40class MachineIRBuilder;
42class MachineRegisterInfo;
46class TargetRegisterClass;
86 unsigned SubIdx)
const;
88 bool constrainCopyLikeIntrin(
MachineInstr &
MI,
unsigned NewOpc)
const;
122 bool selectDSAppendConsume(
MachineInstr &
MI,
bool IsAppend)
const;
129 bool selectG_INTRINSIC_W_SIDE_EFFECTS(
MachineInstr &
I)
const;
158 std::pair<Register, unsigned> selectVOP3ModsImpl(
Register Src,
159 bool IsCanonicalizing =
true,
160 bool AllowAbs =
true,
161 bool OpSel =
false)
const;
165 bool ForceVGPR =
false)
const;
188 std::pair<Register, unsigned>
190 bool IsDOT =
false)
const;
236 std::pair<Register, int> selectFlatOffsetImpl(
MachineOperand &Root,
262 bool isDSOffset2Legal(
Register Base, int64_t Offset0, int64_t Offset1,
263 unsigned Size)
const;
268 std::pair<Register, unsigned>
279 std::pair<Register, unsigned> selectDSReadWrite2Impl(
MachineOperand &Root,
280 unsigned size)
const;
284 std::pair<Register, int64_t>
285 getPtrBaseWithConstantOffset(
Register Root,
291 struct MUBUFAddressData {
296 bool shouldUseAddr64(MUBUFAddressData AddrData)
const;
298 void splitIllegalMUBUFOffset(MachineIRBuilder &
B,
299 Register &SOffset, int64_t &ImmOffset)
const;
301 MUBUFAddressData parseMUBUFAddress(Register Src)
const;
303 bool selectMUBUFAddr64Impl(MachineOperand &Root, Register &VAddr,
304 Register &RSrcReg, Register &SOffset,
307 bool selectMUBUFOffsetImpl(MachineOperand &Root, Register &RSrcReg,
308 Register &SOffset, int64_t &
Offset)
const;
311 selectBUFSOffset(MachineOperand &Root)
const;
314 selectMUBUFAddr64(MachineOperand &Root)
const;
317 selectMUBUFOffset(MachineOperand &Root)
const;
323 std::pair<Register, unsigned> selectVOP3PMadMixModsImpl(MachineOperand &Root,
324 bool &Matched)
const;
328 void renderTruncImm32(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
329 int OpIdx = -1)
const;
331 void renderTruncTImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
333 void renderZextBoolTImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
336 void renderOpSelTImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
339 void renderSrcAndDstSelToOpSelXForm_0_0(MachineInstrBuilder &MIB,
340 const MachineInstr &
MI,
343 void renderSrcAndDstSelToOpSelXForm_0_1(MachineInstrBuilder &MIB,
344 const MachineInstr &
MI,
347 void renderSrcAndDstSelToOpSelXForm_1_0(MachineInstrBuilder &MIB,
348 const MachineInstr &
MI,
351 void renderSrcAndDstSelToOpSelXForm_1_1(MachineInstrBuilder &MIB,
352 const MachineInstr &
MI,
355 void renderDstSelToOpSelXForm(MachineInstrBuilder &MIB,
356 const MachineInstr &
MI,
int OpIdx)
const;
358 void renderSrcSelToOpSelXForm(MachineInstrBuilder &MIB,
359 const MachineInstr &
MI,
int OpIdx)
const;
361 void renderSrcAndDstSelToOpSelXForm_2_0(MachineInstrBuilder &MIB,
362 const MachineInstr &
MI,
365 void renderDstSelToOpSel3XFormXForm(MachineInstrBuilder &MIB,
366 const MachineInstr &
MI,
int OpIdx)
const;
368 void renderNegateImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
371 void renderBitcastFPImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
374 void renderBitcastFPImm32(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
376 renderBitcastFPImm(MIB,
MI, OpIdx);
378 void renderBitcastFPImm64(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
380 renderBitcastFPImm(MIB,
MI, OpIdx);
383 void renderPopcntImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
385 void renderExtractCPol(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
387 void renderExtractSWZ(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
389 void renderExtractCpolSetGLC(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
392 void renderFrameIndex(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
395 void renderFPPow2ToExponent(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
398 void renderRoundMode(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
400 void renderScaledMAIIntrinsicOperand(MachineInstrBuilder &MIB,
401 const MachineInstr &
MI,
int OpIdx)
const;
403 bool isInlineImmediate(
const APInt &Imm)
const;
404 bool isInlineImmediate(
const APFloat &Imm)
const;
408 bool isUnneededShiftMask(
const MachineInstr &
MI,
unsigned ShAmtBits)
const;
410 const SIInstrInfo &TII;
411 const SIRegisterInfo &TRI;
412 const AMDGPURegisterBankInfo &RBI;
413 const AMDGPUTargetMachine &
TM;
414 const GCNSubtarget &STI;
415#define GET_GLOBALISEL_PREDICATES_DECL
416#define AMDGPUSubtarget GCNSubtarget
417#include "AMDGPUGenGlobalISel.inc"
418#undef GET_GLOBALISEL_PREDICATES_DECL
419#undef AMDGPUSubtarget
421#define GET_GLOBALISEL_TEMPORARIES_DECL
422#include "AMDGPUGenGlobalISel.inc"
423#undef GET_GLOBALISEL_TEMPORARIES_DECL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static const char * getName()
bool select(MachineInstr &I) override
Select the (possibly generic) instruction I to only use target-specific opcodes.
void setupMF(MachineFunction &MF, GISelKnownBits *KB, CodeGenCoverage *CoverageInfo, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI) override
Setup per-MF executor state.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
std::optional< SmallVector< std::function< void(MachineInstrBuilder &)>, 4 > > ComplexRendererFns
CodeGenCoverage * CoverageInfo
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Analysis providing profile information.
This class implements the register bank concept.
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.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This is an optimization pass for GlobalISel generic memory operations.