15#ifndef LLVM_TRANSFORM_VECTORIZE_VPLANPATTERNMATCH_H
16#define LLVM_TRANSFORM_VECTORIZE_VPLANPATTERNMATCH_H
27template <
typename Val,
typename Pattern>
bool match(Val *V,
const Pattern &
P) {
43 return [&
P](
auto *V) {
return match(V,
P); };
71template <
typename Pred,
unsigned BitW
idth = 0>
struct int_pred_ty {
80 VPV = VPI->getOperand(0);
87 return P.isValue(CI->getAPInt());
104template <
unsigned Bitw
idth = 0>
161 Res = &CI->getAPInt();
174 const APInt *APConst;
221template <
typename Ops_t,
unsigned Opcode,
bool Commutative,
222 typename... RecipeTys>
227 static_assert(std::tuple_size<Ops_t>::value ==
sizeof...(Ops) &&
228 "number of operands in constructor doesn't match Ops_t");
229 static_assert((!Commutative || std::tuple_size<Ops_t>::value == 2) &&
230 "only binary ops can be commutative");
234 auto *DefR = V->getDefiningRecipe();
235 return DefR &&
match(DefR);
243 if (std::tuple_size_v<Ops_t> == 0) {
245 return VPI && VPI->getOpcode() == Opcode;
248 if ((!matchRecipeAndOpcode<RecipeTys>(R) && ...))
251 if (R->getNumOperands() < std::tuple_size<Ops_t>::value) {
255 (RepR && std::tuple_size_v<Ops_t> ==
256 RepR->getNumOperandsWithoutMask())) &&
257 "non-variadic recipe with matched opcode does not have the "
258 "expected number of operands");
266 if (R->getNumOperands() > std::tuple_size<Ops_t>::value) {
268 if (!VPI->isMasked() ||
269 VPI->getNumOperandsWithoutMask() != std::tuple_size<Ops_t>::value)
272 if (!RepR->isPredicated() ||
273 RepR->getNumOperandsWithoutMask() != std::tuple_size<Ops_t>::value)
280 auto IdxSeq = std::make_index_sequence<std::tuple_size<Ops_t>::value>();
281 if (all_of_tuple_elements(IdxSeq, [R](
auto Op,
unsigned Idx) {
282 return Op.match(R->getOperand(Idx));
286 return Commutative &&
287 all_of_tuple_elements(IdxSeq, [R](
auto Op,
unsigned Idx) {
288 return Op.match(R->getOperand(R->getNumOperands() - Idx - 1));
293 template <
typename RecipeTy>
294 static bool matchRecipeAndOpcode(
const VPRecipeBase *R) {
297 if constexpr (std::is_same_v<RecipeTy, VPScalarIVStepsRecipe> ||
298 std::is_same_v<RecipeTy, VPDerivedIVRecipe> ||
299 std::is_same_v<RecipeTy, VPVectorEndPointerRecipe>)
302 return DefR && DefR->getOpcode() == Opcode;
307 template <
typename Fn, std::size_t... Is>
308 bool all_of_tuple_elements(std::index_sequence<Is...>,
309 [[maybe_unused]] Fn
P)
const {
310 return (
P(std::get<Is>(
Ops), Is) && ...);
314template <
unsigned Opcode,
typename... OpTys>
320template <
unsigned Opcode,
typename... OpTys>
325template <
unsigned Opcode,
typename... OpTys>
329template <
unsigned Opcode,
typename... OpTys>
334template <
unsigned Opcode,
typename... OpTys>
340template <
unsigned Opcode,
typename Op0_t,
typename Op1_t>
359template <
typename Op0_t>
369template <
typename Op0_t>
380template <
typename Op0_t,
typename Op1_t>
390template <
typename Op0_t,
typename Op1_t>
400template <
typename Op0_t>
406template <
typename Op0_t>
412template <
typename Op0_t>
418template <
typename Op0_t,
typename Op1_t>
424template <
typename Op0_t,
typename Op1_t,
typename Op2_t>
430template <
typename Op0_t,
typename Op1_t>
436template <
typename Op0_t>
442template <
typename Op0_t>
450template <
typename Op0_t>
456template <
typename Op0_t,
typename Op1_t,
typename Op2_t>
466template <
typename Op0_t>
472template <
typename Op0_t>
478template <
typename Op0_t>
484template <
typename Op0_t,
typename Op1_t,
typename Op2_t>
491template <
typename Op0_t>
500template <
typename Op0_t,
typename Op1_t>
508template <
typename Op0_t>
518template <
typename Op0_t>
524template <
unsigned Opcode,
typename Op0_t>
529template <
typename Op0_t>
534template <
typename Op0_t>
540template <
typename Op0_t>
545template <
typename Op0_t>
550template <
typename Op0_t>
555template <
typename Op0_t>
560template <
typename Op0_t>
571template <
typename Op0_t>
inline auto m_AnyNeg(
const Op0_t &Op0) {
575template <
typename Op0_t>
585template <
unsigned Opcode,
typename Op0_t,
typename Op1_t>
591template <
unsigned Opcode,
typename Op0_t,
typename Op1_t>
597template <
typename Op0_t,
typename Op1_t>
603template <
typename Op0_t,
typename Op1_t>
609template <
typename Op0_t,
typename Op1_t>
615template <
typename Op0_t,
typename Op1_t>
621template <
typename Op0_t,
typename Op1_t>
627template <
typename Op0_t,
typename Op1_t>
633template <
typename Op0_t,
typename Op1_t>
639template <
typename Op0_t,
typename Op1_t>
645template <
typename Op0_t,
typename Op1_t>
651template <
typename Op0_t,
typename Op1_t>
657template <
typename Op0_t,
typename Op1_t>
663template <
typename Op0_t,
typename Op1_t>
669template <
typename Op0_t,
typename Op1_t>
676template <
typename Op0_t,
typename Op1_t>
686template <
typename Op0_t,
typename Op1_t>
692template <
typename Op0_t,
typename Op1_t>
701template <
typename Op0_t,
typename Op1_t,
unsigned... Opcodes>
703 static_assert((
sizeof...(Opcodes) == 1 ||
sizeof...(Opcodes) == 2) &&
704 "Expected one or two opcodes");
706 ((Opcodes == Instruction::ICmp || Opcodes == Instruction::FCmp) && ...) &&
707 "Expected a compare instruction opcode");
718 auto *DefR = V->getDefiningRecipe();
719 return DefR &&
match(DefR);
734template <
typename Op0_t,
typename Op1_t,
unsigned... Opcodes>
744 auto *DefR = V->getDefiningRecipe();
745 return DefR &&
match(DefR);
756template <
typename Op0_t,
typename Op1_t>
762template <
typename Op0_t,
typename Op1_t>
763inline Cmp_match<Op0_t, Op1_t, Instruction::ICmp>
768template <
typename Op0_t,
typename Op1_t>
769inline SpecificCmp_match<Op0_t, Op1_t, Instruction::ICmp>
775template <
typename Op0_t,
typename Op1_t>
776inline Cmp_match<Op0_t, Op1_t, Instruction::ICmp, Instruction::FCmp>
782template <
typename Op0_t,
typename Op1_t>
783inline Cmp_match<Op0_t, Op1_t, Instruction::ICmp, Instruction::FCmp>
789template <
typename Op0_t,
typename Op1_t>
790inline SpecificCmp_match<Op0_t, Op1_t, Instruction::ICmp, Instruction::FCmp>
793 MatchPred, Op0, Op1);
796template <
typename Op0_t,
typename Op1_t>
799 Recipe_match<std::tuple<Op0_t, Op1_t>, Instruction::GetElementPtr,
809template <
typename Op0_t,
typename Op1_t,
typename Op2_t>
struct Blend2_match {
817 template <
typename T>
bool match(
const T *Val)
const {
819 if (!Blend || Blend->getNumIncomingValues() != 2)
821 return MaskOp.match(Blend->getMask(1)) &&
822 TrueOp.match(Blend->getIncomingValue(1)) &&
823 FalseOp.match(Blend->getIncomingValue(0));
828template <
typename Op0_t,
typename Op1_t,
typename Op2_t>
837template <
typename Op0_t,
typename Op1_t,
typename Op2_t>
843template <
typename Op0_t>
inline auto m_Not(
const Op0_t &Op0) {
848template <
typename Op0_t,
typename Op1_t,
typename Op2_t>
853template <
typename Op0_t,
typename Op1_t>
860template <
typename Op0_t,
typename Op1_t>
867template <
typename Op0_t,
typename Op1_t>
874template <
typename Op0_t,
typename Op1_t>
881 template <
typename ArgTy>
bool match(
const ArgTy *V)
const {
883 return RV && RV->getDefiningRegion()->getCanonicalIV() == RV;
891 template <
typename ArgTy>
bool match(
const ArgTy *V)
const {
893 return RV && RV->getDefiningRegion()->getHeaderMask() == RV;
906 template <
typename ArgTy>
bool match(ArgTy *V)
const {
908 if (!WidenIV || !WidenIV->isCanonical())
919inline canonical_widen_iv_match
924template <
typename Op0_t,
typename Op1_t,
typename Op2_t>
931template <
typename Op0_t,
typename Op1_t,
typename Op2_t>
937template <
typename Addr_t,
typename Mask_t>
struct Load_match {
943 template <
typename OpTy>
bool match(
const OpTy *V)
const {
953template <
typename Addr_t,
typename Mask_t>
955 const Mask_t &Mask) {
959template <
typename Addr_t,
typename Val_t,
typename Mask_t>
struct Store_match {
967 template <
typename OpTy>
bool match(
const OpTy *V)
const {
978template <
typename Addr_t,
typename Val_t,
typename Mask_t>
979inline Store_match<Addr_t, Val_t, Mask_t>
984template <
typename Op0_t,
typename Op1_t>
989template <
typename Op0_t,
typename Op1_t>
1005 return Val.match(R->getOperand(
OpI));
1007 return Val.match(R->getOperand(
OpI));
1009 if (R->getOpcode() == Instruction::Call)
1010 return Val.match(R->getOperand(
OpI));
1012 if (R->getOpcode() == Instruction::Call ||
1014 return Val.match(R->getOperand(
OpI));
1020template <
unsigned OpI,
typename Opnd_t>
1042 template <
Intrinsic::ID IntrID,
typename... Ts,
size_t... Is>
1043 static auto impl(std::index_sequence<Is...>,
const Ts &...
Ops) {
1053 std::make_index_sequence<
sizeof...(Ts)>{},
Ops...);
1065 template <
typename ITy>
bool match(ITy *V)
const {
1084 template <
typename ITy>
bool match(ITy *V)
const {
1085 return matchRecipeAndBind<VPWidenGEPRecipe>(V) ||
1086 matchRecipeAndBind<VPInstruction>(V) ||
1087 matchRecipeAndBind<VPReplicateRecipe>(V);
1091 template <
typename RecipeTy>
bool matchRecipeAndBind(
const VPValue *V)
const {
1096 if constexpr (std::is_same_v<RecipeTy, VPWidenGEPRecipe>) {
1098 }
else if (DefR->getOpcode() == Instruction::GetElementPtr) {
1100 ->getSourceElementType();
1101 }
else if constexpr (std::is_same_v<RecipeTy, VPInstruction>) {
1104 LLVMContext &Ctx = DefR->getParent()->getPlan()->getContext();
1131 return V->hasOneUse() &&
SubPattern.match(V);
1144template <
typename Op0_t,
typename Op1_t>
1152template <
typename MatchT>
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static constexpr Value * getValue(Ty &ValueOrUse)
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
MachineInstr unsigned OpIdx
This file contains the declarations of the Vectorization Plan base classes:
Class for arbitrary precision integers.
std::optional< uint64_t > tryZExtValue() const
Get zero extended value if possible.
static bool isSameValue(const APInt &I1, const APInt &I2, bool SignedCompare=false)
Determine if two APInts have the same value, after zero-extending or sign-extending (if SignedCompare...
Represent a constant reference to an array (0 or more elements consecutively in memory),...
An abstraction over a floating-point predicate, and a pack of an integer predicate with samesign info...
static LLVM_ABI std::optional< CmpPredicate > getMatching(CmpPredicate A, CmpPredicate B)
Compares two CmpPredicates taking samesign into account and returns the canonicalized CmpPredicate if...
This is an important class for using LLVM in a threaded context.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
A recipe for converting Current into Start + Current * Step.
This is a concrete Recipe that models a single VPlan-level instruction.
@ ExtractLastActive
Extracts the last active lane from a set of vectors.
@ Intrinsic
Calls a scalar intrinsic. The intrinsic ID is the last operand.
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
A recipe for handling reduction phis.
VPReplicateRecipe replicates a given instruction producing multiple scalar copies of the original sca...
A recipe for handling phi nodes of integer and floating-point inductions, producing their scalar valu...
VPSingleDefRecipe is a base class for recipes that model a sequence of one or more output IR that def...
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
This is the base class of the VPlan Def/Use graph, used for modeling the data flow into,...
A recipe to compute a pointer to the last element of each part of a widened memory access for widened...
VPWidenCastRecipe is a recipe to create vector cast instructions.
A recipe for handling GEP instructions.
A recipe for handling phi nodes of integer and floating-point inductions, producing their vector valu...
VPWidenRecipe is a recipe for producing a widened instruction using the opcode and operands of the re...
match_isa< To... > m_Isa()
match_combine_or< Ty... > m_CombineOr(const Ty &...Ps)
Combine pattern matchers matching any of Ps patterns.
match_combine_and< Ty... > m_CombineAnd(const Ty &...Ps)
Combine pattern matchers matching all of Ps patterns.
auto m_Cmp()
Matches any compare instruction and ignore it.
auto m_LogicalOr()
Matches L || R where L and R are arbitrary values.
auto m_LogicalAnd()
Matches L && R where L and R are arbitrary values.
auto m_ConstantInt()
Match an arbitrary ConstantInt and ignore it.
VPInstruction_match< VPInstruction::ExtractLastLane, VPInstruction_match< VPInstruction::ExtractLastPart, Op0_t > > m_ExtractLastLaneOfLastPart(const Op0_t &Op0)
AllRecipe_match< Instruction::Select, Op0_t, Op1_t, Op2_t > m_Select(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2)
Match recipe recipe with Select opcode, i.e. excluding VPBlendRecipe.
VPInstruction_match< Instruction::Freeze, Op0_t > m_Freeze(const Op0_t &Op0)
AllRecipe_commutative_match< Instruction::And, Op0_t, Op1_t > m_c_BinaryAnd(const Op0_t &Op0, const Op1_t &Op1)
Match a binary AND operation.
AllRecipe_match< Instruction::ZExt, Op0_t > m_ZExt(const Op0_t &Op0)
AllRecipe_match< Instruction::URem, Op0_t, Op1_t > m_URem(const Op0_t &Op0, const Op1_t &Op1)
AllRecipe_match< Instruction::Or, Op0_t, Op1_t > m_BinaryOr(const Op0_t &Op0, const Op1_t &Op1)
Match a binary OR operation.
int_pred_ty< is_specific_int, Bitwidth > specific_intval
Store_match< Addr_t, Val_t, Mask_t > m_MaskedStore(const Addr_t &Addr, const Val_t &Val, const Mask_t &Mask)
Match a (possibly reversed) masked store.
int_pred_ty< is_zero_int > m_ZeroInt()
Match an integer 0 or a vector with all elements equal to 0.
AllRecipe_match< Instruction::FMul, Op0_t, Op1_t > m_FMul(const Op0_t &Op0, const Op1_t &Op1)
SpecificCmp_match< Op0_t, Op1_t, Instruction::ICmp, Instruction::FCmp > m_SpecificCmp(CmpPredicate MatchPred, const Op0_t &Op0, const Op1_t &Op1)
VPInstruction_match< VPInstruction::AnyOf > m_AnyOf()
int_pred_ty< is_all_ones > m_AllOnes()
Match an integer or vector with all bits set.
AllRecipe_commutative_match< Opcode, Op0_t, Op1_t > m_c_Binary(const Op0_t &Op0, const Op1_t &Op1)
AllRecipe_commutative_match< Instruction::Add, Op0_t, Op1_t > m_c_Add(const Op0_t &Op0, const Op1_t &Op1)
AllRecipe_commutative_match< Instruction::Or, Op0_t, Op1_t > m_c_BinaryOr(const Op0_t &Op0, const Op1_t &Op1)
bool matchFindIVResult(VPInstruction *VPI, Op0_t ReducedIV, Op1_t Start)
Match FindIV result pattern: select(icmp ne ComputeReductionResult(ReducedIV), Sentinel),...
VPInstruction_match< VPInstruction::ComputeReductionResult, Op0_t > m_ComputeReductionResult(const Op0_t &Op0)
IntrinsicID_match m_Intrinsic(Intrinsic::ID IntrID)
Match intrinsic calls with a runtime intrinsic ID.
auto m_WidenAnyExtend(const Op0_t &Op0)
match_bind< VPIRValue > m_VPIRValue(VPIRValue *&V)
Match a VPIRValue.
VPInstruction_match< VPInstruction::StepVector > m_StepVector()
auto m_c_LogicalOr(const Op0_t &Op0, const Op1_t &Op1)
match_deferred< VPValue > m_Deferred(VPValue *const &V)
Like m_Specific(), but works if the specific value to match is determined as part of the same match()...
match_combine_or< AllRecipe_match< Instruction::ZExt, Op0_t >, AllRecipe_match< Instruction::SExt, Op0_t > > m_ZExtOrSExt(const Op0_t &Op0)
auto m_VPPhi(const Op0_t &Op0, const Op1_t &Op1)
SpecificCmp_match< Op0_t, Op1_t, Instruction::ICmp > m_SpecificICmp(CmpPredicate MatchPred, const Op0_t &Op0, const Op1_t &Op1)
auto m_SelectLike(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2)
Match recipe with Select opcode or an equivalent VPBlendRecipe with 2 incoming values.
AllRecipe_match< Instruction::Add, Op0_t, Op1_t > m_Add(const Op0_t &Op0, const Op1_t &Op1)
match_poison m_Poison()
Match a VPIRValue that's poison.
auto m_c_Select(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2)
Recipe_match< std::tuple< OpTys... >, Opcode, false, VPInstruction > VPInstruction_match
VPInstruction_match< VPInstruction::BranchOnTwoConds > m_BranchOnTwoConds()
VPInstruction_match< Instruction::InsertElement, Op0_t, Op1_t, Op2_t > m_InsertElement(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2)
AllRecipe_match< Opcode, Op0_t, Op1_t > m_Binary(const Op0_t &Op0, const Op1_t &Op1)
AllRecipe_match< Instruction::LShr, Op0_t, Op1_t > m_LShr(const Op0_t &Op0, const Op1_t &Op1)
VPInstruction_match< VPInstruction::LastActiveLane, Op0_t > m_LastActiveLane(const Op0_t &Op0)
AllRecipe_match< Opcode, Op0_t > m_Unary(const Op0_t &Op0)
auto m_WidenIntrinsic(const T &...Ops)
Recipe_match< std::tuple< OpTys... >, Opcode, true, VPInstruction > VPInstruction_commutative_match
AllRecipe_commutative_match< Instruction::FAdd, Op0_t, Op1_t > m_c_FAdd(const Op0_t &Op0, const Op1_t &Op1)
Load_match< Addr_t, Mask_t > m_MaskedLoad(const Addr_t &Addr, const Mask_t &Mask)
Match a (possibly reversed) masked load.
VPInstruction_match< VPInstruction::ExtractLastActive, Op0_t, Op1_t, Op2_t > m_ExtractLastActive(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2)
match_combine_or< AllRecipe_match< Instruction::Trunc, Op0_t >, Op0_t > m_TruncOrSelf(const Op0_t &Op0)
AllRecipe_match< Instruction::FPExt, Op0_t > m_FPExt(const Op0_t &Op0)
AllRecipe_commutative_match< Instruction::Mul, Op0_t, Op1_t > m_c_Mul(const Op0_t &Op0, const Op1_t &Op1)
canonical_widen_iv_match m_CanonicalWidenIV()
auto match_fn(const Pattern &P)
A match functor that can be used as a UnaryPredicate in functional algorithms like all_of.
Cmp_match< Op0_t, Op1_t, Instruction::ICmp > m_ICmp(const Op0_t &Op0, const Op1_t &Op1)
AllRecipe_match< Instruction::Mul, Op0_t, Op1_t > m_Mul(const Op0_t &Op0, const Op1_t &Op1)
specificval_ty m_Specific(const VPValue *VPV)
VPInstruction_match< VPInstruction::ExitingIVValue, Op0_t > m_ExitingIVValue(const Op0_t &Op0)
VPInstruction_match< Instruction::ExtractElement, Op0_t, Op1_t > m_ExtractElement(const Op0_t &Op0, const Op1_t &Op1)
specific_intval< 1 > m_False()
VPInstruction_match< VPInstruction::ExtractLastLane, Op0_t > m_ExtractLastLane(const Op0_t &Op0)
specific_intval< 0 > m_SpecificInt(uint64_t V)
VPInstruction_match< VPInstruction::ActiveLaneMask, Op0_t, Op1_t, Op2_t > m_ActiveLaneMask(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2)
match_bind< VPSingleDefRecipe > m_VPSingleDefRecipe(VPSingleDefRecipe *&V)
Match a VPSingleDefRecipe, capturing if we match.
VPInstruction_match< VPInstruction::BranchOnCount > m_BranchOnCount()
auto m_GetElementPtr(const Op0_t &Op0, const Op1_t &Op1)
auto m_ZExtOrTruncOrSelf(const Op0_t &Op0)
AllRecipe_match< Instruction::Sub, Op0_t, Op1_t > m_Sub(const Op0_t &Op0, const Op1_t &Op1)
canonical_iv_match m_CanonicalIV()
AllRecipe_match< Instruction::SExt, Op0_t > m_SExt(const Op0_t &Op0)
VPInstruction_commutative_match< Opcode, Op0_t, Op1_t > m_c_VPInstruction(const Op0_t &Op0, const Op1_t &Op1)
specific_intval< 1 > m_True()
auto m_VPValue()
Match an arbitrary VPValue and ignore it.
Recipe_match< std::tuple< OpTys... >, Opcode, true, VPWidenRecipe, VPReplicateRecipe, VPInstruction > AllRecipe_commutative_match
specific_intval< 0 > m_SpecificSInt(int64_t V)
AllRecipe_match< Instruction::FAdd, Op0_t, Op1_t > m_FAdd(const Op0_t &Op0, const Op1_t &Op1)
VectorEndPointerRecipe_match< Op0_t, Op1_t > m_VecEndPtr(const Op0_t &Op0, const Op1_t &Op1)
VPInstruction_match< VPInstruction::ExtractLastPart, Op0_t > m_ExtractLastPart(const Op0_t &Op0)
VPRecipeBase * findUserOf(VPValue *V, const MatchT &P)
If V is used by a recipe matching pattern P, return it.
VPInstruction_match< VPInstruction::Broadcast, Op0_t > m_Broadcast(const Op0_t &Op0)
bool match(Val *V, const Pattern &P)
header_mask_match m_HeaderMask()
OneUse_match< T > m_OneUse(const T &SubPattern)
VPInstruction_match< VPInstruction::ExplicitVectorLength, Op0_t > m_EVL(const Op0_t &Op0)
VPInstruction_match< VPInstruction::BuildVector > m_BuildVector()
BuildVector is matches only its opcode, w/o matching its operands as the number of operands is not fi...
AllRecipe_match< Instruction::Trunc, Op0_t > m_Trunc(const Op0_t &Op0)
VPInstruction_match< VPInstruction::ExtractPenultimateElement, Op0_t > m_ExtractPenultimateElement(const Op0_t &Op0)
AllRecipe_match< Instruction::Shl, Op0_t, Op1_t > m_Shl(const Op0_t &Op0, const Op1_t &Op1)
Recipe_match< std::tuple< Op0_t, Op1_t >, 0, false, VPVectorEndPointerRecipe > VectorEndPointerRecipe_match
match_bind< VPInstruction > m_VPInstruction(VPInstruction *&V)
Match a VPInstruction, capturing if we match.
match_combine_or< AllRecipe_match< Instruction::ZExt, Op0_t >, Op0_t > m_ZExtOrSelf(const Op0_t &Op0)
VPInstruction_match< VPInstruction::FirstActiveLane, Op0_t > m_FirstActiveLane(const Op0_t &Op0)
Argument_match< Opnd_t > m_Argument(const Opnd_t &Op)
Match a call argument.
AllRecipe_match< Instruction::FNeg, Op0_t > m_FNeg(const Op0_t &Op0)
AllRecipe_match< Instruction::UDiv, Op0_t, Op1_t > m_UDiv(const Op0_t &Op0, const Op1_t &Op1)
auto m_Not(const Op0_t &Op0)
auto m_DerivedIV(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2)
auto m_c_LogicalAnd(const Op0_t &Op0, const Op1_t &Op1)
int_pred_ty< is_one > m_One()
Match an integer 1 or a vector with all elements equal to 1.
Recipe_match< std::tuple< OpTys... >, Opcode, false, VPWidenRecipe, VPReplicateRecipe, VPWidenCastRecipe, VPInstruction > AllRecipe_match
AllRecipe_match< Instruction::SRem, Op0_t, Op1_t > m_SRem(const Op0_t &Op0, const Op1_t &Op1)
VPInstruction_match< VPInstruction::BranchOnCond > m_BranchOnCond()
match_bind< VPReductionPHIRecipe > m_ReductionPhi(VPReductionPHIRecipe *&V)
auto m_ScalarIVSteps(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2)
VPInstruction_match< VPInstruction::ExtractLane, Op0_t, Op1_t > m_ExtractLane(const Op0_t &Op0, const Op1_t &Op1)
VPInstruction_match< VPInstruction::BuildStructVector > m_BuildStructVector()
BuildStructVector matches only its opcode, w/o matching its operands as the number of operands is not...
bind_apint m_APInt(const APInt *&C)
auto m_AnyNeg(const Op0_t &Op0)
VPInstruction_match< VPInstruction::Reverse, Op0_t > m_Reverse(const Op0_t &Op0)
Intrinsic::ID getIntrinsicID(const Ty *R)
Return the intrinsic ID underlying a call.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
@ Load
The value being inserted comes from a load (InsertElement only).
@ Store
The extracted value is stored (ExtractElement only).
auto cast_or_null(const Y &Val)
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
constexpr unsigned BitWidth
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
Matcher to bind the captured value.
Matching or combinator leaf case.
Matcher for a specific value, but stores a reference to the value, not the value itself.
A VPValue representing a live-in from the input IR or a constant.
Match a call argument at a given argument index.
unsigned OpI
Call argument index to match.
Argument_match(unsigned OpIdx, const Opnd_t &V)
bool match(OpTy *V) const
Match a VPBlendRecipe with 2 incoming values ([I0, I1, M1] == normalized([I0, M0, I1,...
bool match(const T *Val) const
Blend2_match(const Op0_t &MaskOp, const Op1_t &TrueOp, const Op2_t &FalseOp)
Cmp_match is a variant of BinaryRecipe_match that also binds the comparison predicate.
Cmp_match(CmpPredicate &Pred, const Op0_t &Op0, const Op1_t &Op1)
Cmp_match(const Op0_t &Op0, const Op1_t &Op1)
bool match(const VPValue *V) const
bool match(const VPRecipeBase *V) const
Match a GEP recipe (VPWidenGEPRecipe, VPInstruction, or VPReplicateRecipe) and bind the source elemen...
GetElementPtr_match(Type *&SourceElementType, ArrayRef< VPValue * > &Operands)
ArrayRef< VPValue * > & Operands
Type *& SourceElementType
IntrinsicID_match(Intrinsic::ID IntrID)
bool match(OpTy *V) const
static auto impl(std::index_sequence< Is... >, const Ts &...Ops)
Match VPValues that represent live-ins: VPIRValues and (plain) VPSymbolicValues.
Load_match(Addr_t Addr, Mask_t Mask)
bool match(const OpTy *V) const
OneUse_match(const SubPattern_t &SP)
bool match(OpTy *V) const
bool match(const VPSingleDefRecipe *R) const
Recipe_match(OpTy... Ops)
std::tuple< OpTys... > Ops
bool match(const VPValue *V) const
bool match(const VPRecipeBase *R) const
SpecificCmp_match is a variant of Cmp_match that matches the comparison predicate,...
SpecificCmp_match(CmpPredicate Pred, const Op0_t &LHS, const Op1_t &RHS)
const CmpPredicate Predicate
bool match(const VPValue *V) const
bool match(const VPRecipeBase *V) const
Store_match(Addr_t Addr, Val_t Val, Mask_t Mask)
bool match(const OpTy *V) const
bind_apint(const APInt *&Res)
bool match(const VPValue *VPV) const
bool match(const VPValue *VPV) const
bind_const_int(uint64_t &Res)
Match the canonical induction variable (IV) of any loop region.
bool match(const ArgTy *V) const
Match a canonical VPWidenIntOrFpInductionRecipe optionally capturing it.
bool match(ArgTy *V) const
canonical_widen_iv_match()=default
VPWidenIntOrFpInductionRecipe ** Capture
canonical_widen_iv_match(VPWidenIntOrFpInductionRecipe *&V)
Match an integer constant if Pred::isValue returns true for the APInt.
bool match(const VPValue *VPV) const
bool isValue(const APInt &C) const
bool isValue(const APInt &C) const
Match a specified signed or unsigned integer value.
bool isValue(const APInt &C) const
is_specific_int(APInt Val, bool IsSigned=false)
bool isValue(const APInt &C) const
bool match(const VPValue *V) const
Match a specified VPValue.
specificval_ty(const VPValue *V)
bool match(const VPValue *VPV) const