LLVM 22.0.0git
|
#include "llvm/CodeGen/GlobalISel/GISelValueTracking.h"
Public Member Functions | |
GISelValueTracking (MachineFunction &MF, unsigned MaxDepth=6) | |
virtual | ~GISelValueTracking ()=default |
const MachineFunction & | getMachineFunction () const |
const DataLayout & | getDataLayout () const |
virtual void | computeKnownBitsImpl (Register R, KnownBits &Known, const APInt &DemandedElts, unsigned Depth=0) |
unsigned | computeNumSignBits (Register R, const APInt &DemandedElts, unsigned Depth=0) |
unsigned | computeNumSignBits (Register R, unsigned Depth=0) |
KnownBits | getKnownBits (Register R) |
KnownBits | getKnownBits (Register R, const APInt &DemandedElts, unsigned Depth=0) |
KnownBits | getKnownBits (MachineInstr &MI) |
APInt | getKnownZeroes (Register R) |
APInt | getKnownOnes (Register R) |
bool | maskedValueIsZero (Register Val, const APInt &Mask) |
bool | signBitIsZero (Register Op) |
Align | computeKnownAlignment (Register R, unsigned Depth=0) |
std::optional< ConstantRange > | getValidShiftAmountRange (Register R, const APInt &DemandedElts, unsigned Depth) |
If a G_SHL/G_ASHR/G_LSHR node with shift operand R has shift amounts that are all less than the element bit-width of the shift node, return the valid constant range. | |
std::optional< uint64_t > | getValidMinimumShiftAmount (Register R, const APInt &DemandedElts, unsigned Depth=0) |
If a G_SHL/G_ASHR/G_LSHR node with shift operand R has shift amounts that are all less than the element bit-width of the shift node, return the minimum possible value. | |
KnownFPClass | computeKnownFPClass (Register R, const APInt &DemandedElts, FPClassTest InterestedClasses, unsigned Depth) |
Determine which floating-point classes are valid for V , and return them in KnownFPClass bit sets. | |
KnownFPClass | computeKnownFPClass (Register R, FPClassTest InterestedClasses=fcAllFlags, unsigned Depth=0) |
KnownFPClass | computeKnownFPClass (Register R, const APInt &DemandedElts, uint32_t Flags, FPClassTest InterestedClasses, unsigned Depth) |
Wrapper to account for known fast math flags at the use instruction. | |
KnownFPClass | computeKnownFPClass (Register R, uint32_t Flags, FPClassTest InterestedClasses, unsigned Depth) |
void | erasingInstr (MachineInstr &MI) override |
An instruction is about to be erased. | |
void | createdInstr (MachineInstr &MI) override |
An instruction has been created and inserted into the function. | |
void | changingInstr (MachineInstr &MI) override |
This instruction is about to be mutated in some way. | |
void | changedInstr (MachineInstr &MI) override |
This instruction was mutated in some way. | |
![]() | |
virtual | ~GISelChangeObserver ()=default |
virtual void | erasingInstr (MachineInstr &MI)=0 |
An instruction is about to be erased. | |
virtual void | createdInstr (MachineInstr &MI)=0 |
An instruction has been created and inserted into the function. | |
virtual void | changingInstr (MachineInstr &MI)=0 |
This instruction is about to be mutated in some way. | |
virtual void | changedInstr (MachineInstr &MI)=0 |
This instruction was mutated in some way. | |
LLVM_ABI void | changingAllUsesOfReg (const MachineRegisterInfo &MRI, Register Reg) |
All the instructions using the given register are being changed. | |
LLVM_ABI void | finishedChangingAllUsesOfReg () |
All instructions reported as changing by changingAllUsesOfReg() have finished being changed. | |
Static Public Member Functions | |
static void | computeKnownBitsForAlignment (KnownBits &Known, Align Alignment) |
Protected Member Functions | |
unsigned | getMaxDepth () const |
Definition at line 34 of file GISelValueTracking.h.
llvm::GISelValueTracking::GISelValueTracking | ( | MachineFunction & | MF, |
unsigned | MaxDepth = 6 |
||
) |
|
virtualdefault |
|
inlineoverridevirtual |
This instruction was mutated in some way.
Implements llvm::GISelChangeObserver.
Definition at line 152 of file GISelValueTracking.h.
|
inlineoverridevirtual |
This instruction is about to be mutated in some way.
Implements llvm::GISelChangeObserver.
Definition at line 151 of file GISelValueTracking.h.
R
. Definition at line 55 of file GISelValueTracking.cpp.
References llvm::TargetLowering::computeKnownAlignForTargetInstr(), computeKnownAlignment(), llvm::Depth, llvm::MachineFunction::getFrameInfo(), llvm::MachineFrameInfo::getObjectAlign(), llvm::MachineRegisterInfo::getVRegDef(), and MI.
Referenced by computeKnownAlignment().
|
inlinestatic |
Definition at line 98 of file GISelValueTracking.h.
References llvm::Log2(), llvm::APInt::setLowBits(), and llvm::KnownBits::Zero.
|
virtual |
Definition at line 163 of file GISelValueTracking.cpp.
References llvm::KnownBits::add(), llvm::KnownBits::anyext(), llvm::KnownBits::anyextOrTrunc(), llvm::KnownBits::ashr(), assert(), llvm::bit_width(), llvm::BitWidth, llvm::KnownBits::byteSwap(), llvm::APInt::clearLowBits(), llvm::TargetLowering::computeKnownBitsForFrameIndex(), llvm::TargetLowering::computeKnownBitsForTargetInstr(), llvm::computeKnownBitsFromRangeMetadata(), computeKnownBitsImpl(), llvm::KnownBits::countMaxLeadingZeros(), llvm::KnownBits::countMaxPopulation(), llvm::dbgs(), llvm::Depth, llvm::drop_begin(), dumpResult(), llvm::enumerate(), llvm::extractBits(), llvm::APInt::extractBits(), llvm::KnownBits::extractBits(), llvm::LLT::getAddressSpace(), llvm::APInt::getAllOnes(), llvm::APInt::getBitWidth(), llvm::KnownBits::getBitWidth(), llvm::TargetLoweringBase::getBooleanContents(), llvm::APInt::getLowBitsSet(), getMaxDepth(), llvm::MachineMemOperand::getMemoryType(), llvm::LLT::getNumElements(), llvm::MachineMemOperand::getRanges(), getReg(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getScalarType(), llvm::getShuffleDemandedElts(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::MachineRegisterInfo::getVRegDef(), I, Idx, llvm::KnownBits::insertBits(), llvm::KnownBits::intersectWith(), llvm::LLT::isFixedVector(), llvm::DataLayout::isNonIntegralAddressSpace(), llvm::LLT::isScalableVector(), llvm::KnownBits::isUnknown(), llvm::LLT::isValid(), llvm::LLT::isVector(), llvm::Register::isVirtual(), LLVM_DEBUG, llvm::Log2_64(), llvm::KnownBits::lshr(), llvm::KnownBits::makeConstant(), MI, llvm::KnownBits::mul(), llvm::KnownBits::One, llvm::KnownBits::reverseBits(), llvm::APInt::setAllBits(), llvm::APInt::setBitsFrom(), llvm::APInt::setLowBits(), llvm::KnownBits::sext(), llvm::KnownBits::sextInReg(), llvm::KnownBits::shl(), llvm::APInt::shl(), llvm::KnownBits::smax(), llvm::KnownBits::smin(), llvm::KnownBits::sub(), llvm::KnownBits::trunc(), llvm::KnownBits::umax(), llvm::KnownBits::umin(), llvm::KnownBits::Zero, llvm::TargetLoweringBase::ZeroOrOneBooleanContent, llvm::KnownBits::zext(), llvm::APInt::zext(), and llvm::KnownBits::zextOrTrunc().
Referenced by llvm::SITargetLowering::computeKnownBitsForTargetInstr(), computeKnownBitsImpl(), getKnownBits(), and knownBitsForSBFE().
KnownFPClass GISelValueTracking::computeKnownFPClass | ( | Register | R, |
const APInt & | DemandedElts, | ||
FPClassTest | InterestedClasses, | ||
unsigned | Depth | ||
) |
Determine which floating-point classes are valid for V
, and return them in KnownFPClass bit sets.
This function is defined on values with floating-point type, values vectors of floating-point type, and arrays of floating-point type. InterestedClasses
is a compile time optimization hint for which floating point classes should be queried. Queries not specified in InterestedClasses
should be reliable if they are determined during the query.
Definition at line 1705 of file GISelValueTracking.cpp.
References llvm::Depth.
KnownFPClass GISelValueTracking::computeKnownFPClass | ( | Register | R, |
const APInt & | DemandedElts, | ||
uint32_t | Flags, | ||
FPClassTest | InterestedClasses, | ||
unsigned | Depth | ||
) |
Wrapper to account for known fast math flags at the use instruction.
Definition at line 1720 of file GISelValueTracking.cpp.
References llvm::Depth, llvm::MachineInstr::FmNoInfs, and llvm::MachineInstr::FmNoNans.
KnownFPClass GISelValueTracking::computeKnownFPClass | ( | Register | R, |
FPClassTest | InterestedClasses = fcAllFlags , |
||
unsigned | Depth = 0 |
||
) |
Definition at line 1713 of file GISelValueTracking.cpp.
References llvm::Depth.
KnownFPClass GISelValueTracking::computeKnownFPClass | ( | Register | R, |
uint32_t | Flags, | ||
FPClassTest | InterestedClasses, | ||
unsigned | Depth | ||
) |
Definition at line 1738 of file GISelValueTracking.cpp.
References llvm::Depth, llvm::APInt::getAllOnes(), llvm::LLT::getNumElements(), llvm::MachineRegisterInfo::getType(), and llvm::LLT::isFixedVector().
unsigned GISelValueTracking::computeNumSignBits | ( | Register | R, |
const APInt & | DemandedElts, | ||
unsigned | Depth = 0 |
||
) |
Definition at line 1784 of file GISelValueTracking.cpp.
References llvm::CallingConv::C, computeNumSignBits(), llvm::TargetLowering::computeNumSignBitsForTargetInstr(), computeNumSignBitsFromRangeMetadata(), llvm::Depth, llvm::drop_begin(), llvm::enumerate(), llvm::APInt::extractBits(), llvm::TargetLoweringBase::getBooleanContents(), getDataLayout(), getKnownBits(), getMaxDepth(), llvm::LLT::getNumElements(), llvm::LLT::getScalarSizeInBits(), llvm::getShuffleDemandedElts(), llvm::MachineMemOperand::getSizeInBits(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), getValidMinimumShiftAmount(), llvm::LocationSize::getValue(), llvm::MachineRegisterInfo::getVRegDef(), I, llvm::KnownBits::isNegative(), llvm::KnownBits::isNonNegative(), llvm::LLT::isScalableVector(), llvm::LLT::isValid(), llvm::LLT::isVector(), MI, llvm::KnownBits::One, llvm::KnownBits::Zero, llvm::TargetLoweringBase::ZeroOrNegativeOneBooleanContent, and llvm::TargetLoweringBase::ZeroOrOneBooleanContent.
Referenced by computeNumSignBits(), llvm::CombinerHelper::matchAddOverflow(), llvm::CombinerHelper::matchRedundantSExtInReg(), and llvm::LegalizationArtifactCombiner::tryCombineSExt().
Definition at line 2057 of file GISelValueTracking.cpp.
References computeNumSignBits(), llvm::Depth, llvm::APInt::getAllOnes(), llvm::LLT::getNumElements(), llvm::MachineRegisterInfo::getType(), and llvm::LLT::isFixedVector().
|
inlineoverridevirtual |
An instruction has been created and inserted into the function.
Note that the instruction might not be a fully fledged instruction at this point and won't be if the MachineFunction::Delegate is calling it. This is because the delegate only sees the construction of the MachineInstr before operands have been added.
Implements llvm::GISelChangeObserver.
Definition at line 150 of file GISelValueTracking.h.
|
inlineoverridevirtual |
An instruction is about to be erased.
Implements llvm::GISelChangeObserver.
Definition at line 149 of file GISelValueTracking.h.
|
inline |
Definition at line 67 of file GISelValueTracking.h.
References DL.
Referenced by computeNumSignBits().
KnownBits GISelValueTracking::getKnownBits | ( | MachineInstr & | MI | ) |
Definition at line 77 of file GISelValueTracking.cpp.
References assert(), getKnownBits(), and MI.
Definition at line 83 of file GISelValueTracking.cpp.
References llvm::APInt::getAllOnes(), getKnownBits(), llvm::LLT::getNumElements(), llvm::MachineRegisterInfo::getType(), and llvm::LLT::isFixedVector().
Referenced by llvm::AMDGPULegalizerInfo::buildMultiply(), llvm::CombinerHelper::buildUDivOrURemUsingMul(), computeNumSignBits(), getKnownBits(), getKnownOnes(), getKnownZeroes(), getValidShiftAmountRange(), llvm::isKnownToBeAPowerOfTwo(), llvm::CombinerHelper::matchAddOverflow(), llvm::CombinerHelper::matchCombineTruncOfShift(), llvm::CombinerHelper::matchCombineZextTrunc(), llvm::CombinerHelper::matchICmpToLHSKnownBits(), llvm::CombinerHelper::matchICmpToTrueFalseKnownBits(), llvm::CombinerHelper::matchRedundantAnd(), llvm::CombinerHelper::matchRedundantOr(), llvm::CombinerHelper::matchShiftsTooBig(), and llvm::CombinerHelper::matchSuboCarryOut().
KnownBits GISelValueTracking::getKnownBits | ( | Register | R, |
const APInt & | DemandedElts, | ||
unsigned | Depth = 0 |
||
) |
Definition at line 93 of file GISelValueTracking.cpp.
References assert(), computeKnownBitsImpl(), and llvm::Depth.
Definition at line 115 of file GISelValueTracking.cpp.
References getKnownBits(), and llvm::KnownBits::One.
Definition at line 111 of file GISelValueTracking.cpp.
References getKnownBits(), and llvm::KnownBits::Zero.
Referenced by llvm::CombinerHelper::matchCombineShlOfExtend(), and llvm::LegalizationArtifactCombiner::tryCombineZExt().
|
inline |
Definition at line 65 of file GISelValueTracking.h.
Referenced by llvm::SITargetLowering::computeKnownAlignForTargetInstr(), knownBitsForSBFE(), and knownBitsForWorkitemID().
|
inlineprotected |
Definition at line 155 of file GISelValueTracking.h.
Referenced by computeKnownBitsImpl(), and computeNumSignBits().
std::optional< uint64_t > GISelValueTracking::getValidMinimumShiftAmount | ( | Register | R, |
const APInt & | DemandedElts, | ||
unsigned | Depth = 0 |
||
) |
If a G_SHL/G_ASHR/G_LSHR node with shift operand R
has shift amounts that are all less than the element bit-width of the shift node, return the minimum possible value.
Definition at line 2114 of file GISelValueTracking.cpp.
References llvm::Depth, and getValidShiftAmountRange().
Referenced by computeNumSignBits().
std::optional< ConstantRange > GISelValueTracking::getValidShiftAmountRange | ( | Register | R, |
const APInt & | DemandedElts, | ||
unsigned | Depth | ||
) |
If a G_SHL/G_ASHR/G_LSHR node with shift operand R
has shift amounts that are all less than the element bit-width of the shift node, return the valid constant range.
Definition at line 2064 of file GISelValueTracking.cpp.
References assert(), llvm::BitWidth, llvm::Depth, llvm::ConstantRange::fromKnownBits(), getKnownBits(), llvm::KnownBits::getMaxValue(), llvm::LLT::getScalarSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::MachineRegisterInfo::getVRegDef(), I, MI, llvm::APInt::uge(), llvm::APInt::ugt(), and llvm::APInt::ult().
Referenced by getValidMinimumShiftAmount().
Definition at line 90 of file GISelValueTracking.h.
Referenced by llvm::AMDGPU::getBaseWithConstantOffset(), and signBitIsZero().
Definition at line 105 of file GISelValueTracking.cpp.
References llvm::BitWidth, llvm::LLT::getScalarSizeInBits(), llvm::APInt::getSignMask(), llvm::MachineRegisterInfo::getType(), and maskedValueIsZero().