Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
TargetLowering.cpp File Reference

Go to the source code of this file.

Functions

static SDValue combineShiftToAVG (SDValue Op, TargetLowering::TargetLoweringOpt &TLO, const TargetLowering &TLI, const APInt &DemandedBits, const APInt &DemandedElts, unsigned Depth)
static APInt getKnownUndefForVectorBinop (SDValue BO, SelectionDAG &DAG, const APInt &UndefOp0, const APInt &UndefOp1)
 Given a vector binary operation and known undefined elements for each input operand, compute whether each element of the output is undefined.
static SDValue simplifySetCCWithCTPOP (const TargetLowering &TLI, EVT VT, SDValue N0, const APInt &C1, ISD::CondCode Cond, const SDLoc &dl, SelectionDAG &DAG)
static SDValue foldSetCCWithRotate (EVT VT, SDValue N0, SDValue N1, ISD::CondCode Cond, const SDLoc &dl, SelectionDAG &DAG)
static SDValue foldSetCCWithFunnelShift (EVT VT, SDValue N0, SDValue N1, ISD::CondCode Cond, const SDLoc &dl, SelectionDAG &DAG)
static unsigned getConstraintPiority (TargetLowering::ConstraintType CT)
 Return a number indicating our preference for chosing a type of constraint over another, for the purpose of sorting them.
static bool lowerImmediateIfPossible (TargetLowering::ConstraintPair &P, SDValue Op, SelectionDAG *DAG, const TargetLowering &TLI)
 If we have an immediate, see if we can lower it.
static SDValue BuildExactSDIV (const TargetLowering &TLI, SDNode *N, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDNode * > &Created)
 Given an exact SDIV by a constant, create a multiplication with the multiplicative inverse of the constant.
static SDValue BuildExactUDIV (const TargetLowering &TLI, SDNode *N, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDNode * > &Created)
 Given an exact UDIV by a constant, create a multiplication with the multiplicative inverse of the constant.
static void turnVectorIntoSplatVector (MutableArrayRef< SDValue > Values, std::function< bool(SDValue)> Predicate, SDValue AlternativeReplacement=SDValue())
 If all values in Values that don't match the predicate are same 'splat' value, then replace all values with that splat value.
static bool isNonZeroModBitWidthOrUndef (SDValue Z, unsigned BW)
static SDValue expandVPFunnelShift (SDNode *Node, SelectionDAG &DAG)
static std::optional< boolisFCmpEqualZero (FPClassTest Test, const fltSemantics &Semantics, const MachineFunction &MF)
 Returns a true value if if this FPClassTest can be performed with an ordered fcmp to 0, and a false value if it's an unordered fcmp to 0.
static bool canExpandVectorCTPOP (const TargetLowering &TLI, EVT VT)
static SDValue clampDynamicVectorIndex (SelectionDAG &DAG, SDValue Idx, EVT VecVT, const SDLoc &dl, ElementCount SubEC)

Function Documentation

◆ BuildExactSDIV()

◆ BuildExactUDIV()

◆ canExpandVectorCTPOP()

◆ clampDynamicVectorIndex()

◆ combineShiftToAVG()

◆ expandVPFunnelShift()

◆ foldSetCCWithFunnelShift()

◆ foldSetCCWithRotate()

◆ getConstraintPiority()

unsigned getConstraintPiority ( TargetLowering::ConstraintType CT)
static

Return a number indicating our preference for chosing a type of constraint over another, for the purpose of sorting them.

Immediates are almost always preferrable (when they can be emitted). A higher return value means a stronger preference for one constraint type relative to another. FIXME: We should prefer registers over memory but doing so may lead to unrecoverable register exhaustion later. https://github.com/llvm/llvm-project/issues/20571

Definition at line 6118 of file TargetLowering.cpp.

References llvm::TargetLowering::C_Address, llvm::TargetLowering::C_Immediate, llvm::TargetLowering::C_Memory, llvm::TargetLowering::C_Other, llvm::TargetLowering::C_Register, llvm::TargetLowering::C_RegisterClass, llvm::TargetLowering::C_Unknown, and llvm_unreachable.

Referenced by llvm::TargetLowering::getConstraintPreferences().

◆ getKnownUndefForVectorBinop()

◆ isFCmpEqualZero()

std::optional< bool > isFCmpEqualZero ( FPClassTest Test,
const fltSemantics & Semantics,
const MachineFunction & MF )
static

Returns a true value if if this FPClassTest can be performed with an ordered fcmp to 0, and a false value if it's an unordered fcmp to 0.

Returns std::nullopt if it cannot be performed as a compare with 0.

Definition at line 8879 of file TargetLowering.cpp.

References llvm::fcNan, llvm::fcNone, llvm::fcSubnormal, llvm::fcZero, llvm::MachineFunction::getDenormalMode(), llvm::DenormalMode::IEEE, llvm::DenormalMode::Input, llvm::DenormalMode::inputsAreZero(), and llvm::Test.

Referenced by llvm::TargetLowering::expandIS_FPCLASS().

◆ isNonZeroModBitWidthOrUndef()

bool isNonZeroModBitWidthOrUndef ( SDValue Z,
unsigned BW )
static

Definition at line 8152 of file TargetLowering.cpp.

References llvm::CallingConv::C, and llvm::ISD::matchUnaryPredicate().

◆ lowerImmediateIfPossible()

bool lowerImmediateIfPossible ( TargetLowering::ConstraintPair & P,
SDValue Op,
SelectionDAG * DAG,
const TargetLowering & TLI )
static

If we have an immediate, see if we can lower it.

Return true if we can, false otherwise.

Definition at line 6264 of file TargetLowering.cpp.

References assert(), llvm::TargetLowering::C_Immediate, llvm::TargetLowering::C_Other, llvm::TargetLowering::LowerAsmOperandForConstraint(), and P.

Referenced by llvm::TargetLowering::ComputeConstraintToUse().

◆ simplifySetCCWithCTPOP()

◆ turnVectorIntoSplatVector()

void turnVectorIntoSplatVector ( MutableArrayRef< SDValue > Values,
std::function< bool(SDValue)> Predicate,
SDValue AlternativeReplacement = SDValue() )
static

If all values in Values that don't match the predicate are same 'splat' value, then replace all values with that splat value.

Else, if AlternativeReplacement was provided, then replace all values that do match predicate with AlternativeReplacement value.

Definition at line 6894 of file TargetLowering.cpp.

References llvm::all_of(), llvm::MutableArrayRef< T >::begin(), llvm::MutableArrayRef< T >::end(), and llvm::find_if_not().