LLVM 22.0.0git
|
This file implements the targeting of the InstructionSelector class for AMDGPU. More...
#include "AMDGPUInstructionSelector.h"
#include "AMDGPU.h"
#include "AMDGPUGlobalISelUtils.h"
#include "AMDGPUInstrInfo.h"
#include "AMDGPURegisterBankInfo.h"
#include "AMDGPUTargetMachine.h"
#include "SIMachineFunctionInfo.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h"
#include "llvm/CodeGen/GlobalISel/GISelValueTracking.h"
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include <optional>
#include "AMDGPUGenGlobalISel.inc"
Go to the source code of this file.
Classes | |
class | SearchOptions |
This is used to control valid status that current MI supports. More... | |
Macros | |
#define | DEBUG_TYPE "amdgpu-isel" |
#define | GET_GLOBALISEL_IMPL |
#define | AMDGPUSubtarget GCNSubtarget |
#define | GET_GLOBALISEL_PREDICATES_INIT |
#define | GET_GLOBALISEL_TEMPORARIES_INIT |
Enumerations | |
enum class | SrcStatus { IS_SAME , IS_UPPER_HALF , IS_LOWER_HALF , IS_UPPER_HALF_NEG , IS_LOWER_HALF_NEG , IS_HI_NEG , IS_LO_NEG , IS_BOTH_NEG , INVALID , NEG_START = IS_UPPER_HALF_NEG , NEG_END = IS_BOTH_NEG , HALF_START = IS_UPPER_HALF , HALF_END = IS_LOWER_HALF_NEG } |
enum class | TypeClass { VECTOR_OF_TWO , SCALAR , NONE_OF_LISTED } |
This file implements the targeting of the InstructionSelector class for AMDGPU.
Definition in file AMDGPUInstructionSelector.cpp.
#define AMDGPUSubtarget GCNSubtarget |
Definition at line 38 of file AMDGPUInstructionSelector.cpp.
#define DEBUG_TYPE "amdgpu-isel" |
Definition at line 32 of file AMDGPUInstructionSelector.cpp.
#define GET_GLOBALISEL_IMPL |
Definition at line 37 of file AMDGPUInstructionSelector.cpp.
#define GET_GLOBALISEL_PREDICATES_INIT |
#define GET_GLOBALISEL_TEMPORARIES_INIT |
|
strong |
Enumerator | |
---|---|
IS_SAME | |
IS_UPPER_HALF | |
IS_LOWER_HALF | |
IS_UPPER_HALF_NEG | |
IS_LOWER_HALF_NEG | |
IS_HI_NEG | |
IS_LO_NEG | |
IS_BOTH_NEG | |
INVALID | |
NEG_START | |
NEG_END | |
HALF_START | |
HALF_END |
Definition at line 4379 of file AMDGPUInstructionSelector.cpp.
|
strong |
Enumerator | |
---|---|
VECTOR_OF_TWO | |
SCALAR | |
NONE_OF_LISTED |
Definition at line 4451 of file AMDGPUInstructionSelector.cpp.
|
static |
Definition at line 6265 of file AMDGPUInstructionSelector.cpp.
References llvm::MachineInstrBuilder::addImm().
|
static |
Definition at line 3819 of file AMDGPUInstructionSelector.cpp.
References BitOp3_Op(), llvm::getSrcRegIgnoringCopies(), I, LHS, llvm::MIPatternMatch::m_AllOnesInt(), llvm::MIPatternMatch::m_Not(), llvm::MIPatternMatch::m_Reg(), llvm::MIPatternMatch::m_ZeroInt(), MI, llvm::MIPatternMatch::mi_match(), MRI, and RHS.
Referenced by BitOp3_Op().
|
static |
Definition at line 6314 of file AMDGPUInstructionSelector.cpp.
References B, buildRSRC(), llvm::Hi_32(), MRI, and TII.
|
static |
Definition at line 6323 of file AMDGPUInstructionSelector.cpp.
References B, buildRSRC(), llvm::Hi_32(), MRI, and TII.
|
static |
Definition at line 4970 of file AMDGPUInstructionSelector.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), B, llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::SIRegisterInfo::getSubRegFromChannel(), llvm_unreachable, MRI, and llvm::SmallVectorBase< Size_T >::size().
Referenced by selectWMMAModsNegAbs().
|
static |
Return a resource descriptor for use with an arbitrary 64-bit pointer.
If BasePtr
is not valid, a null base pointer will be used.
Definition at line 6271 of file AMDGPUInstructionSelector.cpp.
Referenced by buildAddr64RSrc(), and buildOffsetSrc().
|
static |
Definition at line 4619 of file AMDGPUInstructionSelector.cpp.
References getNegStatus(), isLshrHalf(), isShlHalf(), isTruncHalf(), isUnmergeHalf(), MI, MRI, and Opc.
Referenced by getLastSameOrNeg(), and getSrcStats().
|
static |
Definition at line 4886 of file AMDGPUInstructionSelector.cpp.
References llvm::RegisterBank::getID(), llvm::RegisterBankInfo::getRegBank(), MRI, and TRI.
Referenced by getLegalRegBank().
|
static |
Return the register to use for the index value, and the subregister to use for the indirectly accessed register.
Definition at line 3179 of file AMDGPUInstructionSelector.cpp.
References assert(), llvm::AMDGPU::getBaseWithConstantOffset(), MRI, llvm::Offset, llvm::ArrayRef< T >::size(), and TRI.
|
static |
Get an immediate that must be 32-bits, and treated as zero extended.
Definition at line 6544 of file AMDGPUInstructionSelector.cpp.
References llvm::getIConstantVRegSExtVal(), llvm::Lo_32(), and MRI.
|
static |
Definition at line 4762 of file AMDGPUInstructionSelector.cpp.
References calcNextStatus(), SearchOptions::checkOptions(), llvm::Depth, and MRI.
|
static |
Definition at line 4901 of file AMDGPUInstructionSelector.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), checkRB(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), MI, MRI, TII, and TRI.
Definition at line 375 of file AMDGPUInstructionSelector.cpp.
References llvm_unreachable, and Opc.
unsigned getNamedBarrierOp | ( | bool | HasInlineConst, |
Intrinsic::ID | IntrID | ||
) |
Definition at line 6735 of file AMDGPUInstructionSelector.cpp.
References llvm_unreachable.
|
static |
Definition at line 4463 of file AMDGPUInstructionSelector.cpp.
References isVectorOfTwoOrScalar(), llvm_unreachable, and MRI.
Referenced by calcNextStatus().
|
static |
Definition at line 4745 of file AMDGPUInstructionSelector.cpp.
References calcNextStatus(), SearchOptions::checkOptions(), llvm::Depth, and MRI.
|
static |
Definition at line 1208 of file AMDGPUInstructionSelector.cpp.
References llvm::CmpInst::FCMP_FALSE, llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_TRUE, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm_unreachable, P, Select, and Size.
|
static |
Definition at line 71 of file AMDGPUInstructionSelector.cpp.
Definition at line 1842 of file AMDGPUInstructionSelector.cpp.
References llvm_unreachable.
|
static |
Definition at line 2877 of file AMDGPUInstructionSelector.cpp.
References MI.
Referenced by arePointersCompatible(), llvm::buildModuleSummaryIndex(), llvm::MDBuilder::createTBAANode(), llvm::HexagonInstrInfo::expandPostRAPseudo(), llvm::slpvectorizer::BoUpSLP::findReusedOrderedScalars(), getMemcpyLoadsAndStores(), llvm::slpvectorizer::BoUpSLP::getReorderingData(), isSimpleVIDSequence(), llvm::slpvectorizer::BoUpSLP::reorderBottomToTop(), tryFoldHelper(), and tryToFindDuplicates().
|
static |
Definition at line 2719 of file AMDGPUInstructionSelector.cpp.
References assert(), llvm::LLT::fixed_vector(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::getShuffleMask(), llvm::MIPatternMatch::m_GLShr(), llvm::MIPatternMatch::m_GTrunc(), llvm::MIPatternMatch::m_Reg(), llvm::MIPatternMatch::m_SpecificICst(), llvm::MIPatternMatch::mi_match(), MRI, stripBitCast(), and stripCopy().
Referenced by buildRegSequence16().
|
static |
Definition at line 1569 of file AMDGPUInstructionSelector.cpp.
References llvm::RegisterBank::getID(), isLaneMaskFromSameBlock(), LHS, llvm::MIPatternMatch::m_GAnd(), llvm::MIPatternMatch::m_Reg(), MBB, MI, llvm::MIPatternMatch::mi_match(), MRI, and RHS.
Referenced by isLaneMaskFromSameBlock().
|
static |
Test if the MI is logic shift right with half bits, such as reg0:2n =G_LSHR reg1:2n, CONST(n)
Definition at line 4410 of file AMDGPUInstructionSelector.cpp.
References llvm::MIPatternMatch::m_GCst(), llvm::MIPatternMatch::m_GLShr(), llvm::MIPatternMatch::m_Reg(), MI, llvm::MIPatternMatch::mi_match(), and MRI.
Referenced by calcNextStatus().
|
static |
Definition at line 5986 of file AMDGPUInstructionSelector.cpp.
References Addr, and llvm::MachineInstr::NoUWrap.
|
static |
Definition at line 4782 of file AMDGPUInstructionSelector.cpp.
References MRI.
Referenced by isValidToPack().
|
static |
Test if the MI is shift left with half bits, such as reg0:2n =G_SHL reg1:2n, CONST(n)
Definition at line 4427 of file AMDGPUInstructionSelector.cpp.
References llvm::MIPatternMatch::m_GCst(), llvm::MIPatternMatch::m_GShl(), llvm::MIPatternMatch::m_Reg(), MI, llvm::MIPatternMatch::mi_match(), and MRI.
Referenced by calcNextStatus().
|
static |
Test if the MI is truncating to half, such as reg0:n = G_TRUNC reg1:2n
Definition at line 4398 of file AMDGPUInstructionSelector.cpp.
Referenced by calcNextStatus().
|
static |
Test function, if the MI is reg0:n, reg1:n = G_UNMERGE_VALUES reg2:2n
Definition at line 4443 of file AMDGPUInstructionSelector.cpp.
References MI.
Referenced by calcNextStatus().
|
static |
Definition at line 4814 of file AMDGPUInstructionSelector.cpp.
References isSameBitWidth(), and MRI.
|
static |
Definition at line 2973 of file AMDGPUInstructionSelector.cpp.
References isVCmpResult(), MI, and MRI.
Referenced by isVCmpResult().
|
static |
Definition at line 4453 of file AMDGPUInstructionSelector.cpp.
References llvm::LLT::getNumElements(), llvm::LLT::isScalar(), llvm::LLT::isVector(), and MRI.
Referenced by getNegStatus().
Definition at line 1992 of file AMDGPUInstructionSelector.cpp.
|
static |
Definition at line 4998 of file AMDGPUInstructionSelector.cpp.
References assert(), buildRegSequence(), llvm::MIPatternMatch::m_GFabs(), llvm::MIPatternMatch::m_Reg(), llvm::MIPatternMatch::mi_match(), MRI, llvm::SISrcMods::NEG, llvm::SISrcMods::NEG_HI, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallVectorBase< Size_T >::size().
Size
bits will be an inline immediate. Definition at line 2538 of file AMDGPUInstructionSelector.cpp.
References Size.
|
static |
Definition at line 2712 of file AMDGPUInstructionSelector.cpp.
References llvm::MIPatternMatch::m_GBitcast(), llvm::MIPatternMatch::m_Reg(), llvm::MIPatternMatch::mi_match(), and MRI.
Referenced by isExtractHiElt().
|
static |
Definition at line 2708 of file AMDGPUInstructionSelector.cpp.
References llvm::getDefSrcRegIgnoringCopies(), and MRI.
Referenced by isExtractHiElt().
Definition at line 4789 of file AMDGPUInstructionSelector.cpp.
References llvm::SISrcMods::NEG, llvm::SISrcMods::NEG_HI, llvm::SISrcMods::OP_SEL_0, and llvm::SISrcMods::OP_SEL_1.