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;
128 bool selectG_INTRINSIC_W_SIDE_EFFECTS(
MachineInstr &
I)
const;
153 std::pair<Register, unsigned> selectVOP3ModsImpl(
Register Src,
154 bool IsCanonicalizing =
true,
155 bool AllowAbs =
true,
156 bool OpSel =
false)
const;
160 bool ForceVGPR =
false)
const;
183 std::pair<Register, unsigned>
185 bool IsDOT =
false)
const;
231 std::pair<Register, int> selectFlatOffsetImpl(
MachineOperand &Root,
257 bool isDSOffset2Legal(
Register Base, int64_t Offset0, int64_t Offset1,
258 unsigned Size)
const;
263 std::pair<Register, unsigned>
274 std::pair<Register, unsigned> selectDSReadWrite2Impl(
MachineOperand &Root,
275 unsigned size)
const;
279 std::pair<Register, int64_t>
280 getPtrBaseWithConstantOffset(
Register Root,
286 struct MUBUFAddressData {
291 bool shouldUseAddr64(MUBUFAddressData AddrData)
const;
293 void splitIllegalMUBUFOffset(MachineIRBuilder &
B,
294 Register &SOffset, int64_t &ImmOffset)
const;
296 MUBUFAddressData parseMUBUFAddress(Register Src)
const;
298 bool selectMUBUFAddr64Impl(MachineOperand &Root, Register &VAddr,
299 Register &RSrcReg, Register &SOffset,
302 bool selectMUBUFOffsetImpl(MachineOperand &Root, Register &RSrcReg,
303 Register &SOffset, int64_t &
Offset)
const;
306 selectBUFSOffset(MachineOperand &Root)
const;
309 selectMUBUFAddr64(MachineOperand &Root)
const;
312 selectMUBUFOffset(MachineOperand &Root)
const;
318 std::pair<Register, unsigned> selectVOP3PMadMixModsImpl(MachineOperand &Root,
319 bool &Matched)
const;
323 void renderTruncImm32(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
324 int OpIdx = -1)
const;
326 void renderTruncTImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
329 void renderOpSelTImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
332 void renderNegateImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
335 void renderBitcastFPImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
338 void renderBitcastFPImm32(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
340 renderBitcastFPImm(MIB,
MI, OpIdx);
342 void renderBitcastFPImm64(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
344 renderBitcastFPImm(MIB,
MI, OpIdx);
347 void renderPopcntImm(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
349 void renderExtractCPol(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
351 void renderExtractSWZ(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
353 void renderExtractCpolSetGLC(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
356 void renderFrameIndex(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
359 void renderFPPow2ToExponent(MachineInstrBuilder &MIB,
const MachineInstr &
MI,
362 bool isInlineImmediate(
const APInt &Imm)
const;
363 bool isInlineImmediate(
const APFloat &Imm)
const;
367 bool isUnneededShiftMask(
const MachineInstr &
MI,
unsigned ShAmtBits)
const;
369 const SIInstrInfo &TII;
370 const SIRegisterInfo &TRI;
371 const AMDGPURegisterBankInfo &RBI;
372 const AMDGPUTargetMachine &
TM;
373 const GCNSubtarget &STI;
374 bool EnableLateStructurizeCFG;
375#define GET_GLOBALISEL_PREDICATES_DECL
376#define AMDGPUSubtarget GCNSubtarget
377#include "AMDGPUGenGlobalISel.inc"
378#undef GET_GLOBALISEL_PREDICATES_DECL
379#undef AMDGPUSubtarget
381#define GET_GLOBALISEL_TEMPORARIES_DECL
382#include "AMDGPUGenGlobalISel.inc"
383#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.