#ifndef LLVM_CODEGEN_SDPATTERNMATCH_H
#define LLVM_CODEGEN_SDPATTERNMATCH_H
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/TargetLowering.h"
namespace llvm {
namespace SDPatternMatch {
class BasicMatchContext { … };
template <typename Pattern, typename MatchContext>
[[nodiscard]] bool sd_context_match(SDValue N, const MatchContext &Ctx,
Pattern &&P) { … }
template <typename Pattern, typename MatchContext>
[[nodiscard]] bool sd_context_match(SDNode *N, const MatchContext &Ctx,
Pattern &&P) { … }
template <typename Pattern>
[[nodiscard]] bool sd_match(SDNode *N, const SelectionDAG *DAG, Pattern &&P) { … }
template <typename Pattern>
[[nodiscard]] bool sd_match(SDValue N, const SelectionDAG *DAG, Pattern &&P) { … }
template <typename Pattern>
[[nodiscard]] bool sd_match(SDNode *N, Pattern &&P) { … }
template <typename Pattern>
[[nodiscard]] bool sd_match(SDValue N, Pattern &&P) { … }
struct Value_match { … };
inline Value_match m_Value() { … }
inline Value_match m_Specific(SDValue N) { … }
struct DeferredValue_match { … };
inline DeferredValue_match m_Deferred(SDValue &V) { … }
struct Opcode_match { … };
inline Opcode_match m_Opc(unsigned Opcode) { … }
template <unsigned NumUses, typename Pattern> struct NUses_match { … };
template <typename Pattern>
inline NUses_match<1, Pattern> m_OneUse(const Pattern &P) { … }
template <unsigned N, typename Pattern>
inline NUses_match<N, Pattern> m_NUses(const Pattern &P) { … }
inline NUses_match<1, Value_match> m_OneUse() { … }
template <unsigned N> inline NUses_match<N, Value_match> m_NUses() { … }
struct Value_bind { … };
inline Value_bind m_Value(SDValue &N) { … }
template <typename Pattern, typename PredFuncT> struct TLI_pred_match { … };
template <typename PredFuncT, typename Pattern>
TLI_pred_match(const PredFuncT &Pred, const Pattern &P)
-> TLI_pred_match<Pattern, PredFuncT>;
template <typename Pattern> inline auto m_LegalOp(const Pattern &P) { … }
template <typename NewMatchContext, typename Pattern> struct SwitchContext { … };
template <typename MatchContext, typename Pattern>
inline SwitchContext<MatchContext, Pattern> m_Context(const MatchContext &Ctx,
Pattern &&P) { … }
struct ValueType_bind { … };
inline ValueType_bind m_VT(EVT &VT) { … }
template <typename Pattern, typename PredFuncT> struct ValueType_match { … };
template <typename PredFuncT, typename Pattern>
ValueType_match(const PredFuncT &Pred, const Pattern &P)
-> ValueType_match<Pattern, PredFuncT>;
template <typename Pattern>
inline auto m_SpecificVT(EVT RefVT, const Pattern &P) { … }
inline auto m_SpecificVT(EVT RefVT) { … }
inline auto m_Glue() { … }
inline auto m_OtherVT() { … }
template <typename Pattern> inline auto m_IntegerVT(const Pattern &P) { … }
inline auto m_IntegerVT() { … }
template <typename Pattern> inline auto m_FloatingPointVT(const Pattern &P) { … }
inline auto m_FloatingPointVT() { … }
template <typename Pattern> inline auto m_VectorVT(const Pattern &P) { … }
inline auto m_VectorVT() { … }
template <typename Pattern> inline auto m_FixedVectorVT(const Pattern &P) { … }
inline auto m_FixedVectorVT() { … }
template <typename Pattern> inline auto m_ScalableVectorVT(const Pattern &P) { … }
inline auto m_ScalableVectorVT() { … }
template <typename Pattern> inline auto m_LegalType(const Pattern &P) { … }
template <typename... Preds> struct And { … };
And<Pred, Preds...>;
template <typename... Preds> struct Or { … };
Or<Pred, Preds...>;
template <typename Pred> struct Not { … };
template <typename Pred> Not(const Pred &P) -> Not<Pred>;
template <typename Pred> inline Not<Pred> m_Unless(const Pred &P) { … }
template <typename... Preds> And<Preds...> m_AllOf(const Preds &...preds) { … }
template <typename... Preds> Or<Preds...> m_AnyOf(const Preds &...preds) { … }
template <typename... Preds> auto m_NoneOf(const Preds &...preds) { … }
template <unsigned OpIdx, typename... OpndPreds> struct Operands_match { … };
Operands_match<OpIdx, OpndPred, OpndPreds...>;
template <typename... OpndPreds>
auto m_Node(unsigned Opcode, const OpndPreds &...preds) { … }
template <bool ExcludeChain> struct EffectiveOperands { … };
template <> struct EffectiveOperands<false> { … };
template <typename T0_P, typename T1_P, typename T2_P, bool Commutable = false,
bool ExcludeChain = false>
struct TernaryOpc_match { … };
template <typename T0_P, typename T1_P, typename T2_P>
inline TernaryOpc_match<T0_P, T1_P, T2_P>
m_SetCC(const T0_P &LHS, const T1_P &RHS, const T2_P &CC) { … }
template <typename T0_P, typename T1_P, typename T2_P>
inline TernaryOpc_match<T0_P, T1_P, T2_P, true, false>
m_c_SetCC(const T0_P &LHS, const T1_P &RHS, const T2_P &CC) { … }
template <typename T0_P, typename T1_P, typename T2_P>
inline TernaryOpc_match<T0_P, T1_P, T2_P>
m_Select(const T0_P &Cond, const T1_P &T, const T2_P &F) { … }
template <typename T0_P, typename T1_P, typename T2_P>
inline TernaryOpc_match<T0_P, T1_P, T2_P>
m_VSelect(const T0_P &Cond, const T1_P &T, const T2_P &F) { … }
template <typename LHS_P, typename RHS_P, bool Commutable = false,
bool ExcludeChain = false>
struct BinaryOpc_match { … };
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_BinOp(unsigned Opc, const LHS &L,
const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_c_BinOp(unsigned Opc, const LHS &L,
const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, false, true>
m_ChainedBinOp(unsigned Opc, const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true, true>
m_c_ChainedBinOp(unsigned Opc, const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_Add(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_Sub(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_Mul(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_And(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_Or(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_DisjointOr(const LHS &L,
const RHS &R) { … }
template <typename LHS, typename RHS>
inline auto m_AddLike(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_Xor(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_SMin(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_SMax(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_UMin(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_UMax(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_UDiv(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_SDiv(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_URem(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_SRem(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_Shl(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_Sra(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_Srl(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_FAdd(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_FSub(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS, true> m_FMul(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_FDiv(const LHS &L, const RHS &R) { … }
template <typename LHS, typename RHS>
inline BinaryOpc_match<LHS, RHS> m_FRem(const LHS &L, const RHS &R) { … }
template <typename Opnd_P, bool ExcludeChain = false> struct UnaryOpc_match { … };
template <typename Opnd>
inline UnaryOpc_match<Opnd> m_UnaryOp(unsigned Opc, const Opnd &Op) { … }
template <typename Opnd>
inline UnaryOpc_match<Opnd, true> m_ChainedUnaryOp(unsigned Opc,
const Opnd &Op) { … }
template <typename Opnd>
inline UnaryOpc_match<Opnd> m_BitReverse(const Opnd &Op) { … }
template <typename Opnd> inline UnaryOpc_match<Opnd> m_ZExt(const Opnd &Op) { … }
template <typename Opnd>
inline UnaryOpc_match<Opnd> m_NNegZExt(const Opnd &Op) { … }
template <typename Opnd> inline auto m_SExt(const Opnd &Op) { … }
template <typename Opnd> inline UnaryOpc_match<Opnd> m_AnyExt(const Opnd &Op) { … }
template <typename Opnd> inline UnaryOpc_match<Opnd> m_Trunc(const Opnd &Op) { … }
template <typename Opnd> inline auto m_ZExtOrSelf(const Opnd &Op) { … }
template <typename Opnd> inline auto m_SExtOrSelf(const Opnd &Op) { … }
template <typename Opnd> inline auto m_SExtLike(const Opnd &Op) { … }
template <typename Opnd>
inline Or<UnaryOpc_match<Opnd>, Opnd> m_AExtOrSelf(const Opnd &Op) { … }
template <typename Opnd>
inline Or<UnaryOpc_match<Opnd>, Opnd> m_TruncOrSelf(const Opnd &Op) { … }
template <typename Opnd> inline UnaryOpc_match<Opnd> m_VScale(const Opnd &Op) { … }
template <typename Opnd> inline UnaryOpc_match<Opnd> m_FPToUI(const Opnd &Op) { … }
template <typename Opnd> inline UnaryOpc_match<Opnd> m_FPToSI(const Opnd &Op) { … }
struct ConstantInt_match { … };
inline ConstantInt_match m_ConstInt() { … }
inline ConstantInt_match m_ConstInt(APInt &V) { … }
struct SpecificInt_match { … };
inline SpecificInt_match m_SpecificInt(APInt V) { … }
inline SpecificInt_match m_SpecificInt(uint64_t V) { … }
inline SpecificInt_match m_Zero() { … }
inline SpecificInt_match m_One() { … }
struct AllOnes_match { … };
inline AllOnes_match m_AllOnes() { … }
inline auto m_True() { … }
inline auto m_False() { … }
struct CondCode_match { … };
inline CondCode_match m_CondCode() { … }
inline CondCode_match m_CondCode(ISD::CondCode &CC) { … }
inline CondCode_match m_SpecificCondCode(ISD::CondCode CC) { … }
template <typename ValTy>
inline BinaryOpc_match<SpecificInt_match, ValTy> m_Neg(const ValTy &V) { … }
template <typename ValTy>
inline BinaryOpc_match<ValTy, AllOnes_match, true> m_Not(const ValTy &V) { … }
}
}
#endif