19 #ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H 20 #define LLVM_CODEGEN_SELECTIONDAGNODES_H 60 template <
typename T>
struct DenseMapInfo;
62 class MachineBasicBlock;
63 class MachineConstantPoolValue;
146 return Node == O.Node && ResNo == O.ResNo;
152 return std::tie(Node, ResNo) < std::tie(O.Node, O.ResNo);
154 explicit operator bool()
const {
155 return Node !=
nullptr;
166 inline EVT getValueType()
const;
184 inline unsigned getNumOperands()
const;
185 inline const SDValue &getOperand(
unsigned i)
const;
186 inline uint64_t getConstantOperandVal(
unsigned i)
const;
187 inline bool isTargetMemoryOpcode()
const;
188 inline bool isTargetOpcode()
const;
189 inline bool isMachineOpcode()
const;
191 inline unsigned getMachineOpcode()
const;
193 inline void dump()
const;
195 inline void dumpr()
const;
203 bool reachesChainWithoutSideEffects(
SDValue Dest,
204 unsigned Depth = 2)
const;
207 inline bool use_empty()
const;
210 inline bool hasOneUse()
const;
227 return ((
unsigned)((uintptr_t)Val.
getNode() >> 4) ^
266 SDUse **Prev =
nullptr;
267 SDUse *Next =
nullptr;
275 operator const SDValue&()
const {
return Val; }
315 void setUser(
SDNode *p) { User = p; }
319 inline void set(
const SDValue &V);
322 inline void setInitial(
const SDValue &V);
325 inline void setNode(
SDNode *
N);
329 if (Next) Next->Prev = &Next;
334 void removeFromList() {
336 if (Next) Next->Prev = Prev;
360 bool NoUnsignedWrap : 1;
361 bool NoSignedWrap : 1;
367 bool VectorReduction : 1;
369 bool ApproximateFuncs : 1;
370 bool AllowReassociation : 1;
379 AllowReassociation(
false) {}
436 ApproximateFuncs = b;
440 AllowReassociation = b;
466 NoUnsignedWrap &= Flags.NoUnsignedWrap;
467 NoSignedWrap &= Flags.NoSignedWrap;
468 Exact &= Flags.Exact;
473 VectorReduction &= Flags.VectorReduction;
475 ApproximateFuncs &= Flags.ApproximateFuncs;
476 AllowReassociation &= Flags.AllowReassociation;
498 uint16_t HasDebugValue : 1;
499 uint16_t IsMemIntrinsic : 1;
500 uint16_t IsDivergent : 1;
502 enum { NumSDNodeBits = 3 };
507 uint16_t : NumSDNodeBits;
509 uint16_t IsOpaque : 1;
517 uint16_t : NumSDNodeBits;
520 uint16_t IsNonTemporal : 1;
521 uint16_t IsDereferenceable : 1;
522 uint16_t IsInvariant : 1;
524 enum { NumMemSDNodeBits = NumSDNodeBits + 4 };
529 uint16_t : NumMemSDNodeBits;
533 enum { NumLSBaseSDNodeBits = NumMemSDNodeBits + 3 };
539 uint16_t : NumLSBaseSDNodeBits;
542 uint16_t IsExpanding : 1;
549 uint16_t : NumLSBaseSDNodeBits;
551 uint16_t IsTruncating : 1;
552 uint16_t IsCompressing : 1;
556 char RawSDNodeBits[
sizeof(uint16_t)];
584 SDUse *OperandList =
nullptr;
588 const EVT *ValueList;
591 SDUse *UseList =
nullptr;
594 unsigned short NumOperands = 0;
595 unsigned short NumValues;
608 static const EVT *getValueTypeList(
EVT VT);
649 SDNodeBits.IsMemIntrinsic;
693 assert(isMachineOpcode() &&
"Not a MachineInstr opcode!");
707 return !use_empty() && std::next(use_begin()) == use_end();
712 size_t use_size()
const {
return std::distance(use_begin(), use_end()); }
736 :
public std::iterator<std::forward_iterator_tag, SDUse, ptrdiff_t> {
744 using reference = std::iterator<std::forward_iterator_tag,
746 using pointer = std::iterator<std::forward_iterator_tag,
760 bool atEnd()
const {
return Op ==
nullptr; }
764 assert(Op &&
"Cannot increment end iterator!");
775 assert(Op &&
"Cannot dereference end iterator!");
785 assert(Op &&
"Cannot dereference end iterator!");
786 return (
unsigned)(Op - Op->
getUser()->OperandList);
806 bool hasNUsesOfValue(
unsigned NUses,
unsigned Value)
const;
810 bool hasAnyUseOfValue(
unsigned Value)
const;
813 bool isOnlyUserOf(
const SDNode *
N)
const;
829 bool hasPredecessor(
const SDNode *N)
const;
843 unsigned int MaxSteps = 0,
844 bool TopologicalPrune =
false) {
846 if (Visited.
count(N))
866 while (!Worklist.
empty()) {
870 (MId > 0) && (MId < NId)) {
876 if (Visited.
insert(Op).second)
883 if (MaxSteps != 0 && Visited.
size() >= MaxSteps)
889 if (MaxSteps != 0 && Visited.
size() >= MaxSteps)
902 inline uint64_t getConstantOperandVal(
unsigned Num)
const;
905 assert(Num < NumOperands &&
"Invalid child # of SDNode!");
906 return OperandList[Num];
918 std::random_access_iterator_tag, SDValue,
919 ptrdiff_t, value_op_iterator *,
920 value_op_iterator *> {
940 if (getNumOperands() != 0 &&
941 getOperand(getNumOperands()-1).getValueType() ==
MVT::Glue)
942 return getOperand(getNumOperands()-1).getNode();
949 for (
use_iterator UI = use_begin(), UE = use_end(); UI != UE; ++UI)
950 if (UI.getUse().get().getValueType() ==
MVT::Glue)
968 assert(ResNo < NumValues &&
"Illegal result number!");
969 return ValueList[ResNo];
974 return getValueType(ResNo).getSimpleVT();
979 return getValueType(ResNo).getSizeInBits();
988 std::string getOperationName(
const SelectionDAG *
G =
nullptr)
const;
1010 unsigned depth = 100)
const;
1040 unsigned depth = 100)
const;
1059 : NodeType(Opc), ValueList(VTs.VTs), NumValues(VTs.
NumVTs),
1060 IROrder(Order), debugLoc(
std::move(dl)) {
1061 memset(&RawSDNodeBits, 0,
sizeof(RawSDNodeBits));
1064 "NumValues wasn't wide enough for its operands!");
1068 void DropOperands();
1090 assert(Order >= 0 &&
"bad IROrder");
1102 : Node(node), ResNo(resno) {
1106 assert((!Node || !ResNo || ResNo < Node->getNumValues()) &&
1107 "Invalid result number for the given node!");
1108 assert(ResNo < -2U &&
"Cannot use result numbers reserved for DenseMaps.");
1164 return Node->
dump();
1168 return Node->
dump(G);
1172 return Node->
dumpr();
1176 return Node->
dumpr(G);
1181 inline void SDUse::set(
const SDValue &V) {
1182 if (Val.
getNode()) removeFromList();
1187 inline void SDUse::setInitial(
const SDValue &V) {
1192 inline void SDUse::setNode(
SDNode *
N) {
1193 if (Val.
getNode()) removeFromList();
1210 PersistentId = 0xffff;
1228 unsigned SrcAddrSpace;
1229 unsigned DestAddrSpace;
1233 unsigned SrcAS,
unsigned DestAS);
1277 char RawSDNodeBits[
sizeof(uint16_t)];
1280 memcpy(&RawSDNodeBits, &this->RawSDNodeBits,
sizeof(this->RawSDNodeBits));
1281 SDNodeBits.HasDebugValue = 0;
1282 SDNodeBits.IsDivergent =
false;
1283 memcpy(&Data, &RawSDNodeBits,
sizeof(RawSDNodeBits));
1322 return getPointerInfo().getAddrSpace();
1375 :
MemSDNode(Opc, Order, dl, VTL, MemVT, MMO) {}
1391 assert(isCompareAndSwap() &&
"Must be cmpxchg operation");
1392 return MMO->getFailureOrdering();
1424 :
MemSDNode(Opc, Order, dl, VTs, MemoryVT, MMO) {
1425 SDNodeBits.IsMemIntrinsic =
true;
1471 assert(
isSplat() &&
"Cannot get splat index for non-splat!");
1480 static bool isSplatMask(
const int *Mask,
EVT VT);
1485 unsigned NumElems = Mask.
size();
1486 for (
unsigned i = 0; i != NumElems; ++i) {
1490 else if (idx < (
int)NumElems)
1491 Mask[i] = idx + NumElems;
1493 Mask[i] = idx - NumElems;
1511 ConstantSDNodeBits.IsOpaque = isOpaque;
1527 bool isOpaque()
const {
return ConstantSDNodeBits.IsOpaque; }
1536 return cast<ConstantSDNode>(
getOperand(Num))->getZExtValue();
1576 bool isExactlyValue(
const APFloat& V)
const;
1578 static bool isValueValidForType(
EVT VT,
const APFloat& Val);
1647 unsigned getAddressSpace()
const;
1664 0,
DebugLoc(), getSDVTList(VT)), FI(fi) {
1684 0,
DebugLoc(), getSDVTList(VT)), JTI(jti), TargetFlags(TF) {
1709 unsigned Align,
unsigned char TF)
1711 DebugLoc(), getSDVTList(VT)), Offset(o), Alignment(Align),
1713 assert(Offset >= 0 &&
"Offset is too large");
1718 EVT VT,
int o,
unsigned Align,
unsigned char TF)
1722 assert(Offset >= 0 &&
"Offset is too large");
1723 Val.MachineCPVal = v;
1724 Offset |= 1 << (
sizeof(
unsigned)*CHAR_BIT-1);
1733 assert(!isMachineConstantPoolEntry() &&
"Wrong constantpool type");
1734 return Val.ConstVal;
1738 assert(isMachineConstantPoolEntry() &&
"Wrong constantpool type");
1739 return Val.MachineCPVal;
1743 return Offset & ~(1 << (
sizeof(
unsigned)*CHAR_BIT-1));
1754 return N->
getOpcode() == ISD::ConstantPool ||
1770 TargetFlags(TF), Index(Idx), Offset(Ofs) {}
1817 unsigned &SplatBitSize,
bool &HasAnyUndefs,
1818 unsigned MinSplatBits = 0,
1819 bool isBigEndian =
false)
const;
1833 getConstantSplatNode(
BitVector *UndefElements =
nullptr)
const;
1841 getConstantFPSplatNode(
BitVector *UndefElements =
nullptr)
const;
1848 int32_t getConstantFPSplatPow2ToLog2Int(
BitVector *UndefElements,
1939 int64_t o,
unsigned char Flags)
1941 BA(ba), Offset(o), TargetFlags(Flags) {}
1979 0,
DebugLoc(), getSDVTList(VT)), Symbol(Sym), TargetFlags(TF) {}
2049 :
MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {
2050 LSBaseSDNodeBits.AddressingMode = AM;
2051 assert(getAddressingMode() == AM &&
"Value truncated");
2084 LoadSDNodeBits.ExtTy = ETy;
2085 assert(readMem() &&
"Load MachineMemOperand is not a load!");
2086 assert(!writeMem() &&
"Load MachineMemOperand is a store!");
2112 StoreSDNodeBits.IsTruncating = isTrunc;
2113 assert(!readMem() &&
"Store MachineMemOperand is a load!");
2114 assert(writeMem() &&
"Store MachineMemOperand is not a store!");
2123 StoreSDNodeBits.IsTruncating = Truncating;
2143 :
MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {}
2170 LoadSDNodeBits.ExtTy = ETy;
2171 LoadSDNodeBits.IsExpanding = IsExpanding;
2195 bool isTrunc,
bool isCompressing,
EVT MemVT,
2198 StoreSDNodeBits.IsTruncating = isTrunc;
2199 StoreSDNodeBits.IsCompressing = isCompressing;
2232 :
MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {}
2295 :
SDNode(Opc, Order, DL, VTs) {}
2324 if (NumMemRefs == 0)
2326 if (NumMemRefs == 1)
2348 SDNode, ptrdiff_t> {
2356 return Operand == x.Operand;
2373 assert(Node == Other.Node &&
2374 "Cannot compare iterators of two different nodes!");
2375 return Operand - Other.Operand;
2424 return isa<LoadSDNode>(
N) &&
2430 return isa<LoadSDNode>(
N) &&
2431 cast<LoadSDNode>(N)->getExtensionType() ==
ISD::EXTLOAD;
2436 return isa<LoadSDNode>(
N) &&
2442 return isa<LoadSDNode>(
N) &&
2448 return isa<LoadSDNode>(
N) &&
2462 return isa<StoreSDNode>(
N) && !cast<StoreSDNode>(N)->isTruncatingStore();
2467 return isa<StoreSDNode>(
N) && cast<StoreSDNode>(N)->isTruncatingStore();
2472 return isa<StoreSDNode>(
N) &&
2493 bool AllowUndefs =
false);
2501 bool AllowUndefs =
false);
2506 #endif // LLVM_CODEGEN_SELECTIONDAGNODES_H ANNOTATION_LABEL - Represents a mid basic block label used by annotations.
bool isMachineConstantPoolEntry() const
Iterator for directly iterating over the operand SDValue's.
void setAllowReciprocal(bool b)
void setAllowReassociation(bool b)
BUILTIN_OP_END - This must be the last enum value in this list.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
EVT getValueType() const
Return the ValueType of the referenced return value.
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
static void commuteMask(MutableArrayRef< int > Mask)
Change values in a shuffle permute mask assuming the two vector operands have swapped position...
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
const SDValue & getOffset() const
void setFlags(SDNodeFlags NewFlags)
static bool isConstant(const MachineInstr &MI)
bool hasNoSignedZeros() const
Constrained versions of libm-equivalent floating point intrinsics.
This SDNode is used for target intrinsics that touch memory and need an associated MachineMemOperand...
bool hasNoNaNs() const
Test if this operation's arguments and results are assumed not-NaN.
const GlobalValue * getGlobal() const
PointerUnion< const Value *, const PseudoSourceValue * > ValueType
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
MCSymbol * getLabel() const
bool hasNoInfs() const
Test if this operation's arguments and results are assumed not-infinite.
bool isBuildVectorOfConstantSDNodes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR node of all ConstantSDNode or undef...
static bool classof(const SDNode *N)
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
Atomic ordering constants.
unsigned char getTargetFlags() const
MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to reference metadata in the IR...
This class represents lattice values for constants.
bool isNON_TRUNCStore(const SDNode *N)
Returns true if the specified node is a non-truncating store.
value_iterator value_end() const
bool isCompareAndSwap() const
Returns true if this SDNode represents cmpxchg atomic operation, false otherwise. ...
void intersectWith(const SDNodeFlags Flags)
Clear any flags in this flag set that aren't also set in Flags.
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
const SDValue & getVal() const
constexpr char IsVolatile[]
Key for Kernel::Arg::Metadata::mIsVolatile.
int getSplatIndex() const
const Value * getSplatValue(const Value *V)
Get splat value if the input is a splat vector or return nullptr.
bool isNullOrNullSplat(SDValue V)
Return true if the value is a constant 0 integer or a splatted vector of a constant 0 integer (with n...
unsigned getIROrder() const
Return the node ordering.
const SDValue & getBasePtr() const
bool isNegative() const
Return true if the value is negative.
bool isTargetMemoryOpcode() const
Test if this node has a target-specific memory-referencing opcode (in the <target>ISD namespace and g...
const SDNode * getNode() const
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
void push_back(const T &Elt)
bool operator<(const SDValue &O) const
MachineBasicBlock * getBasicBlock() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
StoreSDNodeBitfields StoreSDNodeBits
bool isMemIntrinsic() const
Test if this node is a memory intrinsic (with valid pointer information).
const SDValue & getValue() const
SDVTList getVTList() const
bool isCompressingStore() const
Returns true if the op does a compression to the vector before storing.
MCSymbol * getMCSymbol() const
bool isTargetOpcode() const
bool atEnd() const
Return true if this iterator is at the end of uses list.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
const SDValue & getBasePtr() const
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
Completely target-dependent object reference.
const SDValue & getBasePtr() const
void copyFMF(const FPMathOperator &FPMO)
Propagate the fast-math-flags from an IR FPMathOperator.
const SDValue & getChain() const
static bool classof(const SDNode *N)
unsigned getResNo() const
Convenience function for get().getResNo().
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc, or post-dec.
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
unsigned getAlignment() const
bool operator==(const use_iterator &x) const
unsigned getValueSizeInBits(unsigned ResNo) const
Returns MVT::getSizeInBits(getValueType(ResNo)).
bool isBitwiseNot(SDValue V)
Returns true if V is a bitwise not operation.
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
bool isAllOnesOrAllOnesSplat(SDValue V)
Return true if the value is a constant -1 integer or a splatted vector of a constant -1 integer (with...
Constrained versions of the binary floating point operators.
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
bool hasAllowContract() const
Test if this operation can be floating-point contracted (FMA).
void setApproximateFuncs(bool b)
const SDNodeFlags getFlags() const
void setNodeId(int Id)
Set unique node id.
bool isTargetOpcode() const
Test if this node has a target-specific opcode (in the <target>ISD namespace).
SDNode * getNode() const
get the SDNode which holds the desired result
static bool classof(const SDNode *N)
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
void setNoSignedZeros(bool b)
uint64_t getBaseAlignment() const
Return the minimum known alignment in bytes of the base address, without the offset.
static ChildIteratorType child_end(NodeRef N)
static SimpleType getSimplifiedValue(SDUse &Val)
uint16_t PersistentId
Unique and persistent id per SDNode in the DAG.
const DebugLoc & getDebugLoc() const
Return the source location info.
SDUse * getNext() const
Get the next SDUse in the use list.
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
const ConstantFP * getConstantFPValue() const
const DebugLoc & getDebugLoc() const
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
bool isAllOnesValue() const
static bool classof(const SDNode *N)
bool hasApproximateFuncs() const
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
bool isTruncatingStore() const
Return true if the op does a truncation before store.
static bool hasPredecessorHelper(const SDNode *N, SmallPtrSetImpl< const SDNode *> &Visited, SmallVectorImpl< const SDNode *> &Worklist, unsigned int MaxSteps=0, bool TopologicalPrune=false)
Returns true if N is a predecessor of any node in Worklist.
unsigned getAddressSpace() const
Return the address space for the associated pointer.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
unsigned char getTargetFlags() const
static bool classof(const SDNode *N)
static SDVTList getSDVTList(EVT VT)
void setNoSignedWrap(bool b)
The address of a basic block.
AAMDNodes getAAInfo() const
Return the AA tags for the memory reference.
static bool classof(const SDNode *N)
bool isSEXTLoad(const SDNode *N)
Returns true if the specified node is a SEXTLOAD.
bool hasOneUse() const
Return true if there is exactly one use of this node.
A description of a memory reference used in the backend.
std::iterator< std::forward_iterator_tag, SDUse, ptrdiff_t >::reference reference
static bool classof(const SDNode *N)
void setVectorReduction(bool b)
static SDValue getTombstoneKey()
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Shift and rotation operations.
bool matchUnaryPredicate(SDValue Op, std::function< bool(ConstantSDNode *)> Match, bool AllowUndefs=false)
Attempt to match a unary predicate against a scalar/splat constant or every element of a constant BUI...
bool isNormalStore(const SDNode *N)
Returns true if the specified node is a non-truncating and unindexed store.
const MDNode * getRanges() const
Return the range tag for the memory reference.
Base class for LoadSDNode and StoreSDNode.
bool isBuildVectorAllZeros(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are 0 or undef...
static Optional< unsigned > getOpcode(ArrayRef< VPValue *> Values)
Returns the opcode of Values or ~0 if they do not all agree.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
const SDValue & getPassThru() const
const MDNode * getMD() const
ArrayRef< MachineMemOperand * > memoperands() const
op_iterator op_end() const
unsigned getScalarValueSizeInBits() const
uint64_t getConstantOperandVal(unsigned i) const
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
bool isZEXTLoad(const SDNode *N)
Returns true if the specified node is a ZEXTLOAD.
PT1 const * getAddrOfPtr1() const
If the union is set to the first pointer type get an address pointing to it.
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt) For double-word atomic operations: ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi) ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi) These correspond to the atomicrmw instruction.
const SDValue & getValue() const
bool hasAllowReciprocal() const
Test if this operation can use reciprocal multiply instead of division.
bool isTRUNCStore(const SDNode *N)
Returns true if the specified node is a truncating store.
This class is used to represent EVT's, which are used to parameterize some operations.
const BlockAddress * getBlockAddress() const
This is an SDNode representing atomic operations.
ShuffleVectorSDNode(EVT VT, unsigned Order, const DebugLoc &dl, const int *M)
AtomicOrdering getOrdering() const
Return the atomic ordering requirements for this memory operation.
static unsigned getHashValue(const SDValue &Val)
APInt operator*(APInt a, uint64_t RHS)
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
bool isConstantSplatVector(const SDNode *N, APInt &SplatValue)
Node predicates.
This class is used to represent an MSTORE node.
AtomicOrdering
Atomic ordering for LLVM's memory model.
LoadSDNodeBitfields LoadSDNodeBits
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
int64_t getSExtValue() const
bool operator==(const SDValue &V) const
Convenience function for get().operator==.
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
static bool classof(const SDNode *N)
AtomicOrdering getOrdering() const
Return the atomic ordering requirements for this memory operation.
static bool classof(const SDNode *N)
void checkForCycles(const SelectionDAG *DAG, bool force=false)
bool isOneOrOneSplat(SDValue V)
Return true if the value is a constant 1 integer or a splatted vector of a constant 1 integer (with n...
void clearMemRefs()
Clear out the memory reference descriptor list.
static SDNodeIterator begin(const SDNode *N)
bool isUNINDEXEDStore(const SDNode *N)
Returns true if the specified node is an unindexed store.
int64_t getOffset() const
static bool classof(const SDNode *N)
static bool classof(const SDNode *N)
const SDValue & getScale() const
bool isNegative() const
Return true if the sign bit is set.
SDValue peekThroughBitcasts(SDValue V)
Return the non-bitcasted source operand of V if it exists.
Simple integer binary arithmetic operators.
static SimpleType getSimplifiedValue(const SDValue &Val)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
static bool classof(const SDNode *N)
const APInt & getValue() const
Return the constant as an APInt value reference.
static bool classof(const SDNode *N)
bool isMinusOne() const
This function will return true iff every bit in this constant is set to true.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
op_iterator op_begin() const
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
MachineConstantPoolValue * MachineCPVal
ArrayRef< SDUse > ops() const
void setIROrder(unsigned Order)
Set the node ordering.
const SDValue & getMask() const
int64_t getSrcValueOffset() const
bool getHasDebugValue() const
mmo_iterator memoperands_end() const
unsigned getSrcAddressSpace() const
SDNodeBitfields SDNodeBits
const char * getSymbol() const
static bool classof(const SDNode *N)
bool use_empty() const
Return true if there are no nodes using value ResNo of Node.
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
MaskedStoreSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, bool isTrunc, bool isCompressing, EVT MemVT, MachineMemOperand *MMO)
bool hasAllowReciprocal() const
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
bool isOneConstant(SDValue V)
Returns true if V is a constant integer one.
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
SDNode * operator->() const
bool isZero() const
Return true if the value is positive or negative zero.
bool hasAllowContract() const
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
const SDValue & getBasePtr() const
static bool classof(const SDNode *N)
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
int64_t getOffset() const
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
const SDValue & operator*() const
bool isNaN() const
Return true if the value is a NaN.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
value_op_iterator(SDUse *U=nullptr)
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
bool isExpandingLoad() const
static bool classof(const SDNode *N)
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
Simple binary floating point operators.
bool hasAnyUseOfValue(unsigned Value) const
Return true if there are any use of the indicated value.
bool isMachineOpcode() const
CRTP base class for adapting an iterator to a different type.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
size_t size() const
size - Get the array size.
This is an important base class in LLVM.
iterator_range< value_op_iterator > op_values() const
SDNode * getGluedUser() const
If this node has a glue value with a user, return the user (there is at most one).
static bool classof(const SDNode *N)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
const SDValue & getOperand(unsigned Num) const
bool operator==(const SDValue &O) const
bool operator!=(const SDValue &V) const
Convenience function for get().operator!=.
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool isOperandOf(const SUnit *SU, SDNode *N)
use_iterator operator++(int)
bool matchBinaryPredicate(SDValue LHS, SDValue RHS, std::function< bool(ConstantSDNode *, ConstantSDNode *)> Match, bool AllowUndefs=false)
Attempt to match a binary predicate against a pair of scalar/splat constants or every element of a pa...
ConstantFP - Floating Point Values [float, double].
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
unsigned char getTargetFlags() const
This is a base class used to represent MGATHER and MSCATTER nodes.
unsigned char getTargetFlags() const
const SDValue & getOffset() const
unsigned getDestAddressSpace() const
bool isTargetMemoryOpcode() const
bool isExactlyValue(double V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This class provides iterator support for SDUse operands that use a specific SDNode.
bool isExactlyValue(double V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
static bool classof(const SDNode *N)
unsigned getMachineOpcode() const
SDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs)
Create an SDNode.
const APInt & getAPIntValue() const
TargetIndex - Like a constant pool entry, but with completely target-dependent semantics.
static bool classof(const SDNode *N)
SDNodeIterator & operator++()
SDNodeIterator operator++(int)
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
bool isDefined() const
Returns true if the flags are in a defined state.
SDNode * getGluedNode() const
If this node has a glue operand, return the node to which the glue operand points.
static bool classof(const SDNode *N)
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
unsigned getOriginalAlignment() const
Returns alignment and volatility of the memory access.
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
void setAllowContract(bool b)
const SDValue & getValue() const
static bool classof(const SDNode *N)
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
unsigned char getTargetFlags() const
void addUse(SDUse &U)
This method should only be used by the SDUse class.
static bool classof(const SDNode *N)
const SDValue & getIndex() const
unsigned getAlignment() const
static bool classof(const SDNode *N)
const SDValue & getBasePtr() const
Abstract base class for all machine specific constantpool value subclasses.
static bool classof(const SDNode *N)
static wasm::ValType getType(const TargetRegisterClass *RC)
static bool classof(const SDNode *N)
This class contains a discriminated union of information about pointers in memory operands...
bool hasApproxFunc() const
Test if this operation allows approximations of math library functions or intrinsics.
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
unsigned getNumOperands() const
Return the number of values used by this operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
HANDLENODE node - Used as a handle for various purposes.
uint64_t getAlignment() const
Return the minimum known alignment in bytes of the actual memory reference.
const SDValue & getMask() const
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
void refineAlignment(const MachineMemOperand *MMO)
Update this MachineMemOperand to reflect the alignment of MMO, if it has a greater alignment...
bool isEXTLoad(const SDNode *N)
Returns true if the specified node is a EXTLOAD.
ConstantFPSDNode * isConstOrConstSplatFP(SDValue N, bool AllowUndefs=false)
Returns the SDNode if it is a constant splat BuildVector or constant float.
MachineMemOperand * MMO
Memory reference information.
static bool classof(const SDNode *N)
bool isUNINDEXEDLoad(const SDNode *N)
Returns true if the specified node is an unindexed load.
const APFloat & getValueAPF() const
bool hasAllowReassoc() const
Test if this operation may be simplified with reassociative transforms.
bool use_empty() const
Return true if there are no uses of this node.
SDNode * getNode() const
Convenience function for get().getNode().
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
static bool isUndef(ArrayRef< int > Mask)
TokenFactor - This node takes multiple tokens as input and produces a single token result...
void dump() const
Dump this node, for debugging.
bool isBuildVectorAllOnes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are ~0 or undef...
ConstantSDNodeBitfields ConstantSDNodeBits
static bool classof(const SDNode *N)
isPodLike - This is a type trait that is used to determine whether a given type can be copied around ...
bool memoperands_empty() const
bool hasNoSignedZeros() const
Test if this operation can ignore the sign of zero.
void setNoUnsignedWrap(bool b)
uint64_t getLimitedValue(uint64_t Limit=~0ULL) const
getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the l...
This is the shared class of boolean and integer constants.
void setNode(SDNode *N)
set the SDNode
use_iterator(const use_iterator &I)
TargetIndexSDNode(int Idx, EVT VT, int64_t Ofs, unsigned char TF)
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
const SDValue & getMask() const
void setDefined()
Sets the state of the flags to the defined state.
ADDRSPACECAST - This operator converts between pointers of different address spaces.
value_iterator value_begin() const
static bool classof(const SDNode *N)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Utility class for floating point operations which can have information about relaxed accuracy require...
const DebugLoc & getDebugLoc() const
bool allOperandsUndef(const SDNode *N)
Return true if the node has at least one operand and all operands of the specified node are ISD::UNDE...
An SDNode that represents everything that will be needed to construct a MachineInstr.
const SDValue & getOffset() const
Promote Memory to Register
const SDValue & getPassThru() const
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
LLVM_NODISCARD T pop_back_val()
This is an abstract virtual class for memory operations.
const Constant * getConstVal() const
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static const int FIRST_TARGET_MEMORY_OPCODE
FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations which do not reference a specific me...
Represents one node in the SelectionDAG.
bool operator==(const SDNodeIterator &x) const
unsigned char getTargetFlags() const
static bool classof(const SDNode *N)
bool isDereferenceable() const
size_t use_size() const
Return the number of uses of this node.
A range adaptor for a pair of iterators.
EVT getMemoryVT() const
Return the type of the in-memory value.
Class for arbitrary precision integers.
bool isBuildVectorOfConstantFPSDNodes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR node of all ConstantFPSDNode or undef...
iterator_range< use_iterator > uses()
A "pseudo-class" with methods for operating on BUILD_VECTORs.
SDValue peekThroughOneUseBitcasts(SDValue V)
Return the non-bitcasted and one-use source operand of V if it exists.
static use_iterator use_end()
bool isNullFPConstant(SDValue V)
Returns true if V is an FP constant with a value of positive zero.
pointer operator->() const
This union template exposes a suitably aligned and sized character array member which can hold elemen...
unsigned getOperandNo() const
Retrieve the operand # of this use in its user.
iterator_range< use_iterator > uses() const
const SDValue & getBasePtr() const
const uint32_t * getRegMask() const
int getMaskElt(unsigned Idx) const
size_t operator-(SDNodeIterator Other) const
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
LSBaseSDNodeBitfields LSBaseSDNodeBits
static SDValue getEmptyKey()
bool hasVectorReduction() const
static bool classof(const SDNode *N)
static bool classof(const SDNode *N)
int getNodeId() const
Return the unique node id.
static bool classof(const SDNode *N)
bool hasNoSignedWrap() const
pointer operator*() const
void setTruncatingStore(bool Truncating)
static bool isConstantSplat(SDValue Op, APInt &SplatVal)
mmo_iterator memoperands_begin() const
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID for this memory operation.
These are IR-level optimization flags that may be propagated to SDNodes.
Represents a use of a SDNode.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
SDNode * operator*() const
Retrieve a pointer to the current user node.
ConstantSDNode * isConstOrConstSplat(SDValue N, bool AllowUndefs=false)
Returns the SDNode if it is a constant splat BuildVector or constant int.
const MachinePointerInfo & getPointerInfo() const
static bool classof(const SDNode *N)
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
const SDValue & getValue() const
Bitwise operators - logical and, logical or, logical xor.
bool operator!=(const use_iterator &x) const
Node - This class is used to maintain the singly linked bucket list in a folding set.
bool operator!=(const SDValue &O) const
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first found DebugLoc that has a DILocation, given a range of instructions.
This base class is used to represent MLOAD and MSTORE nodes.
LLVM_NODISCARD bool empty() const
bool isZero() const
Return true if the value is positive or negative zero.
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
bool isNaN() const
Return true if the value is a NaN.
int64_t getOffset() const
static NodeRef getEntryNode(SDNode *N)
static SimpleType getSimplifiedValue(SDValue &Val)
const ConstantInt * getConstantIntValue() const
const Value * getValue() const
Return the contained Value.
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
bool isInfinity() const
Return true if the value is infinity.
An SDNode that holds an arbitrary LLVM IR Value.
EVT getValueType() const
Convenience function for get().getValueType().
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
bool isBinaryOp(const SDNode *N)
Return true if the node is a math/logic binary operator.
const SDValue & getBasePtr() const
bool operator<(const SDValue &V) const
Convenience function for get().operator<.
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
unsigned getOpcode() const
SDValue getValue(unsigned R) const
bool isInfinity() const
Return true if the value is an infinity.
use_iterator & operator++()
This class is used to represent an MSCATTER node.
static ChildIteratorType child_begin(NodeRef N)
const MachinePointerInfo & getPointerInfo() const
const Constant * ConstVal
T get() const
Returns the value of the specified pointer type.
MachineConstantPoolValue * getMachineCPVal() const
MaskedGatherScatterSDNode(ISD::NodeType NodeTy, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class is used to form a handle around another node that is persistent and is updated across invo...
std::iterator< std::forward_iterator_tag, SDUse, ptrdiff_t >::pointer pointer
bool isAllOnesConstant(SDValue V)
Returns true if V is an integer constant with all bits set.
void dumpr() const
Dump (recursively) this node and its use-def subgraph.
This class is used to represent an MLOAD node.
MaskedScatterSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
bool isPredecessorOf(const SDNode *N) const
Return true if this node is a predecessor of N.
unsigned getRawSubclassData() const
Return the SubclassData value, without HasDebugValue.
ArrayRef< int > getMask() const
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
unsigned getOperand() const
LLVM Value Representation.
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
unsigned getResNo() const
get the index which selects a specific result in the SDNode
static bool isEqual(const SDValue &LHS, const SDValue &RHS)
static SDNodeIterator end(const SDNode *N)
const MDNode * getRanges() const
Returns the Ranges that describes the dereference.
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID for this memory operation.
AtomicOrdering getFailureOrdering() const
For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur...
MemSDNodeBitfields MemSDNodeBits
bool isTruncatingStore() const
Return true if the op does a truncation before store.
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
void setDebugLoc(DebugLoc dl)
Set source location info.
This class is used to represent an MGATHER node.
bool hasNoUnsignedWrap() const
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
PREFETCH - This corresponds to a prefetch intrinsic.
void setHasDebugValue(bool b)
bool isNonTemporal() const
LSBaseSDNode(ISD::NodeType NodeTy, unsigned Order, const DebugLoc &dl, SDVTList VTs, ISD::MemIndexedMode AM, EVT MemVT, MachineMemOperand *MMO)
bool isUndef() const
Return true if the type of the node type undefined.
This class implements an extremely fast bulk output stream that can only output to a stream...
SDNodeFlags()
Default constructor turns off all optimization flags.
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX)
bool hasAllowReassociation() const
print Print MemDeps of function
SDLoc(const Instruction *I, int Order)
const APFloat & getValueAPF() const
static bool classof(const SDNode *N)
ISD::LoadExtType getExtensionType() const
static bool isSplat(ArrayRef< Value *> VL)
bool operator!=(const SDNodeIterator &x) const
bool operator==(uint64_t V1, const APInt &V2)
unsigned getNumOperands() const
bool isStrictFPOpcode()
Test if this node is a strict floating point pseudo-op.
const SDValue & getOperand(unsigned i) const
int64_t getSExtValue() const
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
SDNode * getUser()
This returns the SDNode that contains this Use.
MaskedLoadSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, ISD::LoadExtType ETy, bool IsExpanding, EVT MemVT, MachineMemOperand *MMO)
uint64_t getZExtValue() const
bool hasPredecessor(const SDNode *N) const
Return true if N is a predecessor of this node.
SDNode * operator->() const
AtomicSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTL, EVT MemVT, MachineMemOperand *MMO)
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
MemIntrinsicSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemoryVT, MachineMemOperand *MMO)
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
const SDValue & getBasePtr() const
const SDValue & getMask() const
unsigned getIROrder() const
MaskedGatherSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
A discriminated union of two pointer types, with the discriminator in the low bit of the pointer...
void refineAlignment(const MachineMemOperand *NewMMO)
Update this MemSDNode's MachineMemOperand information to reflect the alignment of NewMMO...
bool hasTrivialDestructor() const
Check whether this has a trivial destructor.
MaskedLoadStoreSDNode(ISD::NodeType NodeTy, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
SRCVALUE - This is a node type that holds a Value* that is used to make reference to a value in the L...
This class is used to represent ISD::LOAD nodes.