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;
125 bool selectDSAppendConsume(
MachineInstr &
MI,
bool IsAppend)
const;
132 bool selectG_INTRINSIC_W_SIDE_EFFECTS(
MachineInstr &
I)
const;
161 std::pair<Register, unsigned> selectVOP3ModsImpl(
Register Src,
162 bool IsCanonicalizing =
true,
163 bool AllowAbs =
true,
164 bool OpSel =
false)
const;
168 bool ForceVGPR =
false)
const;
191 std::pair<Register, unsigned>
193 bool IsDOT =
false)
const;
239 std::pair<Register, int> selectFlatOffsetImpl(
MachineOperand &Root,
265 bool isDSOffset2Legal(
Register Base, int64_t Offset0, int64_t Offset1,
266 unsigned Size)
const;
271 std::pair<Register, unsigned>
282 std::pair<Register, unsigned> selectDSReadWrite2Impl(
MachineOperand &Root,
283 unsigned size)
const;
287 std::pair<Register, int64_t>
288 getPtrBaseWithConstantOffset(
Register Root,
294 struct MUBUFAddressData {
299 bool shouldUseAddr64(MUBUFAddressData AddrData)
const;
301 void splitIllegalMUBUFOffset(MachineIRBuilder &
B,
302 Register &SOffset, int64_t &ImmOffset)
const;
304 MUBUFAddressData parseMUBUFAddress(Register Src)
const;
306 bool selectMUBUFAddr64Impl(MachineOperand &Root, Register &VAddr,
307 Register &RSrcReg, Register &SOffset,
310 bool selectMUBUFOffsetImpl(MachineOperand &Root, Register &RSrcReg,
311 Register &SOffset, int64_t &
Offset)
const;
314 selectBUFSOffset(MachineOperand &Root)
const;
317 selectMUBUFAddr64(MachineOperand &Root)
const;
320 selectMUBUFOffset(MachineOperand &Root)
const;
326 std::pair<Register, unsigned> selectVOP3PMadMixModsImpl(MachineOperand &Root,
327 bool &Matched)
const;
331 void renderTruncImm32(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
332 int OpIdx = -1)
const;
334 void renderTruncTImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
336 void renderZextBoolTImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
339 void renderOpSelTImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
342 void renderSrcAndDstSelToOpSelXForm_0_0(MachineInstrBuilder &MIB,
343 const MachineInstr &
MI,
346 void renderSrcAndDstSelToOpSelXForm_0_1(MachineInstrBuilder &MIB,
347 const MachineInstr &
MI,
350 void renderSrcAndDstSelToOpSelXForm_1_0(MachineInstrBuilder &MIB,
351 const MachineInstr &
MI,
354 void renderSrcAndDstSelToOpSelXForm_1_1(MachineInstrBuilder &MIB,
355 const MachineInstr &
MI,
358 void renderDstSelToOpSelXForm(MachineInstrBuilder &MIB,
359 const MachineInstr &
MI,
int OpIdx)
const;
361 void renderSrcSelToOpSelXForm(MachineInstrBuilder &MIB,
362 const MachineInstr &
MI,
int OpIdx)
const;
364 void renderSrcAndDstSelToOpSelXForm_2_0(MachineInstrBuilder &MIB,
365 const MachineInstr &
MI,
368 void renderDstSelToOpSel3XFormXForm(MachineInstrBuilder &MIB,
369 const MachineInstr &
MI,
int OpIdx)
const;
371 void renderNegateImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
374 void renderBitcastFPImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
377 void renderBitcastFPImm32(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
379 renderBitcastFPImm(MIB,
MI, OpIdx);
381 void renderBitcastFPImm64(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
383 renderBitcastFPImm(MIB,
MI, OpIdx);
386 void renderPopcntImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
388 void renderExtractCPol(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
390 void renderExtractSWZ(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
392 void renderExtractCpolSetGLC(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
395 void renderFrameIndex(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
398 void renderFPPow2ToExponent(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
401 void renderRoundMode(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
403 void renderScaledMAIIntrinsicOperand(MachineInstrBuilder &MIB,
404 const MachineInstr &
MI,
int OpIdx)
const;
406 bool isInlineImmediate(
const APInt &Imm)
const;
407 bool isInlineImmediate(
const APFloat &Imm)
const;
411 bool isUnneededShiftMask(
const MachineInstr &
MI,
unsigned ShAmtBits)
const;
413 const SIInstrInfo &TII;
414 const SIRegisterInfo &TRI;
415 const AMDGPURegisterBankInfo &RBI;
416 const AMDGPUTargetMachine &
TM;
417 const GCNSubtarget &STI;
418#define GET_GLOBALISEL_PREDICATES_DECL
419#define AMDGPUSubtarget GCNSubtarget
420#include "AMDGPUGenGlobalISel.inc"
421#undef GET_GLOBALISEL_PREDICATES_DECL
422#undef AMDGPUSubtarget
424#define GET_GLOBALISEL_TEMPORARIES_DECL
425#include "AMDGPUGenGlobalISel.inc"
426#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.