LLVM 20.0.0git
Public Member Functions | List of all members
llvm::AMDGPULegalizerInfo Class Referencefinal

#include "Target/AMDGPU/AMDGPULegalizerInfo.h"

Inheritance diagram for llvm::AMDGPULegalizerInfo:
Inheritance graph
[legend]

Public Member Functions

 AMDGPULegalizerInfo (const GCNSubtarget &ST, const GCNTargetMachine &TM)
 
bool legalizeCustom (LegalizerHelper &Helper, MachineInstr &MI, LostDebugLocObserver &LocObserver) const override
 Called for instructions with the Custom LegalizationAction.
 
Register getSegmentAperture (unsigned AddrSpace, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeAddrSpaceCast (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFroundeven (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFceil (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFrem (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeIntrinsicTrunc (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeITOFP (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B, bool Signed) const
 
bool legalizeFPTOI (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B, bool Signed) const
 
bool legalizeMinNumMaxNum (LegalizerHelper &Helper, MachineInstr &MI) const
 
bool legalizeExtractVectorElt (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeInsertVectorElt (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeSinCos (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool buildPCRelGlobalAddress (Register DstReg, LLT PtrTy, MachineIRBuilder &B, const GlobalValue *GV, int64_t Offset, unsigned GAFlags=SIInstrInfo::MO_NONE) const
 
void buildAbsGlobalAddress (Register DstReg, LLT PtrTy, MachineIRBuilder &B, const GlobalValue *GV, MachineRegisterInfo &MRI) const
 
bool legalizeGlobalValue (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeLoad (LegalizerHelper &Helper, MachineInstr &MI) const
 
bool legalizeStore (LegalizerHelper &Helper, MachineInstr &MI) const
 
bool legalizeFMad (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeAtomicCmpXChg (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
std::pair< Register, RegistergetScaledLogInput (MachineIRBuilder &B, Register Src, unsigned Flags) const
 
bool legalizeFlog2 (MachineInstr &MI, MachineIRBuilder &B) const
 
bool legalizeFlogCommon (MachineInstr &MI, MachineIRBuilder &B) const
 
bool legalizeFlogUnsafe (MachineIRBuilder &B, Register Dst, Register Src, bool IsLog10, unsigned Flags) const
 
bool legalizeFExp2 (MachineInstr &MI, MachineIRBuilder &B) const
 
bool legalizeFExpUnsafe (MachineIRBuilder &B, Register Dst, Register Src, unsigned Flags) const
 
bool legalizeFExp (MachineInstr &MI, MachineIRBuilder &B) const
 
bool legalizeFPow (MachineInstr &MI, MachineIRBuilder &B) const
 
bool legalizeFFloor (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeBuildVector (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
void buildMultiply (LegalizerHelper &Helper, MutableArrayRef< Register > Accum, ArrayRef< Register > Src0, ArrayRef< Register > Src1, bool UsePartialMad64_32, bool SeparateOddAlignedProducts) const
 
bool legalizeMul (LegalizerHelper &Helper, MachineInstr &MI) const
 
bool legalizeCTLZ_CTTZ (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeCTLZ_ZERO_UNDEF (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool loadInputValue (Register DstReg, MachineIRBuilder &B, const ArgDescriptor *Arg, const TargetRegisterClass *ArgRC, LLT ArgTy) const
 
bool loadInputValue (Register DstReg, MachineIRBuilder &B, AMDGPUFunctionArgInfo::PreloadedValue ArgType) const
 
bool legalizePointerAsRsrcIntrin (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 To create a buffer resource from a 64-bit pointer, mask off the upper 32 bits of the pointer and replace them with the stride argument, then merge_values everything together.
 
bool legalizePreloadedArgIntrin (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B, AMDGPUFunctionArgInfo::PreloadedValue ArgType) const
 
bool legalizeWorkitemIDIntrinsic (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B, unsigned Dim, AMDGPUFunctionArgInfo::PreloadedValue ArgType) const
 
Register getKernargParameterPtr (MachineIRBuilder &B, int64_t Offset) const
 
bool legalizeKernargMemParameter (MachineInstr &MI, MachineIRBuilder &B, uint64_t Offset, Align Alignment=Align(4)) const
 Legalize a value that's loaded from kernel arguments.
 
bool legalizeUnsignedDIV_REM (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
void legalizeUnsignedDIV_REM32Impl (MachineIRBuilder &B, Register DstDivReg, Register DstRemReg, Register Num, Register Den) const
 
void legalizeUnsignedDIV_REM64Impl (MachineIRBuilder &B, Register DstDivReg, Register DstRemReg, Register Num, Register Den) const
 
bool legalizeSignedDIV_REM (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFDIV (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFDIV16 (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFDIV32 (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFDIV64 (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFFREXP (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFastUnsafeFDIV (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFastUnsafeFDIV64 (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFDIVFastIntrin (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFSQRTF16 (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFSQRTF32 (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFSQRTF64 (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeFSQRT (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeRsqClampIntrinsic (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool getImplicitArgPtr (Register DstReg, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeImplicitArgPtr (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool getLDSKernelId (Register DstReg, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeLDSKernelId (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeIsAddrSpace (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B, unsigned AddrSpace) const
 
std::pair< Register, unsignedsplitBufferOffsets (MachineIRBuilder &B, Register OrigOffset) const
 
Register handleD16VData (MachineIRBuilder &B, MachineRegisterInfo &MRI, Register Reg, bool ImageStore=false) const
 Handle register layout difference for f16 images for some subtargets.
 
Register fixStoreSourceType (MachineIRBuilder &B, Register VData, LLT MemTy, bool IsFormat) const
 
bool legalizeBufferStore (MachineInstr &MI, LegalizerHelper &Helper, bool IsTyped, bool IsFormat) const
 
bool legalizeBufferLoad (MachineInstr &MI, LegalizerHelper &Helper, bool IsFormat, bool IsTyped) const
 
bool legalizeBufferAtomic (MachineInstr &MI, MachineIRBuilder &B, Intrinsic::ID IID) const
 
bool legalizeLaneOp (LegalizerHelper &Helper, MachineInstr &MI, Intrinsic::ID IID) const
 
bool legalizeBVHIntrinsic (MachineInstr &MI, MachineIRBuilder &B) const
 
bool legalizeStackSave (MachineInstr &MI, MachineIRBuilder &B) const
 
bool legalizeWaveID (MachineInstr &MI, MachineIRBuilder &B) const
 
bool legalizeGetFPEnv (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeSetFPEnv (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeImageIntrinsic (MachineInstr &MI, MachineIRBuilder &B, GISelChangeObserver &Observer, const AMDGPU::ImageDimIntrinsicInfo *ImageDimIntr) const
 Rewrite image intrinsics to use register layouts expected by the subtarget.
 
bool legalizeSBufferLoad (LegalizerHelper &Helper, MachineInstr &MI) const
 
bool legalizeSBufferPrefetch (LegalizerHelper &Helper, MachineInstr &MI) const
 
bool legalizeTrap (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeTrapEndpgm (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeTrapHsaQueuePtr (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeTrapHsa (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeDebugTrap (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B) const
 
bool legalizeIntrinsic (LegalizerHelper &Helper, MachineInstr &MI) const override
 
- Public Member Functions inherited from llvm::LegalizerInfo
virtual ~LegalizerInfo ()=default
 
const LegacyLegalizerInfogetLegacyLegalizerInfo () const
 
LegacyLegalizerInfogetLegacyLegalizerInfo ()
 
unsigned getOpcodeIdxForOpcode (unsigned Opcode) const
 
unsigned getActionDefinitionsIdx (unsigned Opcode) const
 
void verify (const MCInstrInfo &MII) const
 Perform simple self-diagnostic and assert if there is anything obviously wrong with the actions set up.
 
const LegalizeRuleSetgetActionDefinitions (unsigned Opcode) const
 Get the action definitions for the given opcode.
 
LegalizeRuleSetgetActionDefinitionsBuilder (unsigned Opcode)
 Get the action definition builder for the given opcode.
 
LegalizeRuleSetgetActionDefinitionsBuilder (std::initializer_list< unsigned > Opcodes)
 Get the action definition builder for the given set of opcodes.
 
void aliasActionDefinitions (unsigned OpcodeTo, unsigned OpcodeFrom)
 
LegalizeActionStep getAction (const LegalityQuery &Query) const
 Determine what action should be taken to legalize the described instruction.
 
LegalizeActionStep getAction (const MachineInstr &MI, const MachineRegisterInfo &MRI) const
 Determine what action should be taken to legalize the given generic instruction.
 
bool isLegal (const LegalityQuery &Query) const
 
bool isLegalOrCustom (const LegalityQuery &Query) const
 
bool isLegal (const MachineInstr &MI, const MachineRegisterInfo &MRI) const
 
bool isLegalOrCustom (const MachineInstr &MI, const MachineRegisterInfo &MRI) const
 
virtual bool legalizeCustom (LegalizerHelper &Helper, MachineInstr &MI, LostDebugLocObserver &LocObserver) const
 Called for instructions with the Custom LegalizationAction.
 
virtual bool legalizeIntrinsic (LegalizerHelper &Helper, MachineInstr &MI) const
 
virtual unsigned getExtOpcodeForWideningConstant (LLT SmallTy) const
 Return the opcode (SEXT/ZEXT/ANYEXT) that should be performed while widening a constant of type SmallTy which targets can override.
 

Detailed Description

Definition at line 30 of file AMDGPULegalizerInfo.h.

Constructor & Destructor Documentation

◆ AMDGPULegalizerInfo()

AMDGPULegalizerInfo::AMDGPULegalizerInfo ( const GCNSubtarget ST,
const GCNTargetMachine TM 
)

Definition at line 656 of file AMDGPULegalizerInfo.cpp.

References llvm::LegalityPredicates::all(), AllS32Vectors, AllS64Vectors, llvm::LegalizeRuleSet::alwaysLegal(), assert(), llvm::AMDGPUAS::BUFFER_FAT_POINTER, llvm::AMDGPUAS::BUFFER_RESOURCE, llvm::AMDGPUAS::BUFFER_STRIDED_POINTER, llvm::LegalizeMutations::changeTo(), llvm::LegalizeRuleSet::clampMaxNumElements(), llvm::LegalizeRuleSet::clampMaxNumElementsStrict(), llvm::LegalizeRuleSet::clampScalar(), llvm::LegalizeRuleSet::clampScalarOrElt(), llvm::AMDGPUAS::CONSTANT_ADDRESS, llvm::AMDGPUAS::CONSTANT_ADDRESS_32BIT, llvm::LegalizeRuleSet::custom(), llvm::LegalizeRuleSet::customFor(), llvm::LegalizeRuleSet::customIf(), elementTypeIsLegal(), llvm::LegalizeRuleSet::fewerElementsIf(), fewerEltsToSize64Vector(), llvm::AMDGPUAS::FLAT_ADDRESS, llvm::LegalizerInfo::getActionDefinitionsBuilder(), llvm::AMDGPUAS::GLOBAL_ADDRESS, llvm::AMDGPUSubtarget::has16BitInsts(), llvm::GCNSubtarget::hasAddNoCarry(), llvm::AMDGPUSubtarget::hasCvtPkF16F32Inst(), llvm::GCNSubtarget::hasFractBug(), llvm::GCNSubtarget::hasIntClamp(), llvm::GCNSubtarget::hasMad64_32(), llvm::GCNSubtarget::hasMadF16(), llvm::AMDGPUSubtarget::hasMadMacF32Insts(), llvm::GCNSubtarget::hasPackedFP32Ops(), llvm::GCNSubtarget::hasScalarAddSub64(), llvm::GCNSubtarget::hasScalarSMulU64(), llvm::AMDGPUSubtarget::hasVOP3PInsts(), llvm::LegalityPredicates::isPointer(), isRegisterClassType(), llvm::LegalityPredicates::isScalar(), isSmallOddVector(), llvm::LegalizeRuleSet::legalFor(), llvm::LegalizeRuleSet::legalIf(), llvm::AMDGPUAS::LOCAL_ADDRESS, llvm::LegalizeRuleSet::lower(), llvm::LegalizeRuleSet::maxScalar(), MaxScalar, llvm::LegalizeRuleSet::minScalar(), llvm::LegalizeRuleSet::moreElementsIf(), llvm::Mul, oneMoreElement(), llvm::LLT::pointer(), llvm::AMDGPUAS::PRIVATE_ADDRESS, llvm::AMDGPUAS::REGION_ADDRESS, S1, S128, S16, S256, S32, S64, S8, llvm::LegalizeMutations::scalarize(), llvm::LegalizeRuleSet::scalarize(), llvm::LegalityPredicates::typeIs(), llvm::LegalityPredicates::typeIsNot(), V16S32, V2S16, V2S32, V2S64, V2S8, V32S32, V4S16, vectorWiderThan(), llvm::LegalizeRuleSet::widenScalarToNextMultipleOf(), and llvm::LegalizeRuleSet::widenScalarToNextPow2().

Member Function Documentation

◆ buildAbsGlobalAddress()

void AMDGPULegalizerInfo::buildAbsGlobalAddress ( Register  DstReg,
LLT  PtrTy,
MachineIRBuilder B,
const GlobalValue GV,
MachineRegisterInfo MRI 
) const

◆ buildMultiply()

void AMDGPULegalizerInfo::buildMultiply ( LegalizerHelper Helper,
MutableArrayRef< Register Accum,
ArrayRef< Register Src0,
ArrayRef< Register Src1,
bool  UsePartialMad64_32,
bool  SeparateOddAlignedProducts 
) const

◆ buildPCRelGlobalAddress()

bool AMDGPULegalizerInfo::buildPCRelGlobalAddress ( Register  DstReg,
LLT  PtrTy,
MachineIRBuilder B,
const GlobalValue GV,
int64_t  Offset,
unsigned  GAFlags = SIInstrInfo::MO_NONE 
) const

◆ fixStoreSourceType()

Register AMDGPULegalizerInfo::fixStoreSourceType ( MachineIRBuilder B,
Register  VData,
LLT  MemTy,
bool  IsFormat 
) const

◆ getImplicitArgPtr()

bool AMDGPULegalizerInfo::getImplicitArgPtr ( Register  DstReg,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ getKernargParameterPtr()

Register AMDGPULegalizerInfo::getKernargParameterPtr ( MachineIRBuilder B,
int64_t  Offset 
) const

◆ getLDSKernelId()

bool AMDGPULegalizerInfo::getLDSKernelId ( Register  DstReg,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ getScaledLogInput()

std::pair< Register, Register > AMDGPULegalizerInfo::getScaledLogInput ( MachineIRBuilder B,
Register  Src,
unsigned  Flags 
) const

◆ getSegmentAperture()

Register AMDGPULegalizerInfo::getSegmentAperture ( unsigned  AddrSpace,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ handleD16VData()

Register AMDGPULegalizerInfo::handleD16VData ( MachineIRBuilder B,
MachineRegisterInfo MRI,
Register  Reg,
bool  ImageStore = false 
) const

◆ legalizeAddrSpaceCast()

bool AMDGPULegalizerInfo::legalizeAddrSpaceCast ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeAtomicCmpXChg()

bool AMDGPULegalizerInfo::legalizeAtomicCmpXChg ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeBufferAtomic()

bool AMDGPULegalizerInfo::legalizeBufferAtomic ( MachineInstr MI,
MachineIRBuilder B,
Intrinsic::ID  IID 
) const

◆ legalizeBufferLoad()

bool AMDGPULegalizerInfo::legalizeBufferLoad ( MachineInstr MI,
LegalizerHelper Helper,
bool  IsFormat,
bool  IsTyped 
) const

◆ legalizeBufferStore()

bool AMDGPULegalizerInfo::legalizeBufferStore ( MachineInstr MI,
LegalizerHelper Helper,
bool  IsTyped,
bool  IsFormat 
) const

◆ legalizeBuildVector()

bool AMDGPULegalizerInfo::legalizeBuildVector ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

Definition at line 3854 of file AMDGPULegalizerInfo.cpp.

References assert(), B, llvm::LLT::fixed_vector(), Merge, MI, MRI, S16, S32, and llvm::LLT::scalar().

Referenced by legalizeCustom().

◆ legalizeBVHIntrinsic()

bool AMDGPULegalizerInfo::legalizeBVHIntrinsic ( MachineInstr MI,
MachineIRBuilder B 
) const

◆ legalizeCTLZ_CTTZ()

bool AMDGPULegalizerInfo::legalizeCTLZ_CTTZ ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

Definition at line 4190 of file AMDGPULegalizerInfo.cpp.

References B, llvm::LLT::getSizeInBits(), MI, and MRI.

Referenced by legalizeCustom().

◆ legalizeCTLZ_ZERO_UNDEF()

bool AMDGPULegalizerInfo::legalizeCTLZ_ZERO_UNDEF ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

Definition at line 4208 of file AMDGPULegalizerInfo.cpp.

References assert(), B, getReg(), llvm::LLT::getSizeInBits(), MI, MRI, and S32.

Referenced by legalizeCustom().

◆ legalizeCustom()

bool AMDGPULegalizerInfo::legalizeCustom ( LegalizerHelper Helper,
MachineInstr MI,
LostDebugLocObserver LocObserver 
) const
overridevirtual

◆ legalizeDebugTrap()

bool AMDGPULegalizerInfo::legalizeDebugTrap ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeExtractVectorElt()

bool AMDGPULegalizerInfo::legalizeExtractVectorElt ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFastUnsafeFDIV()

bool AMDGPULegalizerInfo::legalizeFastUnsafeFDIV ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFastUnsafeFDIV64()

bool AMDGPULegalizerInfo::legalizeFastUnsafeFDIV64 ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFceil()

bool AMDGPULegalizerInfo::legalizeFceil ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFDIV()

bool AMDGPULegalizerInfo::legalizeFDIV ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFDIV16()

bool AMDGPULegalizerInfo::legalizeFDIV16 ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFDIV32()

bool AMDGPULegalizerInfo::legalizeFDIV32 ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFDIV64()

bool AMDGPULegalizerInfo::legalizeFDIV64 ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFDIVFastIntrin()

bool AMDGPULegalizerInfo::legalizeFDIVFastIntrin ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

Definition at line 5183 of file AMDGPULegalizerInfo.cpp.

References B, llvm::CmpInst::FCMP_OGT, LHS, MI, RHS, S1, S32, and llvm::LLT::scalar().

Referenced by legalizeIntrinsic().

◆ legalizeFExp()

bool AMDGPULegalizerInfo::legalizeFExp ( MachineInstr MI,
MachineIRBuilder B 
) const

◆ legalizeFExp2()

bool AMDGPULegalizerInfo::legalizeFExp2 ( MachineInstr MI,
MachineIRBuilder B 
) const

◆ legalizeFExpUnsafe()

bool AMDGPULegalizerInfo::legalizeFExpUnsafe ( MachineIRBuilder B,
Register  Dst,
Register  Src,
unsigned  Flags 
) const

◆ legalizeFFloor()

bool AMDGPULegalizerInfo::legalizeFFloor ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFFREXP()

bool AMDGPULegalizerInfo::legalizeFFREXP ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFlog2()

bool AMDGPULegalizerInfo::legalizeFlog2 ( MachineInstr MI,
MachineIRBuilder B 
) const

Definition at line 3304 of file AMDGPULegalizerInfo.cpp.

References assert(), B, F32, getScaledLogInput(), llvm::Log2(), MI, and llvm::LLT::scalar().

Referenced by legalizeCustom().

◆ legalizeFlogCommon()

bool AMDGPULegalizerInfo::legalizeFlogCommon ( MachineInstr MI,
MachineIRBuilder B 
) const

◆ legalizeFlogUnsafe()

bool AMDGPULegalizerInfo::legalizeFlogUnsafe ( MachineIRBuilder B,
Register  Dst,
Register  Src,
bool  IsLog10,
unsigned  Flags 
) const

◆ legalizeFMad()

bool AMDGPULegalizerInfo::legalizeFMad ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFPow()

bool AMDGPULegalizerInfo::legalizeFPow ( MachineInstr MI,
MachineIRBuilder B 
) const

Definition at line 3749 of file AMDGPULegalizerInfo.cpp.

References B, F32, llvm::LLT::float16(), llvm::LLT::float32(), MI, and llvm::Mul.

Referenced by legalizeCustom().

◆ legalizeFPTOI()

bool AMDGPULegalizerInfo::legalizeFPTOI ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B,
bool  Signed 
) const

Definition at line 2630 of file AMDGPULegalizerInfo.cpp.

References assert(), B, llvm::Hi, llvm::Lo, MI, MRI, llvm::Mul, S32, S64, llvm::LLT::scalar(), and Signed.

Referenced by legalizeCustom().

◆ legalizeFrem()

bool AMDGPULegalizerInfo::legalizeFrem ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

Definition at line 2494 of file AMDGPULegalizerInfo.cpp.

References B, MI, and MRI.

Referenced by legalizeCustom().

◆ legalizeFroundeven()

bool AMDGPULegalizerInfo::legalizeFroundeven ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFSQRT()

bool AMDGPULegalizerInfo::legalizeFSQRT ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFSQRTF16()

bool AMDGPULegalizerInfo::legalizeFSQRTF16 ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFSQRTF32()

bool AMDGPULegalizerInfo::legalizeFSQRTF32 ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeFSQRTF64()

bool AMDGPULegalizerInfo::legalizeFSQRTF64 ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeGetFPEnv()

bool AMDGPULegalizerInfo::legalizeGetFPEnv ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

Definition at line 7207 of file AMDGPULegalizerInfo.cpp.

References B, FPEnvModeBitField, FPEnvTrapBitField, MI, MRI, S32, and S64.

Referenced by legalizeCustom().

◆ legalizeGlobalValue()

bool AMDGPULegalizerInfo::legalizeGlobalValue ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeImageIntrinsic()

bool AMDGPULegalizerInfo::legalizeImageIntrinsic ( MachineInstr MI,
MachineIRBuilder B,
GISelChangeObserver Observer,
const AMDGPU::ImageDimIntrinsicInfo Intr 
) const

Rewrite image intrinsics to use register layouts expected by the subtarget.

Depending on the subtarget, load/store with 16-bit element data need to be rewritten to use the low half of 32-bit registers, or directly use a packed layout. 16-bit addresses should also sometimes be packed into 32-bit registers.

We don't want to directly select image instructions just yet, but also want to exposes all register repacking to the legalizer/combiners. We also don't want a selected instruction entering RegBankSelect. In order to avoid defining a multitude of intermediate image instructions, directly hack on the intrinsic's arguments. In cases like a16 addresses, this requires padding now unnecessary arguments with $noreg.

Definition at line 6399 of file AMDGPULegalizerInfo.cpp.

References assert(), llvm::AMDGPU::MIMGBaseOpcodeInfo::Atomic, llvm::AMDGPU::MIMGBaseOpcodeInfo::AtomicX2, B, llvm::AMDGPU::MIMGBaseOpcodeInfo::BaseOpcode, llvm::GISelChangeObserver::changedInstr(), llvm::LLT::changeElementCount(), llvm::GISelChangeObserver::changingInstr(), Concat, convertImageAddrToPacked(), llvm::MachineOperand::CreateImm(), llvm::LLT::fixed_vector(), llvm::AMDGPU::MIMGBaseOpcodeInfo::Gather4, llvm::ElementCount::getFixed(), llvm::SrcOp::getImm(), llvm::AMDGPU::getMIMGBaseOpcodeInfo(), llvm::GCNSubtarget::getNSAMaxSize(), llvm::GCNSubtarget::getNSAThreshold(), llvm::LLT::getNumElements(), llvm::SrcOp::getReg(), llvm::LLT::getScalarType(), llvm::LLT::getSizeInBits(), llvm::AMDGPU::MIMGBaseOpcodeInfo::Gradients, handleD16VData(), llvm::GCNSubtarget::hasA16(), llvm::GCNSubtarget::hasG16(), llvm::GCNSubtarget::hasNSAEncoding(), llvm::GCNSubtarget::hasPartialNSAEncoding(), llvm::GCNSubtarget::hasUnpackedD16VMem(), I, Intr, llvm::LLT::isVector(), llvm::make_scope_exit(), MI, MRI, llvm::AMDGPU::MIMGBaseOpcodeInfo::NoReturn, packImage16bitOpsToDwords(), llvm::popcount(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::resize(), S16, S32, llvm::AMDGPU::MIMGBaseOpcodeInfo::Sampler, llvm::LLT::scalar(), llvm::LLT::scalarOrVector(), llvm::SmallVectorBase< Size_T >::size(), llvm::AMDGPU::MIMGBaseOpcodeInfo::Store, V2S16, and V4S16.

Referenced by legalizeIntrinsic().

◆ legalizeImplicitArgPtr()

bool AMDGPULegalizerInfo::legalizeImplicitArgPtr ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeInsertVectorElt()

bool AMDGPULegalizerInfo::legalizeInsertVectorElt ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeIntrinsic()

bool AMDGPULegalizerInfo::legalizeIntrinsic ( LegalizerHelper Helper,
MachineInstr MI 
) const
overridevirtual
Returns
true if MI is either legal or has been legalized and false if not legal. Return true if MI is either legal or has been legalized and false if not legal.

Reimplemented from llvm::LegalizerInfo.

Definition at line 7247 of file AMDGPULegalizerInfo.cpp.

References B, llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::AMDGPUFunctionArgInfo::DISPATCH_ID, llvm::AMDGPUFunctionArgInfo::DISPATCH_PTR, llvm::AMDGPU::getImageDimIntrinsicInfo(), llvm::MachineInstr::getOperand(), llvm::AMDGPUSubtarget::getWavefrontSize(), llvm::SI::KernelInputOffsets::GLOBAL_SIZE_X, llvm::SI::KernelInputOffsets::GLOBAL_SIZE_Y, llvm::SI::KernelInputOffsets::GLOBAL_SIZE_Z, llvm::AMDGPUFunctionArgInfo::IMPLICIT_BUFFER_PTR, llvm::AMDGPU::isKernel(), llvm::AMDGPUFunctionArgInfo::KERNARG_SEGMENT_PTR, llvm::AMDGPUFunctionArgInfo::LDS_KERNEL_ID, legalizeAddrSpaceCast(), legalizeBufferAtomic(), legalizeBufferLoad(), legalizeBufferStore(), legalizeBVHIntrinsic(), legalizeFDIVFastIntrin(), legalizeImageIntrinsic(), legalizeImplicitArgPtr(), legalizeIsAddrSpace(), legalizeKernargMemParameter(), legalizeLaneOp(), legalizePointerAsRsrcIntrin(), legalizePreloadedArgIntrin(), legalizeRsqClampIntrinsic(), legalizeSBufferLoad(), legalizeSBufferPrefetch(), legalizeWaveID(), legalizeWorkitemIDIntrinsic(), llvm::AMDGPUAS::LOCAL_ADDRESS, llvm::SI::KernelInputOffsets::LOCAL_SIZE_X, llvm::SI::KernelInputOffsets::LOCAL_SIZE_Y, llvm::SI::KernelInputOffsets::LOCAL_SIZE_Z, MI, llvm::LegalizerHelper::MIRBuilder, MRI, llvm::SI::KernelInputOffsets::NGROUPS_X, llvm::SI::KernelInputOffsets::NGROUPS_Y, llvm::SI::KernelInputOffsets::NGROUPS_Z, llvm::LegalizerHelper::Observer, llvm::AMDGPUAS::PRIVATE_ADDRESS, llvm::AMDGPUFunctionArgInfo::QUEUE_PTR, S32, llvm::LLT::scalar(), llvm::MachineOperand::setMBB(), std::swap(), TRI, verifyCFIntrinsic(), llvm::AMDGPUFunctionArgInfo::WORKGROUP_ID_X, llvm::AMDGPUFunctionArgInfo::WORKGROUP_ID_Y, llvm::AMDGPUFunctionArgInfo::WORKGROUP_ID_Z, llvm::AMDGPUFunctionArgInfo::WORKITEM_ID_X, llvm::AMDGPUFunctionArgInfo::WORKITEM_ID_Y, and llvm::AMDGPUFunctionArgInfo::WORKITEM_ID_Z.

◆ legalizeIntrinsicTrunc()

bool AMDGPULegalizerInfo::legalizeIntrinsicTrunc ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeIsAddrSpace()

bool AMDGPULegalizerInfo::legalizeIsAddrSpace ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B,
unsigned  AddrSpace 
) const

◆ legalizeITOFP()

bool AMDGPULegalizerInfo::legalizeITOFP ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B,
bool  Signed 
) const

Definition at line 2573 of file AMDGPULegalizerInfo.cpp.

References assert(), B, MI, MRI, S32, S64, llvm::LLT::scalar(), Signed, and X.

Referenced by legalizeCustom().

◆ legalizeKernargMemParameter()

bool AMDGPULegalizerInfo::legalizeKernargMemParameter ( MachineInstr MI,
MachineIRBuilder B,
uint64_t  Offset,
Align  Alignment = Align(4) 
) const

Legalize a value that's loaded from kernel arguments.

This is only used by legacy intrinsics.

Definition at line 4450 of file AMDGPULegalizerInfo.cpp.

References assert(), B, llvm::AMDGPUAS::CONSTANT_ADDRESS, getKernargParameterPtr(), MI, llvm::MachineMemOperand::MODereferenceable, llvm::MachineMemOperand::MOInvariant, llvm::Offset, Ptr, and llvm::LLT::scalar().

Referenced by legalizeIntrinsic().

◆ legalizeLaneOp()

bool AMDGPULegalizerInfo::legalizeLaneOp ( LegalizerHelper Helper,
MachineInstr MI,
Intrinsic::ID  IID 
) const

◆ legalizeLDSKernelId()

bool AMDGPULegalizerInfo::legalizeLDSKernelId ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeLoad()

bool AMDGPULegalizerInfo::legalizeLoad ( LegalizerHelper Helper,
MachineInstr MI 
) const

◆ legalizeMinNumMaxNum()

bool AMDGPULegalizerInfo::legalizeMinNumMaxNum ( LegalizerHelper Helper,
MachineInstr MI 
) const

◆ legalizeMul()

bool AMDGPULegalizerInfo::legalizeMul ( LegalizerHelper Helper,
MachineInstr MI 
) const

◆ legalizePointerAsRsrcIntrin()

bool AMDGPULegalizerInfo::legalizePointerAsRsrcIntrin ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

To create a buffer resource from a 64-bit pointer, mask off the upper 32 bits of the pointer and replace them with the stride argument, then merge_values everything together.

In the common case of a raw buffer (the stride component is 0), we can just AND off the upper half.

Definition at line 5621 of file AMDGPULegalizerInfo.cpp.

References B, llvm::getIConstantVRegValWithLookThrough(), llvm::MachineInstrBuilder::getReg(), llvm::Masked, MI, MRI, S32, and llvm::LLT::scalar().

Referenced by legalizeIntrinsic().

◆ legalizePreloadedArgIntrin()

bool AMDGPULegalizerInfo::legalizePreloadedArgIntrin ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B,
AMDGPUFunctionArgInfo::PreloadedValue  ArgType 
) const

Definition at line 4375 of file AMDGPULegalizerInfo.cpp.

References B, loadInputValue(), and MI.

Referenced by legalizeImplicitArgPtr(), legalizeIntrinsic(), and legalizeLDSKernelId().

◆ legalizeRsqClampIntrinsic()

bool AMDGPULegalizerInfo::legalizeRsqClampIntrinsic ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeSBufferLoad()

bool AMDGPULegalizerInfo::legalizeSBufferLoad ( LegalizerHelper Helper,
MachineInstr MI 
) const

◆ legalizeSBufferPrefetch()

bool AMDGPULegalizerInfo::legalizeSBufferPrefetch ( LegalizerHelper Helper,
MachineInstr MI 
) const

◆ legalizeSetFPEnv()

bool AMDGPULegalizerInfo::legalizeSetFPEnv ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

Definition at line 7227 of file AMDGPULegalizerInfo.cpp.

References B, FPEnvModeBitField, FPEnvTrapBitField, MI, MRI, S32, and S64.

Referenced by legalizeCustom().

◆ legalizeSignedDIV_REM()

bool AMDGPULegalizerInfo::legalizeSignedDIV_REM ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeSinCos()

bool AMDGPULegalizerInfo::legalizeSinCos ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeStackSave()

bool AMDGPULegalizerInfo::legalizeStackSave ( MachineInstr MI,
MachineIRBuilder B 
) const

◆ legalizeStore()

bool AMDGPULegalizerInfo::legalizeStore ( LegalizerHelper Helper,
MachineInstr MI 
) const

◆ legalizeTrap()

bool AMDGPULegalizerInfo::legalizeTrap ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeTrapEndpgm()

bool AMDGPULegalizerInfo::legalizeTrapEndpgm ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeTrapHsa()

bool AMDGPULegalizerInfo::legalizeTrapHsa ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeTrapHsaQueuePtr()

bool AMDGPULegalizerInfo::legalizeTrapHsaQueuePtr ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeUnsignedDIV_REM()

bool AMDGPULegalizerInfo::legalizeUnsignedDIV_REM ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B 
) const

◆ legalizeUnsignedDIV_REM32Impl()

void AMDGPULegalizerInfo::legalizeUnsignedDIV_REM32Impl ( MachineIRBuilder B,
Register  DstDivReg,
Register  DstRemReg,
Register  Num,
Register  Den 
) const

◆ legalizeUnsignedDIV_REM64Impl()

void AMDGPULegalizerInfo::legalizeUnsignedDIV_REM64Impl ( MachineIRBuilder B,
Register  DstDivReg,
Register  DstRemReg,
Register  Num,
Register  Den 
) const

◆ legalizeWaveID()

bool AMDGPULegalizerInfo::legalizeWaveID ( MachineInstr MI,
MachineIRBuilder B 
) const

◆ legalizeWorkitemIDIntrinsic()

bool AMDGPULegalizerInfo::legalizeWorkitemIDIntrinsic ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B,
unsigned  Dim,
AMDGPUFunctionArgInfo::PreloadedValue  ArgType 
) const

◆ loadInputValue() [1/2]

bool AMDGPULegalizerInfo::loadInputValue ( Register  DstReg,
MachineIRBuilder B,
AMDGPUFunctionArgInfo::PreloadedValue  ArgType 
) const

◆ loadInputValue() [2/2]

bool AMDGPULegalizerInfo::loadInputValue ( Register  DstReg,
MachineIRBuilder B,
const ArgDescriptor Arg,
const TargetRegisterClass ArgRC,
LLT  ArgTy 
) const

◆ splitBufferOffsets()

std::pair< Register, unsigned > AMDGPULegalizerInfo::splitBufferOffsets ( MachineIRBuilder B,
Register  OrigOffset 
) const

The documentation for this class was generated from the following files: