LLVM 20.0.0git
Public Types | Public Member Functions | Public Attributes | List of all members
llvm::LegalizerHelper Class Reference

#include "llvm/CodeGen/GlobalISel/LegalizerHelper.h"

Public Types

enum  LegalizeResult { AlreadyLegal , Legalized , UnableToLegalize }
 

Public Member Functions

const LegalizerInfogetLegalizerInfo () const
 Expose LegalizerInfo so the clients can re-use.
 
const TargetLoweringgetTargetLowering () const
 
GISelKnownBitsgetKnownBits () const
 
 LegalizerHelper (MachineFunction &MF, GISelChangeObserver &Observer, MachineIRBuilder &B)
 
 LegalizerHelper (MachineFunction &MF, const LegalizerInfo &LI, GISelChangeObserver &Observer, MachineIRBuilder &B, GISelKnownBits *KB=nullptr)
 
LegalizeResult legalizeInstrStep (MachineInstr &MI, LostDebugLocObserver &LocObserver)
 Replace MI by a sequence of legal instructions that can implement the same operation.
 
LegalizeResult libcall (MachineInstr &MI, LostDebugLocObserver &LocObserver)
 Legalize an instruction by emiting a runtime library call instead.
 
LegalizeResult narrowScalar (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 Legalize an instruction by reducing the width of the underlying scalar type.
 
LegalizeResult widenScalar (MachineInstr &MI, unsigned TypeIdx, LLT WideTy)
 Legalize an instruction by performing the operation on a wider scalar type (for example a 16-bit addition can be safely performed at 32-bits precision, ignoring the unused bits).
 
LegalizeResult bitcast (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 Legalize an instruction by replacing the value type.
 
LegalizeResult lower (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 Legalize an instruction by splitting it into simpler parts, hopefully understood by the target.
 
LegalizeResult fewerElementsVector (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 Legalize a vector instruction by splitting into multiple components, each acting on the same scalar type as the original but with fewer elements.
 
LegalizeResult moreElementsVector (MachineInstr &MI, unsigned TypeIdx, LLT MoreTy)
 Legalize a vector instruction by increasing the number of vector elements involved and ignoring the added elements later.
 
Register coerceToScalar (Register Val)
 Cast the given value to an LLT::scalar with an equivalent size.
 
void widenScalarSrc (MachineInstr &MI, LLT WideTy, unsigned OpIdx, unsigned ExtOpcode)
 Legalize a single operand OpIdx of the machine instruction MI as a Use by extending the operand's type to WideTy using the specified ExtOpcode for the extension instruction, and replacing the vreg of the operand in place.
 
void narrowScalarSrc (MachineInstr &MI, LLT NarrowTy, unsigned OpIdx)
 Legalize a single operand OpIdx of the machine instruction MI as a Use by truncating the operand's type to NarrowTy using G_TRUNC, and replacing the vreg of the operand in place.
 
void widenScalarDst (MachineInstr &MI, LLT WideTy, unsigned OpIdx=0, unsigned TruncOpcode=TargetOpcode::G_TRUNC)
 Legalize a single operand OpIdx of the machine instruction MI as a Def by extending the operand's type to WideTy and truncating it back with the TruncOpcode, and replacing the vreg of the operand in place.
 
void narrowScalarDst (MachineInstr &MI, LLT NarrowTy, unsigned OpIdx, unsigned ExtOpcode)
 
void moreElementsVectorDst (MachineInstr &MI, LLT MoreTy, unsigned OpIdx)
 Legalize a single operand OpIdx of the machine instruction MI as a Def by performing it with additional vector elements and extracting the result elements, and replacing the vreg of the operand in place.
 
void moreElementsVectorSrc (MachineInstr &MI, LLT MoreTy, unsigned OpIdx)
 Legalize a single operand OpIdx of the machine instruction MI as a Use by producing a vector with undefined high elements, extracting the original vector type, and replacing the vreg of the operand in place.
 
void bitcastSrc (MachineInstr &MI, LLT CastTy, unsigned OpIdx)
 Legalize a single operand OpIdx of the machine instruction MI as a use by inserting a G_BITCAST to CastTy.
 
void bitcastDst (MachineInstr &MI, LLT CastTy, unsigned OpIdx)
 Legalize a single operand OpIdx of the machine instruction MI as a def by inserting a G_BITCAST from CastTy.
 
Align getStackTemporaryAlignment (LLT Type, Align MinAlign=Align()) const
 Return the alignment to use for a stack temporary object with the given type.
 
MachineInstrBuilder createStackTemporary (TypeSize Bytes, Align Alignment, MachinePointerInfo &PtrInfo)
 Create a stack temporary based on the size in bytes and the alignment.
 
Register getVectorElementPointer (Register VecPtr, LLT VecTy, Register Index)
 Get a pointer to vector element Index located in memory for a vector of type VecTy starting at a base address of VecPtr.
 
LegalizeResult fewerElementsVectorMultiEltType (GenericMachineInstr &MI, unsigned NumElts, std::initializer_list< unsigned > NonVecOpIndices={})
 Handles most opcodes.
 
LegalizeResult fewerElementsVectorPhi (GenericMachineInstr &MI, unsigned NumElts)
 
LegalizeResult moreElementsVectorPhi (MachineInstr &MI, unsigned TypeIdx, LLT MoreTy)
 
LegalizeResult moreElementsVectorShuffle (MachineInstr &MI, unsigned TypeIdx, LLT MoreTy)
 
LegalizeResult fewerElementsVectorUnmergeValues (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 
LegalizeResult fewerElementsVectorMerge (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 
LegalizeResult fewerElementsVectorExtractInsertVectorElt (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 
LegalizeResult equalizeVectorShuffleLengths (MachineInstr &MI)
 Equalize source and destination vector sizes of G_SHUFFLE_VECTOR.
 
LegalizeResult reduceLoadStoreWidth (GLoadStore &MI, unsigned TypeIdx, LLT NarrowTy)
 
LegalizeResult narrowScalarShiftByConstant (MachineInstr &MI, const APInt &Amt, LLT HalfTy, LLT ShiftAmtTy)
 
LegalizeResult fewerElementsVectorReductions (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 
LegalizeResult fewerElementsVectorSeqReductions (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 
LegalizeResult fewerElementsBitcast (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 
LegalizeResult fewerElementsVectorShuffle (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 
LegalizeResult narrowScalarShift (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult narrowScalarAddSub (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 
LegalizeResult narrowScalarMul (MachineInstr &MI, LLT Ty)
 
LegalizeResult narrowScalarFPTOI (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult narrowScalarExtract (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult narrowScalarInsert (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult narrowScalarBasic (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult narrowScalarExt (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult narrowScalarSelect (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult narrowScalarCTLZ (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult narrowScalarCTTZ (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult narrowScalarCTPOP (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult narrowScalarFLDEXP (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 
LegalizeResult bitcastExtractVectorElt (MachineInstr &MI, unsigned TypeIdx, LLT CastTy)
 Perform Bitcast legalize action on G_EXTRACT_VECTOR_ELT.
 
LegalizeResult bitcastInsertVectorElt (MachineInstr &MI, unsigned TypeIdx, LLT CastTy)
 Perform Bitcast legalize action on G_INSERT_VECTOR_ELT.
 
LegalizeResult bitcastConcatVector (MachineInstr &MI, unsigned TypeIdx, LLT CastTy)
 
LegalizeResult lowerConstant (MachineInstr &MI)
 
LegalizeResult lowerFConstant (MachineInstr &MI)
 
LegalizeResult lowerBitcast (MachineInstr &MI)
 
LegalizeResult lowerLoad (GAnyLoad &MI)
 
LegalizeResult lowerStore (GStore &MI)
 
LegalizeResult lowerBitCount (MachineInstr &MI)
 
LegalizeResult lowerFunnelShiftWithInverse (MachineInstr &MI)
 
LegalizeResult lowerFunnelShiftAsShifts (MachineInstr &MI)
 
LegalizeResult lowerFunnelShift (MachineInstr &MI)
 
LegalizeResult lowerEXT (MachineInstr &MI)
 
LegalizeResult lowerTRUNC (MachineInstr &MI)
 
LegalizeResult lowerRotateWithReverseRotate (MachineInstr &MI)
 
LegalizeResult lowerRotate (MachineInstr &MI)
 
LegalizeResult lowerU64ToF32BitOps (MachineInstr &MI)
 
LegalizeResult lowerUITOFP (MachineInstr &MI)
 
LegalizeResult lowerSITOFP (MachineInstr &MI)
 
LegalizeResult lowerFPTOUI (MachineInstr &MI)
 
LegalizeResult lowerFPTOSI (MachineInstr &MI)
 
LegalizeResult lowerFPTRUNC_F64_TO_F16 (MachineInstr &MI)
 
LegalizeResult lowerFPTRUNC (MachineInstr &MI)
 
LegalizeResult lowerFPOWI (MachineInstr &MI)
 
LegalizeResult lowerISFPCLASS (MachineInstr &MI)
 
LegalizeResult lowerThreewayCompare (MachineInstr &MI)
 
LegalizeResult lowerMinMax (MachineInstr &MI)
 
LegalizeResult lowerFCopySign (MachineInstr &MI)
 
LegalizeResult lowerFMinNumMaxNum (MachineInstr &MI)
 
LegalizeResult lowerFMad (MachineInstr &MI)
 
LegalizeResult lowerIntrinsicRound (MachineInstr &MI)
 
LegalizeResult lowerFFloor (MachineInstr &MI)
 
LegalizeResult lowerMergeValues (MachineInstr &MI)
 
LegalizeResult lowerUnmergeValues (MachineInstr &MI)
 
LegalizeResult lowerExtractInsertVectorElt (MachineInstr &MI)
 Lower a vector extract or insert by writing the vector to a stack temporary and reloading the element or vector.
 
LegalizeResult lowerShuffleVector (MachineInstr &MI)
 
LegalizeResult lowerVECTOR_COMPRESS (MachineInstr &MI)
 
Register getDynStackAllocTargetPtr (Register SPReg, Register AllocSize, Align Alignment, LLT PtrTy)
 
LegalizeResult lowerDynStackAlloc (MachineInstr &MI)
 
LegalizeResult lowerStackSave (MachineInstr &MI)
 
LegalizeResult lowerStackRestore (MachineInstr &MI)
 
LegalizeResult lowerExtract (MachineInstr &MI)
 
LegalizeResult lowerInsert (MachineInstr &MI)
 
LegalizeResult lowerSADDO_SSUBO (MachineInstr &MI)
 
LegalizeResult lowerAddSubSatToMinMax (MachineInstr &MI)
 
LegalizeResult lowerAddSubSatToAddoSubo (MachineInstr &MI)
 
LegalizeResult lowerShlSat (MachineInstr &MI)
 
LegalizeResult lowerBswap (MachineInstr &MI)
 
LegalizeResult lowerBitreverse (MachineInstr &MI)
 
LegalizeResult lowerReadWriteRegister (MachineInstr &MI)
 
LegalizeResult lowerSMULH_UMULH (MachineInstr &MI)
 
LegalizeResult lowerSelect (MachineInstr &MI)
 
LegalizeResult lowerDIVREM (MachineInstr &MI)
 
LegalizeResult lowerAbsToAddXor (MachineInstr &MI)
 
LegalizeResult lowerAbsToMaxNeg (MachineInstr &MI)
 
LegalizeResult lowerAbsToCNeg (MachineInstr &MI)
 
LegalizeResult lowerVectorReduction (MachineInstr &MI)
 
LegalizeResult lowerMemcpyInline (MachineInstr &MI)
 
LegalizeResult lowerMemCpyFamily (MachineInstr &MI, unsigned MaxLen=0)
 
LegalizeResult lowerVAArg (MachineInstr &MI)
 

Public Attributes

MachineIRBuilderMIRBuilder
 Expose MIRBuilder so clients can set their own RecordInsertInstruction functions.
 
GISelChangeObserverObserver
 To keep track of changes made by the LegalizerHelper.
 

Detailed Description

Definition at line 47 of file LegalizerHelper.h.

Member Enumeration Documentation

◆ LegalizeResult

Enumerator
AlreadyLegal 

Instruction was already legal and no change was made to the MachineFunction.

Legalized 

Instruction has been legalized and the MachineFunction changed.

UnableToLegalize 

Some kind of error has occurred and we could not legalize this instruction.

Definition at line 63 of file LegalizerHelper.h.

Constructor & Destructor Documentation

◆ LegalizerHelper() [1/2]

LegalizerHelper::LegalizerHelper ( MachineFunction MF,
GISelChangeObserver Observer,
MachineIRBuilder B 
)

Definition at line 104 of file LegalizerHelper.cpp.

◆ LegalizerHelper() [2/2]

LegalizerHelper::LegalizerHelper ( MachineFunction MF,
const LegalizerInfo LI,
GISelChangeObserver Observer,
MachineIRBuilder B,
GISelKnownBits KB = nullptr 
)

Definition at line 111 of file LegalizerHelper.cpp.

Member Function Documentation

◆ bitcast()

LegalizerHelper::LegalizeResult LegalizerHelper::bitcast ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ bitcastConcatVector()

LegalizerHelper::LegalizeResult LegalizerHelper::bitcastConcatVector ( MachineInstr MI,
unsigned  TypeIdx,
LLT  CastTy 
)

◆ bitcastDst()

void LegalizerHelper::bitcastDst ( MachineInstr MI,
LLT  CastTy,
unsigned  OpIdx 
)

◆ bitcastExtractVectorElt()

LegalizerHelper::LegalizeResult LegalizerHelper::bitcastExtractVectorElt ( MachineInstr MI,
unsigned  TypeIdx,
LLT  CastTy 
)

Perform Bitcast legalize action on G_EXTRACT_VECTOR_ELT.

Perform a G_EXTRACT_VECTOR_ELT in a different sized vector element.

If this is casting to a vector with a smaller element size, perform multiple element extracts and merge the results. If this is coercing to a vector with larger elements, index the bitcasted vector and extract the target element with bit operations. This is intended to force the indexing in the native register size for architectures that can dynamically index the register file.

Definition at line 3377 of file LegalizerHelper.cpp.

References llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildBitcast(), llvm::MachineIRBuilder::buildBuildVector(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildExtractVectorElement(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildMul(), llvm::MachineIRBuilder::buildTrunc(), getBitcastWiderVectorElementOffset(), llvm::LLT::getElementType(), llvm::ElementCount::getFixed(), llvm::LLT::getNumElements(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), I, Idx, llvm::isPowerOf2_32(), llvm::LLT::isVector(), Legalized, llvm::Log2_32(), MI, MIRBuilder, llvm::LLT::scalarOrVector(), and UnableToLegalize.

Referenced by bitcast().

◆ bitcastInsertVectorElt()

LegalizerHelper::LegalizeResult LegalizerHelper::bitcastInsertVectorElt ( MachineInstr MI,
unsigned  TypeIdx,
LLT  CastTy 
)

Perform Bitcast legalize action on G_INSERT_VECTOR_ELT.

Perform a G_INSERT_VECTOR_ELT in a different sized vector element.

If this is increasing the element size, perform the indexing in the target element type, and use bit operations to insert at the element position. This is intended for architectures that can dynamically index the register file and want to force indexing in the native register size.

Definition at line 3513 of file LegalizerHelper.cpp.

References llvm::MachineIRBuilder::buildBitcast(), buildBitFieldInsert(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildExtractVectorElement(), llvm::MachineIRBuilder::buildInsertVectorElement(), llvm::MachineIRBuilder::buildLShr(), getBitcastWiderVectorElementOffset(), llvm::LLT::getElementType(), llvm::LLT::getNumElements(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), Idx, llvm::isPowerOf2_32(), llvm::LLT::isVector(), Legalized, llvm::Log2_32(), MI, MIRBuilder, and UnableToLegalize.

Referenced by bitcast().

◆ bitcastSrc()

void LegalizerHelper::bitcastSrc ( MachineInstr MI,
LLT  CastTy,
unsigned  OpIdx 
)

Legalize a single operand OpIdx of the machine instruction MI as a use by inserting a G_BITCAST to CastTy.

Definition at line 1981 of file LegalizerHelper.cpp.

References llvm::MachineIRBuilder::buildBitcast(), llvm::MachineInstrBuilder::getReg(), MI, and MIRBuilder.

Referenced by bitcast().

◆ coerceToScalar()

Register LegalizerHelper::coerceToScalar ( Register  Val)

◆ createStackTemporary()

MachineInstrBuilder LegalizerHelper::createStackTemporary ( TypeSize  Bytes,
Align  Alignment,
MachinePointerInfo PtrInfo 
)

◆ equalizeVectorShuffleLengths()

LegalizerHelper::LegalizeResult LegalizerHelper::equalizeVectorShuffleLengths ( MachineInstr MI)

◆ fewerElementsBitcast()

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsBitcast ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

◆ fewerElementsVector()

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVector ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

◆ fewerElementsVectorExtractInsertVectorElt()

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorExtractInsertVectorElt ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

◆ fewerElementsVectorMerge()

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorMerge ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

◆ fewerElementsVectorMultiEltType()

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorMultiEltType ( GenericMachineInstr MI,
unsigned  NumElts,
std::initializer_list< unsigned NonVecOpIndices = {} 
)

Handles most opcodes.

Split MI into same instruction on sub-vectors or scalars with NumElts elements (1 for scalar). Supports uneven splits: there can be leftover sub-vector with fewer then NumElts or a leftover scalar. To avoid this use moreElements first and set MI number of elements to multiple of NumElts. Non-vector operands that should be used on all sub-instructions without split are listed in NonVecOpIndices.

Definition at line 4452 of file LegalizerHelper.cpp.

References assert(), broadcastSrcOp(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::extractVectorParts(), llvm::LLT::getNumElements(), llvm::MachineRegisterInfo::getType(), hasSameNumEltsOnAllVectorOperands(), I, llvm::is_contained(), Legalized, makeDstOps(), MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::size(), and Uses.

Referenced by fewerElementsVector().

◆ fewerElementsVectorPhi()

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorPhi ( GenericMachineInstr MI,
unsigned  NumElts 
)

◆ fewerElementsVectorReductions()

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorReductions ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

◆ fewerElementsVectorSeqReductions()

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorSeqReductions ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

◆ fewerElementsVectorShuffle()

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorShuffle ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

◆ fewerElementsVectorUnmergeValues()

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorUnmergeValues ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

◆ getDynStackAllocTargetPtr()

Register LegalizerHelper::getDynStackAllocTargetPtr ( Register  SPReg,
Register  AllocSize,
Align  Alignment,
LLT  PtrTy 
)

◆ getKnownBits()

GISelKnownBits * llvm::LegalizerHelper::getKnownBits ( ) const
inline

Definition at line 79 of file LegalizerHelper.h.

Referenced by llvm::AMDGPULegalizerInfo::buildMultiply().

◆ getLegalizerInfo()

const LegalizerInfo & llvm::LegalizerHelper::getLegalizerInfo ( ) const
inline

Expose LegalizerInfo so the clients can re-use.

Definition at line 77 of file LegalizerHelper.h.

◆ getStackTemporaryAlignment()

Align LegalizerHelper::getStackTemporaryAlignment ( LLT  Type,
Align  MinAlign = Align() 
) const

Return the alignment to use for a stack temporary object with the given type.

Definition at line 4290 of file LegalizerHelper.cpp.

References llvm::LLT::getSizeInBytes(), llvm::MinAlign(), and llvm::PowerOf2Ceil().

Referenced by lowerExtractInsertVectorElt(), and lowerVECTOR_COMPRESS().

◆ getTargetLowering()

const TargetLowering & llvm::LegalizerHelper::getTargetLowering ( ) const
inline

Definition at line 78 of file LegalizerHelper.h.

◆ getVectorElementPointer()

Register LegalizerHelper::getVectorElementPointer ( Register  VecPtr,
LLT  VecTy,
Register  Index 
)

◆ legalizeInstrStep()

LegalizerHelper::LegalizeResult LegalizerHelper::legalizeInstrStep ( MachineInstr MI,
LostDebugLocObserver LocObserver 
)

Replace MI by a sequence of legal instructions that can implement the same operation.

Note that this means MI may be deleted, so any iterator steps should be performed before calling this function. Helper should be initialized to the MachineFunction containing MI.

Considered as an opaque blob, the legal code will use and define the same registers as MI.

Definition at line 118 of file LegalizerHelper.cpp.

References AlreadyLegal, bitcast(), llvm::LegalizeActions::Bitcast, llvm::LegalizeActions::Custom, llvm::dbgs(), llvm::LegalizeActions::FewerElements, fewerElementsVector(), llvm::LegalizerInfo::getAction(), llvm::IRSimilarity::Legal, llvm::LegalizerInfo::legalizeCustom(), Legalized, llvm::LegalizerInfo::legalizeIntrinsic(), llvm::LegalizeActions::Libcall, libcall, LLVM_DEBUG, lower(), llvm::Lower, MI, MIRBuilder, llvm::LegalizeActions::MoreElements, moreElementsVector(), narrowScalar(), llvm::LegalizeActions::NarrowScalar, llvm::MachineIRBuilder::setInstrAndDebugLoc(), UnableToLegalize, widenScalar(), and llvm::LegalizeActions::WidenScalar.

Referenced by llvm::Legalizer::legalizeMachineFunction().

◆ libcall()

LegalizerHelper::LegalizeResult LegalizerHelper::libcall ( MachineInstr MI,
LostDebugLocObserver LocObserver 
)

◆ lower()

LegalizerHelper::LegalizeResult LegalizerHelper::lower ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

Legalize an instruction by splitting it into simpler parts, hopefully understood by the target.

Definition at line 3939 of file LegalizerHelper.cpp.

References Addr, assert(), llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildAShr(), llvm::MachineIRBuilder::buildAtomicCmpXchg(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildFAdd(), llvm::MachineIRBuilder::buildFNeg(), llvm::MachineIRBuilder::buildFPTOSI(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildMul(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildStrictFAdd(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildXor(), llvm::MachineIRBuilder::buildZExt(), llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::MachineRegisterInfo::cloneVirtualRegister(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSignMask(), llvm::LLT::getSizeInBits(), llvm::MachineIRBuilder::getTII(), llvm::MachineRegisterInfo::getType(), GISEL_VECREDUCE_CASES_NONSEQ, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::LegalizerInfo::isLegalOrCustom(), llvm::LLT::isVector(), Legalized, LHS, lowerAbsToAddXor(), lowerAddSubSatToAddoSubo(), lowerAddSubSatToMinMax(), lowerBitcast(), lowerBitCount(), lowerBitreverse(), lowerBswap(), lowerDIVREM(), lowerDynStackAlloc(), lowerEXT(), lowerExtract(), lowerExtractInsertVectorElt(), lowerFConstant(), lowerFCopySign(), lowerFFloor(), lowerFMad(), lowerFMinNumMaxNum(), lowerFPOWI(), lowerFPTOSI(), lowerFPTOUI(), lowerFPTRUNC(), lowerFunnelShift(), lowerInsert(), lowerIntrinsicRound(), lowerISFPCLASS(), lowerLoad(), lowerMemCpyFamily(), lowerMergeValues(), lowerMinMax(), lowerReadWriteRegister(), lowerRotate(), lowerSADDO_SSUBO(), lowerSelect(), lowerShlSat(), lowerShuffleVector(), lowerSITOFP(), lowerSMULH_UMULH(), lowerStackRestore(), lowerStackSave(), lowerStore(), lowerThreewayCompare(), lowerTRUNC(), lowerUITOFP(), lowerUnmergeValues(), lowerVAArg(), lowerVECTOR_COMPRESS(), lowerVectorReduction(), MI, MIRBuilder, Observer, RHS, llvm::MachineIRBuilder::setInsertPt(), TII, and UnableToLegalize.

Referenced by llvm::RISCVLegalizerInfo::legalizeCustom(), and legalizeInstrStep().

◆ lowerAbsToAddXor()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerAbsToAddXor ( MachineInstr MI)

◆ lowerAbsToCNeg()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerAbsToCNeg ( MachineInstr MI)

◆ lowerAbsToMaxNeg()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerAbsToMaxNeg ( MachineInstr MI)

◆ lowerAddSubSatToAddoSubo()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerAddSubSatToAddoSubo ( MachineInstr MI)

◆ lowerAddSubSatToMinMax()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerAddSubSatToMinMax ( MachineInstr MI)

◆ lowerBitcast()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerBitcast ( MachineInstr MI)

◆ lowerBitCount()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerBitCount ( MachineInstr MI)

◆ lowerBitreverse()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerBitreverse ( MachineInstr MI)

◆ lowerBswap()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerBswap ( MachineInstr MI)

◆ lowerConstant()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerConstant ( MachineInstr MI)

◆ lowerDIVREM()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerDIVREM ( MachineInstr MI)

Definition at line 8701 of file LegalizerHelper.cpp.

References llvm::MachineIRBuilder::buildInstr(), getReg(), Legalized, MI, and MIRBuilder.

Referenced by lower().

◆ lowerDynStackAlloc()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerDynStackAlloc ( MachineInstr MI)

◆ lowerEXT()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerEXT ( MachineInstr MI)

◆ lowerExtract()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerExtract ( MachineInstr MI)

◆ lowerExtractInsertVectorElt()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerExtractInsertVectorElt ( MachineInstr MI)

◆ lowerFConstant()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFConstant ( MachineInstr MI)

◆ lowerFCopySign()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFCopySign ( MachineInstr MI)

◆ lowerFFloor()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFFloor ( MachineInstr MI)

◆ lowerFMad()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFMad ( MachineInstr MI)

◆ lowerFMinNumMaxNum()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFMinNumMaxNum ( MachineInstr MI)

◆ lowerFPOWI()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPOWI ( MachineInstr MI)

◆ lowerFPTOSI()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPTOSI ( MachineInstr MI)

◆ lowerFPTOUI()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPTOUI ( MachineInstr MI)

◆ lowerFPTRUNC()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPTRUNC ( MachineInstr MI)

◆ lowerFPTRUNC_F64_TO_F16()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPTRUNC_F64_TO_F16 ( MachineInstr MI)

◆ lowerFunnelShift()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFunnelShift ( MachineInstr MI)

Definition at line 6853 of file LegalizerHelper.cpp.

References llvm::LegalizerInfo::getAction(), llvm::MachineRegisterInfo::getType(), and MI.

Referenced by lower().

◆ lowerFunnelShiftAsShifts()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFunnelShiftAsShifts ( MachineInstr MI)

◆ lowerFunnelShiftWithInverse()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerFunnelShiftWithInverse ( MachineInstr MI)

◆ lowerInsert()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerInsert ( MachineInstr MI)

◆ lowerIntrinsicRound()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerIntrinsicRound ( MachineInstr MI)

◆ lowerISFPCLASS()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerISFPCLASS ( MachineInstr MI)

◆ lowerLoad()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerLoad ( GAnyLoad MI)

◆ lowerMemCpyFamily()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerMemCpyFamily ( MachineInstr MI,
unsigned  MaxLen = 0 
)

◆ lowerMemcpyInline()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerMemcpyInline ( MachineInstr MI)

◆ lowerMergeValues()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerMergeValues ( MachineInstr MI)

◆ lowerMinMax()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerMinMax ( MachineInstr MI)

◆ lowerReadWriteRegister()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerReadWriteRegister ( MachineInstr MI)

◆ lowerRotate()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerRotate ( MachineInstr MI)

◆ lowerRotateWithReverseRotate()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerRotateWithReverseRotate ( MachineInstr MI)

◆ lowerSADDO_SSUBO()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerSADDO_SSUBO ( MachineInstr MI)

◆ lowerSelect()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerSelect ( MachineInstr MI)

◆ lowerShlSat()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerShlSat ( MachineInstr MI)

◆ lowerShuffleVector()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerShuffleVector ( MachineInstr MI)

◆ lowerSITOFP()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerSITOFP ( MachineInstr MI)

◆ lowerSMULH_UMULH()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerSMULH_UMULH ( MachineInstr MI)

◆ lowerStackRestore()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerStackRestore ( MachineInstr MI)

◆ lowerStackSave()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerStackSave ( MachineInstr MI)

◆ lowerStore()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerStore ( GStore MI)

◆ lowerThreewayCompare()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerThreewayCompare ( MachineInstr MI)

◆ lowerTRUNC()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerTRUNC ( MachineInstr MI)

◆ lowerU64ToF32BitOps()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerU64ToF32BitOps ( MachineInstr MI)

◆ lowerUITOFP()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerUITOFP ( MachineInstr MI)

◆ lowerUnmergeValues()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerUnmergeValues ( MachineInstr MI)

◆ lowerVAArg()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerVAArg ( MachineInstr MI)

◆ lowerVECTOR_COMPRESS()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerVECTOR_COMPRESS ( llvm::MachineInstr MI)

◆ lowerVectorReduction()

LegalizerHelper::LegalizeResult LegalizerHelper::lowerVectorReduction ( MachineInstr MI)

◆ moreElementsVector()

LegalizerHelper::LegalizeResult LegalizerHelper::moreElementsVector ( MachineInstr MI,
unsigned  TypeIdx,
LLT  MoreTy 
)

◆ moreElementsVectorDst()

void LegalizerHelper::moreElementsVectorDst ( MachineInstr MI,
LLT  MoreTy,
unsigned  OpIdx 
)

◆ moreElementsVectorPhi()

LegalizerHelper::LegalizeResult LegalizerHelper::moreElementsVectorPhi ( MachineInstr MI,
unsigned  TypeIdx,
LLT  MoreTy 
)

◆ moreElementsVectorShuffle()

LegalizerHelper::LegalizeResult LegalizerHelper::moreElementsVectorShuffle ( MachineInstr MI,
unsigned  TypeIdx,
LLT  MoreTy 
)

◆ moreElementsVectorSrc()

void LegalizerHelper::moreElementsVectorSrc ( MachineInstr MI,
LLT  MoreTy,
unsigned  OpIdx 
)

Legalize a single operand OpIdx of the machine instruction MI as a Use by producing a vector with undefined high elements, extracting the original vector type, and replacing the vreg of the operand in place.

Definition at line 1974 of file LegalizerHelper.cpp.

References llvm::MachineIRBuilder::buildPadVectorWithUndefElements(), llvm::MachineInstrBuilder::getReg(), MI, MIRBuilder, and llvm::MachineOperand::setReg().

Referenced by moreElementsVector(), moreElementsVectorPhi(), and moreElementsVectorShuffle().

◆ narrowScalar()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalar ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

Legalize an instruction by reducing the width of the underlying scalar type.

Definition at line 1370 of file LegalizerHelper.cpp.

References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::MachineIRBuilder::buildAnyExt(), llvm::MachineIRBuilder::buildAShr(), llvm::MachineIRBuilder::buildBuildVector(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildLoad(), llvm::MachineIRBuilder::buildLoadInstr(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildMul(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildSExt(), llvm::MachineIRBuilder::buildStore(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineIRBuilder::buildUndef(), llvm::MachineIRBuilder::buildUnmerge(), llvm::MachineIRBuilder::buildVScale(), llvm::MachineIRBuilder::buildXor(), llvm::MachineIRBuilder::buildZExt(), llvm::CallingConv::C, llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::dbgs(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::extractParts(), llvm::LLT::getElementCount(), llvm::MachineBasicBlock::getFirstNonPHI(), llvm::MachineBasicBlock::getFirstTerminatorForward(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), getReg(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarSizeInBits(), llvm::MachineMemOperand::getSizeInBits(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::ICmpInst::getUnsignedPredicate(), llvm::LocationSize::getValue(), I, llvm::CmpInst::ICMP_EQ, llvm::SmallVectorImpl< T >::insert(), llvm::ICmpInst::isEquality(), llvm::LLT::isVector(), Legalized, LHS, LLVM_DEBUG, llvm::APInt::lshr(), MBB, MI, MIRBuilder, narrowScalarAddSub(), narrowScalarBasic(), narrowScalarCTLZ(), narrowScalarCTPOP(), narrowScalarCTTZ(), narrowScalarDst(), narrowScalarExt(), narrowScalarExtract(), narrowScalarFLDEXP(), narrowScalarFPTOI(), narrowScalarInsert(), narrowScalarMul(), narrowScalarSelect(), narrowScalarShift(), narrowScalarSrc(), Observer, llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), reduceLoadStoreWidth(), RHS, llvm::LLT::scalar(), llvm::MachineIRBuilder::setInsertPt(), llvm::MachineOperand::setReg(), llvm::SmallVectorBase< Size_T >::size(), llvm::APInt::trunc(), UnableToLegalize, llvm::LLT::vector(), llvm::Xor, and llvm::zip().

Referenced by llvm::AMDGPURegisterBankInfo::applyMappingImpl(), llvm::MipsRegisterBankInfo::applyMappingImpl(), llvm::AMDGPURegisterBankInfo::applyMappingLoad(), and legalizeInstrStep().

◆ narrowScalarAddSub()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarAddSub ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

◆ narrowScalarBasic()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarBasic ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarCTLZ()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarCTLZ ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarCTPOP()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarCTPOP ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarCTTZ()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarCTTZ ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarDst()

void LegalizerHelper::narrowScalarDst ( MachineInstr MI,
LLT  NarrowTy,
unsigned  OpIdx,
unsigned  ExtOpcode 
)

◆ narrowScalarExt()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarExt ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarExtract()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarExtract ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarFLDEXP()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarFLDEXP ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarFPTOI()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarFPTOI ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarInsert()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarInsert ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarMul()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarMul ( MachineInstr MI,
LLT  Ty 
)

◆ narrowScalarSelect()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarSelect ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarShift()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarShift ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

◆ narrowScalarShiftByConstant()

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarShiftByConstant ( MachineInstr MI,
const APInt Amt,
LLT  HalfTy,
LLT  ShiftAmtTy 
)

◆ narrowScalarSrc()

void LegalizerHelper::narrowScalarSrc ( MachineInstr MI,
LLT  NarrowTy,
unsigned  OpIdx 
)

Legalize a single operand OpIdx of the machine instruction MI as a Use by truncating the operand's type to NarrowTy using G_TRUNC, and replacing the vreg of the operand in place.

Definition at line 1939 of file LegalizerHelper.cpp.

References llvm::MachineIRBuilder::buildTrunc(), MI, MIRBuilder, and llvm::MachineOperand::setReg().

Referenced by narrowScalar(), and narrowScalarShift().

◆ reduceLoadStoreWidth()

LegalizerHelper::LegalizeResult LegalizerHelper::reduceLoadStoreWidth ( GLoadStore MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)

◆ widenScalar()

LegalizerHelper::LegalizeResult LegalizerHelper::widenScalar ( MachineInstr MI,
unsigned  TypeIdx,
LLT  WideTy 
)

Legalize an instruction by performing the operation on a wider scalar type (for example a 16-bit addition can be safely performed at 32-bits precision, ignoring the unused bits).

Definition at line 2525 of file LegalizerHelper.cpp.

References assert(), llvm::APFloat::bitcastToAPInt(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineIRBuilder::buildZExtOrTrunc(), llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::MCInstrInfo::get(), llvm::MachineIRBuilder::getBoolExtOp(), llvm::MachineOperand::getCImm(), llvm::Function::getContext(), llvm::LLT::getElementCount(), llvm::LLT::getElementType(), llvm::LegalizerInfo::getExtOpcodeForWideningConstant(), llvm::MachineBasicBlock::getFirstNonPHI(), llvm::MachineBasicBlock::getFirstTerminatorForward(), llvm::MachineOperand::getFPImm(), llvm::MachineFunction::getFunction(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), llvm::MachineIRBuilder::getMF(), llvm::APInt::getOneBitSet(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getSizeInBits(), llvm::MachineIRBuilder::getTII(), llvm::MachineRegisterInfo::getType(), llvm::ConstantInt::getValue(), llvm::ConstantFP::getValueAPF(), I, llvm::LLT::isScalar(), llvm::CmpInst::isSigned(), llvm::LLT::isVector(), Legalized, MBB, MI, MIRBuilder, Observer, llvm::MachineOperand::setCImm(), llvm::MachineIRBuilder::setInsertPt(), llvm::MachineIRBuilder::setInstrAndDebugLoc(), llvm::APInt::sext(), UnableToLegalize, llvm::LLT::vector(), widenScalarDst(), widenScalarSrc(), and llvm::APInt::zext().

Referenced by llvm::AMDGPURegisterBankInfo::applyMappingImpl(), and legalizeInstrStep().

◆ widenScalarDst()

void LegalizerHelper::widenScalarDst ( MachineInstr MI,
LLT  WideTy,
unsigned  OpIdx = 0,
unsigned  TruncOpcode = TargetOpcode::G_TRUNC 
)

Legalize a single operand OpIdx of the machine instruction MI as a Def by extending the operand's type to WideTy and truncating it back with the TruncOpcode, and replacing the vreg of the operand in place.

Definition at line 1946 of file LegalizerHelper.cpp.

References llvm::MachineIRBuilder::buildInstr(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), MI, MIRBuilder, llvm::MachineIRBuilder::setInsertPt(), and llvm::MachineOperand::setReg().

Referenced by llvm::AMDGPULegalizerInfo::legalizeSBufferLoad(), and widenScalar().

◆ widenScalarSrc()

void LegalizerHelper::widenScalarSrc ( MachineInstr MI,
LLT  WideTy,
unsigned  OpIdx,
unsigned  ExtOpcode 
)

Legalize a single operand OpIdx of the machine instruction MI as a Use by extending the operand's type to WideTy using the specified ExtOpcode for the extension instruction, and replacing the vreg of the operand in place.

Definition at line 1932 of file LegalizerHelper.cpp.

References llvm::MachineIRBuilder::buildInstr(), MI, MIRBuilder, and llvm::MachineOperand::setReg().

Referenced by widenScalar().

Member Data Documentation

◆ MIRBuilder

MachineIRBuilder& llvm::LegalizerHelper::MIRBuilder

Expose MIRBuilder so clients can set their own RecordInsertInstruction functions.

Definition at line 51 of file LegalizerHelper.h.

Referenced by bitcastDst(), bitcastExtractVectorElt(), bitcastInsertVectorElt(), bitcastSrc(), llvm::AMDGPULegalizerInfo::buildMultiply(), coerceToScalar(), convertPtrToInt(), createStackTemporary(), equalizeVectorShuffleLengths(), fewerElementsBitcast(), fewerElementsVectorExtractInsertVectorElt(), fewerElementsVectorMerge(), fewerElementsVectorMultiEltType(), fewerElementsVectorPhi(), fewerElementsVectorReductions(), fewerElementsVectorSeqReductions(), fewerElementsVectorShuffle(), fewerElementsVectorUnmergeValues(), getDynStackAllocTargetPtr(), getVectorElementPointer(), llvm::AArch64LegalizerInfo::legalizeCustom(), llvm::AMDGPULegalizerInfo::legalizeCustom(), llvm::ARMLegalizerInfo::legalizeCustom(), llvm::MipsLegalizerInfo::legalizeCustom(), llvm::RISCVLegalizerInfo::legalizeCustom(), llvm::SPIRVLegalizerInfo::legalizeCustom(), llvm::X86LegalizerInfo::legalizeCustom(), legalizeInstrStep(), llvm::AArch64LegalizerInfo::legalizeIntrinsic(), llvm::AMDGPULegalizerInfo::legalizeIntrinsic(), llvm::MipsLegalizerInfo::legalizeIntrinsic(), llvm::RISCVLegalizerInfo::legalizeIntrinsic(), llvm::AMDGPULegalizerInfo::legalizeLaneOp(), llvm::AMDGPULegalizerInfo::legalizeLoad(), llvm::Legalizer::legalizeMachineFunction(), llvm::AMDGPULegalizerInfo::legalizeMinNumMaxNum(), llvm::AMDGPULegalizerInfo::legalizeMul(), llvm::AMDGPULegalizerInfo::legalizeSBufferLoad(), llvm::AMDGPULegalizerInfo::legalizeStore(), libcall(), lower(), lowerAbsToAddXor(), lowerAbsToCNeg(), lowerAbsToMaxNeg(), lowerAddSubSatToAddoSubo(), lowerAddSubSatToMinMax(), lowerBitcast(), lowerBitCount(), lowerBitreverse(), lowerBswap(), lowerConstant(), lowerDIVREM(), lowerDynStackAlloc(), lowerEXT(), lowerExtract(), lowerExtractInsertVectorElt(), lowerFConstant(), lowerFCopySign(), lowerFFloor(), lowerFMad(), lowerFMinNumMaxNum(), lowerFPOWI(), lowerFPTOSI(), lowerFPTOUI(), lowerFPTRUNC_F64_TO_F16(), lowerFunnelShiftAsShifts(), lowerFunnelShiftWithInverse(), lowerInsert(), lowerIntrinsicRound(), lowerISFPCLASS(), lowerLoad(), lowerMergeValues(), lowerMinMax(), lowerReadWriteRegister(), lowerRotate(), lowerRotateWithReverseRotate(), lowerSADDO_SSUBO(), lowerSelect(), lowerShlSat(), lowerShuffleVector(), lowerSITOFP(), lowerSMULH_UMULH(), lowerStackRestore(), lowerStackSave(), lowerStore(), lowerThreewayCompare(), lowerTRUNC(), lowerU64ToF32BitOps(), lowerUITOFP(), lowerUnmergeValues(), lowerVAArg(), lowerVECTOR_COMPRESS(), lowerVectorReduction(), moreElementsVector(), moreElementsVectorDst(), moreElementsVectorPhi(), moreElementsVectorShuffle(), moreElementsVectorSrc(), narrowScalar(), narrowScalarAddSub(), narrowScalarBasic(), narrowScalarCTLZ(), narrowScalarCTPOP(), narrowScalarCTTZ(), narrowScalarDst(), narrowScalarExtract(), narrowScalarFLDEXP(), narrowScalarInsert(), narrowScalarMul(), narrowScalarSelect(), narrowScalarShift(), narrowScalarShiftByConstant(), narrowScalarSrc(), reduceLoadStoreWidth(), widenScalar(), widenScalarDst(), and widenScalarSrc().

◆ Observer

GISelChangeObserver& llvm::LegalizerHelper::Observer

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