13#ifndef LLVM_LIB_CODEGEN_SELECTIONDAG_MATCHCONTEXT_H
14#define LLVM_LIB_CODEGEN_SELECTIONDAG_MATCHCONTEXT_H
28 : DAG(DAG), TLI(TLI), Root(Root) {}
37 return DAG.
getNode(std::forward<ArgT>(Args)...);
45 bool LegalOnly =
false)
const {
61 : DAG(DAG), TLI(TLI), RootMaskOp(), RootVectorLenOp() {
66 else if (Root->
getOpcode() == ISD::VP_SELECT)
71 RootVectorLenOp = Root->
getOperand(*RootVLenPos);
77 assert(Opcode.has_value());
96 if (RootMaskOp != MaskOp &&
103 if (RootVectorLenOp != OpVal.
getOperand(*VLenPos))
117 {Operand, RootMaskOp, RootVectorLenOp});
125 return DAG.
getNode(VPOpcode,
DL, VT, {N1, N2, RootMaskOp, RootVectorLenOp});
134 {N1, N2, N3, RootMaskOp, RootVectorLenOp});
142 return DAG.
getNode(VPOpcode,
DL, VT, {Operand, RootMaskOp, RootVectorLenOp},
151 return DAG.
getNode(VPOpcode,
DL, VT, {N1, N2, RootMaskOp, RootVectorLenOp},
161 {N1, N2, N3, RootMaskOp, RootVectorLenOp}, Flags);
170 bool LegalOnly =
false)
const {
176 return N->isVPOpcode() ?
N->getNumOperands() - 2 :
N->getNumOperands();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file describes how to lower LLVM code to machine code.
This class represents an Operation in the Expression.
bool match(SDValue OpN, unsigned Opcode) const
bool isOperationLegalOrCustom(unsigned Op, EVT VT, bool LegalOnly=false) const
unsigned getNumOperands(SDValue N) const
EmptyMatchContext(SelectionDAG &DAG, const TargetLowering &TLI, SDNode *Root)
unsigned getRootBaseOpcode()
bool isOperationLegal(unsigned Op, EVT VT) const
SDValue getNode(ArgT &&...Args)
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
SDNodeFlags getFlags() const
const SDValue & getOperand(unsigned Num) const
bool isVPOpcode() const
Test if this node is a vector predication operation.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
EVT getValueType() const
Return the ValueType of the referenced return value.
const SDValue & getOperand(unsigned i) const
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
LLVM_ABI SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget=false, bool IsOpaque=false)
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
bool isOperationLegalOrCustom(unsigned Op, EVT VT, bool LegalOnly=false) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, SDValue N2, SDNodeFlags Flags)
bool isOperationLegalOrCustom(unsigned Op, EVT VT, bool LegalOnly=false) const
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue Operand, SDNodeFlags Flags)
bool isOperationLegal(unsigned Op, EVT VT) const
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, SDValue N2, SDValue N3, SDNodeFlags Flags)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, SDValue N2, SDValue N3)
bool match(SDValue OpVal, unsigned Opc) const
whether OpVal is a node that is functionally compatible with the NodeType Opc
unsigned getRootBaseOpcode()
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue Operand)
VPMatchContext(SelectionDAG &DAG, const TargetLowering &TLI, SDNode *_Root)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, SDValue N2)
unsigned getNumOperands(SDValue N) const
LLVM_ABI bool isConstantSplatVectorAllOnes(const SDNode *N, bool BuildVectorOnly=false)
Return true if the specified node is a BUILD_VECTOR or SPLAT_VECTOR where all of the elements are ~0 ...
LLVM_ABI std::optional< unsigned > getBaseOpcodeForVP(unsigned Opcode, bool hasFPExcept)
Translate this VP Opcode to its corresponding non-VP Opcode.
LLVM_ABI std::optional< unsigned > getVPMaskIdx(unsigned Opcode)
The operand position of the vector mask.
LLVM_ABI std::optional< unsigned > getVPExplicitVectorLengthIdx(unsigned Opcode)
The operand position of the explicit vector length parameter.
LLVM_ABI std::optional< unsigned > getVPForBaseOpcode(unsigned Opcode)
Translate this non-VP Opcode to its corresponding VP Opcode.
This is an optimization pass for GlobalISel generic memory operations.
These are IR-level optimization flags that may be propagated to SDNodes.
bool hasNoFPExcept() const