1 //===-- llvm/CodeGen/SelectionDAGNodes.h - SelectionDAG Nodes ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the SDNode class and derived classes, which are used to
11 // represent the nodes and operations present in a SelectionDAG. These nodes
12 // and operations are machine code level operations, with some similarities to
13 // the GCC RTL representation.
15 // Clients should include the SelectionDAG.h file instead of this file directly.
17 //===----------------------------------------------------------------------===//
19 #ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H
20 #define LLVM_CODEGEN_SELECTIONDAGNODES_H
22 #include "llvm/ADT/iterator_range.h"
23 #include "llvm/ADT/FoldingSet.h"
24 #include "llvm/ADT/GraphTraits.h"
25 #include "llvm/ADT/STLExtras.h"
26 #include "llvm/ADT/SmallPtrSet.h"
27 #include "llvm/ADT/SmallVector.h"
28 #include "llvm/ADT/ilist_node.h"
29 #include "llvm/CodeGen/ISDOpcodes.h"
30 #include "llvm/CodeGen/MachineMemOperand.h"
31 #include "llvm/CodeGen/ValueTypes.h"
32 #include "llvm/IR/Constants.h"
33 #include "llvm/IR/DebugLoc.h"
34 #include "llvm/IR/Instructions.h"
35 #include "llvm/Support/DataTypes.h"
36 #include "llvm/Support/MathExtras.h"
43 class MachineBasicBlock;
44 class MachineConstantPoolValue;
48 template <typename T> struct DenseMapInfo;
49 template <typename T> struct simplify_type;
50 template <typename T> struct ilist_traits;
52 void checkForCycles(const SDNode *N);
54 /// SDVTList - This represents a list of ValueType's that has been intern'd by
55 /// a SelectionDAG. Instances of this simple value class are returned by
56 /// SelectionDAG::getVTList(...).
66 /// isBuildVectorAllOnes - Return true if the specified node is a
67 /// BUILD_VECTOR where all of the elements are ~0 or undef.
68 bool isBuildVectorAllOnes(const SDNode *N);
70 /// isBuildVectorAllZeros - Return true if the specified node is a
71 /// BUILD_VECTOR where all of the elements are 0 or undef.
72 bool isBuildVectorAllZeros(const SDNode *N);
74 /// \brief Return true if the specified node is a BUILD_VECTOR node of
75 /// all ConstantSDNode or undef.
76 bool isBuildVectorOfConstantSDNodes(const SDNode *N);
78 /// isScalarToVector - Return true if the specified node is a
79 /// ISD::SCALAR_TO_VECTOR node or a BUILD_VECTOR node where only the low
80 /// element is not an undef.
81 bool isScalarToVector(const SDNode *N);
83 /// allOperandsUndef - Return true if the node has at least one operand
84 /// and all operands of the specified node are ISD::UNDEF.
85 bool allOperandsUndef(const SDNode *N);
86 } // end llvm:ISD namespace
88 //===----------------------------------------------------------------------===//
89 /// SDValue - Unlike LLVM values, Selection DAG nodes may return multiple
90 /// values as the result of a computation. Many nodes return multiple values,
91 /// from loads (which define a token and a return value) to ADDC (which returns
92 /// a result and a carry value), to calls (which may return an arbitrary number
95 /// As such, each use of a SelectionDAG computation must indicate the node that
96 /// computes it as well as which return value to use from that node. This pair
97 /// of information is represented with the SDValue value type.
100 SDNode *Node; // The node defining the value we are using.
101 unsigned ResNo; // Which return value of the node we are using.
103 SDValue() : Node(nullptr), ResNo(0) {}
104 SDValue(SDNode *node, unsigned resno) : Node(node), ResNo(resno) {}
106 /// get the index which selects a specific result in the SDNode
107 unsigned getResNo() const { return ResNo; }
109 /// get the SDNode which holds the desired result
110 SDNode *getNode() const { return Node; }
113 void setNode(SDNode *N) { Node = N; }
115 inline SDNode *operator->() const { return Node; }
117 bool operator==(const SDValue &O) const {
118 return Node == O.Node && ResNo == O.ResNo;
120 bool operator!=(const SDValue &O) const {
121 return !operator==(O);
123 bool operator<(const SDValue &O) const {
124 return std::tie(Node, ResNo) < std::tie(O.Node, O.ResNo);
127 SDValue getValue(unsigned R) const {
128 return SDValue(Node, R);
131 // isOperandOf - Return true if this node is an operand of N.
132 bool isOperandOf(SDNode *N) const;
134 /// getValueType - Return the ValueType of the referenced return value.
136 inline EVT getValueType() const;
138 /// Return the simple ValueType of the referenced return value.
139 MVT getSimpleValueType() const {
140 return getValueType().getSimpleVT();
143 /// getValueSizeInBits - Returns the size of the value in bits.
145 unsigned getValueSizeInBits() const {
146 return getValueType().getSizeInBits();
149 unsigned getScalarValueSizeInBits() const {
150 return getValueType().getScalarType().getSizeInBits();
153 // Forwarding methods - These forward to the corresponding methods in SDNode.
154 inline unsigned getOpcode() const;
155 inline unsigned getNumOperands() const;
156 inline const SDValue &getOperand(unsigned i) const;
157 inline uint64_t getConstantOperandVal(unsigned i) const;
158 inline bool isTargetMemoryOpcode() const;
159 inline bool isTargetOpcode() const;
160 inline bool isMachineOpcode() const;
161 inline unsigned getMachineOpcode() const;
162 inline const DebugLoc getDebugLoc() const;
163 inline void dump() const;
164 inline void dumpr() const;
166 /// reachesChainWithoutSideEffects - Return true if this operand (which must
167 /// be a chain) reaches the specified operand without crossing any
168 /// side-effecting instructions. In practice, this looks through token
169 /// factors and non-volatile loads. In order to remain efficient, this only
170 /// looks a couple of nodes in, it does not do an exhaustive search.
171 bool reachesChainWithoutSideEffects(SDValue Dest,
172 unsigned Depth = 2) const;
174 /// use_empty - Return true if there are no nodes using value ResNo
177 inline bool use_empty() const;
179 /// hasOneUse - Return true if there is exactly one node using value
182 inline bool hasOneUse() const;
186 template<> struct DenseMapInfo<SDValue> {
187 static inline SDValue getEmptyKey() {
188 return SDValue((SDNode*)-1, -1U);
190 static inline SDValue getTombstoneKey() {
191 return SDValue((SDNode*)-1, 0);
193 static unsigned getHashValue(const SDValue &Val) {
194 return ((unsigned)((uintptr_t)Val.getNode() >> 4) ^
195 (unsigned)((uintptr_t)Val.getNode() >> 9)) + Val.getResNo();
197 static bool isEqual(const SDValue &LHS, const SDValue &RHS) {
201 template <> struct isPodLike<SDValue> { static const bool value = true; };
204 /// simplify_type specializations - Allow casting operators to work directly on
205 /// SDValues as if they were SDNode*'s.
206 template<> struct simplify_type<SDValue> {
207 typedef SDNode* SimpleType;
208 static SimpleType getSimplifiedValue(SDValue &Val) {
209 return Val.getNode();
212 template<> struct simplify_type<const SDValue> {
213 typedef /*const*/ SDNode* SimpleType;
214 static SimpleType getSimplifiedValue(const SDValue &Val) {
215 return Val.getNode();
219 /// SDUse - Represents a use of a SDNode. This class holds an SDValue,
220 /// which records the SDNode being used and the result number, a
221 /// pointer to the SDNode using the value, and Next and Prev pointers,
222 /// which link together all the uses of an SDNode.
225 /// Val - The value being used.
227 /// User - The user of this value.
229 /// Prev, Next - Pointers to the uses list of the SDNode referred by
233 SDUse(const SDUse &U) LLVM_DELETED_FUNCTION;
234 void operator=(const SDUse &U) LLVM_DELETED_FUNCTION;
237 SDUse() : Val(), User(nullptr), Prev(nullptr), Next(nullptr) {}
239 /// Normally SDUse will just implicitly convert to an SDValue that it holds.
240 operator const SDValue&() const { return Val; }
242 /// If implicit conversion to SDValue doesn't work, the get() method returns
244 const SDValue &get() const { return Val; }
246 /// getUser - This returns the SDNode that contains this Use.
247 SDNode *getUser() { return User; }
249 /// getNext - Get the next SDUse in the use list.
250 SDUse *getNext() const { return Next; }
252 /// getNode - Convenience function for get().getNode().
253 SDNode *getNode() const { return Val.getNode(); }
254 /// getResNo - Convenience function for get().getResNo().
255 unsigned getResNo() const { return Val.getResNo(); }
256 /// getValueType - Convenience function for get().getValueType().
257 EVT getValueType() const { return Val.getValueType(); }
259 /// operator== - Convenience function for get().operator==
260 bool operator==(const SDValue &V) const {
264 /// operator!= - Convenience function for get().operator!=
265 bool operator!=(const SDValue &V) const {
269 /// operator< - Convenience function for get().operator<
270 bool operator<(const SDValue &V) const {
275 friend class SelectionDAG;
278 void setUser(SDNode *p) { User = p; }
280 /// set - Remove this use from its existing use list, assign it the
281 /// given value, and add it to the new value's node's use list.
282 inline void set(const SDValue &V);
283 /// setInitial - like set, but only supports initializing a newly-allocated
284 /// SDUse with a non-null value.
285 inline void setInitial(const SDValue &V);
286 /// setNode - like set, but only sets the Node portion of the value,
287 /// leaving the ResNo portion unmodified.
288 inline void setNode(SDNode *N);
290 void addToList(SDUse **List) {
292 if (Next) Next->Prev = &Next;
297 void removeFromList() {
299 if (Next) Next->Prev = Prev;
303 /// simplify_type specializations - Allow casting operators to work directly on
304 /// SDValues as if they were SDNode*'s.
305 template<> struct simplify_type<SDUse> {
306 typedef SDNode* SimpleType;
307 static SimpleType getSimplifiedValue(SDUse &Val) {
308 return Val.getNode();
313 /// SDNode - Represents one node in the SelectionDAG.
315 class SDNode : public FoldingSetNode, public ilist_node<SDNode> {
317 /// NodeType - The operation that this node performs.
321 /// OperandsNeedDelete - This is true if OperandList was new[]'d. If true,
322 /// then they will be delete[]'d when the node is destroyed.
323 uint16_t OperandsNeedDelete : 1;
325 /// HasDebugValue - This tracks whether this node has one or more dbg_value
326 /// nodes corresponding to it.
327 uint16_t HasDebugValue : 1;
330 /// SubclassData - This member is defined by this class, but is not used for
331 /// anything. Subclasses can use it to hold whatever state they find useful.
332 /// This field is initialized to zero by the ctor.
333 uint16_t SubclassData : 14;
336 /// NodeId - Unique id per SDNode in the DAG.
339 /// OperandList - The values that are used by this operation.
343 /// ValueList - The types of the values this node defines. SDNode's may
344 /// define multiple values simultaneously.
345 const EVT *ValueList;
347 /// UseList - List of uses for this SDNode.
350 /// NumOperands/NumValues - The number of entries in the Operand/Value list.
351 unsigned short NumOperands, NumValues;
353 /// debugLoc - source line information.
356 // The ordering of the SDNodes. It roughly corresponds to the ordering of the
357 // original LLVM instructions.
358 // This is used for turning off scheduling, because we'll forgo
359 // the normal scheduling algorithms and output the instructions according to
363 /// getValueTypeList - Return a pointer to the specified value type.
364 static const EVT *getValueTypeList(EVT VT);
366 friend class SelectionDAG;
367 friend struct ilist_traits<SDNode>;
370 //===--------------------------------------------------------------------===//
374 /// getOpcode - Return the SelectionDAG opcode value for this node. For
375 /// pre-isel nodes (those for which isMachineOpcode returns false), these
376 /// are the opcode values in the ISD and <target>ISD namespaces. For
377 /// post-isel opcodes, see getMachineOpcode.
378 unsigned getOpcode() const { return (unsigned short)NodeType; }
380 /// isTargetOpcode - Test if this node has a target-specific opcode (in the
381 /// \<target\>ISD namespace).
382 bool isTargetOpcode() const { return NodeType >= ISD::BUILTIN_OP_END; }
384 /// isTargetMemoryOpcode - Test if this node has a target-specific
385 /// memory-referencing opcode (in the \<target\>ISD namespace and
386 /// greater than FIRST_TARGET_MEMORY_OPCODE).
387 bool isTargetMemoryOpcode() const {
388 return NodeType >= ISD::FIRST_TARGET_MEMORY_OPCODE;
391 /// isMachineOpcode - Test if this node has a post-isel opcode, directly
392 /// corresponding to a MachineInstr opcode.
393 bool isMachineOpcode() const { return NodeType < 0; }
395 /// getMachineOpcode - This may only be called if isMachineOpcode returns
396 /// true. It returns the MachineInstr opcode value that the node's opcode
398 unsigned getMachineOpcode() const {
399 assert(isMachineOpcode() && "Not a MachineInstr opcode!");
403 /// getHasDebugValue - get this bit.
404 bool getHasDebugValue() const { return HasDebugValue; }
406 /// setHasDebugValue - set this bit.
407 void setHasDebugValue(bool b) { HasDebugValue = b; }
409 /// use_empty - Return true if there are no uses of this node.
411 bool use_empty() const { return UseList == nullptr; }
413 /// hasOneUse - Return true if there is exactly one use of this node.
415 bool hasOneUse() const {
416 return !use_empty() && std::next(use_begin()) == use_end();
419 /// use_size - Return the number of uses of this node. This method takes
420 /// time proportional to the number of uses.
422 size_t use_size() const { return std::distance(use_begin(), use_end()); }
424 /// getNodeId - Return the unique node id.
426 int getNodeId() const { return NodeId; }
428 /// setNodeId - Set unique node id.
429 void setNodeId(int Id) { NodeId = Id; }
431 /// getIROrder - Return the node ordering.
433 unsigned getIROrder() const { return IROrder; }
435 /// setIROrder - Set the node ordering.
437 void setIROrder(unsigned Order) { IROrder = Order; }
439 /// getDebugLoc - Return the source location info.
440 const DebugLoc getDebugLoc() const { return debugLoc; }
442 /// setDebugLoc - Set source location info. Try to avoid this, putting
443 /// it in the constructor is preferable.
444 void setDebugLoc(const DebugLoc dl) { debugLoc = dl; }
446 /// use_iterator - This class provides iterator support for SDUse
447 /// operands that use a specific SDNode.
449 : public std::iterator<std::forward_iterator_tag, SDUse, ptrdiff_t> {
451 explicit use_iterator(SDUse *op) : Op(op) {
455 typedef std::iterator<std::forward_iterator_tag,
456 SDUse, ptrdiff_t>::reference reference;
457 typedef std::iterator<std::forward_iterator_tag,
458 SDUse, ptrdiff_t>::pointer pointer;
460 use_iterator(const use_iterator &I) : Op(I.Op) {}
461 use_iterator() : Op(nullptr) {}
463 bool operator==(const use_iterator &x) const {
466 bool operator!=(const use_iterator &x) const {
467 return !operator==(x);
470 /// atEnd - return true if this iterator is at the end of uses list.
471 bool atEnd() const { return Op == nullptr; }
473 // Iterator traversal: forward iteration only.
474 use_iterator &operator++() { // Preincrement
475 assert(Op && "Cannot increment end iterator!");
480 use_iterator operator++(int) { // Postincrement
481 use_iterator tmp = *this; ++*this; return tmp;
484 /// Retrieve a pointer to the current user node.
485 SDNode *operator*() const {
486 assert(Op && "Cannot dereference end iterator!");
487 return Op->getUser();
490 SDNode *operator->() const { return operator*(); }
492 SDUse &getUse() const { return *Op; }
494 /// getOperandNo - Retrieve the operand # of this use in its user.
496 unsigned getOperandNo() const {
497 assert(Op && "Cannot dereference end iterator!");
498 return (unsigned)(Op - Op->getUser()->OperandList);
502 /// use_begin/use_end - Provide iteration support to walk over all uses
505 use_iterator use_begin() const {
506 return use_iterator(UseList);
509 static use_iterator use_end() { return use_iterator(nullptr); }
511 inline iterator_range<use_iterator> uses() {
512 return iterator_range<use_iterator>(use_begin(), use_end());
514 inline iterator_range<use_iterator> uses() const {
515 return iterator_range<use_iterator>(use_begin(), use_end());
518 /// hasNUsesOfValue - Return true if there are exactly NUSES uses of the
519 /// indicated value. This method ignores uses of other values defined by this
521 bool hasNUsesOfValue(unsigned NUses, unsigned Value) const;
523 /// hasAnyUseOfValue - Return true if there are any use of the indicated
524 /// value. This method ignores uses of other values defined by this operation.
525 bool hasAnyUseOfValue(unsigned Value) const;
527 /// isOnlyUserOf - Return true if this node is the only use of N.
529 bool isOnlyUserOf(SDNode *N) const;
531 /// isOperandOf - Return true if this node is an operand of N.
533 bool isOperandOf(SDNode *N) const;
535 /// isPredecessorOf - Return true if this node is a predecessor of N.
536 /// NOTE: Implemented on top of hasPredecessor and every bit as
537 /// expensive. Use carefully.
538 bool isPredecessorOf(const SDNode *N) const {
539 return N->hasPredecessor(this);
542 /// hasPredecessor - Return true if N is a predecessor of this node.
543 /// N is either an operand of this node, or can be reached by recursively
544 /// traversing up the operands.
545 /// NOTE: This is an expensive method. Use it carefully.
546 bool hasPredecessor(const SDNode *N) const;
548 /// hasPredecesorHelper - Return true if N is a predecessor of this node.
549 /// N is either an operand of this node, or can be reached by recursively
550 /// traversing up the operands.
551 /// In this helper the Visited and worklist sets are held externally to
552 /// cache predecessors over multiple invocations. If you want to test for
553 /// multiple predecessors this method is preferable to multiple calls to
554 /// hasPredecessor. Be sure to clear Visited and Worklist if the DAG
556 /// NOTE: This is still very expensive. Use carefully.
557 bool hasPredecessorHelper(const SDNode *N,
558 SmallPtrSet<const SDNode *, 32> &Visited,
559 SmallVectorImpl<const SDNode *> &Worklist) const;
561 /// getNumOperands - Return the number of values used by this operation.
563 unsigned getNumOperands() const { return NumOperands; }
565 /// getConstantOperandVal - Helper method returns the integer value of a
566 /// ConstantSDNode operand.
567 uint64_t getConstantOperandVal(unsigned Num) const;
569 const SDValue &getOperand(unsigned Num) const {
570 assert(Num < NumOperands && "Invalid child # of SDNode!");
571 return OperandList[Num];
574 typedef SDUse* op_iterator;
575 op_iterator op_begin() const { return OperandList; }
576 op_iterator op_end() const { return OperandList+NumOperands; }
578 SDVTList getVTList() const {
579 SDVTList X = { ValueList, NumValues };
583 /// getGluedNode - If this node has a glue operand, return the node
584 /// to which the glue operand points. Otherwise return NULL.
585 SDNode *getGluedNode() const {
586 if (getNumOperands() != 0 &&
587 getOperand(getNumOperands()-1).getValueType() == MVT::Glue)
588 return getOperand(getNumOperands()-1).getNode();
592 // If this is a pseudo op, like copyfromreg, look to see if there is a
593 // real target node glued to it. If so, return the target node.
594 const SDNode *getGluedMachineNode() const {
595 const SDNode *FoundNode = this;
597 // Climb up glue edges until a machine-opcode node is found, or the
598 // end of the chain is reached.
599 while (!FoundNode->isMachineOpcode()) {
600 const SDNode *N = FoundNode->getGluedNode();
608 /// getGluedUser - If this node has a glue value with a user, return
609 /// the user (there is at most one). Otherwise return NULL.
610 SDNode *getGluedUser() const {
611 for (use_iterator UI = use_begin(), UE = use_end(); UI != UE; ++UI)
612 if (UI.getUse().get().getValueType() == MVT::Glue)
617 /// getNumValues - Return the number of values defined/returned by this
620 unsigned getNumValues() const { return NumValues; }
622 /// getValueType - Return the type of a specified result.
624 EVT getValueType(unsigned ResNo) const {
625 assert(ResNo < NumValues && "Illegal result number!");
626 return ValueList[ResNo];
629 /// Return the type of a specified result as a simple type.
631 MVT getSimpleValueType(unsigned ResNo) const {
632 return getValueType(ResNo).getSimpleVT();
635 /// getValueSizeInBits - Returns MVT::getSizeInBits(getValueType(ResNo)).
637 unsigned getValueSizeInBits(unsigned ResNo) const {
638 return getValueType(ResNo).getSizeInBits();
641 typedef const EVT* value_iterator;
642 value_iterator value_begin() const { return ValueList; }
643 value_iterator value_end() const { return ValueList+NumValues; }
645 /// getOperationName - Return the opcode of this operation for printing.
647 std::string getOperationName(const SelectionDAG *G = nullptr) const;
648 static const char* getIndexedModeName(ISD::MemIndexedMode AM);
649 void print_types(raw_ostream &OS, const SelectionDAG *G) const;
650 void print_details(raw_ostream &OS, const SelectionDAG *G) const;
651 void print(raw_ostream &OS, const SelectionDAG *G = nullptr) const;
652 void printr(raw_ostream &OS, const SelectionDAG *G = nullptr) const;
654 /// printrFull - Print a SelectionDAG node and all children down to
655 /// the leaves. The given SelectionDAG allows target-specific nodes
656 /// to be printed in human-readable form. Unlike printr, this will
657 /// print the whole DAG, including children that appear multiple
660 void printrFull(raw_ostream &O, const SelectionDAG *G = nullptr) const;
662 /// printrWithDepth - Print a SelectionDAG node and children up to
663 /// depth "depth." The given SelectionDAG allows target-specific
664 /// nodes to be printed in human-readable form. Unlike printr, this
665 /// will print children that appear multiple times wherever they are
668 void printrWithDepth(raw_ostream &O, const SelectionDAG *G = nullptr,
669 unsigned depth = 100) const;
672 /// dump - Dump this node, for debugging.
675 /// dumpr - Dump (recursively) this node and its use-def subgraph.
678 /// dump - Dump this node, for debugging.
679 /// The given SelectionDAG allows target-specific nodes to be printed
680 /// in human-readable form.
681 void dump(const SelectionDAG *G) const;
683 /// dumpr - Dump (recursively) this node and its use-def subgraph.
684 /// The given SelectionDAG allows target-specific nodes to be printed
685 /// in human-readable form.
686 void dumpr(const SelectionDAG *G) const;
688 /// dumprFull - printrFull to dbgs(). The given SelectionDAG allows
689 /// target-specific nodes to be printed in human-readable form.
690 /// Unlike dumpr, this will print the whole DAG, including children
691 /// that appear multiple times.
693 void dumprFull(const SelectionDAG *G = nullptr) const;
695 /// dumprWithDepth - printrWithDepth to dbgs(). The given
696 /// SelectionDAG allows target-specific nodes to be printed in
697 /// human-readable form. Unlike dumpr, this will print children
698 /// that appear multiple times wherever they are used.
700 void dumprWithDepth(const SelectionDAG *G = nullptr,
701 unsigned depth = 100) const;
703 /// Profile - Gather unique data for the node.
705 void Profile(FoldingSetNodeID &ID) const;
707 /// addUse - This method should only be used by the SDUse class.
709 void addUse(SDUse &U) { U.addToList(&UseList); }
712 static SDVTList getSDVTList(EVT VT) {
713 SDVTList Ret = { getValueTypeList(VT), 1 };
717 SDNode(unsigned Opc, unsigned Order, const DebugLoc dl, SDVTList VTs,
718 const SDValue *Ops, unsigned NumOps)
719 : NodeType(Opc), OperandsNeedDelete(true), HasDebugValue(false),
720 SubclassData(0), NodeId(-1),
721 OperandList(NumOps ? new SDUse[NumOps] : nullptr),
722 ValueList(VTs.VTs), UseList(nullptr),
723 NumOperands(NumOps), NumValues(VTs.NumVTs),
724 debugLoc(dl), IROrder(Order) {
725 for (unsigned i = 0; i != NumOps; ++i) {
726 OperandList[i].setUser(this);
727 OperandList[i].setInitial(Ops[i]);
729 checkForCycles(this);
732 /// This constructor adds no operands itself; operands can be
733 /// set later with InitOperands.
734 SDNode(unsigned Opc, unsigned Order, const DebugLoc dl, SDVTList VTs)
735 : NodeType(Opc), OperandsNeedDelete(false), HasDebugValue(false),
736 SubclassData(0), NodeId(-1), OperandList(nullptr), ValueList(VTs.VTs),
737 UseList(nullptr), NumOperands(0), NumValues(VTs.NumVTs), debugLoc(dl),
740 /// InitOperands - Initialize the operands list of this with 1 operand.
741 void InitOperands(SDUse *Ops, const SDValue &Op0) {
742 Ops[0].setUser(this);
743 Ops[0].setInitial(Op0);
746 checkForCycles(this);
749 /// InitOperands - Initialize the operands list of this with 2 operands.
750 void InitOperands(SDUse *Ops, const SDValue &Op0, const SDValue &Op1) {
751 Ops[0].setUser(this);
752 Ops[0].setInitial(Op0);
753 Ops[1].setUser(this);
754 Ops[1].setInitial(Op1);
757 checkForCycles(this);
760 /// InitOperands - Initialize the operands list of this with 3 operands.
761 void InitOperands(SDUse *Ops, const SDValue &Op0, const SDValue &Op1,
762 const SDValue &Op2) {
763 Ops[0].setUser(this);
764 Ops[0].setInitial(Op0);
765 Ops[1].setUser(this);
766 Ops[1].setInitial(Op1);
767 Ops[2].setUser(this);
768 Ops[2].setInitial(Op2);
771 checkForCycles(this);
774 /// InitOperands - Initialize the operands list of this with 4 operands.
775 void InitOperands(SDUse *Ops, const SDValue &Op0, const SDValue &Op1,
776 const SDValue &Op2, const SDValue &Op3) {
777 Ops[0].setUser(this);
778 Ops[0].setInitial(Op0);
779 Ops[1].setUser(this);
780 Ops[1].setInitial(Op1);
781 Ops[2].setUser(this);
782 Ops[2].setInitial(Op2);
783 Ops[3].setUser(this);
784 Ops[3].setInitial(Op3);
787 checkForCycles(this);
790 /// InitOperands - Initialize the operands list of this with N operands.
791 void InitOperands(SDUse *Ops, const SDValue *Vals, unsigned N) {
792 for (unsigned i = 0; i != N; ++i) {
793 Ops[i].setUser(this);
794 Ops[i].setInitial(Vals[i]);
798 checkForCycles(this);
801 /// DropOperands - Release the operands and set this node to have
806 /// Wrapper class for IR location info (IR ordering and DebugLoc) to be passed
807 /// into SDNode creation functions.
808 /// When an SDNode is created from the DAGBuilder, the DebugLoc is extracted
809 /// from the original Instruction, and IROrder is the ordinal position of
811 /// When an SDNode is created after the DAG is being built, both DebugLoc and
812 /// the IROrder are propagated from the original SDNode.
813 /// So SDLoc class provides two constructors besides the default one, one to
814 /// be used by the DAGBuilder, the other to be used by others.
817 // Ptr could be used for either Instruction* or SDNode*. It is used for
818 // Instruction* if IROrder is not -1.
823 SDLoc() : Ptr(nullptr), IROrder(0) {}
824 SDLoc(const SDNode *N) : Ptr(N), IROrder(-1) {
825 assert(N && "null SDNode");
827 SDLoc(const SDValue V) : Ptr(V.getNode()), IROrder(-1) {
828 assert(Ptr && "null SDNode");
830 SDLoc(const Instruction *I, int Order) : Ptr(I), IROrder(Order) {
831 assert(Order >= 0 && "bad IROrder");
833 unsigned getIROrder() {
834 if (IROrder >= 0 || Ptr == nullptr) {
835 return (unsigned)IROrder;
837 const SDNode *N = (const SDNode*)(Ptr);
838 return N->getIROrder();
840 DebugLoc getDebugLoc() {
845 const Instruction *I = (const Instruction*)(Ptr);
846 return I->getDebugLoc();
848 const SDNode *N = (const SDNode*)(Ptr);
849 return N->getDebugLoc();
854 // Define inline functions from the SDValue class.
856 inline unsigned SDValue::getOpcode() const {
857 return Node->getOpcode();
859 inline EVT SDValue::getValueType() const {
860 return Node->getValueType(ResNo);
862 inline unsigned SDValue::getNumOperands() const {
863 return Node->getNumOperands();
865 inline const SDValue &SDValue::getOperand(unsigned i) const {
866 return Node->getOperand(i);
868 inline uint64_t SDValue::getConstantOperandVal(unsigned i) const {
869 return Node->getConstantOperandVal(i);
871 inline bool SDValue::isTargetOpcode() const {
872 return Node->isTargetOpcode();
874 inline bool SDValue::isTargetMemoryOpcode() const {
875 return Node->isTargetMemoryOpcode();
877 inline bool SDValue::isMachineOpcode() const {
878 return Node->isMachineOpcode();
880 inline unsigned SDValue::getMachineOpcode() const {
881 return Node->getMachineOpcode();
883 inline bool SDValue::use_empty() const {
884 return !Node->hasAnyUseOfValue(ResNo);
886 inline bool SDValue::hasOneUse() const {
887 return Node->hasNUsesOfValue(1, ResNo);
889 inline const DebugLoc SDValue::getDebugLoc() const {
890 return Node->getDebugLoc();
892 inline void SDValue::dump() const {
895 inline void SDValue::dumpr() const {
896 return Node->dumpr();
898 // Define inline functions from the SDUse class.
900 inline void SDUse::set(const SDValue &V) {
901 if (Val.getNode()) removeFromList();
903 if (V.getNode()) V.getNode()->addUse(*this);
906 inline void SDUse::setInitial(const SDValue &V) {
908 V.getNode()->addUse(*this);
911 inline void SDUse::setNode(SDNode *N) {
912 if (Val.getNode()) removeFromList();
914 if (N) N->addUse(*this);
917 /// UnarySDNode - This class is used for single-operand SDNodes. This is solely
918 /// to allow co-allocation of node operands with the node itself.
919 class UnarySDNode : public SDNode {
922 UnarySDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs,
924 : SDNode(Opc, Order, dl, VTs) {
925 InitOperands(&Op, X);
929 /// BinarySDNode - This class is used for two-operand SDNodes. This is solely
930 /// to allow co-allocation of node operands with the node itself.
931 class BinarySDNode : public SDNode {
934 BinarySDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs,
935 SDValue X, SDValue Y)
936 : SDNode(Opc, Order, dl, VTs) {
937 InitOperands(Ops, X, Y);
941 /// TernarySDNode - This class is used for three-operand SDNodes. This is solely
942 /// to allow co-allocation of node operands with the node itself.
943 class TernarySDNode : public SDNode {
946 TernarySDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs,
947 SDValue X, SDValue Y, SDValue Z)
948 : SDNode(Opc, Order, dl, VTs) {
949 InitOperands(Ops, X, Y, Z);
954 /// HandleSDNode - This class is used to form a handle around another node that
955 /// is persistent and is updated across invocations of replaceAllUsesWith on its
956 /// operand. This node should be directly created by end-users and not added to
957 /// the AllNodes list.
958 class HandleSDNode : public SDNode {
961 explicit HandleSDNode(SDValue X)
962 : SDNode(ISD::HANDLENODE, 0, DebugLoc(), getSDVTList(MVT::Other)) {
963 InitOperands(&Op, X);
966 const SDValue &getValue() const { return Op; }
969 class AddrSpaceCastSDNode : public UnarySDNode {
971 unsigned SrcAddrSpace;
972 unsigned DestAddrSpace;
975 AddrSpaceCastSDNode(unsigned Order, DebugLoc dl, EVT VT, SDValue X,
976 unsigned SrcAS, unsigned DestAS);
978 unsigned getSrcAddressSpace() const { return SrcAddrSpace; }
979 unsigned getDestAddressSpace() const { return DestAddrSpace; }
981 static bool classof(const SDNode *N) {
982 return N->getOpcode() == ISD::ADDRSPACECAST;
986 /// Abstact virtual class for operations for memory operations
987 class MemSDNode : public SDNode {
989 // MemoryVT - VT of in-memory value.
993 /// MMO - Memory reference information.
994 MachineMemOperand *MMO;
997 MemSDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs,
998 EVT MemoryVT, MachineMemOperand *MMO);
1000 MemSDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs,
1002 unsigned NumOps, EVT MemoryVT, MachineMemOperand *MMO);
1004 bool readMem() const { return MMO->isLoad(); }
1005 bool writeMem() const { return MMO->isStore(); }
1007 /// Returns alignment and volatility of the memory access
1008 unsigned getOriginalAlignment() const {
1009 return MMO->getBaseAlignment();
1011 unsigned getAlignment() const {
1012 return MMO->getAlignment();
1015 /// getRawSubclassData - Return the SubclassData value, which contains an
1016 /// encoding of the volatile flag, as well as bits used by subclasses. This
1017 /// function should only be used to compute a FoldingSetNodeID value.
1018 unsigned getRawSubclassData() const {
1019 return SubclassData;
1022 // We access subclass data here so that we can check consistency
1023 // with MachineMemOperand information.
1024 bool isVolatile() const { return (SubclassData >> 5) & 1; }
1025 bool isNonTemporal() const { return (SubclassData >> 6) & 1; }
1026 bool isInvariant() const { return (SubclassData >> 7) & 1; }
1028 AtomicOrdering getOrdering() const {
1029 return AtomicOrdering((SubclassData >> 8) & 15);
1031 SynchronizationScope getSynchScope() const {
1032 return SynchronizationScope((SubclassData >> 12) & 1);
1035 /// Returns the SrcValue and offset that describes the location of the access
1036 const Value *getSrcValue() const { return MMO->getValue(); }
1037 int64_t getSrcValueOffset() const { return MMO->getOffset(); }
1039 /// Returns the TBAAInfo that describes the dereference.
1040 const MDNode *getTBAAInfo() const { return MMO->getTBAAInfo(); }
1042 /// Returns the Ranges that describes the dereference.
1043 const MDNode *getRanges() const { return MMO->getRanges(); }
1045 /// getMemoryVT - Return the type of the in-memory value.
1046 EVT getMemoryVT() const { return MemoryVT; }
1048 /// getMemOperand - Return a MachineMemOperand object describing the memory
1049 /// reference performed by operation.
1050 MachineMemOperand *getMemOperand() const { return MMO; }
1052 const MachinePointerInfo &getPointerInfo() const {
1053 return MMO->getPointerInfo();
1056 /// getAddressSpace - Return the address space for the associated pointer
1057 unsigned getAddressSpace() const {
1058 return getPointerInfo().getAddrSpace();
1061 /// refineAlignment - Update this MemSDNode's MachineMemOperand information
1062 /// to reflect the alignment of NewMMO, if it has a greater alignment.
1063 /// This must only be used when the new alignment applies to all users of
1064 /// this MachineMemOperand.
1065 void refineAlignment(const MachineMemOperand *NewMMO) {
1066 MMO->refineAlignment(NewMMO);
1069 const SDValue &getChain() const { return getOperand(0); }
1070 const SDValue &getBasePtr() const {
1071 return getOperand(getOpcode() == ISD::STORE ? 2 : 1);
1074 // Methods to support isa and dyn_cast
1075 static bool classof(const SDNode *N) {
1076 // For some targets, we lower some target intrinsics to a MemIntrinsicNode
1077 // with either an intrinsic or a target opcode.
1078 return N->getOpcode() == ISD::LOAD ||
1079 N->getOpcode() == ISD::STORE ||
1080 N->getOpcode() == ISD::PREFETCH ||
1081 N->getOpcode() == ISD::ATOMIC_CMP_SWAP ||
1082 N->getOpcode() == ISD::ATOMIC_SWAP ||
1083 N->getOpcode() == ISD::ATOMIC_LOAD_ADD ||
1084 N->getOpcode() == ISD::ATOMIC_LOAD_SUB ||
1085 N->getOpcode() == ISD::ATOMIC_LOAD_AND ||
1086 N->getOpcode() == ISD::ATOMIC_LOAD_OR ||
1087 N->getOpcode() == ISD::ATOMIC_LOAD_XOR ||
1088 N->getOpcode() == ISD::ATOMIC_LOAD_NAND ||
1089 N->getOpcode() == ISD::ATOMIC_LOAD_MIN ||
1090 N->getOpcode() == ISD::ATOMIC_LOAD_MAX ||
1091 N->getOpcode() == ISD::ATOMIC_LOAD_UMIN ||
1092 N->getOpcode() == ISD::ATOMIC_LOAD_UMAX ||
1093 N->getOpcode() == ISD::ATOMIC_LOAD ||
1094 N->getOpcode() == ISD::ATOMIC_STORE ||
1095 N->isTargetMemoryOpcode();
1099 /// AtomicSDNode - A SDNode reprenting atomic operations.
1101 class AtomicSDNode : public MemSDNode {
1104 /// For cmpxchg instructions, the ordering requirements when a store does not
1106 AtomicOrdering FailureOrdering;
1108 void InitAtomic(AtomicOrdering SuccessOrdering,
1109 AtomicOrdering FailureOrdering,
1110 SynchronizationScope SynchScope) {
1111 // This must match encodeMemSDNodeFlags() in SelectionDAG.cpp.
1112 assert((SuccessOrdering & 15) == SuccessOrdering &&
1113 "Ordering may not require more than 4 bits!");
1114 assert((FailureOrdering & 15) == FailureOrdering &&
1115 "Ordering may not require more than 4 bits!");
1116 assert((SynchScope & 1) == SynchScope &&
1117 "SynchScope may not require more than 1 bit!");
1118 SubclassData |= SuccessOrdering << 8;
1119 SubclassData |= SynchScope << 12;
1120 this->FailureOrdering = FailureOrdering;
1121 assert(getSuccessOrdering() == SuccessOrdering &&
1122 "Ordering encoding error!");
1123 assert(getFailureOrdering() == FailureOrdering &&
1124 "Ordering encoding error!");
1125 assert(getSynchScope() == SynchScope && "Synch-scope encoding error!");
1129 // Opc: opcode for atomic
1130 // VTL: value type list
1131 // Chain: memory chain for operaand
1132 // Ptr: address to update as a SDValue
1133 // Cmp: compare value
1135 // SrcVal: address to update as a Value (used for MemOperand)
1136 // Align: alignment of memory
1137 AtomicSDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTL,
1138 EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp,
1139 MachineMemOperand *MMO, AtomicOrdering Ordering,
1140 SynchronizationScope SynchScope)
1141 : MemSDNode(Opc, Order, dl, VTL, MemVT, MMO) {
1142 InitAtomic(Ordering, Ordering, SynchScope);
1143 InitOperands(Ops, Chain, Ptr, Cmp, Swp);
1145 AtomicSDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTL,
1147 SDValue Chain, SDValue Ptr,
1148 SDValue Val, MachineMemOperand *MMO,
1149 AtomicOrdering Ordering, SynchronizationScope SynchScope)
1150 : MemSDNode(Opc, Order, dl, VTL, MemVT, MMO) {
1151 InitAtomic(Ordering, Ordering, SynchScope);
1152 InitOperands(Ops, Chain, Ptr, Val);
1154 AtomicSDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTL,
1156 SDValue Chain, SDValue Ptr,
1157 MachineMemOperand *MMO,
1158 AtomicOrdering Ordering, SynchronizationScope SynchScope)
1159 : MemSDNode(Opc, Order, dl, VTL, MemVT, MMO) {
1160 InitAtomic(Ordering, Ordering, SynchScope);
1161 InitOperands(Ops, Chain, Ptr);
1163 AtomicSDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTL, EVT MemVT,
1164 SDValue* AllOps, SDUse *DynOps, unsigned NumOps,
1165 MachineMemOperand *MMO,
1166 AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering,
1167 SynchronizationScope SynchScope)
1168 : MemSDNode(Opc, Order, dl, VTL, MemVT, MMO) {
1169 InitAtomic(SuccessOrdering, FailureOrdering, SynchScope);
1170 assert((DynOps || NumOps <= array_lengthof(Ops)) &&
1171 "Too many ops for internal storage!");
1172 InitOperands(DynOps ? DynOps : Ops, AllOps, NumOps);
1175 const SDValue &getBasePtr() const { return getOperand(1); }
1176 const SDValue &getVal() const { return getOperand(2); }
1178 AtomicOrdering getSuccessOrdering() const {
1179 return getOrdering();
1182 // Not quite enough room in SubclassData for everything, so failure gets its
1184 AtomicOrdering getFailureOrdering() const {
1185 return FailureOrdering;
1188 bool isCompareAndSwap() const {
1189 unsigned Op = getOpcode();
1190 return Op == ISD::ATOMIC_CMP_SWAP;
1193 // Methods to support isa and dyn_cast
1194 static bool classof(const SDNode *N) {
1195 return N->getOpcode() == ISD::ATOMIC_CMP_SWAP ||
1196 N->getOpcode() == ISD::ATOMIC_SWAP ||
1197 N->getOpcode() == ISD::ATOMIC_LOAD_ADD ||
1198 N->getOpcode() == ISD::ATOMIC_LOAD_SUB ||
1199 N->getOpcode() == ISD::ATOMIC_LOAD_AND ||
1200 N->getOpcode() == ISD::ATOMIC_LOAD_OR ||
1201 N->getOpcode() == ISD::ATOMIC_LOAD_XOR ||
1202 N->getOpcode() == ISD::ATOMIC_LOAD_NAND ||
1203 N->getOpcode() == ISD::ATOMIC_LOAD_MIN ||
1204 N->getOpcode() == ISD::ATOMIC_LOAD_MAX ||
1205 N->getOpcode() == ISD::ATOMIC_LOAD_UMIN ||
1206 N->getOpcode() == ISD::ATOMIC_LOAD_UMAX ||
1207 N->getOpcode() == ISD::ATOMIC_LOAD ||
1208 N->getOpcode() == ISD::ATOMIC_STORE;
1212 /// MemIntrinsicSDNode - This SDNode is used for target intrinsics that touch
1213 /// memory and need an associated MachineMemOperand. Its opcode may be
1214 /// INTRINSIC_VOID, INTRINSIC_W_CHAIN, PREFETCH, or a target-specific opcode
1215 /// with a value not less than FIRST_TARGET_MEMORY_OPCODE.
1216 class MemIntrinsicSDNode : public MemSDNode {
1218 MemIntrinsicSDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs,
1219 const SDValue *Ops, unsigned NumOps,
1220 EVT MemoryVT, MachineMemOperand *MMO)
1221 : MemSDNode(Opc, Order, dl, VTs, Ops, NumOps, MemoryVT, MMO) {
1224 // Methods to support isa and dyn_cast
1225 static bool classof(const SDNode *N) {
1226 // We lower some target intrinsics to their target opcode
1227 // early a node with a target opcode can be of this class
1228 return N->getOpcode() == ISD::INTRINSIC_W_CHAIN ||
1229 N->getOpcode() == ISD::INTRINSIC_VOID ||
1230 N->getOpcode() == ISD::PREFETCH ||
1231 N->isTargetMemoryOpcode();
1235 /// ShuffleVectorSDNode - This SDNode is used to implement the code generator
1236 /// support for the llvm IR shufflevector instruction. It combines elements
1237 /// from two input vectors into a new input vector, with the selection and
1238 /// ordering of elements determined by an array of integers, referred to as
1239 /// the shuffle mask. For input vectors of width N, mask indices of 0..N-1
1240 /// refer to elements from the LHS input, and indices from N to 2N-1 the RHS.
1241 /// An index of -1 is treated as undef, such that the code generator may put
1242 /// any value in the corresponding element of the result.
1243 class ShuffleVectorSDNode : public SDNode {
1246 // The memory for Mask is owned by the SelectionDAG's OperandAllocator, and
1247 // is freed when the SelectionDAG object is destroyed.
1250 friend class SelectionDAG;
1251 ShuffleVectorSDNode(EVT VT, unsigned Order, DebugLoc dl, SDValue N1,
1252 SDValue N2, const int *M)
1253 : SDNode(ISD::VECTOR_SHUFFLE, Order, dl, getSDVTList(VT)), Mask(M) {
1254 InitOperands(Ops, N1, N2);
1258 ArrayRef<int> getMask() const {
1259 EVT VT = getValueType(0);
1260 return makeArrayRef(Mask, VT.getVectorNumElements());
1262 int getMaskElt(unsigned Idx) const {
1263 assert(Idx < getValueType(0).getVectorNumElements() && "Idx out of range!");
1267 bool isSplat() const { return isSplatMask(Mask, getValueType(0)); }
1268 int getSplatIndex() const {
1269 assert(isSplat() && "Cannot get splat index for non-splat!");
1270 EVT VT = getValueType(0);
1271 for (unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i) {
1275 llvm_unreachable("Splat with all undef indices?");
1277 static bool isSplatMask(const int *Mask, EVT VT);
1279 static bool classof(const SDNode *N) {
1280 return N->getOpcode() == ISD::VECTOR_SHUFFLE;
1284 class ConstantSDNode : public SDNode {
1285 const ConstantInt *Value;
1286 friend class SelectionDAG;
1287 ConstantSDNode(bool isTarget, bool isOpaque, const ConstantInt *val, EVT VT)
1288 : SDNode(isTarget ? ISD::TargetConstant : ISD::Constant,
1289 0, DebugLoc(), getSDVTList(VT)), Value(val) {
1290 SubclassData |= (uint16_t)isOpaque;
1294 const ConstantInt *getConstantIntValue() const { return Value; }
1295 const APInt &getAPIntValue() const { return Value->getValue(); }
1296 uint64_t getZExtValue() const { return Value->getZExtValue(); }
1297 int64_t getSExtValue() const { return Value->getSExtValue(); }
1299 bool isOne() const { return Value->isOne(); }
1300 bool isNullValue() const { return Value->isNullValue(); }
1301 bool isAllOnesValue() const { return Value->isAllOnesValue(); }
1303 bool isOpaque() const { return SubclassData & 1; }
1305 static bool classof(const SDNode *N) {
1306 return N->getOpcode() == ISD::Constant ||
1307 N->getOpcode() == ISD::TargetConstant;
1311 class ConstantFPSDNode : public SDNode {
1312 const ConstantFP *Value;
1313 friend class SelectionDAG;
1314 ConstantFPSDNode(bool isTarget, const ConstantFP *val, EVT VT)
1315 : SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP,
1316 0, DebugLoc(), getSDVTList(VT)), Value(val) {
1320 const APFloat& getValueAPF() const { return Value->getValueAPF(); }
1321 const ConstantFP *getConstantFPValue() const { return Value; }
1323 /// isZero - Return true if the value is positive or negative zero.
1324 bool isZero() const { return Value->isZero(); }
1326 /// isNaN - Return true if the value is a NaN.
1327 bool isNaN() const { return Value->isNaN(); }
1329 /// isExactlyValue - We don't rely on operator== working on double values, as
1330 /// it returns true for things that are clearly not equal, like -0.0 and 0.0.
1331 /// As such, this method can be used to do an exact bit-for-bit comparison of
1332 /// two floating point values.
1334 /// We leave the version with the double argument here because it's just so
1335 /// convenient to write "2.0" and the like. Without this function we'd
1336 /// have to duplicate its logic everywhere it's called.
1337 bool isExactlyValue(double V) const {
1340 Tmp.convert(Value->getValueAPF().getSemantics(),
1341 APFloat::rmNearestTiesToEven, &ignored);
1342 return isExactlyValue(Tmp);
1344 bool isExactlyValue(const APFloat& V) const;
1346 static bool isValueValidForType(EVT VT, const APFloat& Val);
1348 static bool classof(const SDNode *N) {
1349 return N->getOpcode() == ISD::ConstantFP ||
1350 N->getOpcode() == ISD::TargetConstantFP;
1354 class GlobalAddressSDNode : public SDNode {
1355 const GlobalValue *TheGlobal;
1357 unsigned char TargetFlags;
1358 friend class SelectionDAG;
1359 GlobalAddressSDNode(unsigned Opc, unsigned Order, DebugLoc DL,
1360 const GlobalValue *GA, EVT VT, int64_t o,
1361 unsigned char TargetFlags);
1364 const GlobalValue *getGlobal() const { return TheGlobal; }
1365 int64_t getOffset() const { return Offset; }
1366 unsigned char getTargetFlags() const { return TargetFlags; }
1367 // Return the address space this GlobalAddress belongs to.
1368 unsigned getAddressSpace() const;
1370 static bool classof(const SDNode *N) {
1371 return N->getOpcode() == ISD::GlobalAddress ||
1372 N->getOpcode() == ISD::TargetGlobalAddress ||
1373 N->getOpcode() == ISD::GlobalTLSAddress ||
1374 N->getOpcode() == ISD::TargetGlobalTLSAddress;
1378 class FrameIndexSDNode : public SDNode {
1380 friend class SelectionDAG;
1381 FrameIndexSDNode(int fi, EVT VT, bool isTarg)
1382 : SDNode(isTarg ? ISD::TargetFrameIndex : ISD::FrameIndex,
1383 0, DebugLoc(), getSDVTList(VT)), FI(fi) {
1387 int getIndex() const { return FI; }
1389 static bool classof(const SDNode *N) {
1390 return N->getOpcode() == ISD::FrameIndex ||
1391 N->getOpcode() == ISD::TargetFrameIndex;
1395 class JumpTableSDNode : public SDNode {
1397 unsigned char TargetFlags;
1398 friend class SelectionDAG;
1399 JumpTableSDNode(int jti, EVT VT, bool isTarg, unsigned char TF)
1400 : SDNode(isTarg ? ISD::TargetJumpTable : ISD::JumpTable,
1401 0, DebugLoc(), getSDVTList(VT)), JTI(jti), TargetFlags(TF) {
1405 int getIndex() const { return JTI; }
1406 unsigned char getTargetFlags() const { return TargetFlags; }
1408 static bool classof(const SDNode *N) {
1409 return N->getOpcode() == ISD::JumpTable ||
1410 N->getOpcode() == ISD::TargetJumpTable;
1414 class ConstantPoolSDNode : public SDNode {
1416 const Constant *ConstVal;
1417 MachineConstantPoolValue *MachineCPVal;
1419 int Offset; // It's a MachineConstantPoolValue if top bit is set.
1420 unsigned Alignment; // Minimum alignment requirement of CP (not log2 value).
1421 unsigned char TargetFlags;
1422 friend class SelectionDAG;
1423 ConstantPoolSDNode(bool isTarget, const Constant *c, EVT VT, int o,
1424 unsigned Align, unsigned char TF)
1425 : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0,
1426 DebugLoc(), getSDVTList(VT)), Offset(o), Alignment(Align),
1428 assert(Offset >= 0 && "Offset is too large");
1431 ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v,
1432 EVT VT, int o, unsigned Align, unsigned char TF)
1433 : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0,
1434 DebugLoc(), getSDVTList(VT)), Offset(o), Alignment(Align),
1436 assert(Offset >= 0 && "Offset is too large");
1437 Val.MachineCPVal = v;
1438 Offset |= 1 << (sizeof(unsigned)*CHAR_BIT-1);
1442 bool isMachineConstantPoolEntry() const {
1446 const Constant *getConstVal() const {
1447 assert(!isMachineConstantPoolEntry() && "Wrong constantpool type");
1448 return Val.ConstVal;
1451 MachineConstantPoolValue *getMachineCPVal() const {
1452 assert(isMachineConstantPoolEntry() && "Wrong constantpool type");
1453 return Val.MachineCPVal;
1456 int getOffset() const {
1457 return Offset & ~(1 << (sizeof(unsigned)*CHAR_BIT-1));
1460 // Return the alignment of this constant pool object, which is either 0 (for
1461 // default alignment) or the desired value.
1462 unsigned getAlignment() const { return Alignment; }
1463 unsigned char getTargetFlags() const { return TargetFlags; }
1465 Type *getType() const;
1467 static bool classof(const SDNode *N) {
1468 return N->getOpcode() == ISD::ConstantPool ||
1469 N->getOpcode() == ISD::TargetConstantPool;
1473 /// Completely target-dependent object reference.
1474 class TargetIndexSDNode : public SDNode {
1475 unsigned char TargetFlags;
1478 friend class SelectionDAG;
1481 TargetIndexSDNode(int Idx, EVT VT, int64_t Ofs, unsigned char TF)
1482 : SDNode(ISD::TargetIndex, 0, DebugLoc(), getSDVTList(VT)),
1483 TargetFlags(TF), Index(Idx), Offset(Ofs) {}
1486 unsigned char getTargetFlags() const { return TargetFlags; }
1487 int getIndex() const { return Index; }
1488 int64_t getOffset() const { return Offset; }
1490 static bool classof(const SDNode *N) {
1491 return N->getOpcode() == ISD::TargetIndex;
1495 class BasicBlockSDNode : public SDNode {
1496 MachineBasicBlock *MBB;
1497 friend class SelectionDAG;
1498 /// Debug info is meaningful and potentially useful here, but we create
1499 /// blocks out of order when they're jumped to, which makes it a bit
1500 /// harder. Let's see if we need it first.
1501 explicit BasicBlockSDNode(MachineBasicBlock *mbb)
1502 : SDNode(ISD::BasicBlock, 0, DebugLoc(), getSDVTList(MVT::Other)), MBB(mbb)
1506 MachineBasicBlock *getBasicBlock() const { return MBB; }
1508 static bool classof(const SDNode *N) {
1509 return N->getOpcode() == ISD::BasicBlock;
1513 /// BuildVectorSDNode - A "pseudo-class" with methods for operating on
1515 class BuildVectorSDNode : public SDNode {
1516 // These are constructed as SDNodes and then cast to BuildVectorSDNodes.
1517 explicit BuildVectorSDNode() LLVM_DELETED_FUNCTION;
1519 /// isConstantSplat - Check if this is a constant splat, and if so, find the
1520 /// smallest element size that splats the vector. If MinSplatBits is
1521 /// nonzero, the element size must be at least that large. Note that the
1522 /// splat element may be the entire vector (i.e., a one element vector).
1523 /// Returns the splat element value in SplatValue. Any undefined bits in
1524 /// that value are zero, and the corresponding bits in the SplatUndef mask
1525 /// are set. The SplatBitSize value is set to the splat element size in
1526 /// bits. HasAnyUndefs is set to true if any bits in the vector are
1527 /// undefined. isBigEndian describes the endianness of the target.
1528 bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef,
1529 unsigned &SplatBitSize, bool &HasAnyUndefs,
1530 unsigned MinSplatBits = 0,
1531 bool isBigEndian = false) const;
1533 /// getConstantSplatValue - Check if this is a constant splat, and if so,
1534 /// return the splat value only if it is a ConstantSDNode. Otherwise
1535 /// return nullptr. This is a simpler form of isConstantSplat.
1536 /// Get the constant splat only if you care about the splat value.
1537 ConstantSDNode *getConstantSplatValue() const;
1539 bool isConstant() const;
1541 static inline bool classof(const SDNode *N) {
1542 return N->getOpcode() == ISD::BUILD_VECTOR;
1546 /// SrcValueSDNode - An SDNode that holds an arbitrary LLVM IR Value. This is
1547 /// used when the SelectionDAG needs to make a simple reference to something
1548 /// in the LLVM IR representation.
1550 class SrcValueSDNode : public SDNode {
1552 friend class SelectionDAG;
1553 /// Create a SrcValue for a general value.
1554 explicit SrcValueSDNode(const Value *v)
1555 : SDNode(ISD::SRCVALUE, 0, DebugLoc(), getSDVTList(MVT::Other)), V(v) {}
1558 /// getValue - return the contained Value.
1559 const Value *getValue() const { return V; }
1561 static bool classof(const SDNode *N) {
1562 return N->getOpcode() == ISD::SRCVALUE;
1566 class MDNodeSDNode : public SDNode {
1568 friend class SelectionDAG;
1569 explicit MDNodeSDNode(const MDNode *md)
1570 : SDNode(ISD::MDNODE_SDNODE, 0, DebugLoc(), getSDVTList(MVT::Other)), MD(md)
1574 const MDNode *getMD() const { return MD; }
1576 static bool classof(const SDNode *N) {
1577 return N->getOpcode() == ISD::MDNODE_SDNODE;
1581 class RegisterSDNode : public SDNode {
1583 friend class SelectionDAG;
1584 RegisterSDNode(unsigned reg, EVT VT)
1585 : SDNode(ISD::Register, 0, DebugLoc(), getSDVTList(VT)), Reg(reg) {
1589 unsigned getReg() const { return Reg; }
1591 static bool classof(const SDNode *N) {
1592 return N->getOpcode() == ISD::Register;
1596 class RegisterMaskSDNode : public SDNode {
1597 // The memory for RegMask is not owned by the node.
1598 const uint32_t *RegMask;
1599 friend class SelectionDAG;
1600 RegisterMaskSDNode(const uint32_t *mask)
1601 : SDNode(ISD::RegisterMask, 0, DebugLoc(), getSDVTList(MVT::Untyped)),
1605 const uint32_t *getRegMask() const { return RegMask; }
1607 static bool classof(const SDNode *N) {
1608 return N->getOpcode() == ISD::RegisterMask;
1612 class BlockAddressSDNode : public SDNode {
1613 const BlockAddress *BA;
1615 unsigned char TargetFlags;
1616 friend class SelectionDAG;
1617 BlockAddressSDNode(unsigned NodeTy, EVT VT, const BlockAddress *ba,
1618 int64_t o, unsigned char Flags)
1619 : SDNode(NodeTy, 0, DebugLoc(), getSDVTList(VT)),
1620 BA(ba), Offset(o), TargetFlags(Flags) {
1623 const BlockAddress *getBlockAddress() const { return BA; }
1624 int64_t getOffset() const { return Offset; }
1625 unsigned char getTargetFlags() const { return TargetFlags; }
1627 static bool classof(const SDNode *N) {
1628 return N->getOpcode() == ISD::BlockAddress ||
1629 N->getOpcode() == ISD::TargetBlockAddress;
1633 class EHLabelSDNode : public SDNode {
1636 friend class SelectionDAG;
1637 EHLabelSDNode(unsigned Order, DebugLoc dl, SDValue ch, MCSymbol *L)
1638 : SDNode(ISD::EH_LABEL, Order, dl, getSDVTList(MVT::Other)), Label(L) {
1639 InitOperands(&Chain, ch);
1642 MCSymbol *getLabel() const { return Label; }
1644 static bool classof(const SDNode *N) {
1645 return N->getOpcode() == ISD::EH_LABEL;
1649 class ExternalSymbolSDNode : public SDNode {
1651 unsigned char TargetFlags;
1653 friend class SelectionDAG;
1654 ExternalSymbolSDNode(bool isTarget, const char *Sym, unsigned char TF, EVT VT)
1655 : SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol,
1656 0, DebugLoc(), getSDVTList(VT)), Symbol(Sym), TargetFlags(TF) {
1660 const char *getSymbol() const { return Symbol; }
1661 unsigned char getTargetFlags() const { return TargetFlags; }
1663 static bool classof(const SDNode *N) {
1664 return N->getOpcode() == ISD::ExternalSymbol ||
1665 N->getOpcode() == ISD::TargetExternalSymbol;
1669 class CondCodeSDNode : public SDNode {
1670 ISD::CondCode Condition;
1671 friend class SelectionDAG;
1672 explicit CondCodeSDNode(ISD::CondCode Cond)
1673 : SDNode(ISD::CONDCODE, 0, DebugLoc(), getSDVTList(MVT::Other)),
1678 ISD::CondCode get() const { return Condition; }
1680 static bool classof(const SDNode *N) {
1681 return N->getOpcode() == ISD::CONDCODE;
1685 /// CvtRndSatSDNode - NOTE: avoid using this node as this may disappear in the
1686 /// future and most targets don't support it.
1687 class CvtRndSatSDNode : public SDNode {
1688 ISD::CvtCode CvtCode;
1689 friend class SelectionDAG;
1690 explicit CvtRndSatSDNode(EVT VT, unsigned Order, DebugLoc dl,
1691 const SDValue *Ops, unsigned NumOps,
1693 : SDNode(ISD::CONVERT_RNDSAT, Order, dl, getSDVTList(VT), Ops, NumOps),
1695 assert(NumOps == 5 && "wrong number of operations");
1698 ISD::CvtCode getCvtCode() const { return CvtCode; }
1700 static bool classof(const SDNode *N) {
1701 return N->getOpcode() == ISD::CONVERT_RNDSAT;
1705 /// VTSDNode - This class is used to represent EVT's, which are used
1706 /// to parameterize some operations.
1707 class VTSDNode : public SDNode {
1709 friend class SelectionDAG;
1710 explicit VTSDNode(EVT VT)
1711 : SDNode(ISD::VALUETYPE, 0, DebugLoc(), getSDVTList(MVT::Other)),
1716 EVT getVT() const { return ValueType; }
1718 static bool classof(const SDNode *N) {
1719 return N->getOpcode() == ISD::VALUETYPE;
1723 /// LSBaseSDNode - Base class for LoadSDNode and StoreSDNode
1725 class LSBaseSDNode : public MemSDNode {
1726 //! Operand array for load and store
1728 \note Moving this array to the base class captures more
1729 common functionality shared between LoadSDNode and
1734 LSBaseSDNode(ISD::NodeType NodeTy, unsigned Order, DebugLoc dl,
1735 SDValue *Operands, unsigned numOperands,
1736 SDVTList VTs, ISD::MemIndexedMode AM, EVT MemVT,
1737 MachineMemOperand *MMO)
1738 : MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {
1739 SubclassData |= AM << 2;
1740 assert(getAddressingMode() == AM && "MemIndexedMode encoding error!");
1741 InitOperands(Ops, Operands, numOperands);
1742 assert((getOffset().getOpcode() == ISD::UNDEF || isIndexed()) &&
1743 "Only indexed loads and stores have a non-undef offset operand");
1746 const SDValue &getOffset() const {
1747 return getOperand(getOpcode() == ISD::LOAD ? 2 : 3);
1750 /// getAddressingMode - Return the addressing mode for this load or store:
1751 /// unindexed, pre-inc, pre-dec, post-inc, or post-dec.
1752 ISD::MemIndexedMode getAddressingMode() const {
1753 return ISD::MemIndexedMode((SubclassData >> 2) & 7);
1756 /// isIndexed - Return true if this is a pre/post inc/dec load/store.
1757 bool isIndexed() const { return getAddressingMode() != ISD::UNINDEXED; }
1759 /// isUnindexed - Return true if this is NOT a pre/post inc/dec load/store.
1760 bool isUnindexed() const { return getAddressingMode() == ISD::UNINDEXED; }
1762 static bool classof(const SDNode *N) {
1763 return N->getOpcode() == ISD::LOAD ||
1764 N->getOpcode() == ISD::STORE;
1768 /// LoadSDNode - This class is used to represent ISD::LOAD nodes.
1770 class LoadSDNode : public LSBaseSDNode {
1771 friend class SelectionDAG;
1772 LoadSDNode(SDValue *ChainPtrOff, unsigned Order, DebugLoc dl, SDVTList VTs,
1773 ISD::MemIndexedMode AM, ISD::LoadExtType ETy, EVT MemVT,
1774 MachineMemOperand *MMO)
1775 : LSBaseSDNode(ISD::LOAD, Order, dl, ChainPtrOff, 3, VTs, AM, MemVT, MMO) {
1776 SubclassData |= (unsigned short)ETy;
1777 assert(getExtensionType() == ETy && "LoadExtType encoding error!");
1778 assert(readMem() && "Load MachineMemOperand is not a load!");
1779 assert(!writeMem() && "Load MachineMemOperand is a store!");
1783 /// getExtensionType - Return whether this is a plain node,
1784 /// or one of the varieties of value-extending loads.
1785 ISD::LoadExtType getExtensionType() const {
1786 return ISD::LoadExtType(SubclassData & 3);
1789 const SDValue &getBasePtr() const { return getOperand(1); }
1790 const SDValue &getOffset() const { return getOperand(2); }
1792 static bool classof(const SDNode *N) {
1793 return N->getOpcode() == ISD::LOAD;
1797 /// StoreSDNode - This class is used to represent ISD::STORE nodes.
1799 class StoreSDNode : public LSBaseSDNode {
1800 friend class SelectionDAG;
1801 StoreSDNode(SDValue *ChainValuePtrOff, unsigned Order, DebugLoc dl,
1802 SDVTList VTs, ISD::MemIndexedMode AM, bool isTrunc, EVT MemVT,
1803 MachineMemOperand *MMO)
1804 : LSBaseSDNode(ISD::STORE, Order, dl, ChainValuePtrOff, 4,
1805 VTs, AM, MemVT, MMO) {
1806 SubclassData |= (unsigned short)isTrunc;
1807 assert(isTruncatingStore() == isTrunc && "isTrunc encoding error!");
1808 assert(!readMem() && "Store MachineMemOperand is a load!");
1809 assert(writeMem() && "Store MachineMemOperand is not a store!");
1813 /// isTruncatingStore - Return true if the op does a truncation before store.
1814 /// For integers this is the same as doing a TRUNCATE and storing the result.
1815 /// For floats, it is the same as doing an FP_ROUND and storing the result.
1816 bool isTruncatingStore() const { return SubclassData & 1; }
1818 const SDValue &getValue() const { return getOperand(1); }
1819 const SDValue &getBasePtr() const { return getOperand(2); }
1820 const SDValue &getOffset() const { return getOperand(3); }
1822 static bool classof(const SDNode *N) {
1823 return N->getOpcode() == ISD::STORE;
1827 /// MachineSDNode - An SDNode that represents everything that will be needed
1828 /// to construct a MachineInstr. These nodes are created during the
1829 /// instruction selection proper phase.
1831 class MachineSDNode : public SDNode {
1833 typedef MachineMemOperand **mmo_iterator;
1836 friend class SelectionDAG;
1837 MachineSDNode(unsigned Opc, unsigned Order, const DebugLoc DL, SDVTList VTs)
1838 : SDNode(Opc, Order, DL, VTs), MemRefs(nullptr), MemRefsEnd(nullptr) {}
1840 /// LocalOperands - Operands for this instruction, if they fit here. If
1841 /// they don't, this field is unused.
1842 SDUse LocalOperands[4];
1844 /// MemRefs - Memory reference descriptions for this instruction.
1845 mmo_iterator MemRefs;
1846 mmo_iterator MemRefsEnd;
1849 mmo_iterator memoperands_begin() const { return MemRefs; }
1850 mmo_iterator memoperands_end() const { return MemRefsEnd; }
1851 bool memoperands_empty() const { return MemRefsEnd == MemRefs; }
1853 /// setMemRefs - Assign this MachineSDNodes's memory reference descriptor
1854 /// list. This does not transfer ownership.
1855 void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd) {
1856 for (mmo_iterator MMI = NewMemRefs, MME = NewMemRefsEnd; MMI != MME; ++MMI)
1857 assert(*MMI && "Null mem ref detected!");
1858 MemRefs = NewMemRefs;
1859 MemRefsEnd = NewMemRefsEnd;
1862 static bool classof(const SDNode *N) {
1863 return N->isMachineOpcode();
1867 class SDNodeIterator : public std::iterator<std::forward_iterator_tag,
1868 SDNode, ptrdiff_t> {
1872 SDNodeIterator(const SDNode *N, unsigned Op) : Node(N), Operand(Op) {}
1874 bool operator==(const SDNodeIterator& x) const {
1875 return Operand == x.Operand;
1877 bool operator!=(const SDNodeIterator& x) const { return !operator==(x); }
1879 const SDNodeIterator &operator=(const SDNodeIterator &I) {
1880 assert(I.Node == Node && "Cannot assign iterators to two different nodes!");
1881 Operand = I.Operand;
1885 pointer operator*() const {
1886 return Node->getOperand(Operand).getNode();
1888 pointer operator->() const { return operator*(); }
1890 SDNodeIterator& operator++() { // Preincrement
1894 SDNodeIterator operator++(int) { // Postincrement
1895 SDNodeIterator tmp = *this; ++*this; return tmp;
1897 size_t operator-(SDNodeIterator Other) const {
1898 assert(Node == Other.Node &&
1899 "Cannot compare iterators of two different nodes!");
1900 return Operand - Other.Operand;
1903 static SDNodeIterator begin(const SDNode *N) { return SDNodeIterator(N, 0); }
1904 static SDNodeIterator end (const SDNode *N) {
1905 return SDNodeIterator(N, N->getNumOperands());
1908 unsigned getOperand() const { return Operand; }
1909 const SDNode *getNode() const { return Node; }
1912 template <> struct GraphTraits<SDNode*> {
1913 typedef SDNode NodeType;
1914 typedef SDNodeIterator ChildIteratorType;
1915 static inline NodeType *getEntryNode(SDNode *N) { return N; }
1916 static inline ChildIteratorType child_begin(NodeType *N) {
1917 return SDNodeIterator::begin(N);
1919 static inline ChildIteratorType child_end(NodeType *N) {
1920 return SDNodeIterator::end(N);
1924 /// LargestSDNode - The largest SDNode class.
1926 typedef AtomicSDNode LargestSDNode;
1928 /// MostAlignedSDNode - The SDNode class with the greatest alignment
1931 typedef GlobalAddressSDNode MostAlignedSDNode;
1934 /// isNormalLoad - Returns true if the specified node is a non-extending
1935 /// and unindexed load.
1936 inline bool isNormalLoad(const SDNode *N) {
1937 const LoadSDNode *Ld = dyn_cast<LoadSDNode>(N);
1938 return Ld && Ld->getExtensionType() == ISD::NON_EXTLOAD &&
1939 Ld->getAddressingMode() == ISD::UNINDEXED;
1942 /// isNON_EXTLoad - Returns true if the specified node is a non-extending
1944 inline bool isNON_EXTLoad(const SDNode *N) {
1945 return isa<LoadSDNode>(N) &&
1946 cast<LoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD;
1949 /// isEXTLoad - Returns true if the specified node is a EXTLOAD.
1951 inline bool isEXTLoad(const SDNode *N) {
1952 return isa<LoadSDNode>(N) &&
1953 cast<LoadSDNode>(N)->getExtensionType() == ISD::EXTLOAD;
1956 /// isSEXTLoad - Returns true if the specified node is a SEXTLOAD.
1958 inline bool isSEXTLoad(const SDNode *N) {
1959 return isa<LoadSDNode>(N) &&
1960 cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD;
1963 /// isZEXTLoad - Returns true if the specified node is a ZEXTLOAD.
1965 inline bool isZEXTLoad(const SDNode *N) {
1966 return isa<LoadSDNode>(N) &&
1967 cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD;
1970 /// isUNINDEXEDLoad - Returns true if the specified node is an unindexed load.
1972 inline bool isUNINDEXEDLoad(const SDNode *N) {
1973 return isa<LoadSDNode>(N) &&
1974 cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
1977 /// isNormalStore - Returns true if the specified node is a non-truncating
1978 /// and unindexed store.
1979 inline bool isNormalStore(const SDNode *N) {
1980 const StoreSDNode *St = dyn_cast<StoreSDNode>(N);
1981 return St && !St->isTruncatingStore() &&
1982 St->getAddressingMode() == ISD::UNINDEXED;
1985 /// isNON_TRUNCStore - Returns true if the specified node is a non-truncating
1987 inline bool isNON_TRUNCStore(const SDNode *N) {
1988 return isa<StoreSDNode>(N) && !cast<StoreSDNode>(N)->isTruncatingStore();
1991 /// isTRUNCStore - Returns true if the specified node is a truncating
1993 inline bool isTRUNCStore(const SDNode *N) {
1994 return isa<StoreSDNode>(N) && cast<StoreSDNode>(N)->isTruncatingStore();
1997 /// isUNINDEXEDStore - Returns true if the specified node is an
1998 /// unindexed store.
1999 inline bool isUNINDEXEDStore(const SDNode *N) {
2000 return isa<StoreSDNode>(N) &&
2001 cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
2005 } // end llvm namespace