LLVM 20.0.0git
|
#include "llvm/CodeGen/GlobalISel/LegalizerHelper.h"
Public Types | |
enum | LegalizeResult { AlreadyLegal , Legalized , UnableToLegalize } |
Public Attributes | |
MachineIRBuilder & | MIRBuilder |
Expose MIRBuilder so clients can set their own RecordInsertInstruction functions. | |
GISelChangeObserver & | Observer |
To keep track of changes made by the LegalizerHelper. | |
Definition at line 47 of file LegalizerHelper.h.
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.
LegalizerHelper::LegalizerHelper | ( | MachineFunction & | MF, |
GISelChangeObserver & | Observer, | ||
MachineIRBuilder & | B | ||
) |
Definition at line 104 of file LegalizerHelper.cpp.
LegalizerHelper::LegalizerHelper | ( | MachineFunction & | MF, |
const LegalizerInfo & | LI, | ||
GISelChangeObserver & | Observer, | ||
MachineIRBuilder & | B, | ||
GISelKnownBits * | KB = nullptr |
||
) |
Definition at line 111 of file LegalizerHelper.cpp.
LegalizerHelper::LegalizeResult LegalizerHelper::bitcast | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Legalize an instruction by replacing the value type.
Definition at line 4192 of file LegalizerHelper.cpp.
References bitcastConcatVector(), bitcastDst(), bitcastExtractSubvector(), bitcastExtractVectorElt(), bitcastInsertSubvector(), bitcastInsertVectorElt(), bitcastShuffleVector(), bitcastSrc(), llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::MachineMemOperand::clearRanges(), llvm::dbgs(), llvm::MachineMemOperand::getMemoryType(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isVector(), Legalized, LLVM_DEBUG, MI, Observer, llvm::MachineMemOperand::setType(), and UnableToLegalize.
Referenced by legalizeInstrStep().
LegalizerHelper::LegalizeResult LegalizerHelper::bitcastConcatVector | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | CastTy | ||
) |
Definition at line 3756 of file LegalizerHelper.cpp.
References llvm::LLT::getSizeInBits(), llvm::LegalizerInfo::isLegal(), MI, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by bitcast().
void LegalizerHelper::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
.
Definition at line 2065 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBitcast(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), MI, MIRBuilder, llvm::MachineIRBuilder::setInsertPt(), and llvm::MachineOperand::setReg().
Referenced by bitcast(), llvm::AMDGPULegalizerInfo::legalizeBufferLoad(), and llvm::AMDGPULegalizerInfo::legalizeSBufferLoad().
LegalizerHelper::LegalizeResult LegalizerHelper::bitcastExtractSubvector | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | CastTy | ||
) |
This attempts to bitcast G_EXTRACT_SUBVECTOR to CastTy.
<vscale x 8 x i1> = G_EXTRACT_SUBVECTOR <vscale x 16 x i1>, N
===>
<vscale x 2 x i1> = G_BITCAST <vscale x 16 x i1> <vscale x 1 x i8> = G_EXTRACT_SUBVECTOR <vscale x 2 x i1>, N / 8 <vscale x 8 x i1> = G_BITCAST <vscale x 1 x i8>
Definition at line 3835 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBitcast(), llvm::MachineIRBuilder::buildExtractSubvector(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::divideCoefficientBy(), llvm::MachineInstr::eraseFromParent(), llvm::LLT::getElementCount(), llvm::LLT::getElementType(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getKnownMinValue(), llvm::MachineIRBuilder::getMRI(), llvm::LLT::getSizeInBits(), Idx, llvm::LLT::isVector(), Legalized, MI, MIRBuilder, MRI, UnableToLegalize, and llvm::LLT::vector().
Referenced by bitcast().
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 3547 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().
LegalizerHelper::LegalizeResult LegalizerHelper::bitcastInsertSubvector | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | CastTy | ||
) |
This attempts to bitcast G_INSERT_SUBVECTOR to CastTy.
<vscale x 16 x i1> = G_INSERT_SUBVECTOR <vscale x 16 x i1>, <vscale x 8 x i1>, N
===>
<vscale x 2 x i8> = G_BITCAST <vscale x 16 x i1> <vscale x 1 x i8> = G_BITCAST <vscale x 8 x i1> <vscale x 2 x i8> = G_INSERT_SUBVECTOR <vscale x 2 x i8>, <vscale x 1 x i8>, N / 8 <vscale x 16 x i1> = G_BITCAST <vscale x 2 x i8>
Definition at line 3898 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBitcast(), llvm::MachineIRBuilder::buildInsertSubvector(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::divideCoefficientBy(), llvm::MachineInstr::eraseFromParent(), llvm::LLT::getElementCount(), llvm::LLT::getElementType(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getKnownMinValue(), llvm::MachineIRBuilder::getMRI(), llvm::LLT::getSizeInBits(), Idx, llvm::LLT::isVector(), Legalized, MI, MIRBuilder, MRI, UnableToLegalize, and llvm::LLT::vector().
Referenced by bitcast().
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 3683 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().
LegalizerHelper::LegalizeResult LegalizerHelper::bitcastShuffleVector | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | CastTy | ||
) |
Definition at line 3801 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildCast(), llvm::MachineIRBuilder::buildShuffleVector(), llvm::LLT::changeElementType(), llvm::LLT::getElementCount(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getScalarType(), llvm::MachineRegisterInfo::getType(), Legalized, MI, MIRBuilder, and UnableToLegalize.
Referenced by bitcast().
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 2060 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBitcast(), llvm::MachineInstrBuilder::getReg(), MI, and MIRBuilder.
Referenced by bitcast().
Cast the given value to an LLT::scalar with an equivalent size.
Returns the register to use if an instruction was inserted. Returns the original register if no coercion was necessary.
Definition at line 1990 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildBitcast(), llvm::MachineIRBuilder::buildPtrToInt(), DL, llvm::LLT::getAddressSpace(), llvm::MachineIRBuilder::getDataLayout(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isPointer(), llvm::LLT::isPointerVector(), llvm::LLT::isScalar(), llvm::LLT::isVector(), MIRBuilder, and llvm::LLT::scalar().
Referenced by lowerUnmergeValues().
MachineInstrBuilder LegalizerHelper::createStackTemporary | ( | TypeSize | Bytes, |
Align | Alignment, | ||
MachinePointerInfo & | PtrInfo | ||
) |
Create a stack temporary based on the size in bytes and the alignment.
Definition at line 4643 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildFrameIndex(), llvm::MachineFrameInfo::CreateStackObject(), DL, llvm::MachineIRBuilder::getDataLayout(), llvm::MachinePointerInfo::getFixedStack(), llvm::MachineFunction::getFrameInfo(), llvm::MachineIRBuilder::getMF(), MIRBuilder, and llvm::LLT::pointer().
Referenced by lowerExtractInsertVectorElt(), and lowerVECTOR_COMPRESS().
LegalizerHelper::LegalizeResult LegalizerHelper::equalizeVectorShuffleLengths | ( | MachineInstr & | MI | ) |
Equalize source and destination vector sizes of G_SHUFFLE_VECTOR.
Definition at line 6219 of file LegalizerHelper.cpp.
References llvm::alignTo(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::MachineIRBuilder::buildBuildVector(), llvm::MachineIRBuilder::buildConcatVectors(), llvm::MachineIRBuilder::buildExtractVectorElementConstant(), llvm::MachineIRBuilder::buildShuffleVector(), llvm::MachineIRBuilder::buildUndef(), llvm::copy(), llvm::LLT::fixed_vector(), llvm::LLT::getElementType(), llvm::LLT::getNumElements(), llvm::MachineInstrBuilder::getReg(), I, Idx, Legalized, MI, MIRBuilder, moreElementsVectorDst(), and llvm::MachineIRBuilder::setInstrAndDebugLoc().
Referenced by moreElementsVectorShuffle().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsBitcast | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 5397 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildBitcast(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::LLT::fixed_vector(), llvm::LLT::getElementType(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getSizeInBits(), Legalized, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by fewerElementsVector().
LegalizerHelper::LegalizeResult LegalizerHelper::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.
Definition at line 5222 of file LegalizerHelper.cpp.
References assert(), fewerElementsBitcast(), fewerElementsVectorExtractInsertVectorElt(), fewerElementsVectorMerge(), fewerElementsVectorMultiEltType(), fewerElementsVectorPhi(), fewerElementsVectorReductions(), fewerElementsVectorSeqReductions(), fewerElementsVectorShuffle(), fewerElementsVectorUnmergeValues(), llvm::LLT::getNumElements(), llvm::MachineRegisterInfo::getType(), GISEL_VECREDUCE_CASES_NONSEQ, llvm::LLT::isVector(), MI, reduceLoadStoreWidth(), and UnableToLegalize.
Referenced by llvm::AMDGPURegisterBankInfo::applyMappingLoad(), and legalizeInstrStep().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorExtractInsertVectorElt | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 5053 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildExtractVectorElement(), llvm::MachineIRBuilder::buildInsertVectorElement(), llvm::MachineIRBuilder::buildUndef(), llvm::getIConstantVRegValWithLookThrough(), llvm::LLT::getNumElements(), llvm::MachineRegisterInfo::getType(), Idx, llvm::LLT::isVector(), Legalized, lowerExtractInsertVectorElt(), MI, MIRBuilder, and UnableToLegalize.
Referenced by fewerElementsVector().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorMerge | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 4967 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildUnmerge(), llvm::LLT::getNumElements(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarType(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isVector(), Legalized, MI, MIRBuilder, llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and UnableToLegalize.
Referenced by fewerElementsVector().
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 4794 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().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorPhi | ( | GenericMachineInstr & | MI, |
unsigned | NumElts | ||
) |
Definition at line 4865 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::extractVectorParts(), llvm::MachineBasicBlock::getFirstNonPHI(), llvm::MachineBasicBlock::getFirstTerminatorForward(), llvm::LLT::getNumElements(), llvm::MachineRegisterInfo::getType(), Legalized, makeDstOps(), MBB, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::MachineIRBuilder::setInsertPt().
Referenced by fewerElementsVector().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorReductions | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 5565 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildInstr(), llvm::SmallVectorImpl< T >::clear(), llvm::SmallVectorImpl< T >::emplace_back(), llvm::extractParts(), llvm::LLT::getNumElements(), getReg(), llvm::MachineInstrBuilder::getReg(), Idx, llvm::isPowerOf2_32(), llvm::LLT::isScalar(), llvm::LLT::isVector(), Legalized, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by fewerElementsVector().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorSeqReductions | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 5652 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildInstr(), llvm::extractParts(), llvm::LLT::getNumElements(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::isScalar(), Legalized, MI, MIRBuilder, and UnableToLegalize.
Referenced by fewerElementsVector().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorShuffle | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 5427 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildBuildVector(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildShuffleVector(), llvm::MachineIRBuilder::buildUndef(), llvm::LLT::changeElementCount(), llvm::SmallVectorImpl< T >::clear(), llvm::extractParts(), llvm::LLT::getElementType(), llvm::LLT::getNumElements(), getReg(), llvm::MachineInstrBuilder::getReg(), llvm::Hi, High, Idx, llvm::isPowerOf2_32(), llvm::LLT::isVector(), Legalized, llvm::Lo, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LLT::scalar(), and UnableToLegalize.
Referenced by fewerElementsVector().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorUnmergeValues | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 4918 of file LegalizerHelper.cpp.
References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), assert(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildUnmerge(), llvm::MachineInstr::getNumOperands(), llvm::LLT::getScalarType(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), I, llvm::LLT::isVector(), Legalized, MI, MIRBuilder, and UnableToLegalize.
Referenced by fewerElementsVector().
Register LegalizerHelper::getDynStackAllocTargetPtr | ( | Register | SPReg, |
Register | AllocSize, | ||
Align | Alignment, | ||
LLT | PtrTy | ||
) |
Definition at line 8435 of file LegalizerHelper.cpp.
References llvm::Alloc, llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildCast(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildSub(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), MIRBuilder, llvm::APInt::negate(), llvm::LLT::scalar(), SPReg, and llvm::Align::value().
Referenced by lowerDynStackAlloc().
|
inline |
Definition at line 79 of file LegalizerHelper.h.
Referenced by llvm::AMDGPULegalizerInfo::buildMultiply().
|
inline |
Expose LegalizerInfo so the clients can re-use.
Definition at line 77 of file LegalizerHelper.h.
Return the alignment to use for a stack temporary object with the given type.
Definition at line 4632 of file LegalizerHelper.cpp.
References llvm::LLT::getSizeInBytes(), llvm::MinAlign(), and llvm::PowerOf2Ceil().
Referenced by lowerExtractInsertVectorElt(), and lowerVECTOR_COMPRESS().
|
inline |
Definition at line 78 of file LegalizerHelper.h.
Get a pointer to vector element Index
located in memory for a vector of type VecTy
starting at a base address of VecPtr
.
If Index
is out of bounds the returned pointer is unspecified, but will be within the vector bounds.
Definition at line 4677 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildMul(), llvm::MachineIRBuilder::buildPtrAdd(), llvm::MachineIRBuilder::buildSExtOrTrunc(), llvm::LLT::changeElementSize(), clampVectorIndex(), DL, llvm::LLT::getAddressSpace(), llvm::MachineIRBuilder::getDataLayout(), llvm::LLT::getElementType(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), MIRBuilder, and llvm::Mul.
Referenced by lowerExtractInsertVectorElt(), lowerVECTOR_COMPRESS(), and llvm::CombinerHelper::matchCombineExtractedVectorLoad().
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().
LegalizerHelper::LegalizeResult LegalizerHelper::libcall | ( | MachineInstr & | MI, |
LostDebugLocObserver & | LocObserver | ||
) |
Legalize an instruction by emiting a runtime library call instead.
Definition at line 1204 of file LegalizerHelper.cpp.
References conversionLibcall(), createAtomicLibcall(), llvm::createLibcall(), llvm::createMemLibcall(), llvm::dbgs(), llvm::IntegerType::get(), llvm::Function::getContext(), getFloatTypeForLLT(), llvm::MachineFunction::getFunction(), llvm::Type::getIntNTy(), llvm::MachineIRBuilder::getMF(), llvm::MachineIRBuilder::getMRI(), getReg(), getRTLibDesc(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), Legalized, llvm::LegalizeActions::Libcall, LLVM_DEBUG, MI, MIRBuilder, simpleLibcall(), Size, and UnableToLegalize.
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 4280 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(), Legalized, LHS, lowerAbsToAddXor(), lowerAddSubSatToAddoSubo(), lowerAddSubSatToMinMax(), lowerBitcast(), lowerBitCount(), lowerBitreverse(), lowerBswap(), lowerDIVREM(), lowerDynStackAlloc(), lowerEXT(), lowerExtract(), lowerExtractInsertVectorElt(), lowerFAbs(), lowerFConstant(), lowerFCopySign(), lowerFFloor(), lowerFMad(), lowerFMinNumMaxNum(), lowerFPOWI(), lowerFPTOINT_SAT(), 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().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerAbsToAddXor | ( | MachineInstr & | MI | ) |
Definition at line 9254 of file LegalizerHelper.cpp.
References llvm::Add, llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildAShr(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildXor(), llvm::LLT::getScalarSizeInBits(), llvm::MachineRegisterInfo::getType(), Legalized, MI, and MIRBuilder.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerAbsToCNeg | ( | MachineInstr & | MI | ) |
Definition at line 9286 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildSub(), llvm::MachineInstrBuilder::getReg(), llvm::MachineRegisterInfo::getType(), llvm::CmpInst::ICMP_SGT, Legalized, MI, MIRBuilder, and llvm::LLT::scalar().
Referenced by llvm::AArch64LegalizerInfo::legalizeCustom().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerAbsToMaxNeg | ( | MachineInstr & | MI | ) |
Definition at line 9271 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildSMax(), llvm::MachineIRBuilder::buildSub(), llvm::MachineRegisterInfo::getType(), Legalized, MI, and MIRBuilder.
Referenced by llvm::AMDGPURegisterBankInfo::applyMappingImpl(), and llvm::RISCVLegalizerInfo::legalizeCustom().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerAddSubSatToAddoSubo | ( | MachineInstr & | MI | ) |
Definition at line 8762 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildAShr(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildSelect(), llvm::LLT::changeElementSize(), llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSignedMinValue(), llvm::MachineRegisterInfo::getType(), Legalized, LHS, llvm_unreachable, MI, MIRBuilder, and RHS.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerAddSubSatToMinMax | ( | MachineInstr & | MI | ) |
Definition at line 8687 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildNot(), llvm::MachineIRBuilder::buildSMax(), llvm::MachineIRBuilder::buildSMin(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildUMin(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::MachineRegisterInfo::getType(), llvm::Hi, Legalized, LHS, llvm_unreachable, llvm::Lo, MI, MIRBuilder, and RHS.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerBitcast | ( | MachineInstr & | MI | ) |
Definition at line 3455 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBitcast(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::LLT::fixed_vector(), llvm::LLT::getElementType(), llvm::LLT::getNumElements(), llvm::MachineInstrBuilder::getReg(), getUnmergePieces(), llvm::LLT::isVector(), Legalized, MI, MIRBuilder, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerBitCount | ( | MachineInstr & | MI | ) |
Definition at line 6918 of file LegalizerHelper.cpp.
References llvm::LegalizeActionStep::Action, assert(), B, llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCTLZ(), llvm::MachineIRBuilder::buildCTLZ_ZERO_UNDEF(), llvm::MachineIRBuilder::buildCTPOP(), llvm::MachineIRBuilder::buildCTTZ_ZERO_UNDEF(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildXor(), llvm::GISelChangeObserver::changedInstr(), llvm::LLT::changeElementSize(), llvm::GISelChangeObserver::changingInstr(), llvm::LegalizeActions::Custom, llvm::LegalizerInfo::getAction(), llvm::LLT::getSizeInBits(), llvm::APInt::getSplat(), llvm::MachineIRBuilder::getTII(), llvm::MachineRegisterInfo::getType(), llvm::CmpInst::ICMP_EQ, llvm::IRSimilarity::Legal, Legalized, llvm::LegalizeActions::Libcall, MI, MIRBuilder, Observer, llvm::PowerOf2Ceil(), Size, TII, UnableToLegalize, and llvm::LegalizeActions::WidenScalar.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerBitreverse | ( | MachineInstr & | MI | ) |
Definition at line 8904 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSplat(), llvm::MachineRegisterInfo::getType(), I, Legalized, MI, MIRBuilder, Size, and SwapN().
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerBswap | ( | MachineInstr & | MI | ) |
Definition at line 8859 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::LLT::getScalarSizeInBits(), llvm::MachineRegisterInfo::getType(), Legalized, MI, and MIRBuilder.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerConstant | ( | MachineInstr & | MI | ) |
Definition at line 3433 of file LegalizerHelper.cpp.
References emitLoadFromConstantPool(), llvm::MachineOperand::getCImm(), Legalized, MI, and MIRBuilder.
Referenced by llvm::ARMLegalizerInfo::legalizeCustom(), and llvm::RISCVLegalizerInfo::legalizeCustom().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerDIVREM | ( | MachineInstr & | MI | ) |
Definition at line 9237 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildInstr(), getReg(), Legalized, MI, and MIRBuilder.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerDynStackAlloc | ( | MachineInstr & | MI | ) |
Definition at line 8459 of file LegalizerHelper.cpp.
References llvm::assumeAligned(), llvm::MachineIRBuilder::buildCopy(), getDynStackAllocTargetPtr(), llvm::TargetLoweringBase::getStackPointerRegisterToSaveRestore(), llvm::MachineRegisterInfo::getType(), Legalized, MI, MIRBuilder, SPReg, llvm::TargetFrameLowering::StackGrowsUp, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerEXT | ( | MachineInstr & | MI | ) |
Definition at line 7221 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildUnmerge(), llvm::LLT::changeElementCount(), llvm::LLT::changeElementSize(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::divideCoefficientBy(), llvm::LLT::getElementCount(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::isPowerOf2_32(), Legalized, MI, MIRBuilder, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerExtract | ( | MachineInstr & | MI | ) |
Definition at line 8504 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBitcast(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineIRBuilder::buildUnmerge(), llvm::LLT::getElementType(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), Idx, llvm::LLT::isScalar(), llvm::LLT::isVector(), Legalized, MI, MIRBuilder, llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LLT::scalar(), llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerExtractInsertVectorElt | ( | MachineInstr & | MI | ) |
Lower a vector extract or insert by writing the vector to a stack temporary and reloading the element or vector.
dst = G_EXTRACT_VECTOR_ELT vec, idx => stack_temp = G_FRAME_INDEX G_STORE vec, stack_temp idx = clamp(idx, vec.getNumElements()) element_ptr = G_PTR_ADD stack_temp, idx dst = G_LOAD element_ptr
Definition at line 8238 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildLoad(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildStore(), llvm::commonAlignment(), createStackTemporary(), llvm::dbgs(), llvm::extractParts(), llvm::LLT::getAddressSpace(), llvm::LLT::getElementType(), llvm::TypeSize::getFixed(), llvm::LLT::getNumElements(), llvm::LLT::getSizeInBytes(), getStackTemporaryAlignment(), llvm::MachineRegisterInfo::getType(), getVectorElementPointer(), llvm::MachinePointerInfo::getWithOffset(), Idx, llvm::LLT::isByteSized(), Legalized, LLVM_DEBUG, llvm::MIPatternMatch::m_ICst(), MI, llvm::MIPatternMatch::mi_match(), MIRBuilder, llvm::Offset, and UnableToLegalize.
Referenced by fewerElementsVectorExtractInsertVectorElt(), and lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFAbs | ( | MachineInstr & | MI | ) |
Definition at line 9298 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSignedMaxValue(), llvm::MachineRegisterInfo::getType(), Legalized, MI, and MIRBuilder.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFConstant | ( | MachineInstr & | MI | ) |
Definition at line 3444 of file LegalizerHelper.cpp.
References emitLoadFromConstantPool(), llvm::MachineOperand::getFPImm(), Legalized, MI, and MIRBuilder.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFCopySign | ( | MachineInstr & | MI | ) |
Definition at line 8017 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineIRBuilder::buildZExt(), llvm::MachineInstr::Disjoint, llvm::APInt::getLowBitsSet(), llvm::MachineInstrBuilder::getReg(), llvm::APInt::getSignMask(), Legalized, MI, and MIRBuilder.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFFloor | ( | MachineInstr & | MI | ) |
Definition at line 8134 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildFAdd(), llvm::MachineIRBuilder::buildFCmp(), llvm::MachineIRBuilder::buildFConstant(), llvm::MachineIRBuilder::buildIntrinsicTrunc(), llvm::MachineIRBuilder::buildSITOFP(), llvm::LLT::changeElementSize(), llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::MachineRegisterInfo::getType(), Legalized, MI, and MIRBuilder.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFMad | ( | MachineInstr & | MI | ) |
Definition at line 8087 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildFAdd(), llvm::MachineIRBuilder::buildFMul(), llvm::MachineRegisterInfo::getType(), Legalized, MI, MIRBuilder, and llvm::Mul.
Referenced by llvm::AMDGPULegalizerInfo::legalizeFMad(), and lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFMinNumMaxNum | ( | MachineInstr & | MI | ) |
Definition at line 8059 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildFCanonicalize(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineInstr::FmNoNans, llvm::MachineInstrBuilder::getReg(), llvm::MachineRegisterInfo::getType(), llvm::isKnownNeverSNaN(), Legalized, MI, and MIRBuilder.
Referenced by llvm::AMDGPULegalizerInfo::legalizeMinNumMaxNum(), and lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPOWI | ( | MachineInstr & | MI | ) |
Definition at line 7931 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildFPow(), llvm::MachineIRBuilder::buildSITOFP(), llvm::MachineRegisterInfo::getType(), Legalized, MI, and MIRBuilder.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPTOINT_SAT | ( | MachineInstr & | MI | ) |
Definition at line 7704 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildFCmp(), llvm::MachineIRBuilder::buildFConstant(), llvm::MachineIRBuilder::buildFPTOSI(), llvm::MachineIRBuilder::buildFPTOUI(), llvm::MachineIRBuilder::buildSelect(), llvm::LLT::changeElementSize(), llvm::APFloat::convertFromAPInt(), llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNO, llvm::MachineInstr::FmNoNans, llvm::getFltSemanticForLLT(), llvm::APInt::getMaxValue(), llvm::APInt::getMinValue(), llvm::LLT::getScalarType(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), Legalized, MI, MIRBuilder, llvm::APFloatBase::opInexact, and llvm::APFloatBase::rmTowardZero.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPTOSI | ( | MachineInstr & | MI | ) |
Definition at line 7639 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildAShr(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildSExt(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildXor(), llvm::MachineIRBuilder::buildZExt(), llvm::Exponent, llvm::LLT::getScalarSizeInBits(), llvm::LLT::getScalarType(), llvm::APInt::getSignMask(), llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, Legalized, MI, MIRBuilder, S1, S32, S64, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPTOUI | ( | MachineInstr & | MI | ) |
Definition at line 7599 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildFCmp(), llvm::MachineIRBuilder::buildFConstant(), llvm::MachineIRBuilder::buildFPTOSI(), llvm::MachineIRBuilder::buildFSub(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildXor(), llvm::APFloat::convertFromAPInt(), llvm::CmpInst::FCMP_ULT, llvm::APInt::getSignMask(), llvm::LLT::getSizeInBits(), llvm::APInt::getZero(), llvm::APFloatBase::IEEEdouble(), llvm::APFloatBase::IEEEsingle(), Legalized, MI, MIRBuilder, llvm::APFloatBase::rmNearestTiesToEven, S1, S32, S64, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPTRUNC | ( | MachineInstr & | MI | ) |
Definition at line 7920 of file LegalizerHelper.cpp.
References llvm::LLT::getScalarType(), lowerFPTRUNC_F64_TO_F16(), MI, S16, S64, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPTRUNC_F64_TO_F16 | ( | MachineInstr & | MI | ) |
Definition at line 7805 of file LegalizerHelper.cpp.
References assert(), B, llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildFPTrunc(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildSMax(), llvm::MachineIRBuilder::buildSMin(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineIRBuilder::buildUnmerge(), llvm::MachineIRBuilder::buildZExt(), D, llvm::MachineIRBuilder::getMF(), llvm::LLT::getScalarType(), llvm::MachineFunction::getTarget(), llvm::MachineRegisterInfo::getType(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::LLT::isVector(), Legalized, MI, MIRBuilder, N, llvm::TargetMachine::Options, S1, S32, llvm::LLT::scalar(), UnableToLegalize, and llvm::TargetOptions::UnsafeFPMath.
Referenced by lowerFPTRUNC().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFunnelShift | ( | MachineInstr & | MI | ) |
Definition at line 7198 of file LegalizerHelper.cpp.
References llvm::LegalizerInfo::getAction(), llvm::MachineRegisterInfo::getType(), and MI.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFunnelShiftAsShifts | ( | MachineInstr & | MI | ) |
Definition at line 7143 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildNot(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildURem(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarSizeInBits(), llvm::MachineRegisterInfo::getType(), isNonZeroModBitWidthOrUndef(), llvm::isPowerOf2_32(), Legalized, MI, MIRBuilder, X, and Y.
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFunnelShiftWithInverse | ( | MachineInstr & | MI | ) |
Definition at line 7104 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildNot(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildSub(), getReg(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarSizeInBits(), llvm::MachineRegisterInfo::getType(), isNonZeroModBitWidthOrUndef(), llvm::isPowerOf2_32(), Legalized, MI, MIRBuilder, UnableToLegalize, X, and Y.
LegalizerHelper::LegalizeResult LegalizerHelper::lowerInsert | ( | MachineInstr & | MI | ) |
Definition at line 8558 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildCast(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildPtrToInt(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildUnmerge(), llvm::MachineIRBuilder::buildZExt(), llvm::dbgs(), DL, llvm::LLT::getAddressSpace(), llvm::APInt::getBitsSetWithWrap(), llvm::MachineIRBuilder::getDataLayout(), llvm::LLT::getElementType(), llvm::LLT::getNumElements(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), Idx, llvm::LLT::isPointer(), llvm::LLT::isScalar(), llvm::LLT::isVector(), Legalized, LLVM_DEBUG, MI, MIRBuilder, llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerIntrinsicRound | ( | MachineInstr & | MI | ) |
Definition at line 8101 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildFAbs(), llvm::MachineIRBuilder::buildFAdd(), llvm::MachineIRBuilder::buildFCmp(), llvm::MachineIRBuilder::buildFConstant(), llvm::MachineIRBuilder::buildFCopysign(), llvm::MachineIRBuilder::buildFSub(), llvm::MachineIRBuilder::buildIntrinsicTrunc(), llvm::MachineIRBuilder::buildSelect(), llvm::LLT::changeElementSize(), llvm::CmpInst::FCMP_OGE, llvm::MachineRegisterInfo::getType(), Legalized, MI, MIRBuilder, and X.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerISFPCLASS | ( | MachineInstr & | MI | ) |
Definition at line 9006 of file LegalizerHelper.cpp.
References llvm::APFloat::bitcastToAPInt(), llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildXor(), llvm::fcAllFlags, llvm::fcFinite, llvm::fcInf, llvm::fcNan, llvm::fcNegFinite, llvm::fcNegNormal, llvm::fcNegSubnormal, llvm::fcNone, llvm::fcNormal, llvm::fcPosFinite, llvm::fcPosInf, llvm::fcPosNormal, llvm::fcPosSubnormal, llvm::fcPosZero, llvm::fcQNan, llvm::fcSubnormal, llvm::fcZero, llvm::APInt::getActiveBits(), llvm::APInt::getAllOnes(), llvm::LLT::getElementCount(), llvm::getFltSemanticForLLT(), llvm::APFloat::getInf(), llvm::APFloat::getLargest(), llvm::APInt::getOneBitSet(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getScalarType(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignMask(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::LLT::isVector(), Legalized, MI, MIRBuilder, llvm::LLT::scalar(), llvm::APInt::shl(), and llvm::LLT::vector().
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerLoad | ( | GAnyLoad & | MI | ) |
Definition at line 3955 of file LegalizerHelper.cpp.
References llvm::TargetLoweringBase::allowsMemoryAccess(), assert(), llvm::bit_floor(), llvm::MachineIRBuilder::buildAssertZExt(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildIntToPtr(), llvm::MachineIRBuilder::buildLoad(), llvm::MachineIRBuilder::buildLoadInstr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildPtrAdd(), llvm::MachineIRBuilder::buildSExtInReg(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::MachineInstr::eraseFromParent(), llvm::Function::getContext(), llvm::MachineIRBuilder::getDataLayout(), llvm::GAnyLoad::getDstReg(), llvm::LLT::getElementType(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getMachineMemOperand(), llvm::MachineMemOperand::getMemoryType(), llvm::MachineIRBuilder::getMF(), llvm::GMemOperation::getMMO(), llvm::MachineInstr::getOpcode(), llvm::MachineMemOperand::getPointerInfo(), llvm::GLoadStore::getPointerReg(), llvm::LLT::getSizeInBits(), llvm::LLT::getSizeInBytes(), llvm::MachineRegisterInfo::getType(), llvm::DataLayout::isBigEndian(), llvm::LLT::isPointer(), llvm::isPowerOf2_32(), llvm::LLT::isVector(), Legalized, MIRBuilder, llvm::PowerOf2Ceil(), reduceLoadStoreWidth(), llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerMemCpyFamily | ( | MachineInstr & | MI, |
unsigned | MaxLen = 0 |
||
) |
Definition at line 9856 of file LegalizerHelper.cpp.
References assert(), llvm::getIConstantVRegValWithLookThrough(), llvm::TargetLoweringBase::getMaxStoresPerMemcpy(), Legalized, MI, shouldLowerMemFuncForSize(), and UnableToLegalize.
Referenced by lower(), and llvm::CombinerHelper::tryCombineMemCpyFamily().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerMemcpyInline | ( | MachineInstr & | MI | ) |
Definition at line 9603 of file LegalizerHelper.cpp.
References assert(), llvm::getIConstantVRegValWithLookThrough(), Legalized, and MI.
LegalizerHelper::LegalizeResult LegalizerHelper::lowerMergeValues | ( | MachineInstr & | MI | ) |
Definition at line 8160 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildIntToPtr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildZExt(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::dbgs(), llvm::MachineIRBuilder::getDataLayout(), llvm::MachineInstrBuilder::getReg(), I, llvm::DataLayout::isNonIntegralAddressSpace(), Legalized, LLVM_DEBUG, MI, MIRBuilder, llvm::Offset, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerMinMax | ( | MachineInstr & | MI | ) |
Definition at line 7956 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildSelect(), llvm::LLT::changeElementSize(), llvm::MachineRegisterInfo::getType(), Legalized, MI, minMaxToCompare(), and MIRBuilder.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerReadWriteRegister | ( | MachineInstr & | MI | ) |
Definition at line 8958 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildCopy(), llvm::StringRef::data(), llvm::MachineIRBuilder::getMF(), llvm::TargetLowering::getRegisterByName(), llvm::MDString::getString(), llvm::MachineRegisterInfo::getType(), llvm::Register::isValid(), Legalized, MI, MIRBuilder, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerRotate | ( | MachineInstr & | MI | ) |
Definition at line 7332 of file LegalizerHelper.cpp.
References llvm::LegalizerInfo::isLegalOrCustom(), MI, MIRBuilder, and llvm::MachineIRBuilder::setInstrAndDebugLoc().
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerRotateWithReverseRotate | ( | MachineInstr & | MI | ) |
Definition at line 7321 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildSub(), Legalized, MI, and MIRBuilder.
LegalizerHelper::LegalizeResult LegalizerHelper::lowerSADDO_SSUBO | ( | MachineInstr & | MI | ) |
Definition at line 8648 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildXor(), llvm::MachineRegisterInfo::cloneVirtualRegister(), llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, Legalized, LHS, MI, MIRBuilder, and RHS.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerSelect | ( | MachineInstr & | MI | ) |
Definition at line 9179 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildIntToPtr(), llvm::MachineIRBuilder::buildNot(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildPtrToInt(), llvm::MachineIRBuilder::buildSExtInReg(), llvm::MachineIRBuilder::buildSExtOrTrunc(), llvm::MachineIRBuilder::buildShuffleSplat(), llvm::LLT::changeElementType(), llvm::MachineInstrBuilder::getReg(), Legalized, MI, MIRBuilder, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerShlSat | ( | MachineInstr & | MI | ) |
Definition at line 8828 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildAShr(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildShl(), llvm::LLT::changeElementSize(), llvm::APInt::getMaxValue(), llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::MachineRegisterInfo::getType(), llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SLT, Legalized, LHS, MI, MIRBuilder, and RHS.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerShuffleVector | ( | MachineInstr & | MI | ) |
Definition at line 8310 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBuildVector(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildExtractVectorElement(), llvm::MachineIRBuilder::buildUndef(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarType(), Idx, Legalized, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::LLT::scalar().
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerSITOFP | ( | MachineInstr & | MI | ) |
Definition at line 7556 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildAShr(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildFConstant(), llvm::MachineIRBuilder::buildFNeg(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildUITOFP(), llvm::MachineIRBuilder::buildXor(), llvm::CmpInst::ICMP_NE, Legalized, MI, MIRBuilder, S1, S32, S64, llvm::LLT::scalar(), UnableToLegalize, and llvm::Xor.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerSMULH_UMULH | ( | MachineInstr & | MI | ) |
Definition at line 8984 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildMul(), llvm::MachineIRBuilder::buildTrunc(), llvm::LLT::changeElementSize(), llvm::LLT::getScalarSizeInBits(), llvm::MachineRegisterInfo::getType(), Legalized, LHS, MI, MIRBuilder, llvm::Mul, and RHS.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerStackRestore | ( | MachineInstr & | MI | ) |
Definition at line 8493 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildCopy(), llvm::TargetLoweringBase::getStackPointerRegisterToSaveRestore(), Legalized, MI, MIRBuilder, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerStackSave | ( | MachineInstr & | MI | ) |
Definition at line 8482 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildCopy(), llvm::TargetLoweringBase::getStackPointerRegisterToSaveRestore(), Legalized, MI, MIRBuilder, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerStore | ( | GStore & | MI | ) |
Definition at line 4092 of file LegalizerHelper.cpp.
References llvm::TargetLoweringBase::allowsMemoryAccess(), llvm::MachineIRBuilder::buildAnyExt(), llvm::MachineIRBuilder::buildAnyExtOrTrunc(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildPtrAdd(), llvm::MachineIRBuilder::buildPtrToInt(), llvm::MachineIRBuilder::buildStore(), llvm::MachineIRBuilder::buildZExtInReg(), llvm::MachineInstr::eraseFromParent(), llvm::Function::getContext(), llvm::MachineIRBuilder::getDataLayout(), llvm::LLT::getElementType(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getMachineMemOperand(), llvm::MachineMemOperand::getMemoryType(), llvm::MachineIRBuilder::getMF(), llvm::MachineMemOperand::getPointerInfo(), llvm::GLoadStore::getPointerReg(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), llvm::LLT::getSizeInBytes(), llvm::MachineRegisterInfo::getType(), llvm::GStore::getValueReg(), llvm::LLT::isPointer(), llvm::isPowerOf2_32(), llvm::LLT::isVector(), Legalized, llvm::MachineInstr::memoperands_begin(), MIRBuilder, llvm::PowerOf2Ceil(), reduceLoadStoreWidth(), llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerThreewayCompare | ( | MachineInstr & | MI | ) |
Definition at line 7970 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildSub(), llvm::LLT::changeElementSize(), llvm::getApproximateEVTForLLT(), llvm::TargetLoweringBase::getBooleanContents(), llvm::MachineIRBuilder::getBoolExtOp(), llvm::Function::getContext(), llvm::MachineFunction::getFunction(), llvm::MachineIRBuilder::getMF(), llvm::MachineRegisterInfo::getType(), llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::LLT::isVector(), Legalized, MI, MIRBuilder, llvm::TargetLoweringBase::shouldExpandCmpUsingSelects(), std::swap(), llvm::TargetLoweringBase::UndefinedBooleanContent, and llvm::TargetLoweringBase::ZeroOrNegativeOneBooleanContent.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerTRUNC | ( | MachineInstr & | MI | ) |
Definition at line 7263 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildTrunc(), llvm::LLT::changeElementCount(), llvm::LLT::changeElementSize(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::divideCoefficientBy(), llvm::extractParts(), llvm::LLT::getElementCount(), llvm::MachineIRBuilder::getMRI(), llvm::LLT::getNumElements(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarSizeInBits(), I, llvm::isPowerOf2_32(), llvm::LLT::isVector(), Legalized, Merge, MI, MIRBuilder, MRI, llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerU64ToF32BitOps | ( | MachineInstr & | MI | ) |
Definition at line 7402 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCTLZ_ZERO_UNDEF(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildTrunc(), llvm::CallingConv::C, llvm::MachineRegisterInfo::getType(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_UGT, Legalized, MI, MIRBuilder, S1, S32, S64, and llvm::LLT::scalar().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerU64ToF32WithSITOFP | ( | MachineInstr & | MI | ) |
Definition at line 7460 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildFAdd(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildSITOFP(), llvm::MachineRegisterInfo::getType(), llvm::CmpInst::ICMP_SLT, Legalized, MI, MIRBuilder, S1, S32, S64, and llvm::LLT::scalar().
Referenced by lowerUITOFP().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerU64ToF64BitFloatOps | ( | MachineInstr & | MI | ) |
Definition at line 7495 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildFAdd(), llvm::MachineIRBuilder::buildFConstant(), llvm::MachineIRBuilder::buildFSub(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineIRBuilder::buildZExt(), llvm::MachineRegisterInfo::getType(), Legalized, MI, MIRBuilder, S32, S64, and llvm::LLT::scalar().
Referenced by lowerUITOFP().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerUITOFP | ( | MachineInstr & | MI | ) |
Definition at line 7529 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildFConstant(), llvm::MachineIRBuilder::buildSelect(), Legalized, lowerU64ToF32WithSITOFP(), lowerU64ToF64BitFloatOps(), MI, MIRBuilder, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerUnmergeValues | ( | MachineInstr & | MI | ) |
Definition at line 8198 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildTrunc(), coerceToScalar(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), I, llvm::LLT::isPointer(), Legalized, MI, MIRBuilder, llvm::Offset, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerVAArg | ( | MachineInstr & | MI | ) |
Definition at line 9333 of file LegalizerHelper.cpp.
References A, llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildLoad(), llvm::MachineIRBuilder::buildMaskLowPtrBits(), llvm::MachineIRBuilder::buildPtrAdd(), llvm::MachineIRBuilder::buildStore(), DL, llvm::Function::getContext(), llvm::MachineIRBuilder::getDataLayout(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getMachineMemOperand(), llvm::TargetLoweringBase::getMinStackArgumentAlignment(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::getTypeForLLT(), Legalized, llvm::Log2(), MI, MIRBuilder, llvm::MachineMemOperand::MOLoad, llvm::MachineMemOperand::MOStore, and llvm::LLT::scalar().
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerVECTOR_COMPRESS | ( | llvm::MachineInstr & | MI | ) |
Definition at line 8349 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildExtractVectorElement(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildLoad(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildStore(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineIRBuilder::buildZExt(), createStackTemporary(), llvm::LLT::getElementType(), llvm::TypeSize::getFixed(), llvm::LLT::getNumElements(), llvm::MachineInstr::getOpcode(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), getStackTemporaryAlignment(), llvm::MachinePointerInfo::getUnknownStack(), getVectorElementPointer(), llvm::MachineRegisterInfo::getVRegDef(), I, llvm::CmpInst::ICMP_UGT, Idx, llvm::isConstantOrConstantSplatVector(), Legalized, MI, MIRBuilder, llvm::report_fatal_error(), and llvm::LLT::scalar().
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerVectorReduction | ( | MachineInstr & | MI | ) |
Definition at line 9315 of file LegalizerHelper.cpp.
References llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::MCInstrInfo::get(), llvm::LLT::getSizeInBits(), llvm::MachineIRBuilder::getTII(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isScalar(), Legalized, MI, MIRBuilder, Observer, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::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.
Definition at line 5966 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildDeleteTrailingVectorElements(), llvm::MachineIRBuilder::buildInsertVectorElement(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildPadVectorWithUndefElements(), llvm::MachineIRBuilder::buildShuffleSplat(), llvm::MachineIRBuilder::buildUndef(), llvm::GISelChangeObserver::changedInstr(), llvm::LLT::changeElementCount(), llvm::GISelChangeObserver::changingInstr(), llvm::LLT::fixed_vector(), llvm::ElementCount::get(), llvm::MachineIRBuilder::getDataLayout(), llvm::LLT::getElementCount(), llvm::LLT::getElementType(), llvm::LLT::getNumElements(), llvm::LLT::getScalarType(), llvm::MachineRegisterInfo::getType(), llvm::TargetLoweringBase::getVectorIdxTy(), Idx, llvm::LLT::isScalable(), Legalized, MI, MIRBuilder, moreElementsVectorDst(), moreElementsVectorPhi(), moreElementsVectorShuffle(), moreElementsVectorSrc(), Observer, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::MachineOperand::setReg(), llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by legalizeInstrStep().
void LegalizerHelper::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.
Definition at line 2043 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildDeleteTrailingVectorElements(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), llvm::MachineOperand::getReg(), MI, MIRBuilder, llvm::MachineIRBuilder::setInsertPt(), and llvm::MachineOperand::setReg().
Referenced by equalizeVectorShuffleLengths(), llvm::AMDGPULegalizerInfo::legalizeSBufferLoad(), moreElementsVector(), moreElementsVectorPhi(), and moreElementsVectorShuffle().
LegalizerHelper::LegalizeResult LegalizerHelper::moreElementsVectorPhi | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | MoreTy | ||
) |
Definition at line 5910 of file LegalizerHelper.cpp.
References assert(), llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::MachineBasicBlock::getFirstNonPHI(), llvm::MachineBasicBlock::getFirstTerminator(), I, Legalized, MBB, MI, MIRBuilder, moreElementsVectorDst(), moreElementsVectorSrc(), Observer, and llvm::MachineIRBuilder::setInsertPt().
Referenced by moreElementsVector().
LegalizerHelper::LegalizeResult LegalizerHelper::moreElementsVectorShuffle | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | MoreTy | ||
) |
Definition at line 6290 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildShuffleVector(), equalizeVectorShuffleLengths(), llvm::LLT::getNumElements(), I, Idx, Legalized, MI, MIRBuilder, moreElementsVectorDst(), moreElementsVectorSrc(), llvm::MachineIRBuilder::setInstrAndDebugLoc(), and UnableToLegalize.
Referenced by moreElementsVector().
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 2053 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildPadVectorWithUndefElements(), llvm::MachineInstrBuilder::getReg(), MI, MIRBuilder, and llvm::MachineOperand::setReg().
Referenced by moreElementsVector(), moreElementsVectorPhi(), and moreElementsVectorShuffle().
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 1412 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::SmallVectorBase< Size_T >::empty(), 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().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarAddSub | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 6394 of file LegalizerHelper.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::extractParts(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isVector(), Legalized, llvm_unreachable, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::LLT::scalar(), llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarBasic | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6696 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildInstr(), llvm::extractParts(), llvm::MachineRegisterInfo::getType(), I, Legalized, llvm_unreachable, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarCTLZ | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6804 of file LegalizerHelper.cpp.
References B, llvm::LLT::getSizeInBits(), llvm::CmpInst::ICMP_EQ, llvm::LLT::isScalar(), Legalized, MI, MIRBuilder, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarCTPOP | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6870 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildCTPOP(), llvm::MachineIRBuilder::buildUnmerge(), llvm::LLT::getSizeInBits(), llvm::LLT::isScalar(), Legalized, MI, MIRBuilder, and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarCTTZ | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6837 of file LegalizerHelper.cpp.
References B, llvm::LLT::getSizeInBits(), llvm::CmpInst::ICMP_EQ, llvm::LLT::isScalar(), Legalized, MI, MIRBuilder, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by narrowScalar().
void LegalizerHelper::narrowScalarDst | ( | MachineInstr & | MI, |
LLT | NarrowTy, | ||
unsigned | OpIdx, | ||
unsigned | ExtOpcode | ||
) |
Definition at line 2034 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 narrowScalar(), and narrowScalarFPTOI().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarExt | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6737 of file LegalizerHelper.cpp.
References llvm::MachineRegisterInfo::getType(), llvm::LLT::isVector(), Legalized, MI, and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarExtract | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6545 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBuildVector(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildExtract(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::extractParts(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isVector(), Legalized, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LLT::scalar(), llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarFLDEXP | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6893 of file LegalizerHelper.cpp.
References B, llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::LLT::getScalarSizeInBits(), llvm::MachineRegisterInfo::getType(), Legalized, llvm::maxIntN(), MI, llvm::minIntN(), MIRBuilder, Observer, and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarFPTOI | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6520 of file LegalizerHelper.cpp.
References llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getScalarType(), llvm::MachineRegisterInfo::getType(), Legalized, MI, narrowScalarDst(), Observer, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarInsert | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6613 of file LegalizerHelper.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::MachineIRBuilder::buildAnyExt(), llvm::MachineIRBuilder::buildExtract(), llvm::MachineIRBuilder::buildInsert(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::extractParts(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), I, Legalized, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LLT::scalar(), llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarMul | ( | MachineInstr & | MI, |
LLT | Ty | ||
) |
Definition at line 6490 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::extractParts(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isVector(), Legalized, MI, MIRBuilder, Size, and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarSelect | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6758 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildSelect(), llvm::extractParts(), llvm::MachineRegisterInfo::getType(), I, llvm::LLT::isVector(), Legalized, llvm_unreachable, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), Select, llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarShift | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 5801 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAShr(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildUnmerge(), llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::getIConstantVRegValWithLookThrough(), llvm::LLT::getScalarSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::Hi, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_ULT, llvm::LLT::isVector(), Legalized, llvm_unreachable, llvm::Lo, MI, MIRBuilder, narrowScalarShiftByConstant(), narrowScalarSrc(), Observer, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarShiftByConstant | ( | MachineInstr & | MI, |
const APInt & | Amt, | ||
LLT | HalfTy, | ||
LLT | ShiftAmtTy | ||
) |
Definition at line 5712 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAShr(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildUnmerge(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::LLT::getSizeInBits(), llvm::Hi, llvm::APInt::isZero(), Legalized, llvm::Lo, MI, MIRBuilder, and llvm::APInt::ugt().
Referenced by narrowScalarShift().
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 2018 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildTrunc(), MI, MIRBuilder, and llvm::MachineOperand::setReg().
Referenced by narrowScalar(), and narrowScalarShift().
LegalizerHelper::LegalizeResult LegalizerHelper::reduceLoadStoreWidth | ( | GLoadStore & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 5127 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildLoad(), llvm::MachineIRBuilder::buildStore(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::dbgs(), llvm::MachineInstr::eraseFromParent(), llvm::extractParts(), llvm::MachineIRBuilder::getDataLayout(), llvm::MachineFunction::getMachineMemOperand(), llvm::GMemOperation::getMemSize(), llvm::MachineIRBuilder::getMF(), llvm::GMemOperation::getMMO(), getNarrowTypeBreakDown(), llvm::GLoadStore::getPointerReg(), llvm::GenericMachineInstr::getReg(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::LocationSize::getValue(), Idx, llvm::GMemOperation::isAtomic(), llvm::DataLayout::isBigEndian(), isBigEndian(), llvm::LLT::isValid(), Legalized, LLVM_DEBUG, llvm::MachineIRBuilder::materializePtrAdd(), MIRBuilder, llvm::Offset, llvm::LLT::scalar(), llvm::SmallVectorBase< Size_T >::size(), and UnableToLegalize.
Referenced by llvm::AMDGPURegisterBankInfo::applyMappingLoad(), fewerElementsVector(), lowerLoad(), lowerStore(), and narrowScalar().
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 2604 of file LegalizerHelper.cpp.
References assert(), llvm::APFloat::bitcastToAPInt(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildInsertSubvector(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildSMax(), llvm::MachineIRBuilder::buildSMin(), llvm::MachineIRBuilder::buildSplatVector(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineIRBuilder::buildUMin(), llvm::MachineIRBuilder::buildZExt(), llvm::MachineIRBuilder::buildZExtOrTrunc(), llvm::GISelChangeObserver::changedInstr(), llvm::LLT::changeElementType(), llvm::GISelChangeObserver::changingInstr(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::MCInstrInfo::get(), llvm::APInt::getAllOnes(), llvm::getApproximateEVTForLLT(), llvm::GInsertSubvector::getBigVec(), 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::GInsertSubvector::getIndexImm(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), llvm::MachineIRBuilder::getMF(), llvm::APInt::getOneBitSet(), llvm::GenericMachineInstr::getReg(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::LLT::getSizeInBits(), llvm::GInsertSubvector::getSubVec(), llvm::MachineIRBuilder::getTII(), llvm::MachineRegisterInfo::getType(), llvm::ConstantInt::getValue(), llvm::ConstantFP::getValueAPF(), I, llvm::CmpInst::ICMP_NE, llvm::LLT::isScalar(), llvm::TargetLoweringBase::isSExtCheaperThanZExt(), 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().
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 2025 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::RISCVLegalizerInfo::legalizeCustom(), llvm::AMDGPULegalizerInfo::legalizeSBufferLoad(), and widenScalar().
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 2011 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildInstr(), MI, MIRBuilder, and llvm::MachineOperand::setReg().
Referenced by llvm::RISCVLegalizerInfo::legalizeCustom(), and widenScalar().
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(), bitcastExtractSubvector(), bitcastExtractVectorElt(), bitcastInsertSubvector(), bitcastInsertVectorElt(), bitcastShuffleVector(), bitcastSrc(), llvm::AMDGPULegalizerInfo::buildMultiply(), coerceToScalar(), convertPtrToInt(), createStackTemporary(), equalizeVectorShuffleLengths(), fewerElementsBitcast(), fewerElementsVectorExtractInsertVectorElt(), fewerElementsVectorMerge(), fewerElementsVectorMultiEltType(), fewerElementsVectorPhi(), fewerElementsVectorReductions(), fewerElementsVectorSeqReductions(), fewerElementsVectorShuffle(), fewerElementsVectorUnmergeValues(), getDynStackAllocTargetPtr(), getVectorElementPointer(), llvm::AMDGPULegalizerInfo::legalizeBufferLoad(), llvm::AMDGPULegalizerInfo::legalizeBufferStore(), 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::legalizeSBufferPrefetch(), llvm::AMDGPULegalizerInfo::legalizeStore(), libcall(), lower(), lowerAbsToAddXor(), lowerAbsToCNeg(), lowerAbsToMaxNeg(), lowerAddSubSatToAddoSubo(), lowerAddSubSatToMinMax(), lowerBitcast(), lowerBitCount(), lowerBitreverse(), lowerBswap(), lowerConstant(), lowerDIVREM(), lowerDynStackAlloc(), lowerEXT(), lowerExtract(), lowerExtractInsertVectorElt(), lowerFAbs(), lowerFConstant(), lowerFCopySign(), lowerFFloor(), lowerFMad(), lowerFMinNumMaxNum(), lowerFPOWI(), lowerFPTOINT_SAT(), 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(), lowerU64ToF32WithSITOFP(), lowerU64ToF64BitFloatOps(), 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().
GISelChangeObserver& llvm::LegalizerHelper::Observer |
To keep track of changes made by the LegalizerHelper.
Definition at line 54 of file LegalizerHelper.h.
Referenced by bitcast(), llvm::AMDGPULegalizerInfo::legalizeBufferLoad(), llvm::AArch64LegalizerInfo::legalizeCustom(), llvm::RISCVLegalizerInfo::legalizeCustom(), llvm::AArch64LegalizerInfo::legalizeIntrinsic(), llvm::AMDGPULegalizerInfo::legalizeIntrinsic(), llvm::AMDGPULegalizerInfo::legalizeLoad(), llvm::AMDGPULegalizerInfo::legalizeSBufferLoad(), llvm::AMDGPULegalizerInfo::legalizeSBufferPrefetch(), llvm::AMDGPULegalizerInfo::legalizeStore(), lower(), lowerBitCount(), lowerVectorReduction(), moreElementsVector(), moreElementsVectorPhi(), narrowScalar(), narrowScalarFLDEXP(), narrowScalarFPTOI(), narrowScalarShift(), and widenScalar().