LLVM 22.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 49 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 65 of file LegalizerHelper.h.
LegalizerHelper::LegalizerHelper | ( | MachineFunction & | MF, |
GISelChangeObserver & | Observer, | ||
MachineIRBuilder & | B | ||
) |
Definition at line 105 of file LegalizerHelper.cpp.
LegalizerHelper::LegalizerHelper | ( | MachineFunction & | MF, |
const LegalizerInfo & | LI, | ||
GISelChangeObserver & | Observer, | ||
MachineIRBuilder & | B, | ||
GISelValueTracking * | VT = nullptr |
||
) |
Definition at line 112 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 4337 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(), Legalized, LLVM_DEBUG, MI, MRI, Observer, llvm::MachineMemOperand::setType(), and UnableToLegalize.
Referenced by legalizeInstrStep().
LegalizerHelper::LegalizeResult LegalizerHelper::bitcastConcatVector | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | CastTy | ||
) |
Definition at line 3847 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 2135 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBitcast(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), MI, MIRBuilder, MRI, OpIdx, 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 3926 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 3638 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 3989 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 3774 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 3892 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildCast(), llvm::MachineIRBuilder::buildShuffleVector(), llvm::LLT::changeElementType(), llvm::LLT::getElementCount(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getScalarType(), Legalized, MI, MIRBuilder, MRI, 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 2130 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBitcast(), llvm::MachineInstrBuilder::getReg(), MI, MIRBuilder, and OpIdx.
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 2061 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::LLT::isPointer(), llvm::LLT::isPointerVector(), llvm::LLT::isScalar(), llvm::LLT::isVector(), MIRBuilder, MRI, and llvm::LLT::scalar().
Referenced by lowerUnmergeValues().
MachineInstrBuilder LegalizerHelper::createStackStoreLoad | ( | const DstOp & | Res, |
const SrcOp & | Val | ||
) |
Create a store of Val
to a stack temporary and return a load as the same type as Res
.
Definition at line 4803 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildLoad(), llvm::MachineIRBuilder::buildStore(), createStackTemporary(), llvm::DstOp::getLLTTy(), llvm::SrcOp::getLLTTy(), llvm::LLT::getSizeInBytes(), getStackTemporaryAlignment(), MIRBuilder, and MRI.
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 4790 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 createStackStoreLoad(), lowerExtractInsertVectorElt(), and lowerVECTOR_COMPRESS().
LegalizerHelper::LegalizeResult LegalizerHelper::equalizeVectorShuffleLengths | ( | MachineInstr & | MI | ) |
Equalize source and destination vector sizes of G_SHUFFLE_VECTOR.
Definition at line 6404 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 5571 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildBitcast(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildUnmerge(), llvm::LLT::fixed_vector(), llvm::LLT::getElementType(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getSizeInBits(), getUnmergeResults(), Legalized, MI, MIRBuilder, llvm::SmallVectorTemplateBase< T, bool >::push_back(), 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 5394 of file LegalizerHelper.cpp.
References assert(), fewerElementsBitcast(), fewerElementsVectorExtractInsertVectorElt(), fewerElementsVectorMerge(), fewerElementsVectorMultiEltType(), fewerElementsVectorPhi(), fewerElementsVectorReductions(), fewerElementsVectorSeqReductions(), fewerElementsVectorShuffle(), fewerElementsVectorUnmergeValues(), llvm::LLT::getNumElements(), GISEL_VECREDUCE_CASES_NONSEQ, llvm::LLT::isVector(), MI, MRI, reduceLoadStoreWidth(), and UnableToLegalize.
Referenced by llvm::AMDGPURegisterBankInfo::applyMappingLoad(), and legalizeInstrStep().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorExtractInsertVectorElt | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 5213 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildExtractVectorElement(), llvm::MachineIRBuilder::buildInsertVectorElement(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::MachineIRBuilder::buildUndef(), llvm::extractParts(), llvm::getIConstantVRegValWithLookThrough(), llvm::LLT::getNumElements(), Idx, llvm::LLT::isVector(), Legalized, lowerExtractInsertVectorElt(), MI, MIRBuilder, and MRI.
Referenced by fewerElementsVector().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorMerge | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 5127 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::LLT::isVector(), Legalized, MI, MIRBuilder, MRI, 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 4955 of file LegalizerHelper.cpp.
References llvm::append_range(), assert(), broadcastSrcOp(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::extractVectorParts(), hasSameNumEltsOnAllVectorOperands(), I, llvm::is_contained(), Legalized, makeDstOps(), MI, MIRBuilder, MRI, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::size(), and Uses.
Referenced by fewerElementsVector().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorPhi | ( | GenericMachineInstr & | MI, |
unsigned | NumElts | ||
) |
Definition at line 5025 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::extractVectorParts(), llvm::MachineBasicBlock::getFirstNonPHI(), llvm::MachineBasicBlock::getFirstTerminatorForward(), Legalized, makeDstOps(), MBB, MI, MIRBuilder, MRI, 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 5745 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, MRI, 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 5832 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, MRI, and UnableToLegalize.
Referenced by fewerElementsVector().
LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVectorShuffle | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 5607 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, MRI, 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 5078 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(), I, llvm::LLT::isVector(), Legalized, MI, MIRBuilder, MRI, and UnableToLegalize.
Referenced by fewerElementsVector().
Register LegalizerHelper::getDynStackAllocTargetPtr | ( | Register | SPReg, |
Register | AllocSize, | ||
Align | Alignment, | ||
LLT | PtrTy | ||
) |
Definition at line 8658 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 |
Expose LegalizerInfo so the clients can re-use.
Definition at line 79 of file LegalizerHelper.h.
Return the alignment to use for a stack temporary object with the given type.
Definition at line 4779 of file LegalizerHelper.cpp.
References llvm::LLT::getSizeInBytes(), llvm::MinAlign(), and llvm::PowerOf2Ceil().
Referenced by createStackStoreLoad(), lowerExtractInsertVectorElt(), and lowerVECTOR_COMPRESS().
|
inline |
Definition at line 80 of file LegalizerHelper.h.
|
inline |
Definition at line 81 of file LegalizerHelper.h.
Referenced by llvm::AMDGPULegalizerInfo::buildMultiply().
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 4838 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildMul(), llvm::MachineIRBuilder::buildPtrAdd(), llvm::MachineIRBuilder::buildSExtOrTrunc(), clampVectorIndex(), DL, llvm::MachineIRBuilder::getDataLayout(), llvm::LLT::getElementType(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), MIRBuilder, MRI, 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 119 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 1263 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(), Legalized, llvm::LegalizeActions::Libcall, LLVM_DEBUG, MI, MIRBuilder, MRI, 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 4425 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::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSignMask(), llvm::LLT::getSizeInBits(), llvm::MachineIRBuilder::getTII(), 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, MRI, Observer, RHS, llvm::MachineIRBuilder::setInsertPt(), TII, and UnableToLegalize.
Referenced by llvm::RISCVLegalizerInfo::legalizeCustom(), and legalizeInstrStep().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerAbsToAddXor | ( | MachineInstr & | MI | ) |
Definition at line 9502 of file LegalizerHelper.cpp.
References llvm::Add, llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildAShr(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildXor(), llvm::LLT::getScalarSizeInBits(), Legalized, MI, MIRBuilder, and MRI.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerAbsToCNeg | ( | MachineInstr & | MI | ) |
Definition at line 9534 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildSelect(), llvm::MachineIRBuilder::buildSub(), llvm::MachineInstrBuilder::getReg(), llvm::CmpInst::ICMP_SGT, Legalized, MI, MIRBuilder, MRI, llvm::LLT::scalar(), and llvm::Sub.
Referenced by llvm::AArch64LegalizerInfo::legalizeCustom().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerAbsToMaxNeg | ( | MachineInstr & | MI | ) |
Definition at line 9519 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildSMax(), llvm::MachineIRBuilder::buildSub(), Legalized, MI, MIRBuilder, MRI, and llvm::Sub.
Referenced by llvm::AMDGPURegisterBankInfo::applyMappingImpl(), and llvm::RISCVLegalizerInfo::legalizeCustom().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerAddSubSatToAddoSubo | ( | MachineInstr & | MI | ) |
Definition at line 8985 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(), Legalized, LHS, llvm_unreachable, MI, MIRBuilder, MRI, and RHS.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerAddSubSatToMinMax | ( | MachineInstr & | MI | ) |
Definition at line 8910 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::Hi, Legalized, LHS, llvm_unreachable, llvm::Lo, MI, MIRBuilder, MRI, and RHS.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerBitcast | ( | MachineInstr & | MI | ) |
Definition at line 3546 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 7101 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::CmpInst::ICMP_EQ, llvm::IRSimilarity::Legal, Legalized, llvm::LegalizeActions::Libcall, MI, MIRBuilder, MRI, Observer, Opc, llvm::PowerOf2Ceil(), Size, TII, UnableToLegalize, and llvm::LegalizeActions::WidenScalar.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerBitreverse | ( | MachineInstr & | MI | ) |
Definition at line 9127 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBitcast(), llvm::MachineIRBuilder::buildBitReverse(), llvm::MachineIRBuilder::buildBSwap(), llvm::MachineIRBuilder::buildInstr(), llvm::LLT::fixed_vector(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getSizeInBits(), llvm::APInt::getSplat(), llvm::LegalizerInfo::isLegal(), llvm::LLT::isVector(), MI, MIRBuilder, MRI, Size, and SwapN().
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerBswap | ( | MachineInstr & | MI | ) |
Definition at line 9082 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::LLT::getScalarSizeInBits(), Legalized, MI, MIRBuilder, and MRI.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerConstant | ( | MachineInstr & | MI | ) |
Definition at line 3524 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 9485 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 8682 of file LegalizerHelper.cpp.
References llvm::assumeAligned(), llvm::MachineIRBuilder::buildCopy(), getDynStackAllocTargetPtr(), llvm::TargetSubtargetInfo::getFrameLowering(), llvm::TargetLoweringBase::getStackPointerRegisterToSaveRestore(), llvm::MachineFunction::getSubtarget(), Legalized, MI, MIRBuilder, MRI, SPReg, llvm::TargetFrameLowering::StackGrowsUp, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerEXT | ( | MachineInstr & | MI | ) |
Definition at line 7404 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::isPowerOf2_32(), Legalized, MI, MIRBuilder, MRI, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerExtract | ( | MachineInstr & | MI | ) |
Definition at line 8727 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 8461 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::getElementType(), llvm::TypeSize::getFixed(), llvm::LLT::getNumElements(), llvm::LLT::getSizeInBytes(), getStackTemporaryAlignment(), getVectorElementPointer(), llvm::MachinePointerInfo::getWithOffset(), Idx, llvm::LLT::isByteSized(), Legalized, LLVM_DEBUG, llvm::MIPatternMatch::m_ICst(), MI, llvm::MIPatternMatch::mi_match(), MIRBuilder, MRI, llvm::Offset, and UnableToLegalize.
Referenced by fewerElementsVectorExtractInsertVectorElt(), and lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFAbs | ( | MachineInstr & | MI | ) |
Definition at line 9546 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAnd(), llvm::MachineIRBuilder::buildConstant(), llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSignedMaxValue(), Legalized, MI, MIRBuilder, and MRI.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFConstant | ( | MachineInstr & | MI | ) |
Definition at line 3535 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 8221 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 8357 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, Legalized, MI, MIRBuilder, and MRI.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFMad | ( | MachineInstr & | MI | ) |
Definition at line 8310 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildFAdd(), llvm::MachineIRBuilder::buildFMul(), Legalized, MI, MIRBuilder, MRI, and llvm::Mul.
Referenced by llvm::AMDGPULegalizerInfo::legalizeFMad(), and lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFMinNumMaxNum | ( | MachineInstr & | MI | ) |
Definition at line 8263 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildFCanonicalize(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineInstr::FmNoNans, llvm::MachineInstrBuilder::getReg(), llvm::isKnownNeverSNaN(), Legalized, llvm_unreachable, MI, MIRBuilder, and MRI.
Referenced by llvm::AMDGPULegalizerInfo::legalizeMinNumMaxNum(), and lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPOWI | ( | MachineInstr & | MI | ) |
Definition at line 8135 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildFPow(), llvm::MachineIRBuilder::buildSITOFP(), Legalized, MI, MIRBuilder, and MRI.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFPTOINT_SAT | ( | MachineInstr & | MI | ) |
Definition at line 7908 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_OLT, 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 7843 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 7803 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 8124 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 8009 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::MachineInstr::FmAfn, I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, Legalized, MI, MIRBuilder, MRI, N, S1, S32, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lowerFPTRUNC().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFunnelShift | ( | MachineInstr & | MI | ) |
Definition at line 7381 of file LegalizerHelper.cpp.
References llvm::LegalizerInfo::getAction(), MI, and MRI.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFunnelShiftAsShifts | ( | MachineInstr & | MI | ) |
Definition at line 7326 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::MachineInstr::Disjoint, llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarSizeInBits(), isNonZeroModBitWidthOrUndef(), llvm::isPowerOf2_32(), Legalized, MI, MIRBuilder, MRI, X, and Y.
LegalizerHelper::LegalizeResult LegalizerHelper::lowerFunnelShiftWithInverse | ( | MachineInstr & | MI | ) |
Definition at line 7287 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(), isNonZeroModBitWidthOrUndef(), llvm::isPowerOf2_32(), Legalized, MI, MIRBuilder, MRI, UnableToLegalize, X, and Y.
LegalizerHelper::LegalizeResult LegalizerHelper::lowerInsert | ( | MachineInstr & | MI | ) |
Definition at line 8781 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(), Idx, llvm::LLT::isPointer(), llvm::LLT::isScalar(), llvm::LLT::isVector(), Legalized, LLVM_DEBUG, MI, MIRBuilder, MRI, 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 8324 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, Legalized, MI, MIRBuilder, MRI, and X.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerISFPCLASS | ( | MachineInstr & | MI | ) |
Definition at line 9254 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 4046 of file LegalizerHelper.cpp.
References llvm::TargetLoweringBase::allowsMemoryAccess(), assert(), llvm::bit_floor(), llvm::MachineIRBuilder::buildAssertZExt(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildDeleteTrailingVectorElements(), llvm::MachineIRBuilder::buildIntToPtr(), llvm::MachineIRBuilder::buildLoad(), llvm::MachineIRBuilder::buildLoadInstr(), llvm::MachineIRBuilder::buildObjectPtrOffset(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildSExtInReg(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineInstr::eraseFromParent(), llvm::LLT::fixed_vector(), llvm::GMemOperation::getAlign(), 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::LLT::getNumElements(), llvm::MachineInstr::getOpcode(), llvm::MachineMemOperand::getPointerInfo(), llvm::GLoadStore::getPointerReg(), llvm::GenericMachineInstr::getReg(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getSizeInBits(), llvm::LLT::getSizeInBytes(), llvm::DataLayout::isBigEndian(), llvm::LLT::isPointer(), llvm::isPowerOf2_32(), llvm::isPowerOf2_64(), llvm::LLT::isVector(), Legalized, MIRBuilder, MRI, llvm::NextPowerOf2(), llvm::PowerOf2Ceil(), reduceLoadStoreWidth(), llvm::LLT::scalar(), UnableToLegalize, and llvm::Align::value().
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerMemCpyFamily | ( | MachineInstr & | MI, |
unsigned | MaxLen = 0 |
||
) |
Definition at line 10104 of file LegalizerHelper.cpp.
References assert(), llvm::getIConstantVRegValWithLookThrough(), llvm::TargetLoweringBase::getMaxStoresPerMemcpy(), llvm::MachineFunction::getSubtarget(), llvm::TargetSubtargetInfo::getTargetLowering(), Legalized, MI, MRI, Opc, shouldLowerMemFuncForSize(), and UnableToLegalize.
Referenced by lower(), and llvm::CombinerHelper::tryCombineMemCpyFamily().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerMemcpyInline | ( | MachineInstr & | MI | ) |
Definition at line 9851 of file LegalizerHelper.cpp.
References assert(), llvm::getIConstantVRegValWithLookThrough(), Legalized, MI, and MRI.
LegalizerHelper::LegalizeResult LegalizerHelper::lowerMergeValues | ( | MachineInstr & | MI | ) |
Definition at line 8383 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildIntToPtr(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildZExt(), llvm::dbgs(), llvm::MachineIRBuilder::getDataLayout(), llvm::MachineInstrBuilder::getReg(), I, llvm::DataLayout::isNonIntegralAddressSpace(), Legalized, LLVM_DEBUG, MI, MIRBuilder, MRI, llvm::Offset, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerMinMax | ( | MachineInstr & | MI | ) |
Definition at line 8160 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildSelect(), Legalized, MI, minMaxToCompare(), MIRBuilder, and MRI.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerReadWriteRegister | ( | MachineInstr & | MI | ) |
Definition at line 9196 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildUndef(), llvm::StringRef::data(), llvm::LLVMContext::diagnose(), llvm::Function::getContext(), llvm::MachineFunction::getFunction(), llvm::MachineIRBuilder::getMF(), llvm::TargetLowering::getRegisterByName(), llvm::MDString::getString(), Legalized, MI, MIRBuilder, and MRI.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerRotate | ( | MachineInstr & | MI | ) |
Definition at line 7514 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 7503 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 8871 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildAdd(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildICmp(), llvm::MachineIRBuilder::buildSub(), llvm::MachineIRBuilder::buildXor(), llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, Legalized, LHS, MI, MIRBuilder, MRI, and RHS.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerSelect | ( | MachineInstr & | MI | ) |
Definition at line 9427 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 9051 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::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SLT, Legalized, LHS, MI, MIRBuilder, MRI, and RHS.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerShuffleVector | ( | MachineInstr & | MI | ) |
Definition at line 8533 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 7757 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::LLT::getScalarSizeInBits(), llvm::CmpInst::ICMP_NE, Legalized, loweri64tof16ITOFP(), 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 9232 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildMul(), llvm::MachineIRBuilder::buildTrunc(), llvm::LLT::changeElementSize(), llvm::LLT::getScalarSizeInBits(), Legalized, LHS, MI, MIRBuilder, MRI, llvm::Mul, and RHS.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerStackRestore | ( | MachineInstr & | MI | ) |
Definition at line 8716 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 8705 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 4198 of file LegalizerHelper.cpp.
References llvm::TargetLoweringBase::allowsMemoryAccess(), llvm::MachineIRBuilder::buildAnyExt(), llvm::MachineIRBuilder::buildAnyExtOrTrunc(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildObjectPtrOffset(), 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::GStore::getValueReg(), llvm::LLT::isPointer(), llvm::isPowerOf2_32(), llvm::LLT::isVector(), Legalized, llvm::MachineInstr::memoperands_begin(), MIRBuilder, MRI, llvm::PowerOf2Ceil(), reduceLoadStoreWidth(), llvm::LLT::scalar(), scalarizeVectorBooleanStore(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerThreewayCompare | ( | MachineInstr & | MI | ) |
Definition at line 8174 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::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::LLT::isVector(), Legalized, MI, MIRBuilder, MRI, llvm::TargetLoweringBase::shouldExpandCmpUsingSelects(), std::swap(), llvm::TargetLoweringBase::UndefinedBooleanContent, and llvm::TargetLoweringBase::ZeroOrNegativeOneBooleanContent.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerTRUNC | ( | MachineInstr & | MI | ) |
Definition at line 7446 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(), llvm::isPowerOf2_32(), llvm::LLT::isVector(), Legalized, Merge, MI, MIRBuilder, MRI, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerU64ToF32BitOps | ( | MachineInstr & | MI | ) |
Definition at line 7584 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::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_UGT, Legalized, MI, MIRBuilder, MRI, S1, S32, S64, llvm::LLT::scalar(), and llvm::Sub.
LegalizerHelper::LegalizeResult LegalizerHelper::lowerU64ToF32WithSITOFP | ( | MachineInstr & | MI | ) |
Definition at line 7642 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::CmpInst::ICMP_SLT, Legalized, MI, MIRBuilder, MRI, S1, S32, S64, and llvm::LLT::scalar().
Referenced by lowerUITOFP().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerU64ToF64BitFloatOps | ( | MachineInstr & | MI | ) |
Definition at line 7677 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(), Legalized, MI, MIRBuilder, MRI, S32, S64, and llvm::LLT::scalar().
Referenced by lowerUITOFP().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerUITOFP | ( | MachineInstr & | MI | ) |
Definition at line 7727 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildFConstant(), llvm::MachineIRBuilder::buildSelect(), llvm::LLT::getScalarSizeInBits(), Legalized, loweri64tof16ITOFP(), lowerU64ToF32WithSITOFP(), lowerU64ToF64BitFloatOps(), MI, MIRBuilder, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerUnmergeValues | ( | MachineInstr & | MI | ) |
Definition at line 8421 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildLShr(), llvm::MachineIRBuilder::buildTrunc(), coerceToScalar(), llvm::LLT::getSizeInBits(), I, llvm::LLT::isPointer(), Legalized, MI, MIRBuilder, MRI, llvm::Offset, and UnableToLegalize.
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerVAArg | ( | MachineInstr & | MI | ) |
Definition at line 9581 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::getTypeForLLT(), Legalized, llvm::Log2(), MI, MIRBuilder, llvm::MachineMemOperand::MOLoad, llvm::MachineMemOperand::MOStore, MRI, and llvm::LLT::scalar().
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerVECTOR_COMPRESS | ( | llvm::MachineInstr & | MI | ) |
Definition at line 8572 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::MachineInstrBuilder::getReg(), llvm::LLT::getSizeInBits(), getStackTemporaryAlignment(), llvm::MachinePointerInfo::getUnknownStack(), getVectorElementPointer(), I, llvm::CmpInst::ICMP_UGT, Idx, llvm::isConstantOrConstantSplatVector(), Legalized, MI, MIRBuilder, MRI, llvm::report_fatal_error(), and llvm::LLT::scalar().
Referenced by lower().
LegalizerHelper::LegalizeResult LegalizerHelper::lowerVectorReduction | ( | MachineInstr & | MI | ) |
Definition at line 9563 of file LegalizerHelper.cpp.
References llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::MCInstrInfo::get(), llvm::LLT::getSizeInBits(), llvm::MachineIRBuilder::getTII(), llvm::LLT::isScalar(), Legalized, MI, MIRBuilder, MRI, 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 6146 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::TargetLoweringBase::getVectorIdxLLT(), Idx, llvm::LLT::isScalable(), Legalized, MI, MIRBuilder, moreElementsVectorDst(), moreElementsVectorPhi(), moreElementsVectorShuffle(), moreElementsVectorSrc(), MRI, Observer, Opc, 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 2114 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildDeleteTrailingVectorElements(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), llvm::MachineOperand::getReg(), MI, MIRBuilder, MRI, OpIdx, 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 6090 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 6475 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 2124 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildPadVectorWithUndefElements(), llvm::MachineInstrBuilder::getReg(), MI, MIRBuilder, OpIdx, 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 1483 of file LegalizerHelper.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), llvm::append_range(), assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), 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::dbgs(), llvm::SmallVectorBase< Size_T >::empty(), 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::ICmpInst::getUnsignedPredicate(), llvm::LocationSize::getValue(), I, llvm::CmpInst::ICMP_EQ, llvm::ICmpInst::isEquality(), llvm::LLT::isVector(), Legalized, LHS, LLVM_DEBUG, llvm::APInt::lshr(), MBB, MI, MIRBuilder, MRI, narrowScalarAddSub(), narrowScalarBasic(), narrowScalarCTLZ(), narrowScalarCTPOP(), narrowScalarCTTZ(), narrowScalarDst(), narrowScalarExt(), narrowScalarExtract(), narrowScalarFLDEXP(), narrowScalarFPTOI(), narrowScalarInsert(), narrowScalarMul(), narrowScalarSelect(), narrowScalarShift(), narrowScalarSrc(), Observer, llvm::Offset, OpIdx, 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 6579 of file LegalizerHelper.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::MachineIRBuilder::buildInstr(), llvm::extractParts(), llvm::LLT::isVector(), Legalized, llvm_unreachable, MI, MIRBuilder, MRI, 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 6879 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildInstr(), llvm::extractParts(), I, Legalized, llvm_unreachable, MI, MIRBuilder, MRI, 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 6987 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 7053 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 7020 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 2105 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), MI, MIRBuilder, MRI, OpIdx, 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 6920 of file LegalizerHelper.cpp.
References llvm::LLT::isVector(), Legalized, MI, MRI, and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarExtract | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6730 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildBuildVector(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildExtract(), llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::extractParts(), llvm::LLT::getSizeInBits(), Legalized, MI, MIRBuilder, MRI, 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 7076 of file LegalizerHelper.cpp.
References B, llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::LLT::getScalarSizeInBits(), Legalized, llvm::maxIntN(), MI, llvm::minIntN(), MIRBuilder, MRI, Observer, and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarFPTOI | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6705 of file LegalizerHelper.cpp.
References llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingInstr(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getScalarType(), Legalized, MI, MRI, narrowScalarDst(), Observer, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarInsert | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6797 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::extractParts(), llvm::LLT::getSizeInBits(), I, Legalized, MI, MIRBuilder, MRI, 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 6675 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildMergeLikeInstr(), llvm::extractParts(), llvm::LLT::getSizeInBits(), llvm::LLT::isVector(), Legalized, MI, MIRBuilder, MRI, Size, and UnableToLegalize.
Referenced by narrowScalar().
LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalarSelect | ( | MachineInstr & | MI, |
unsigned | TypeIdx, | ||
LLT | Ty | ||
) |
Definition at line 6941 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildSelect(), llvm::extractParts(), I, llvm::LLT::isVector(), Legalized, llvm_unreachable, MI, MIRBuilder, MRI, 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 5981 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::getIConstantVRegValWithLookThrough(), llvm::LLT::getScalarSizeInBits(), llvm::Hi, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_ULT, llvm::LLT::isVector(), Legalized, llvm_unreachable, llvm::Lo, MI, MIRBuilder, MRI, 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 5892 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::LLT::getSizeInBits(), llvm::Hi, llvm::APInt::isZero(), Legalized, llvm::Lo, MI, MIRBuilder, MRI, 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 2089 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildTrunc(), MI, MIRBuilder, OpIdx, and llvm::MachineOperand::setReg().
Referenced by narrowScalar(), and narrowScalarShift().
LegalizerHelper::LegalizeResult LegalizerHelper::reduceLoadStoreWidth | ( | GLoadStore & | MI, |
unsigned | TypeIdx, | ||
LLT | NarrowTy | ||
) |
Definition at line 5293 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildLoad(), llvm::MachineIRBuilder::buildStore(), 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::LocationSize::getValue(), Idx, llvm::GMemOperation::isAtomic(), llvm::DataLayout::isBigEndian(), isBigEndian(), llvm::LLT::isByteSized(), llvm::LLT::isValid(), Legalized, LLVM_DEBUG, llvm::MachineIRBuilder::materializeObjectPtrOffset(), MIRBuilder, MRI, 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::scalarizeVectorBooleanStore | ( | GStore & | MI | ) |
Given a store of a boolean vector, scalarize it.
Definition at line 4293 of file LegalizerHelper.cpp.
References assert(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildExtractVectorElement(), llvm::MachineIRBuilder::buildOr(), llvm::MachineIRBuilder::buildShl(), llvm::MachineIRBuilder::buildStore(), llvm::MachineIRBuilder::buildTrunc(), llvm::MachineIRBuilder::buildZExt(), llvm::MachineInstr::eraseFromParent(), llvm::MachineFunction::getDataLayout(), llvm::LLT::getElementType(), llvm::MachineFunction::getMachineMemOperand(), llvm::MachineMemOperand::getMemoryType(), llvm::MachineIRBuilder::getMF(), llvm::LLT::getNumElements(), llvm::MachineMemOperand::getPointerInfo(), llvm::GLoadStore::getPointerReg(), llvm::LLT::getSizeInBits(), llvm::GStore::getValueReg(), llvm::TargetLoweringBase::getVectorIdxLLT(), I, llvm::DataLayout::isBigEndian(), llvm::LLT::isByteSized(), llvm::LLT::isVector(), Legalized, llvm::MachineInstr::memoperands_begin(), MIRBuilder, MRI, llvm::LLT::scalar(), and UnableToLegalize.
Referenced by lowerStore().
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 2673 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::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::MachineFunction::getMachineMemOperand(), llvm::MachineIRBuilder::getMBB(), llvm::MachineIRBuilder::getMF(), llvm::APInt::getOneBitSet(), llvm::MachineMemOperand::getPointerInfo(), llvm::GenericMachineInstr::getReg(), llvm::MachineInstrBuilder::getReg(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getScalarType(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::LLT::getSizeInBits(), llvm::GInsertSubvector::getSubVec(), llvm::MachineIRBuilder::getTII(), llvm::ConstantInt::getValue(), llvm::ConstantFP::getValueAPF(), I, llvm::CmpInst::ICMP_NE, llvm::LLT::isPointerOrPointerVector(), llvm::LLT::isScalar(), llvm::TargetLoweringBase::isSExtCheaperThanZExt(), llvm::CmpInst::isSigned(), llvm::LLT::isVector(), Legalized, MBB, MI, MIRBuilder, MRI, 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 2096 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineIRBuilder::getMBB(), MI, MIRBuilder, MRI, OpIdx, llvm::MachineIRBuilder::setInsertPt(), and llvm::MachineOperand::setReg().
Referenced by llvm::AMDGPURegisterBankInfo::applyMappingImpl(), 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 2082 of file LegalizerHelper.cpp.
References llvm::MachineIRBuilder::buildInstr(), MI, MIRBuilder, OpIdx, and llvm::MachineOperand::setReg().
Referenced by llvm::AMDGPURegisterBankInfo::applyMappingImpl(), llvm::RISCVLegalizerInfo::legalizeCustom(), and widenScalar().
MachineIRBuilder& llvm::LegalizerHelper::MIRBuilder |
Expose MIRBuilder so clients can set their own RecordInsertInstruction functions.
Definition at line 53 of file LegalizerHelper.h.
Referenced by bitcastDst(), bitcastExtractSubvector(), bitcastExtractVectorElt(), bitcastInsertSubvector(), bitcastInsertVectorElt(), bitcastShuffleVector(), bitcastSrc(), llvm::AMDGPULegalizerInfo::buildMultiply(), coerceToScalar(), convertPtrToInt(), createStackStoreLoad(), 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(), scalarizeVectorBooleanStore(), widenScalar(), widenScalarDst(), and widenScalarSrc().
GISelChangeObserver& llvm::LegalizerHelper::Observer |
To keep track of changes made by the LegalizerHelper.
Definition at line 56 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().