19 #ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H
20 #define LLVM_CODEGEN_SELECTIONDAGNODES_H
59 template <
typename T>
struct DenseMapInfo;
61 class MachineBasicBlock;
62 class MachineConstantPoolValue;
91 bool AllowShrink =
true);
148 return Node == O.Node && ResNo == O.ResNo;
154 return std::tie(Node, ResNo) < std::tie(O.Node, O.ResNo);
156 explicit operator bool()
const {
157 return Node !=
nullptr;
195 inline void dump()
const;
196 inline void dumpr()
const;
204 unsigned Depth = 2)
const;
227 return ((
unsigned)((uintptr_t)Val.
getNode() >> 4) ^
266 SDUse **Prev =
nullptr;
267 SDUse *Next =
nullptr;
275 operator const SDValue&()
const {
return Val; }
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;
363 bool UnsafeAlgebra : 1;
366 bool NoSignedZeros : 1;
367 bool AllowReciprocal : 1;
368 bool VectorReduction : 1;
369 bool AllowContract : 1;
377 AllowContract(
false) {}
443 NoUnsignedWrap &= Flags.NoUnsignedWrap;
444 NoSignedWrap &= Flags.NoSignedWrap;
445 Exact &= Flags.Exact;
446 UnsafeAlgebra &= Flags.UnsafeAlgebra;
447 NoNaNs &= Flags.NoNaNs;
448 NoInfs &= Flags.NoInfs;
449 NoSignedZeros &= Flags.NoSignedZeros;
450 AllowReciprocal &= Flags.AllowReciprocal;
451 VectorReduction &= Flags.VectorReduction;
452 AllowContract &= Flags.AllowContract;
473 uint16_t HasDebugValue : 1;
474 uint16_t IsMemIntrinsic : 1;
483 uint16_t IsOpaque : 1;
494 uint16_t IsNonTemporal : 1;
495 uint16_t IsDereferenceable : 1;
496 uint16_t IsInvariant : 1;
505 uint16_t AddressingMode : 3;
516 uint16_t IsExpanding : 1;
525 uint16_t IsTruncating : 1;
526 uint16_t IsCompressing : 1;
558 SDUse *OperandList =
nullptr;
562 const EVT *ValueList;
565 SDUse *UseList =
nullptr;
568 unsigned short NumOperands = 0;
569 unsigned short NumValues;
582 static const EVT *getValueTypeList(
EVT VT);
701 :
public std::iterator<std::forward_iterator_tag, SDUse, ptrdiff_t> {
709 using reference = std::iterator<std::forward_iterator_tag,
711 using pointer = std::iterator<std::forward_iterator_tag,
729 assert(
Op &&
"Cannot increment end iterator!");
740 assert(
Op &&
"Cannot dereference end iterator!");
741 return Op->getUser();
750 assert(
Op &&
"Cannot dereference end iterator!");
751 return (
unsigned)(
Op -
Op->getUser()->OperandList);
805 unsigned int MaxSteps = 0) {
806 if (Visited.
count(N))
808 while (!Worklist.
empty()) {
813 if (Visited.
insert(Op).second)
820 if (MaxSteps != 0 && Visited.
size() >= MaxSteps)
837 assert(Num < NumOperands &&
"Invalid child # of SDNode!");
838 return OperandList[Num];
850 std::random_access_iterator_tag, SDValue,
851 ptrdiff_t, value_op_iterator *,
852 value_op_iterator *> {
882 if (UI.getUse().get().getValueType() ==
MVT::Glue)
899 assert(ResNo < NumValues &&
"Illegal result number!");
900 return ValueList[ResNo];
941 unsigned depth = 100)
const;
971 unsigned depth = 100)
const;
990 : NodeType(Opc), ValueList(VTs.VTs), NumValues(VTs.NumVTs),
991 IROrder(Order), debugLoc(std::move(dl)) {
995 "NumValues wasn't wide enough for its operands!");
1021 assert(Order >= 0 &&
"bad IROrder");
1033 : Node(node), ResNo(resno) {
1037 assert((!Node || !ResNo || ResNo < Node->getNumValues()) &&
1038 "Invalid result number for the given node!");
1039 assert(ResNo < -2U &&
"Cannot use result numbers reserved for DenseMaps.");
1095 return Node->
dump();
1099 return Node->
dumpr();
1104 inline void SDUse::set(
const SDValue &V) {
1105 if (Val.
getNode()) removeFromList();
1110 inline void SDUse::setInitial(
const SDValue &V) {
1115 inline void SDUse::setNode(SDNode *
N) {
1116 if (Val.
getNode()) removeFromList();
1118 if (N) N->addUse(*
this);
1151 unsigned SrcAddrSpace;
1152 unsigned DestAddrSpace;
1156 unsigned SrcAS,
unsigned DestAS);
1295 :
MemSDNode(Opc, Order, dl, VTL, MemVT, MMO) {}
1343 :
MemSDNode(Opc, Order, dl, VTs, MemoryVT, MMO) {
1390 assert(
isSplat() &&
"Cannot get splat index for non-splat!");
1404 unsigned NumElems = Mask.
size();
1405 for (
unsigned i = 0; i != NumElems; ++i) {
1409 else if (idx < (
int)NumElems)
1410 Mask[i] = idx + NumElems;
1412 Mask[i] = idx - NumElems;
1453 return cast<ConstantSDNode>(
getOperand(Num))->getZExtValue();
1605 unsigned char TargetFlags;
1608 unsigned Align,
unsigned char TF)
1612 assert(Offset >= 0 &&
"Offset is too large");
1616 ConstantPoolSDNode(
bool isTarget, MachineConstantPoolValue *v,
1617 EVT VT,
int o,
unsigned Align,
unsigned char TF)
1619 DebugLoc(),
getSDVTList(VT)), Offset(o), Alignment(Align),
1621 assert(Offset >= 0 &&
"Offset is too large");
1622 Val.MachineCPVal = v;
1623 Offset |= 1 << (
sizeof(
unsigned)*CHAR_BIT-1);
1633 return Val.ConstVal;
1638 return Val.MachineCPVal;
1642 return Offset & ~(1 << (
sizeof(
unsigned)*CHAR_BIT-1));
1716 unsigned &SplatBitSize,
bool &HasAnyUndefs,
1717 unsigned MinSplatBits = 0,
1718 bool isBigEndian =
false)
const;
1838 int64_t o,
unsigned char Flags)
1947 :
MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {
1983 assert(
readMem() &&
"Load MachineMemOperand is not a load!");
2038 :
MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {}
2084 bool isTrunc,
bool isCompressing,
EVT MemVT,
2119 :
MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {}
2177 :
SDNode(Opc, Order, DL, VTs) {}
2191 for (
mmo_iterator MMI = NewMemRefs, MME = NewMemRefsEnd; MMI != MME; ++MMI)
2192 assert(*MMI &&
"Null mem ref detected!");
2193 MemRefs = NewMemRefs;
2194 MemRefsEnd = NewMemRefsEnd;
2203 SDNode, ptrdiff_t> {
2211 return Operand == x.Operand;
2228 assert(Node == Other.Node &&
2229 "Cannot compare iterators of two different nodes!");
2230 return Operand - Other.Operand;
2261 using LargestSDNode = AlignedCharArrayUnion<AtomicSDNode, TargetIndexSDNode,
2279 return isa<LoadSDNode>(
N) &&
2285 return isa<LoadSDNode>(
N) &&
2286 cast<LoadSDNode>(N)->getExtensionType() ==
ISD::EXTLOAD;
2291 return isa<LoadSDNode>(
N) &&
2297 return isa<LoadSDNode>(
N) &&
2303 return isa<LoadSDNode>(
N) &&
2317 return isa<StoreSDNode>(
N) && !cast<StoreSDNode>(N)->isTruncatingStore();
2322 return isa<StoreSDNode>(
N) && cast<StoreSDNode>(N)->isTruncatingStore();
2327 return isa<StoreSDNode>(
N) &&
2335 #endif // LLVM_CODEGEN_SELECTIONDAGNODES_H
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
value_iterator value_begin() const
Iterator for directly iterating over the operand SDValue's.
bool hasNoUnsignedWrap() const
void setAllowReciprocal(bool b)
pointer operator->() const
unsigned getValueSizeInBits(unsigned ResNo) const
Returns MVT::getSizeInBits(getValueType(ResNo)).
bool use_empty() const
Return true if there are no uses of this node.
void push_back(const T &Elt)
BUILTIN_OP_END - This must be the last enum value in this list.
bool hasAllowContract() const
MCSymbol * getLabel() const
SDValue getValue(unsigned R) const
const SDValue & getValue() const
const DebugLoc & getDebugLoc() const
static void commuteMask(MutableArrayRef< int > Mask)
Change values in a shuffle permute mask assuming the two vector operands have swapped position...
ConstantFPSDNode * getConstantFPSplatNode(BitVector *UndefElements=nullptr) const
Returns the splatted constant FP or null if this is not a constant FP splat.
bool isTruncatingStore() const
Return true if the op does a truncation before store.
const SDValue & operator*() const
void setFlags(SDNodeFlags NewFlags)
const char * getSymbol() 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 isExactlyValue(double V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
SDValue getSplatValue(BitVector *UndefElements=nullptr) const
Returns the splatted value or a null value if this is not a splat.
bool hasNoSignedZeros() const
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)
Atomic ordering constants.
SDNode * operator->() const
MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to reference metadata in the IR...
bool isNON_TRUNCStore(const SDNode *N)
Returns true if the specified node is a non-truncating store.
void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd)
Assign this MachineSDNodes's memory reference descriptor list.
void intersectWith(const SDNodeFlags Flags)
Clear any flags in this flag set that aren't also set in Flags.
bool hasOneUse() const
Return true if there is exactly one use of this node.
unsigned getDestAddressSpace() const
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
const Value * getValue() const
Return the contained Value.
SDVTList getVTList() const
const SDValue & getVal() const
int getSplatIndex() const
static bool hasPredecessorHelper(const SDNode *N, SmallPtrSetImpl< const SDNode * > &Visited, SmallVectorImpl< const SDNode * > &Worklist, unsigned int MaxSteps=0)
Returns true if N is a predecessor of any node in Worklist.
constexpr char IsVolatile[]
Key for Kernel::Arg::Metadata::mIsVolatile.
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
bool operator!=(const use_iterator &x) const
SDNode * getGluedNode() const
If this node has a glue operand, return the node to which the glue operand points.
StoreSDNodeBitfields StoreSDNodeBits
unsigned getSrcAddressSpace() const
const GlobalValue * getGlobal() const
Completely target-dependent object reference.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
bool operator!=(const SDNodeIterator &x) const
bool getHasDebugValue() const
const SDValue & getSrc0() const
static bool classof(const SDNode *N)
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
unsigned getRawSubclassData() const
Return the SubclassData value, without HasDebugValue.
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.
unsigned getNumOperands() const
Return the number of values used by this operation.
SDNode * operator->() const
unsigned getNumOperands() const
Constrained versions of the binary floating point operators.
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
int64_t getOffset() const
const SDValue & getOffset() const
const SDValue & getOperand(unsigned Num) const
mmo_iterator memoperands_end() const
static bool areOnlyUsersOf(ArrayRef< const SDNode * > Nodes, const SDNode *N)
Return true if all the users of N are contained in Nodes.
const uint32_t * getRegMask() const
void setNodeId(int Id)
Set unique node id.
static bool classof(const SDNode *N)
ConstantSDNode * getConstantSplatNode(BitVector *UndefElements=nullptr) const
Returns the splatted constant or null if this is not a constant splat.
const MachinePointerInfo & getPointerInfo() const
const SDValue & getValue() const
void setNoSignedZeros(bool b)
const SDValue & getBasePtr() const
static ChildIteratorType child_end(NodeRef N)
static SimpleType getSimplifiedValue(SDUse &Val)
void intersectFlagsWith(const SDNodeFlags Flags)
Clear any flags in this node that aren't also set in Flags.
void dumprWithDepth(const SelectionDAG *G=nullptr, unsigned depth=100) const
printrWithDepth to dbgs().
uint16_t PersistentId
Unique and persistent id per SDNode in the DAG.
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
unsigned getResNo() const
get the index which selects a specific result in the SDNode
bool isUndef() const
Return true if the type of the node type undefined.
int64_t getSrcValueOffset() const
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
bool isAllOnesValue() const
char RawSDNodeBits[sizeof(uint16_t)]
static bool classof(const SDNode *N)
bool operator!=(const SDValue &V) const
Convenience function for get().operator!=.
MemSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemoryVT, MachineMemOperand *MMO)
SDUse & operator=(const SDUse &)=delete
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
bool isTargetOpcode() const
static SDVTList getSDVTList(EVT VT)
void setNoSignedWrap(bool b)
void print_types(raw_ostream &OS, const SelectionDAG *G) const
The address of a basic block.
AtomicOrdering getOrdering() const
Return the atomic ordering requirements for this memory operation.
static bool classof(const SDNode *N)
bool isSEXTLoad(const SDNode *N)
Returns true if the specified node is a SEXTLOAD.
bool isNegative() const
Return true if the value is negative.
A description of a memory reference used in the backend.
std::iterator< std::forward_iterator_tag, SDUse, ptrdiff_t >::reference reference
mmo_iterator memoperands_begin() const
AddrSpaceCastSDNode(unsigned Order, const DebugLoc &dl, EVT VT, unsigned SrcAS, unsigned DestAS)
static bool classof(const SDNode *N)
void setVectorReduction(bool b)
int64_t getOffset() const
static SDValue getTombstoneKey()
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
bool isNormalStore(const SDNode *N)
Returns true if the specified node is a non-truncating and unindexed store.
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...
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
unsigned getOperand() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool isZEXTLoad(const SDNode *N)
Returns true if the specified node is a ZEXTLOAD.
unsigned getAddressSpace() const
Reg
All possible values of the reg field in the ModR/M byte.
bool memoperands_empty() const
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
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.
unsigned getMachineOpcode() const
bool isTRUNCStore(const SDNode *N)
Returns true if the specified node is a truncating store.
int getMaskElt(unsigned Idx) const
This class is used to represent EVT's, which are used to parameterize some operations.
This is an SDNode representing atomic operations.
ISD::LoadExtType getExtensionType() const
ShuffleVectorSDNode(EVT VT, unsigned Order, const DebugLoc &dl, const int *M)
static unsigned getHashValue(const SDValue &Val)
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
LLVM_NODISCARD bool empty() const
This class is used to represent an MSTORE node.
AtomicOrdering
Atomic ordering for LLVM's memory model.
LoadSDNodeBitfields LoadSDNodeBits
bool isDefined() const
Returns true if the flags are in a defined state.
bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef, unsigned &SplatBitSize, bool &HasAnyUndefs, unsigned MinSplatBits=0, bool isBigEndian=false) const
Check if this is a constant splat, and if so, find the smallest element size that splats the vector...
const AMDGPUAS &AS return SrcAS
EVT getValueType() const
Convenience function for get().getValueType().
bool hasTrivialDestructor() const
Check whether this has a trivial destructor.
bool isConstantSplatVector(const SDNode *N, APInt &SplatValue, bool AllowShrink=true)
Node predicates.
bool operator!=(const SDValue &O) const
static bool classof(const SDNode *N)
static bool classof(const SDNode *N)
void checkForCycles(const SelectionDAG *DAG, bool force=false)
unsigned getIROrder() const
Return the node ordering.
bool operator==(const use_iterator &x) const
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
static SDNodeIterator begin(const SDNode *N)
bool isUNINDEXEDStore(const SDNode *N)
Returns true if the specified node is an unindexed store.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
iterator_range< use_iterator > uses() const
static bool classof(const SDNode *N)
static bool classof(const SDNode *N)
value_iterator value_end() const
static SimpleType getSimplifiedValue(const SDValue &Val)
AtomicOrdering getOrdering() const
Return the atomic ordering requirements for this memory operation.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
static bool classof(const SDNode *N)
static bool classof(const SDNode *N)
uint64_t getAlignment() const
Return the minimum known alignment in bytes of the actual memory reference.
bool isTargetOpcode() const
Test if this node has a target-specific opcode (in the <target>ISD namespace).
const SDValue & getBasePtr() const
MachineConstantPoolValue * getMachineCPVal() const
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
const APInt & getAPIntValue() const
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
EVT getMemoryVT() const
Return the type of the in-memory value.
static const char * getIndexedModeName(ISD::MemIndexedMode AM)
MachineConstantPoolValue * MachineCPVal
const ConstantInt * getConstantIntValue() const
void setIROrder(unsigned Order)
Set the node ordering.
pointer operator*() const
size_t size() const
size - Get the array size.
SDNodeBitfields SDNodeBits
unsigned char getTargetFlags() const
static bool classof(const SDNode *N)
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
const SDValue & getBasePtr() const
MaskedStoreSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, bool isTrunc, bool isCompressing, EVT MemVT, MachineMemOperand *MMO)
std::string getOperationName(const SelectionDAG *G=nullptr) const
Return the opcode of this operation for printing.
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.
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID for this memory operation.
SDNode * getNode() const
get the SDNode which holds the desired result
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
bool isNaN() const
Return true if the value is a NaN.
Function Alias Analysis false
bool hasPredecessor(const SDNode *N) const
Return true if N is a predecessor of this node.
static bool classof(const SDNode *N)
bool isOnlyUserOf(const SDNode *N) const
Return true if this node is the only use of N.
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
bool operator==(const SDValue &V) const
Convenience function for get().operator==.
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
const SDValue & getBasePtr() const
bool isZero() const
Return true if the value is positive or negative zero.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
value_op_iterator(SDUse *U=nullptr)
size_t use_size() const
Return the number of uses of this node.
bool isMachineConstantPoolEntry() const
bool isTargetMemoryOpcode() const
static bool classof(const SDNode *N)
LLVM Basic Block Representation.
const SDValue & getOperand(unsigned i) const
The instances of the Type class are immutable: once they are created, they are never changed...
bool isCompareAndSwap() const
Returns true if this SDNode represents cmpxchg atomic operation, false otherwise. ...
bool isCompressingStore() const
Returns true if the op does a compression to the vector before storing.
bool isNonTemporal() const
AAMDNodes getAAInfo() const
Return the AA tags for the memory reference.
CRTP base class for adapting an iterator to a different type.
void DropOperands()
Release the operands and set this node to have zero operands.
unsigned getOperandNo() const
Retrieve the operand # of this use in its user.
This is an important base class in LLVM.
const SDNodeFlags getFlags() const
static bool classof(const SDNode *N)
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
MachineBasicBlock * getBasicBlock() const
const Constant * getConstVal() const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
use_iterator operator++(int)
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.
This is a base class used to represent MGATHER and MSCATTER nodes.
unsigned getScalarValueSizeInBits() const
AtomicOrdering getFailureOrdering() const
For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur...
bool hasVectorReduction() const
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
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.
unsigned getOriginalAlignment() const
Returns alignment and volatility of the memory access.
bool hasAllowReciprocal() const
static bool classof(const SDNode *N)
void printrFull(raw_ostream &O, const SelectionDAG *G=nullptr) const
Print a SelectionDAG node and all children down to the leaves.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
SDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs)
Create an SDNode.
unsigned getOpcode() const
TargetIndex - Like a constant pool entry, but with completely target-dependent semantics.
const SDValue & getBasePtr() const
MCSymbol * getMCSymbol() const
static bool classof(const SDNode *N)
SDNodeIterator & operator++()
SDNodeIterator operator++(int)
unsigned char getTargetFlags() const
static bool classof(const SDNode *N)
void setAllowContract(bool b)
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
static bool classof(const SDNode *N)
const SDNode * getNode() const
static bool classof(const SDNode *N)
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
const SDValue & getValue() const
ConstantSDNode * isConstOrConstSplat(SDValue V)
Returns the SDNode if it is a constant splat BuildVector or constant int.
unsigned char getTargetFlags() const
bool operator<(const SDValue &V) const
Convenience function for get().operator<.
static bool isValueValidForType(EVT VT, const APFloat &Val)
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
void addUse(SDUse &U)
This method should only be used by the SDUse class.
static bool classof(const SDNode *N)
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID for this memory operation.
static bool classof(const SDNode *N)
MaskedGatherScatterSDNode(unsigned NodeTy, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
const SDValue & getMask() const
const APFloat & getValueAPF() const
const ConstantFP * getConstantFPValue() const
Abstract base class for all machine specific constantpool value subclasses.
static bool classof(const SDNode *N)
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc, or post-dec.
static bool classof(const SDNode *N)
This class contains a discriminated union of information about pointers in memory operands...
HANDLENODE node - Used as a handle for various purposes.
const BlockAddress * getBlockAddress() const
bool operator<(const SDValue &O) const
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
void print(raw_ostream &OS, const SelectionDAG *G=nullptr) const
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.
const MachinePointerInfo & getPointerInfo() const
MachineMemOperand * MMO
Memory reference information.
static bool classof(const SDNode *N)
const MDNode * getRanges() const
Returns the Ranges that describes the dereference.
bool isUNINDEXEDLoad(const SDNode *N)
Returns true if the specified node is an unindexed load.
const SDValue & getOffset() const
ArrayRef< int > getMask() const
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
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 ...
void setNoUnsignedWrap(bool b)
const DebugLoc & getDebugLoc() const
This is the shared class of boolean and integer constants.
void dump() const
Dump this node, for debugging.
void setNode(SDNode *N)
set the SDNode
BuildVectorSDNode()=delete
bool isInfinity() const
Return true if the value is an infinity.
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...
void setDefined()
Sets the state of the flags to the defined state.
ADDRSPACECAST - This operator converts between pointers of different address spaces.
static bool classof(const SDNode *N)
bool isPredecessorOf(const SDNode *N) const
Return true if this node is a predecessor of N.
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...
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
SDNode * getGluedUser() const
If this node has a glue value with a user, return the user (there is at most one).
An SDNode that represents everything that will be needed to construct a MachineInstr.
const SDValue & getChain() const
Promote Memory to Register
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
LLVM_NODISCARD T pop_back_val()
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
unsigned char getTargetFlags() const
This is an abstract virtual class for memory operations.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
bool isMachineOpcode() const
unsigned getAddrSpace() const
Return the LLVM IR address space number that this pointer points into.
static const int FIRST_TARGET_MEMORY_OPCODE
FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations which do not reference a specific me...
bool hasNoSignedWrap() const
bool isDereferenceable() const
Represents one node in the SelectionDAG.
bool use_empty() const
Return true if there are no nodes using value ResNo of Node.
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
static bool classof(const SDNode *N)
void print_details(raw_ostream &OS, const SelectionDAG *G) const
MachineMemOperand ** mmo_iterator
const SDValue & getValue() const
A range adaptor for a pair of iterators.
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
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()
void printr(raw_ostream &OS, const SelectionDAG *G=nullptr) const
A "pseudo-class" with methods for operating on BUILD_VECTORs.
int64_t getSExtValue() const
op_iterator op_begin() const
static use_iterator use_end()
bool isNullFPConstant(SDValue V)
Returns true if V is an FP constant with a value of positive zero.
LSBaseSDNodeBitfields LSBaseSDNodeBits
static SDValue getEmptyKey()
static bool classof(const SDNode *N)
iterator_range< value_op_iterator > op_values() const
llvm_unreachable("Unknown RegBank!")
static bool classof(const SDNode *N)
unsigned getAddressSpace() const
Return the address space for the associated pointer.
SDNode * operator*() const
Retrieve a pointer to the current user node.
AlignedCharArrayUnion< AtomicSDNode, TargetIndexSDNode, BlockAddressSDNode, GlobalAddressSDNode > LargestSDNode
A representation of the largest SDNode, for use in sizeof().
const SDValue & getMask() const
static bool classof(const SDNode *N)
int64_t getOffset() const
unsigned char getTargetFlags() const
static std::vector< std::string > Flags
ConstantFPSDNode * isConstOrConstSplatFP(SDValue V)
Returns the SDNode if it is a constant splat BuildVector or constant float.
These are IR-level optimization flags that may be propagated to SDNodes.
Represents a use of a SDNode.
unsigned getIROrder() const
uint64_t getConstantOperandVal(unsigned i) const
static bool classof(const SDNode *N)
bool hasAnyUseOfValue(unsigned Value) const
Return true if there are any use of the indicated value.
Node - This class is used to maintain the singly linked bucket list in a folding set.
This base class is used to represent MLOAD and MSTORE nodes.
void dumprFull(const SelectionDAG *G=nullptr) const
printrFull to dbgs().
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
static NodeRef getEntryNode(SDNode *N)
static SimpleType getSimplifiedValue(SDValue &Val)
ArrayRef< SDUse > ops() const
bool isOperandOf(const SDNode *N) const
Return true if this node is an operand of N.
void Profile(FoldingSetNodeID &ID) const
Gather unique data for the node.
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
op_iterator op_end() const
An SDNode that holds an arbitrary LLVM IR Value.
bool operator==(const SDNodeIterator &x) const
const SDValue & getOffset() const
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 isExpandingLoad() const
bool reachesChainWithoutSideEffects(SDValue Dest, unsigned Depth=2) const
Return true if this operand (which must be a chain) reaches the specified operand without crossing an...
bool hasUnsafeAlgebra() const
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
SDUse * getNext() const
Get the next SDUse in the use list.
use_iterator & operator++()
This class is used to represent an MSCATTER node.
const SDValue & getIndex() const
int32_t getConstantFPSplatPow2ToLog2Int(BitVector *UndefElements, uint32_t BitWidth) const
If this is a constant FP splat and the splatted constant FP is an exact power or 2, return the log base 2 integer value.
int getNodeId() const
Return the unique node id.
static ChildIteratorType child_begin(NodeRef N)
EVT getValueType() const
Return the ValueType of the referenced return value.
SDNode * getNode() const
Convenience function for get().getNode().
void setUnsafeAlgebra(bool b)
const DebugLoc & getDebugLoc() const
Return the source location info.
const Constant * ConstVal
const MDNode * getMD() const
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.
This class is used to represent an MLOAD node.
MaskedScatterSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
bool atEnd() const
Return true if this iterator is at the end of uses list.
unsigned getAlignment() const
const MDNode * getRanges() const
Return the range tag for the memory reference.
LLVM Value Representation.
const SDValue & getBasePtr() const
static bool isEqual(const SDValue &LHS, const SDValue &RHS)
static SDNodeIterator end(const SDNode *N)
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
MemSDNodeBitfields MemSDNodeBits
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
bool isTruncatingStore() const
Return true if the op does a truncation before store.
void setDebugLoc(DebugLoc dl)
Set source location info.
This class is used to represent an MGATHER node.
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)
void printrWithDepth(raw_ostream &O, const SelectionDAG *G=nullptr, unsigned depth=100) const
Print a SelectionDAG node and children up to depth "depth." The given SelectionDAG allows target-spec...
LSBaseSDNode(ISD::NodeType NodeTy, unsigned Order, const DebugLoc &dl, SDVTList VTs, ISD::MemIndexedMode AM, EVT MemVT, MachineMemOperand *MMO)
This class implements an extremely fast bulk output stream that can only output to a stream...
SDNodeFlags()
Default constructor turns off all optimization flags.
size_t operator-(SDNodeIterator Other) const
SDLoc(const Instruction *I, int Order)
static bool classof(const SDNode *N)
void dumpr() const
Dump (recursively) this node and its use-def subgraph.
bool isStrictFPOpcode()
Test if this node is a strict floating point pseudo-op.
AtomicOrdering getFailureOrdering() const
For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur...
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)
bool isOperandOf(const SDNode *N) const
Return true if this node is an operand of N.
bool isTargetMemoryOpcode() const
Test if this node has a target-specific memory-referencing opcode (in the <target>ISD namespace and g...
unsigned getAlignment() 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...
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
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.
bool isMemIntrinsic() const
Test if this node is a memory intrinsic (with valid pointer information).
bool operator==(const SDValue &O) const
static bool isSplatMask(const int *Mask, EVT VT)
unsigned getResNo() const
Convenience function for get().getResNo().
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
unsigned char getTargetFlags() const
MaskedGatherSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
uint64_t getBaseAlignment() const
Return the minimum known alignment in bytes of the base address, without the offset.
void refineAlignment(const MachineMemOperand *NewMMO)
Update this MemSDNode's MachineMemOperand information to reflect the alignment of NewMMO...
uint64_t getZExtValue() const
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.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
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.