LLVM  16.0.0git
SelectionDAGNodes.h
Go to the documentation of this file.
1 //===- llvm/CodeGen/SelectionDAGNodes.h - SelectionDAG Nodes ----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the SDNode class and derived classes, which are used to
10 // represent the nodes and operations present in a SelectionDAG. These nodes
11 // and operations are machine code level operations, with some similarities to
12 // the GCC RTL representation.
13 //
14 // Clients should include the SelectionDAG.h file instead of this file directly.
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H
19 #define LLVM_CODEGEN_SELECTIONDAGNODES_H
20 
21 #include "llvm/ADT/APFloat.h"
22 #include "llvm/ADT/ArrayRef.h"
23 #include "llvm/ADT/BitVector.h"
24 #include "llvm/ADT/FoldingSet.h"
25 #include "llvm/ADT/GraphTraits.h"
26 #include "llvm/ADT/SmallPtrSet.h"
27 #include "llvm/ADT/SmallVector.h"
28 #include "llvm/ADT/ilist_node.h"
29 #include "llvm/ADT/iterator.h"
33 #include "llvm/CodeGen/Register.h"
35 #include "llvm/IR/Constants.h"
36 #include "llvm/IR/DebugLoc.h"
37 #include "llvm/IR/Instruction.h"
38 #include "llvm/IR/Instructions.h"
39 #include "llvm/IR/Metadata.h"
40 #include "llvm/IR/Operator.h"
41 #include "llvm/Support/AlignOf.h"
43 #include "llvm/Support/Casting.h"
46 #include "llvm/Support/TypeSize.h"
47 #include <algorithm>
48 #include <cassert>
49 #include <climits>
50 #include <cstddef>
51 #include <cstdint>
52 #include <cstring>
53 #include <iterator>
54 #include <string>
55 #include <tuple>
56 #include <utility>
57 
58 namespace llvm {
59 
60 class APInt;
61 class Constant;
62 class GlobalValue;
63 class MachineBasicBlock;
64 class MachineConstantPoolValue;
65 class MCSymbol;
66 class raw_ostream;
67 class SDNode;
68 class SelectionDAG;
69 class Type;
70 class Value;
71 
72 void checkForCycles(const SDNode *N, const SelectionDAG *DAG = nullptr,
73  bool force = false);
74 
75 /// This represents a list of ValueType's that has been intern'd by
76 /// a SelectionDAG. Instances of this simple value class are returned by
77 /// SelectionDAG::getVTList(...).
78 ///
79 struct SDVTList {
80  const EVT *VTs;
81  unsigned int NumVTs;
82 };
83 
84 namespace ISD {
85 
86  /// Node predicates
87 
88 /// If N is a BUILD_VECTOR or SPLAT_VECTOR node whose elements are all the
89 /// same constant or undefined, return true and return the constant value in
90 /// \p SplatValue.
91 bool isConstantSplatVector(const SDNode *N, APInt &SplatValue);
92 
93 /// Return true if the specified node is a BUILD_VECTOR or SPLAT_VECTOR where
94 /// all of the elements are ~0 or undef. If \p BuildVectorOnly is set to
95 /// true, it only checks BUILD_VECTOR.
97  bool BuildVectorOnly = false);
98 
99 /// Return true if the specified node is a BUILD_VECTOR or SPLAT_VECTOR where
100 /// all of the elements are 0 or undef. If \p BuildVectorOnly is set to true, it
101 /// only checks BUILD_VECTOR.
103  bool BuildVectorOnly = false);
104 
105 /// Return true if the specified node is a BUILD_VECTOR where all of the
106 /// elements are ~0 or undef.
107 bool isBuildVectorAllOnes(const SDNode *N);
108 
109 /// Return true if the specified node is a BUILD_VECTOR where all of the
110 /// elements are 0 or undef.
111 bool isBuildVectorAllZeros(const SDNode *N);
112 
113 /// Return true if the specified node is a BUILD_VECTOR node of all
114 /// ConstantSDNode or undef.
116 
117 /// Return true if the specified node is a BUILD_VECTOR node of all
118 /// ConstantFPSDNode or undef.
120 
121 /// Returns true if the specified node is a vector where all elements can
122 /// be truncated to the specified element size without a loss in meaning.
123 bool isVectorShrinkable(const SDNode *N, unsigned NewEltSize, bool Signed);
124 
125 /// Return true if the node has at least one operand and all operands of the
126 /// specified node are ISD::UNDEF.
127 bool allOperandsUndef(const SDNode *N);
128 
129 /// Return true if the specified node is FREEZE(UNDEF).
130 bool isFreezeUndef(const SDNode *N);
131 
132 } // end namespace ISD
133 
134 //===----------------------------------------------------------------------===//
135 /// Unlike LLVM values, Selection DAG nodes may return multiple
136 /// values as the result of a computation. Many nodes return multiple values,
137 /// from loads (which define a token and a return value) to ADDC (which returns
138 /// a result and a carry value), to calls (which may return an arbitrary number
139 /// of values).
140 ///
141 /// As such, each use of a SelectionDAG computation must indicate the node that
142 /// computes it as well as which return value to use from that node. This pair
143 /// of information is represented with the SDValue value type.
144 ///
145 class SDValue {
146  friend struct DenseMapInfo<SDValue>;
147 
148  SDNode *Node = nullptr; // The node defining the value we are using.
149  unsigned ResNo = 0; // Which return value of the node we are using.
150 
151 public:
152  SDValue() = default;
153  SDValue(SDNode *node, unsigned resno);
154 
155  /// get the index which selects a specific result in the SDNode
156  unsigned getResNo() const { return ResNo; }
157 
158  /// get the SDNode which holds the desired result
159  SDNode *getNode() const { return Node; }
160 
161  /// set the SDNode
162  void setNode(SDNode *N) { Node = N; }
163 
164  inline SDNode *operator->() const { return Node; }
165 
166  bool operator==(const SDValue &O) const {
167  return Node == O.Node && ResNo == O.ResNo;
168  }
169  bool operator!=(const SDValue &O) const {
170  return !operator==(O);
171  }
172  bool operator<(const SDValue &O) const {
173  return std::tie(Node, ResNo) < std::tie(O.Node, O.ResNo);
174  }
175  explicit operator bool() const {
176  return Node != nullptr;
177  }
178 
179  SDValue getValue(unsigned R) const {
180  return SDValue(Node, R);
181  }
182 
183  /// Return true if this node is an operand of N.
184  bool isOperandOf(const SDNode *N) const;
185 
186  /// Return the ValueType of the referenced return value.
187  inline EVT getValueType() const;
188 
189  /// Return the simple ValueType of the referenced return value.
191  return getValueType().getSimpleVT();
192  }
193 
194  /// Returns the size of the value in bits.
195  ///
196  /// If the value type is a scalable vector type, the scalable property will
197  /// be set and the runtime size will be a positive integer multiple of the
198  /// base size.
200  return getValueType().getSizeInBits();
201  }
202 
205  }
206 
207  // Forwarding methods - These forward to the corresponding methods in SDNode.
208  inline unsigned getOpcode() const;
209  inline unsigned getNumOperands() const;
210  inline const SDValue &getOperand(unsigned i) const;
211  inline uint64_t getConstantOperandVal(unsigned i) const;
212  inline const APInt &getConstantOperandAPInt(unsigned i) const;
213  inline bool isTargetMemoryOpcode() const;
214  inline bool isTargetOpcode() const;
215  inline bool isMachineOpcode() const;
216  inline bool isUndef() const;
217  inline unsigned getMachineOpcode() const;
218  inline const DebugLoc &getDebugLoc() const;
219  inline void dump() const;
220  inline void dump(const SelectionDAG *G) const;
221  inline void dumpr() const;
222  inline void dumpr(const SelectionDAG *G) const;
223 
224  /// Return true if this operand (which must be a chain) reaches the
225  /// specified operand without crossing any side-effecting instructions.
226  /// In practice, this looks through token factors and non-volatile loads.
227  /// In order to remain efficient, this only
228  /// looks a couple of nodes in, it does not do an exhaustive search.
230  unsigned Depth = 2) const;
231 
232  /// Return true if there are no nodes using value ResNo of Node.
233  inline bool use_empty() const;
234 
235  /// Return true if there is exactly one node using value ResNo of Node.
236  inline bool hasOneUse() const;
237 };
238 
239 template<> struct DenseMapInfo<SDValue> {
240  static inline SDValue getEmptyKey() {
241  SDValue V;
242  V.ResNo = -1U;
243  return V;
244  }
245 
246  static inline SDValue getTombstoneKey() {
247  SDValue V;
248  V.ResNo = -2U;
249  return V;
250  }
251 
252  static unsigned getHashValue(const SDValue &Val) {
253  return ((unsigned)((uintptr_t)Val.getNode() >> 4) ^
254  (unsigned)((uintptr_t)Val.getNode() >> 9)) + Val.getResNo();
255  }
256 
257  static bool isEqual(const SDValue &LHS, const SDValue &RHS) {
258  return LHS == RHS;
259  }
260 };
261 
262 /// Allow casting operators to work directly on
263 /// SDValues as if they were SDNode*'s.
264 template<> struct simplify_type<SDValue> {
265  using SimpleType = SDNode *;
266 
268  return Val.getNode();
269  }
270 };
271 template<> struct simplify_type<const SDValue> {
272  using SimpleType = /*const*/ SDNode *;
273 
274  static SimpleType getSimplifiedValue(const SDValue &Val) {
275  return Val.getNode();
276  }
277 };
278 
279 /// Represents a use of a SDNode. This class holds an SDValue,
280 /// which records the SDNode being used and the result number, a
281 /// pointer to the SDNode using the value, and Next and Prev pointers,
282 /// which link together all the uses of an SDNode.
283 ///
284 class SDUse {
285  /// Val - The value being used.
286  SDValue Val;
287  /// User - The user of this value.
288  SDNode *User = nullptr;
289  /// Prev, Next - Pointers to the uses list of the SDNode referred by
290  /// this operand.
291  SDUse **Prev = nullptr;
292  SDUse *Next = nullptr;
293 
294 public:
295  SDUse() = default;
296  SDUse(const SDUse &U) = delete;
297  SDUse &operator=(const SDUse &) = delete;
298 
299  /// Normally SDUse will just implicitly convert to an SDValue that it holds.
300  operator const SDValue&() const { return Val; }
301 
302  /// If implicit conversion to SDValue doesn't work, the get() method returns
303  /// the SDValue.
304  const SDValue &get() const { return Val; }
305 
306  /// This returns the SDNode that contains this Use.
307  SDNode *getUser() { return User; }
308 
309  /// Get the next SDUse in the use list.
310  SDUse *getNext() const { return Next; }
311 
312  /// Convenience function for get().getNode().
313  SDNode *getNode() const { return Val.getNode(); }
314  /// Convenience function for get().getResNo().
315  unsigned getResNo() const { return Val.getResNo(); }
316  /// Convenience function for get().getValueType().
317  EVT getValueType() const { return Val.getValueType(); }
318 
319  /// Convenience function for get().operator==
320  bool operator==(const SDValue &V) const {
321  return Val == V;
322  }
323 
324  /// Convenience function for get().operator!=
325  bool operator!=(const SDValue &V) const {
326  return Val != V;
327  }
328 
329  /// Convenience function for get().operator<
330  bool operator<(const SDValue &V) const {
331  return Val < V;
332  }
333 
334 private:
335  friend class SelectionDAG;
336  friend class SDNode;
337  // TODO: unfriend HandleSDNode once we fix its operand handling.
338  friend class HandleSDNode;
339 
340  void setUser(SDNode *p) { User = p; }
341 
342  /// Remove this use from its existing use list, assign it the
343  /// given value, and add it to the new value's node's use list.
344  inline void set(const SDValue &V);
345  /// Like set, but only supports initializing a newly-allocated
346  /// SDUse with a non-null value.
347  inline void setInitial(const SDValue &V);
348  /// Like set, but only sets the Node portion of the value,
349  /// leaving the ResNo portion unmodified.
350  inline void setNode(SDNode *N);
351 
352  void addToList(SDUse **List) {
353  Next = *List;
354  if (Next) Next->Prev = &Next;
355  Prev = List;
356  *List = this;
357  }
358 
359  void removeFromList() {
360  *Prev = Next;
361  if (Next) Next->Prev = Prev;
362  }
363 };
364 
365 /// simplify_type specializations - Allow casting operators to work directly on
366 /// SDValues as if they were SDNode*'s.
367 template<> struct simplify_type<SDUse> {
368  using SimpleType = SDNode *;
369 
371  return Val.getNode();
372  }
373 };
374 
375 /// These are IR-level optimization flags that may be propagated to SDNodes.
376 /// TODO: This data structure should be shared by the IR optimizer and the
377 /// the backend.
378 struct SDNodeFlags {
379 private:
380  bool NoUnsignedWrap : 1;
381  bool NoSignedWrap : 1;
382  bool Exact : 1;
383  bool NoNaNs : 1;
384  bool NoInfs : 1;
385  bool NoSignedZeros : 1;
386  bool AllowReciprocal : 1;
387  bool AllowContract : 1;
388  bool ApproximateFuncs : 1;
389  bool AllowReassociation : 1;
390 
391  // We assume instructions do not raise floating-point exceptions by default,
392  // and only those marked explicitly may do so. We could choose to represent
393  // this via a positive "FPExcept" flags like on the MI level, but having a
394  // negative "NoFPExcept" flag here (that defaults to true) makes the flag
395  // intersection logic more straightforward.
396  bool NoFPExcept : 1;
397 
398 public:
399  /// Default constructor turns off all optimization flags.
401  : NoUnsignedWrap(false), NoSignedWrap(false), Exact(false), NoNaNs(false),
402  NoInfs(false), NoSignedZeros(false), AllowReciprocal(false),
403  AllowContract(false), ApproximateFuncs(false),
404  AllowReassociation(false), NoFPExcept(false) {}
405 
406  /// Propagate the fast-math-flags from an IR FPMathOperator.
407  void copyFMF(const FPMathOperator &FPMO) {
408  setNoNaNs(FPMO.hasNoNaNs());
409  setNoInfs(FPMO.hasNoInfs());
415  }
416 
417  // These are mutators for each flag.
418  void setNoUnsignedWrap(bool b) { NoUnsignedWrap = b; }
419  void setNoSignedWrap(bool b) { NoSignedWrap = b; }
420  void setExact(bool b) { Exact = b; }
421  void setNoNaNs(bool b) { NoNaNs = b; }
422  void setNoInfs(bool b) { NoInfs = b; }
423  void setNoSignedZeros(bool b) { NoSignedZeros = b; }
424  void setAllowReciprocal(bool b) { AllowReciprocal = b; }
425  void setAllowContract(bool b) { AllowContract = b; }
426  void setApproximateFuncs(bool b) { ApproximateFuncs = b; }
427  void setAllowReassociation(bool b) { AllowReassociation = b; }
428  void setNoFPExcept(bool b) { NoFPExcept = b; }
429 
430  // These are accessors for each flag.
431  bool hasNoUnsignedWrap() const { return NoUnsignedWrap; }
432  bool hasNoSignedWrap() const { return NoSignedWrap; }
433  bool hasExact() const { return Exact; }
434  bool hasNoNaNs() const { return NoNaNs; }
435  bool hasNoInfs() const { return NoInfs; }
436  bool hasNoSignedZeros() const { return NoSignedZeros; }
437  bool hasAllowReciprocal() const { return AllowReciprocal; }
438  bool hasAllowContract() const { return AllowContract; }
439  bool hasApproximateFuncs() const { return ApproximateFuncs; }
440  bool hasAllowReassociation() const { return AllowReassociation; }
441  bool hasNoFPExcept() const { return NoFPExcept; }
442 
443  /// Clear any flags in this flag set that aren't also set in Flags. All
444  /// flags will be cleared if Flags are undefined.
445  void intersectWith(const SDNodeFlags Flags) {
446  NoUnsignedWrap &= Flags.NoUnsignedWrap;
447  NoSignedWrap &= Flags.NoSignedWrap;
448  Exact &= Flags.Exact;
449  NoNaNs &= Flags.NoNaNs;
450  NoInfs &= Flags.NoInfs;
451  NoSignedZeros &= Flags.NoSignedZeros;
452  AllowReciprocal &= Flags.AllowReciprocal;
453  AllowContract &= Flags.AllowContract;
454  ApproximateFuncs &= Flags.ApproximateFuncs;
455  AllowReassociation &= Flags.AllowReassociation;
456  NoFPExcept &= Flags.NoFPExcept;
457  }
458 };
459 
460 /// Represents one node in the SelectionDAG.
461 ///
462 class SDNode : public FoldingSetNode, public ilist_node<SDNode> {
463 private:
464  /// The operation that this node performs.
465  int16_t NodeType;
466 
467 protected:
468  // We define a set of mini-helper classes to help us interpret the bits in our
469  // SubclassData. These are designed to fit within a uint16_t so they pack
470  // with NodeType.
471 
472 #if defined(_AIX) && (!defined(__GNUC__) || defined(__clang__))
473 // Except for GCC; by default, AIX compilers store bit-fields in 4-byte words
474 // and give the `pack` pragma push semantics.
475 #define BEGIN_TWO_BYTE_PACK() _Pragma("pack(2)")
476 #define END_TWO_BYTE_PACK() _Pragma("pack(pop)")
477 #else
478 #define BEGIN_TWO_BYTE_PACK()
479 #define END_TWO_BYTE_PACK()
480 #endif
481 
484  friend class SDNode;
485  friend class MemIntrinsicSDNode;
486  friend class MemSDNode;
487  friend class SelectionDAG;
488 
489  uint16_t HasDebugValue : 1;
490  uint16_t IsMemIntrinsic : 1;
491  uint16_t IsDivergent : 1;
492  };
493  enum { NumSDNodeBits = 3 };
494 
496  friend class ConstantSDNode;
497 
499 
500  uint16_t IsOpaque : 1;
501  };
502 
504  friend class MemSDNode;
505  friend class MemIntrinsicSDNode;
506  friend class AtomicSDNode;
507 
509 
510  uint16_t IsVolatile : 1;
511  uint16_t IsNonTemporal : 1;
512  uint16_t IsDereferenceable : 1;
513  uint16_t IsInvariant : 1;
514  };
516 
518  friend class LSBaseSDNode;
519  friend class VPBaseLoadStoreSDNode;
520  friend class MaskedLoadStoreSDNode;
522  friend class VPGatherScatterSDNode;
523 
525 
526  // This storage is shared between disparate class hierarchies to hold an
527  // enumeration specific to the class hierarchy in use.
528  // LSBaseSDNode => enum ISD::MemIndexedMode
529  // VPLoadStoreBaseSDNode => enum ISD::MemIndexedMode
530  // MaskedLoadStoreBaseSDNode => enum ISD::MemIndexedMode
531  // VPGatherScatterSDNode => enum ISD::MemIndexType
532  // MaskedGatherScatterSDNode => enum ISD::MemIndexType
534  };
536 
538  friend class LoadSDNode;
539  friend class VPLoadSDNode;
540  friend class VPStridedLoadSDNode;
541  friend class MaskedLoadSDNode;
542  friend class MaskedGatherSDNode;
543  friend class VPGatherSDNode;
544 
546 
547  uint16_t ExtTy : 2; // enum ISD::LoadExtType
548  uint16_t IsExpanding : 1;
549  };
550 
552  friend class StoreSDNode;
553  friend class VPStoreSDNode;
554  friend class VPStridedStoreSDNode;
555  friend class MaskedStoreSDNode;
556  friend class MaskedScatterSDNode;
557  friend class VPScatterSDNode;
558 
560 
561  uint16_t IsTruncating : 1;
562  uint16_t IsCompressing : 1;
563  };
564 
565  union {
566  char RawSDNodeBits[sizeof(uint16_t)];
573  };
575 #undef BEGIN_TWO_BYTE_PACK
576 #undef END_TWO_BYTE_PACK
577 
578  // RawSDNodeBits must cover the entirety of the union. This means that all of
579  // the union's members must have size <= RawSDNodeBits. We write the RHS as
580  // "2" instead of sizeof(RawSDNodeBits) because MSVC can't handle the latter.
581  static_assert(sizeof(SDNodeBitfields) <= 2, "field too wide");
582  static_assert(sizeof(ConstantSDNodeBitfields) <= 2, "field too wide");
583  static_assert(sizeof(MemSDNodeBitfields) <= 2, "field too wide");
584  static_assert(sizeof(LSBaseSDNodeBitfields) <= 2, "field too wide");
585  static_assert(sizeof(LoadSDNodeBitfields) <= 2, "field too wide");
586  static_assert(sizeof(StoreSDNodeBitfields) <= 2, "field too wide");
587 
588 private:
589  friend class SelectionDAG;
590  // TODO: unfriend HandleSDNode once we fix its operand handling.
591  friend class HandleSDNode;
592 
593  /// Unique id per SDNode in the DAG.
594  int NodeId = -1;
595 
596  /// The values that are used by this operation.
597  SDUse *OperandList = nullptr;
598 
599  /// The types of the values this node defines. SDNode's may
600  /// define multiple values simultaneously.
601  const EVT *ValueList;
602 
603  /// List of uses for this SDNode.
604  SDUse *UseList = nullptr;
605 
606  /// The number of entries in the Operand/Value list.
607  unsigned short NumOperands = 0;
608  unsigned short NumValues;
609 
610  // The ordering of the SDNodes. It roughly corresponds to the ordering of the
611  // original LLVM instructions.
612  // This is used for turning off scheduling, because we'll forgo
613  // the normal scheduling algorithms and output the instructions according to
614  // this ordering.
615  unsigned IROrder;
616 
617  /// Source line information.
618  DebugLoc debugLoc;
619 
620  /// Return a pointer to the specified value type.
621  static const EVT *getValueTypeList(EVT VT);
622 
623  SDNodeFlags Flags;
624 
625  uint32_t CFIType = 0;
626 
627 public:
628  /// Unique and persistent id per SDNode in the DAG. Used for debug printing.
629  /// We do not place that under `#if LLVM_ENABLE_ABI_BREAKING_CHECKS`
630  /// intentionally because it adds unneeded complexity without noticeable
631  /// benefits (see discussion with @thakis in D120714).
633 
634  //===--------------------------------------------------------------------===//
635  // Accessors
636  //
637 
638  /// Return the SelectionDAG opcode value for this node. For
639  /// pre-isel nodes (those for which isMachineOpcode returns false), these
640  /// are the opcode values in the ISD and <target>ISD namespaces. For
641  /// post-isel opcodes, see getMachineOpcode.
642  unsigned getOpcode() const { return (unsigned short)NodeType; }
643 
644  /// Test if this node has a target-specific opcode (in the
645  /// <target>ISD namespace).
646  bool isTargetOpcode() const { return NodeType >= ISD::BUILTIN_OP_END; }
647 
648  /// Test if this node has a target-specific opcode that may raise
649  /// FP exceptions (in the <target>ISD namespace and greater than
650  /// FIRST_TARGET_STRICTFP_OPCODE). Note that all target memory
651  /// opcode are currently automatically considered to possibly raise
652  /// FP exceptions as well.
653  bool isTargetStrictFPOpcode() const {
655  }
656 
657  /// Test if this node has a target-specific
658  /// memory-referencing opcode (in the <target>ISD namespace and
659  /// greater than FIRST_TARGET_MEMORY_OPCODE).
660  bool isTargetMemoryOpcode() const {
662  }
663 
664  /// Return true if the type of the node type undefined.
665  bool isUndef() const { return NodeType == ISD::UNDEF; }
666 
667  /// Test if this node is a memory intrinsic (with valid pointer information).
668  /// INTRINSIC_W_CHAIN and INTRINSIC_VOID nodes are sometimes created for
669  /// non-memory intrinsics (with chains) that are not really instances of
670  /// MemSDNode. For such nodes, we need some extra state to determine the
671  /// proper classof relationship.
672  bool isMemIntrinsic() const {
673  return (NodeType == ISD::INTRINSIC_W_CHAIN ||
675  SDNodeBits.IsMemIntrinsic;
676  }
677 
678  /// Test if this node is a strict floating point pseudo-op.
680  switch (NodeType) {
681  default:
682  return false;
685 #define DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \
686  case ISD::STRICT_##DAGN:
687 #include "llvm/IR/ConstrainedOps.def"
688  return true;
689  }
690  }
691 
692  /// Test if this node is a vector predication operation.
693  bool isVPOpcode() const { return ISD::isVPOpcode(getOpcode()); }
694 
695  /// Test if this node has a post-isel opcode, directly
696  /// corresponding to a MachineInstr opcode.
697  bool isMachineOpcode() const { return NodeType < 0; }
698 
699  /// This may only be called if isMachineOpcode returns
700  /// true. It returns the MachineInstr opcode value that the node's opcode
701  /// corresponds to.
702  unsigned getMachineOpcode() const {
703  assert(isMachineOpcode() && "Not a MachineInstr opcode!");
704  return ~NodeType;
705  }
706 
707  bool getHasDebugValue() const { return SDNodeBits.HasDebugValue; }
708  void setHasDebugValue(bool b) { SDNodeBits.HasDebugValue = b; }
709 
710  bool isDivergent() const { return SDNodeBits.IsDivergent; }
711 
712  /// Return true if there are no uses of this node.
713  bool use_empty() const { return UseList == nullptr; }
714 
715  /// Return true if there is exactly one use of this node.
716  bool hasOneUse() const { return hasSingleElement(uses()); }
717 
718  /// Return the number of uses of this node. This method takes
719  /// time proportional to the number of uses.
720  size_t use_size() const { return std::distance(use_begin(), use_end()); }
721 
722  /// Return the unique node id.
723  int getNodeId() const { return NodeId; }
724 
725  /// Set unique node id.
726  void setNodeId(int Id) { NodeId = Id; }
727 
728  /// Return the node ordering.
729  unsigned getIROrder() const { return IROrder; }
730 
731  /// Set the node ordering.
732  void setIROrder(unsigned Order) { IROrder = Order; }
733 
734  /// Return the source location info.
735  const DebugLoc &getDebugLoc() const { return debugLoc; }
736 
737  /// Set source location info. Try to avoid this, putting
738  /// it in the constructor is preferable.
739  void setDebugLoc(DebugLoc dl) { debugLoc = std::move(dl); }
740 
741  /// This class provides iterator support for SDUse
742  /// operands that use a specific SDNode.
743  class use_iterator {
744  friend class SDNode;
745 
746  SDUse *Op = nullptr;
747 
748  explicit use_iterator(SDUse *op) : Op(op) {}
749 
750  public:
751  using iterator_category = std::forward_iterator_tag;
752  using value_type = SDUse;
753  using difference_type = std::ptrdiff_t;
754  using pointer = value_type *;
756 
757  use_iterator() = default;
758  use_iterator(const use_iterator &I) = default;
759 
760  bool operator==(const use_iterator &x) const { return Op == x.Op; }
761  bool operator!=(const use_iterator &x) const {
762  return !operator==(x);
763  }
764 
765  /// Return true if this iterator is at the end of uses list.
766  bool atEnd() const { return Op == nullptr; }
767 
768  // Iterator traversal: forward iteration only.
769  use_iterator &operator++() { // Preincrement
770  assert(Op && "Cannot increment end iterator!");
771  Op = Op->getNext();
772  return *this;
773  }
774 
775  use_iterator operator++(int) { // Postincrement
776  use_iterator tmp = *this; ++*this; return tmp;
777  }
778 
779  /// Retrieve a pointer to the current user node.
780  SDNode *operator*() const {
781  assert(Op && "Cannot dereference end iterator!");
782  return Op->getUser();
783  }
784 
785  SDNode *operator->() const { return operator*(); }
786 
787  SDUse &getUse() const { return *Op; }
788 
789  /// Retrieve the operand # of this use in its user.
790  unsigned getOperandNo() const {
791  assert(Op && "Cannot dereference end iterator!");
792  return (unsigned)(Op - Op->getUser()->OperandList);
793  }
794  };
795 
796  /// Provide iteration support to walk over all uses of an SDNode.
798  return use_iterator(UseList);
799  }
800 
801  static use_iterator use_end() { return use_iterator(nullptr); }
802 
804  return make_range(use_begin(), use_end());
805  }
807  return make_range(use_begin(), use_end());
808  }
809 
810  /// Return true if there are exactly NUSES uses of the indicated value.
811  /// This method ignores uses of other values defined by this operation.
812  bool hasNUsesOfValue(unsigned NUses, unsigned Value) const;
813 
814  /// Return true if there are any use of the indicated value.
815  /// This method ignores uses of other values defined by this operation.
816  bool hasAnyUseOfValue(unsigned Value) const;
817 
818  /// Return true if this node is the only use of N.
819  bool isOnlyUserOf(const SDNode *N) const;
820 
821  /// Return true if this node is an operand of N.
822  bool isOperandOf(const SDNode *N) const;
823 
824  /// Return true if this node is a predecessor of N.
825  /// NOTE: Implemented on top of hasPredecessor and every bit as
826  /// expensive. Use carefully.
827  bool isPredecessorOf(const SDNode *N) const {
828  return N->hasPredecessor(this);
829  }
830 
831  /// Return true if N is a predecessor of this node.
832  /// N is either an operand of this node, or can be reached by recursively
833  /// traversing up the operands.
834  /// NOTE: This is an expensive method. Use it carefully.
835  bool hasPredecessor(const SDNode *N) const;
836 
837  /// Returns true if N is a predecessor of any node in Worklist. This
838  /// helper keeps Visited and Worklist sets externally to allow unions
839  /// searches to be performed in parallel, caching of results across
840  /// queries and incremental addition to Worklist. Stops early if N is
841  /// found but will resume. Remember to clear Visited and Worklists
842  /// if DAG changes. MaxSteps gives a maximum number of nodes to visit before
843  /// giving up. The TopologicalPrune flag signals that positive NodeIds are
844  /// topologically ordered (Operands have strictly smaller node id) and search
845  /// can be pruned leveraging this.
846  static bool hasPredecessorHelper(const SDNode *N,
849  unsigned int MaxSteps = 0,
850  bool TopologicalPrune = false) {
851  SmallVector<const SDNode *, 8> DeferredNodes;
852  if (Visited.count(N))
853  return true;
854 
855  // Node Id's are assigned in three places: As a topological
856  // ordering (> 0), during legalization (results in values set to
857  // 0), new nodes (set to -1). If N has a topolgical id then we
858  // know that all nodes with ids smaller than it cannot be
859  // successors and we need not check them. Filter out all node
860  // that can't be matches. We add them to the worklist before exit
861  // in case of multiple calls. Note that during selection the topological id
862  // may be violated if a node's predecessor is selected before it. We mark
863  // this at selection negating the id of unselected successors and
864  // restricting topological pruning to positive ids.
865 
866  int NId = N->getNodeId();
867  // If we Invalidated the Id, reconstruct original NId.
868  if (NId < -1)
869  NId = -(NId + 1);
870 
871  bool Found = false;
872  while (!Worklist.empty()) {
873  const SDNode *M = Worklist.pop_back_val();
874  int MId = M->getNodeId();
875  if (TopologicalPrune && M->getOpcode() != ISD::TokenFactor && (NId > 0) &&
876  (MId > 0) && (MId < NId)) {
877  DeferredNodes.push_back(M);
878  continue;
879  }
880  for (const SDValue &OpV : M->op_values()) {
881  SDNode *Op = OpV.getNode();
882  if (Visited.insert(Op).second)
883  Worklist.push_back(Op);
884  if (Op == N)
885  Found = true;
886  }
887  if (Found)
888  break;
889  if (MaxSteps != 0 && Visited.size() >= MaxSteps)
890  break;
891  }
892  // Push deferred nodes back on worklist.
893  Worklist.append(DeferredNodes.begin(), DeferredNodes.end());
894  // If we bailed early, conservatively return found.
895  if (MaxSteps != 0 && Visited.size() >= MaxSteps)
896  return true;
897  return Found;
898  }
899 
900  /// Return true if all the users of N are contained in Nodes.
901  /// NOTE: Requires at least one match, but doesn't require them all.
902  static bool areOnlyUsersOf(ArrayRef<const SDNode *> Nodes, const SDNode *N);
903 
904  /// Return the number of values used by this operation.
905  unsigned getNumOperands() const { return NumOperands; }
906 
907  /// Return the maximum number of operands that a SDNode can hold.
908  static constexpr size_t getMaxNumOperands() {
909  return std::numeric_limits<decltype(SDNode::NumOperands)>::max();
910  }
911 
912  /// Helper method returns the integer value of a ConstantSDNode operand.
913  inline uint64_t getConstantOperandVal(unsigned Num) const;
914 
915  /// Helper method returns the APInt of a ConstantSDNode operand.
916  inline const APInt &getConstantOperandAPInt(unsigned Num) const;
917 
918  const SDValue &getOperand(unsigned Num) const {
919  assert(Num < NumOperands && "Invalid child # of SDNode!");
920  return OperandList[Num];
921  }
922 
923  using op_iterator = SDUse *;
924 
925  op_iterator op_begin() const { return OperandList; }
926  op_iterator op_end() const { return OperandList+NumOperands; }
927  ArrayRef<SDUse> ops() const { return makeArrayRef(op_begin(), op_end()); }
928 
929  /// Iterator for directly iterating over the operand SDValue's.
931  : iterator_adaptor_base<value_op_iterator, op_iterator,
932  std::random_access_iterator_tag, SDValue,
933  ptrdiff_t, value_op_iterator *,
934  value_op_iterator *> {
935  explicit value_op_iterator(SDUse *U = nullptr)
936  : iterator_adaptor_base(U) {}
937 
938  const SDValue &operator*() const { return I->get(); }
939  };
940 
944  }
945 
946  SDVTList getVTList() const {
947  SDVTList X = { ValueList, NumValues };
948  return X;
949  }
950 
951  /// If this node has a glue operand, return the node
952  /// to which the glue operand points. Otherwise return NULL.
953  SDNode *getGluedNode() const {
954  if (getNumOperands() != 0 &&
956  return getOperand(getNumOperands()-1).getNode();
957  return nullptr;
958  }
959 
960  /// If this node has a glue value with a user, return
961  /// the user (there is at most one). Otherwise return NULL.
962  SDNode *getGluedUser() const {
963  for (use_iterator UI = use_begin(), UE = use_end(); UI != UE; ++UI)
964  if (UI.getUse().get().getValueType() == MVT::Glue)
965  return *UI;
966  return nullptr;
967  }
968 
969  SDNodeFlags getFlags() const { return Flags; }
970  void setFlags(SDNodeFlags NewFlags) { Flags = NewFlags; }
971 
972  /// Clear any flags in this node that aren't also set in Flags.
973  /// If Flags is not in a defined state then this has no effect.
974  void intersectFlagsWith(const SDNodeFlags Flags);
975 
976  void setCFIType(uint32_t Type) { CFIType = Type; }
977  uint32_t getCFIType() const { return CFIType; }
978 
979  /// Return the number of values defined/returned by this operator.
980  unsigned getNumValues() const { return NumValues; }
981 
982  /// Return the type of a specified result.
983  EVT getValueType(unsigned ResNo) const {
984  assert(ResNo < NumValues && "Illegal result number!");
985  return ValueList[ResNo];
986  }
987 
988  /// Return the type of a specified result as a simple type.
989  MVT getSimpleValueType(unsigned ResNo) const {
990  return getValueType(ResNo).getSimpleVT();
991  }
992 
993  /// Returns MVT::getSizeInBits(getValueType(ResNo)).
994  ///
995  /// If the value type is a scalable vector type, the scalable property will
996  /// be set and the runtime size will be a positive integer multiple of the
997  /// base size.
998  TypeSize getValueSizeInBits(unsigned ResNo) const {
999  return getValueType(ResNo).getSizeInBits();
1000  }
1001 
1002  using value_iterator = const EVT *;
1003 
1004  value_iterator value_begin() const { return ValueList; }
1005  value_iterator value_end() const { return ValueList+NumValues; }
1007  return llvm::make_range(value_begin(), value_end());
1008  }
1009 
1010  /// Return the opcode of this operation for printing.
1011  std::string getOperationName(const SelectionDAG *G = nullptr) const;
1012  static const char* getIndexedModeName(ISD::MemIndexedMode AM);
1013  void print_types(raw_ostream &OS, const SelectionDAG *G) const;
1014  void print_details(raw_ostream &OS, const SelectionDAG *G) const;
1015  void print(raw_ostream &OS, const SelectionDAG *G = nullptr) const;
1016  void printr(raw_ostream &OS, const SelectionDAG *G = nullptr) const;
1017 
1018  /// Print a SelectionDAG node and all children down to
1019  /// the leaves. The given SelectionDAG allows target-specific nodes
1020  /// to be printed in human-readable form. Unlike printr, this will
1021  /// print the whole DAG, including children that appear multiple
1022  /// times.
1023  ///
1024  void printrFull(raw_ostream &O, const SelectionDAG *G = nullptr) const;
1025 
1026  /// Print a SelectionDAG node and children up to
1027  /// depth "depth." The given SelectionDAG allows target-specific
1028  /// nodes to be printed in human-readable form. Unlike printr, this
1029  /// will print children that appear multiple times wherever they are
1030  /// used.
1031  ///
1032  void printrWithDepth(raw_ostream &O, const SelectionDAG *G = nullptr,
1033  unsigned depth = 100) const;
1034 
1035  /// Dump this node, for debugging.
1036  void dump() const;
1037 
1038  /// Dump (recursively) this node and its use-def subgraph.
1039  void dumpr() const;
1040 
1041  /// Dump this node, for debugging.
1042  /// The given SelectionDAG allows target-specific nodes to be printed
1043  /// in human-readable form.
1044  void dump(const SelectionDAG *G) const;
1045 
1046  /// Dump (recursively) this node and its use-def subgraph.
1047  /// The given SelectionDAG allows target-specific nodes to be printed
1048  /// in human-readable form.
1049  void dumpr(const SelectionDAG *G) const;
1050 
1051  /// printrFull to dbgs(). The given SelectionDAG allows
1052  /// target-specific nodes to be printed in human-readable form.
1053  /// Unlike dumpr, this will print the whole DAG, including children
1054  /// that appear multiple times.
1055  void dumprFull(const SelectionDAG *G = nullptr) const;
1056 
1057  /// printrWithDepth to dbgs(). The given
1058  /// SelectionDAG allows target-specific nodes to be printed in
1059  /// human-readable form. Unlike dumpr, this will print children
1060  /// that appear multiple times wherever they are used.
1061  ///
1062  void dumprWithDepth(const SelectionDAG *G = nullptr,
1063  unsigned depth = 100) const;
1064 
1065  /// Gather unique data for the node.
1066  void Profile(FoldingSetNodeID &ID) const;
1067 
1068  /// This method should only be used by the SDUse class.
1069  void addUse(SDUse &U) { U.addToList(&UseList); }
1070 
1071 protected:
1072  static SDVTList getSDVTList(EVT VT) {
1073  SDVTList Ret = { getValueTypeList(VT), 1 };
1074  return Ret;
1075  }
1076 
1077  /// Create an SDNode.
1078  ///
1079  /// SDNodes are created without any operands, and never own the operand
1080  /// storage. To add operands, see SelectionDAG::createOperands.
1081  SDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs)
1082  : NodeType(Opc), ValueList(VTs.VTs), NumValues(VTs.NumVTs),
1083  IROrder(Order), debugLoc(std::move(dl)) {
1084  memset(&RawSDNodeBits, 0, sizeof(RawSDNodeBits));
1085  assert(debugLoc.hasTrivialDestructor() && "Expected trivial destructor");
1086  assert(NumValues == VTs.NumVTs &&
1087  "NumValues wasn't wide enough for its operands!");
1088  }
1089 
1090  /// Release the operands and set this node to have zero operands.
1091  void DropOperands();
1092 };
1093 
1094 /// Wrapper class for IR location info (IR ordering and DebugLoc) to be passed
1095 /// into SDNode creation functions.
1096 /// When an SDNode is created from the DAGBuilder, the DebugLoc is extracted
1097 /// from the original Instruction, and IROrder is the ordinal position of
1098 /// the instruction.
1099 /// When an SDNode is created after the DAG is being built, both DebugLoc and
1100 /// the IROrder are propagated from the original SDNode.
1101 /// So SDLoc class provides two constructors besides the default one, one to
1102 /// be used by the DAGBuilder, the other to be used by others.
1103 class SDLoc {
1104 private:
1105  DebugLoc DL;
1106  int IROrder = 0;
1107 
1108 public:
1109  SDLoc() = default;
1110  SDLoc(const SDNode *N) : DL(N->getDebugLoc()), IROrder(N->getIROrder()) {}
1111  SDLoc(const SDValue V) : SDLoc(V.getNode()) {}
1112  SDLoc(const Instruction *I, int Order) : IROrder(Order) {
1113  assert(Order >= 0 && "bad IROrder");
1114  if (I)
1115  DL = I->getDebugLoc();
1116  }
1117 
1118  unsigned getIROrder() const { return IROrder; }
1119  const DebugLoc &getDebugLoc() const { return DL; }
1120 };
1121 
1122 // Define inline functions from the SDValue class.
1123 
1124 inline SDValue::SDValue(SDNode *node, unsigned resno)
1125  : Node(node), ResNo(resno) {
1126  // Explicitly check for !ResNo to avoid use-after-free, because there are
1127  // callers that use SDValue(N, 0) with a deleted N to indicate successful
1128  // combines.
1129  assert((!Node || !ResNo || ResNo < Node->getNumValues()) &&
1130  "Invalid result number for the given node!");
1131  assert(ResNo < -2U && "Cannot use result numbers reserved for DenseMaps.");
1132 }
1133 
1134 inline unsigned SDValue::getOpcode() const {
1135  return Node->getOpcode();
1136 }
1137 
1138 inline EVT SDValue::getValueType() const {
1139  return Node->getValueType(ResNo);
1140 }
1141 
1142 inline unsigned SDValue::getNumOperands() const {
1143  return Node->getNumOperands();
1144 }
1145 
1146 inline const SDValue &SDValue::getOperand(unsigned i) const {
1147  return Node->getOperand(i);
1148 }
1149 
1151  return Node->getConstantOperandVal(i);
1152 }
1153 
1154 inline const APInt &SDValue::getConstantOperandAPInt(unsigned i) const {
1155  return Node->getConstantOperandAPInt(i);
1156 }
1157 
1158 inline bool SDValue::isTargetOpcode() const {
1159  return Node->isTargetOpcode();
1160 }
1161 
1162 inline bool SDValue::isTargetMemoryOpcode() const {
1163  return Node->isTargetMemoryOpcode();
1164 }
1165 
1166 inline bool SDValue::isMachineOpcode() const {
1167  return Node->isMachineOpcode();
1168 }
1169 
1170 inline unsigned SDValue::getMachineOpcode() const {
1171  return Node->getMachineOpcode();
1172 }
1173 
1174 inline bool SDValue::isUndef() const {
1175  return Node->isUndef();
1176 }
1177 
1178 inline bool SDValue::use_empty() const {
1179  return !Node->hasAnyUseOfValue(ResNo);
1180 }
1181 
1182 inline bool SDValue::hasOneUse() const {
1183  return Node->hasNUsesOfValue(1, ResNo);
1184 }
1185 
1186 inline const DebugLoc &SDValue::getDebugLoc() const {
1187  return Node->getDebugLoc();
1188 }
1189 
1190 inline void SDValue::dump() const {
1191  return Node->dump();
1192 }
1193 
1194 inline void SDValue::dump(const SelectionDAG *G) const {
1195  return Node->dump(G);
1196 }
1197 
1198 inline void SDValue::dumpr() const {
1199  return Node->dumpr();
1200 }
1201 
1202 inline void SDValue::dumpr(const SelectionDAG *G) const {
1203  return Node->dumpr(G);
1204 }
1205 
1206 // Define inline functions from the SDUse class.
1207 
1208 inline void SDUse::set(const SDValue &V) {
1209  if (Val.getNode()) removeFromList();
1210  Val = V;
1211  if (V.getNode())
1212  V->addUse(*this);
1213 }
1214 
1215 inline void SDUse::setInitial(const SDValue &V) {
1216  Val = V;
1217  V->addUse(*this);
1218 }
1219 
1220 inline void SDUse::setNode(SDNode *N) {
1221  if (Val.getNode()) removeFromList();
1222  Val.setNode(N);
1223  if (N) N->addUse(*this);
1224 }
1225 
1226 /// This class is used to form a handle around another node that
1227 /// is persistent and is updated across invocations of replaceAllUsesWith on its
1228 /// operand. This node should be directly created by end-users and not added to
1229 /// the AllNodes list.
1230 class HandleSDNode : public SDNode {
1231  SDUse Op;
1232 
1233 public:
1235  : SDNode(ISD::HANDLENODE, 0, DebugLoc(), getSDVTList(MVT::Other)) {
1236  // HandleSDNodes are never inserted into the DAG, so they won't be
1237  // auto-numbered. Use ID 65535 as a sentinel.
1238  PersistentId = 0xffff;
1239 
1240  // Manually set up the operand list. This node type is special in that it's
1241  // always stack allocated and SelectionDAG does not manage its operands.
1242  // TODO: This should either (a) not be in the SDNode hierarchy, or (b) not
1243  // be so special.
1244  Op.setUser(this);
1245  Op.setInitial(X);
1246  NumOperands = 1;
1247  OperandList = &Op;
1248  }
1249  ~HandleSDNode();
1250 
1251  const SDValue &getValue() const { return Op; }
1252 };
1253 
1254 class AddrSpaceCastSDNode : public SDNode {
1255 private:
1256  unsigned SrcAddrSpace;
1257  unsigned DestAddrSpace;
1258 
1259 public:
1260  AddrSpaceCastSDNode(unsigned Order, const DebugLoc &dl, EVT VT,
1261  unsigned SrcAS, unsigned DestAS);
1262 
1263  unsigned getSrcAddressSpace() const { return SrcAddrSpace; }
1264  unsigned getDestAddressSpace() const { return DestAddrSpace; }
1265 
1266  static bool classof(const SDNode *N) {
1267  return N->getOpcode() == ISD::ADDRSPACECAST;
1268  }
1269 };
1270 
1271 /// This is an abstract virtual class for memory operations.
1272 class MemSDNode : public SDNode {
1273 private:
1274  // VT of in-memory value.
1275  EVT MemoryVT;
1276 
1277 protected:
1278  /// Memory reference information.
1280 
1281 public:
1282  MemSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTs,
1283  EVT memvt, MachineMemOperand *MMO);
1284 
1285  bool readMem() const { return MMO->isLoad(); }
1286  bool writeMem() const { return MMO->isStore(); }
1287 
1288  /// Returns alignment and volatility of the memory access
1289  Align getOriginalAlign() const { return MMO->getBaseAlign(); }
1290  Align getAlign() const { return MMO->getAlign(); }
1291  // FIXME: Remove once transition to getAlign is over.
1292  unsigned getAlignment() const { return MMO->getAlign().value(); }
1293 
1294  /// Return the SubclassData value, without HasDebugValue. This contains an
1295  /// encoding of the volatile flag, as well as bits used by subclasses. This
1296  /// function should only be used to compute a FoldingSetNodeID value.
1297  /// The HasDebugValue bit is masked out because CSE map needs to match
1298  /// nodes with debug info with nodes without debug info. Same is about
1299  /// isDivergent bit.
1300  unsigned getRawSubclassData() const {
1301  uint16_t Data;
1302  union {
1303  char RawSDNodeBits[sizeof(uint16_t)];
1305  };
1306  memcpy(&RawSDNodeBits, &this->RawSDNodeBits, sizeof(this->RawSDNodeBits));
1307  SDNodeBits.HasDebugValue = 0;
1308  SDNodeBits.IsDivergent = false;
1309  memcpy(&Data, &RawSDNodeBits, sizeof(RawSDNodeBits));
1310  return Data;
1311  }
1312 
1313  bool isVolatile() const { return MemSDNodeBits.IsVolatile; }
1314  bool isNonTemporal() const { return MemSDNodeBits.IsNonTemporal; }
1315  bool isDereferenceable() const { return MemSDNodeBits.IsDereferenceable; }
1316  bool isInvariant() const { return MemSDNodeBits.IsInvariant; }
1317 
1318  // Returns the offset from the location of the access.
1319  int64_t getSrcValueOffset() const { return MMO->getOffset(); }
1320 
1321  /// Returns the AA info that describes the dereference.
1322  AAMDNodes getAAInfo() const { return MMO->getAAInfo(); }
1323 
1324  /// Returns the Ranges that describes the dereference.
1325  const MDNode *getRanges() const { return MMO->getRanges(); }
1326 
1327  /// Returns the synchronization scope ID for this memory operation.
1329 
1330  /// Return the atomic ordering requirements for this memory operation. For
1331  /// cmpxchg atomic operations, return the atomic ordering requirements when
1332  /// store occurs.
1334  return MMO->getSuccessOrdering();
1335  }
1336 
1337  /// Return a single atomic ordering that is at least as strong as both the
1338  /// success and failure orderings for an atomic operation. (For operations
1339  /// other than cmpxchg, this is equivalent to getSuccessOrdering().)
1341 
1342  /// Return true if the memory operation ordering is Unordered or higher.
1343  bool isAtomic() const { return MMO->isAtomic(); }
1344 
1345  /// Returns true if the memory operation doesn't imply any ordering
1346  /// constraints on surrounding memory operations beyond the normal memory
1347  /// aliasing rules.
1348  bool isUnordered() const { return MMO->isUnordered(); }
1349 
1350  /// Returns true if the memory operation is neither atomic or volatile.
1351  bool isSimple() const { return !isAtomic() && !isVolatile(); }
1352 
1353  /// Return the type of the in-memory value.
1354  EVT getMemoryVT() const { return MemoryVT; }
1355 
1356  /// Return a MachineMemOperand object describing the memory
1357  /// reference performed by operation.
1358  MachineMemOperand *getMemOperand() const { return MMO; }
1359 
1361  return MMO->getPointerInfo();
1362  }
1363 
1364  /// Return the address space for the associated pointer
1365  unsigned getAddressSpace() const {
1366  return getPointerInfo().getAddrSpace();
1367  }
1368 
1369  /// Update this MemSDNode's MachineMemOperand information
1370  /// to reflect the alignment of NewMMO, if it has a greater alignment.
1371  /// This must only be used when the new alignment applies to all users of
1372  /// this MachineMemOperand.
1373  void refineAlignment(const MachineMemOperand *NewMMO) {
1374  MMO->refineAlignment(NewMMO);
1375  }
1376 
1377  const SDValue &getChain() const { return getOperand(0); }
1378 
1379  const SDValue &getBasePtr() const {
1380  switch (getOpcode()) {
1381  case ISD::STORE:
1382  case ISD::VP_STORE:
1383  case ISD::MSTORE:
1384  case ISD::VP_SCATTER:
1385  case ISD::EXPERIMENTAL_VP_STRIDED_STORE:
1386  return getOperand(2);
1387  case ISD::MGATHER:
1388  case ISD::MSCATTER:
1389  return getOperand(3);
1390  default:
1391  return getOperand(1);
1392  }
1393  }
1394 
1395  // Methods to support isa and dyn_cast
1396  static bool classof(const SDNode *N) {
1397  // For some targets, we lower some target intrinsics to a MemIntrinsicNode
1398  // with either an intrinsic or a target opcode.
1399  switch (N->getOpcode()) {
1400  case ISD::LOAD:
1401  case ISD::STORE:
1402  case ISD::PREFETCH:
1403  case ISD::ATOMIC_CMP_SWAP:
1405  case ISD::ATOMIC_SWAP:
1406  case ISD::ATOMIC_LOAD_ADD:
1407  case ISD::ATOMIC_LOAD_SUB:
1408  case ISD::ATOMIC_LOAD_AND:
1409  case ISD::ATOMIC_LOAD_CLR:
1410  case ISD::ATOMIC_LOAD_OR:
1411  case ISD::ATOMIC_LOAD_XOR:
1412  case ISD::ATOMIC_LOAD_NAND:
1413  case ISD::ATOMIC_LOAD_MIN:
1414  case ISD::ATOMIC_LOAD_MAX:
1415  case ISD::ATOMIC_LOAD_UMIN:
1416  case ISD::ATOMIC_LOAD_UMAX:
1417  case ISD::ATOMIC_LOAD_FADD:
1418  case ISD::ATOMIC_LOAD_FSUB:
1419  case ISD::ATOMIC_LOAD_FMAX:
1420  case ISD::ATOMIC_LOAD_FMIN:
1421  case ISD::ATOMIC_LOAD:
1422  case ISD::ATOMIC_STORE:
1423  case ISD::MLOAD:
1424  case ISD::MSTORE:
1425  case ISD::MGATHER:
1426  case ISD::MSCATTER:
1427  case ISD::VP_LOAD:
1428  case ISD::VP_STORE:
1429  case ISD::VP_GATHER:
1430  case ISD::VP_SCATTER:
1431  case ISD::EXPERIMENTAL_VP_STRIDED_LOAD:
1432  case ISD::EXPERIMENTAL_VP_STRIDED_STORE:
1433  return true;
1434  default:
1435  return N->isMemIntrinsic() || N->isTargetMemoryOpcode();
1436  }
1437  }
1438 };
1439 
1440 /// This is an SDNode representing atomic operations.
1441 class AtomicSDNode : public MemSDNode {
1442 public:
1443  AtomicSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTL,
1444  EVT MemVT, MachineMemOperand *MMO)
1445  : MemSDNode(Opc, Order, dl, VTL, MemVT, MMO) {
1446  assert(((Opc != ISD::ATOMIC_LOAD && Opc != ISD::ATOMIC_STORE) ||
1447  MMO->isAtomic()) && "then why are we using an AtomicSDNode?");
1448  }
1449 
1450  const SDValue &getBasePtr() const { return getOperand(1); }
1451  const SDValue &getVal() const { return getOperand(2); }
1452 
1453  /// Returns true if this SDNode represents cmpxchg atomic operation, false
1454  /// otherwise.
1455  bool isCompareAndSwap() const {
1456  unsigned Op = getOpcode();
1457  return Op == ISD::ATOMIC_CMP_SWAP ||
1459  }
1460 
1461  /// For cmpxchg atomic operations, return the atomic ordering requirements
1462  /// when store does not occur.
1464  assert(isCompareAndSwap() && "Must be cmpxchg operation");
1465  return MMO->getFailureOrdering();
1466  }
1467 
1468  // Methods to support isa and dyn_cast
1469  static bool classof(const SDNode *N) {
1470  return N->getOpcode() == ISD::ATOMIC_CMP_SWAP ||
1471  N->getOpcode() == ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS ||
1472  N->getOpcode() == ISD::ATOMIC_SWAP ||
1473  N->getOpcode() == ISD::ATOMIC_LOAD_ADD ||
1474  N->getOpcode() == ISD::ATOMIC_LOAD_SUB ||
1475  N->getOpcode() == ISD::ATOMIC_LOAD_AND ||
1476  N->getOpcode() == ISD::ATOMIC_LOAD_CLR ||
1477  N->getOpcode() == ISD::ATOMIC_LOAD_OR ||
1478  N->getOpcode() == ISD::ATOMIC_LOAD_XOR ||
1479  N->getOpcode() == ISD::ATOMIC_LOAD_NAND ||
1480  N->getOpcode() == ISD::ATOMIC_LOAD_MIN ||
1481  N->getOpcode() == ISD::ATOMIC_LOAD_MAX ||
1482  N->getOpcode() == ISD::ATOMIC_LOAD_UMIN ||
1483  N->getOpcode() == ISD::ATOMIC_LOAD_UMAX ||
1484  N->getOpcode() == ISD::ATOMIC_LOAD_FADD ||
1485  N->getOpcode() == ISD::ATOMIC_LOAD_FSUB ||
1486  N->getOpcode() == ISD::ATOMIC_LOAD_FMAX ||
1487  N->getOpcode() == ISD::ATOMIC_LOAD_FMIN ||
1488  N->getOpcode() == ISD::ATOMIC_LOAD ||
1489  N->getOpcode() == ISD::ATOMIC_STORE;
1490  }
1491 };
1492 
1493 /// This SDNode is used for target intrinsics that touch
1494 /// memory and need an associated MachineMemOperand. Its opcode may be
1495 /// INTRINSIC_VOID, INTRINSIC_W_CHAIN, PREFETCH, or a target-specific opcode
1496 /// with a value not less than FIRST_TARGET_MEMORY_OPCODE.
1498 public:
1499  MemIntrinsicSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl,
1500  SDVTList VTs, EVT MemoryVT, MachineMemOperand *MMO)
1501  : MemSDNode(Opc, Order, dl, VTs, MemoryVT, MMO) {
1502  SDNodeBits.IsMemIntrinsic = true;
1503  }
1504 
1505  // Methods to support isa and dyn_cast
1506  static bool classof(const SDNode *N) {
1507  // We lower some target intrinsics to their target opcode
1508  // early a node with a target opcode can be of this class
1509  return N->isMemIntrinsic() ||
1510  N->getOpcode() == ISD::PREFETCH ||
1511  N->isTargetMemoryOpcode();
1512  }
1513 };
1514 
1515 /// This SDNode is used to implement the code generator
1516 /// support for the llvm IR shufflevector instruction. It combines elements
1517 /// from two input vectors into a new input vector, with the selection and
1518 /// ordering of elements determined by an array of integers, referred to as
1519 /// the shuffle mask. For input vectors of width N, mask indices of 0..N-1
1520 /// refer to elements from the LHS input, and indices from N to 2N-1 the RHS.
1521 /// An index of -1 is treated as undef, such that the code generator may put
1522 /// any value in the corresponding element of the result.
1523 class ShuffleVectorSDNode : public SDNode {
1524  // The memory for Mask is owned by the SelectionDAG's OperandAllocator, and
1525  // is freed when the SelectionDAG object is destroyed.
1526  const int *Mask;
1527 
1528 protected:
1529  friend class SelectionDAG;
1530 
1531  ShuffleVectorSDNode(EVT VT, unsigned Order, const DebugLoc &dl, const int *M)
1532  : SDNode(ISD::VECTOR_SHUFFLE, Order, dl, getSDVTList(VT)), Mask(M) {}
1533 
1534 public:
1536  EVT VT = getValueType(0);
1537  return makeArrayRef(Mask, VT.getVectorNumElements());
1538  }
1539 
1540  int getMaskElt(unsigned Idx) const {
1541  assert(Idx < getValueType(0).getVectorNumElements() && "Idx out of range!");
1542  return Mask[Idx];
1543  }
1544 
1545  bool isSplat() const { return isSplatMask(Mask, getValueType(0)); }
1546 
1547  int getSplatIndex() const {
1548  assert(isSplat() && "Cannot get splat index for non-splat!");
1549  EVT VT = getValueType(0);
1550  for (unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i)
1551  if (Mask[i] >= 0)
1552  return Mask[i];
1553 
1554  // We can choose any index value here and be correct because all elements
1555  // are undefined. Return 0 for better potential for callers to simplify.
1556  return 0;
1557  }
1558 
1559  static bool isSplatMask(const int *Mask, EVT VT);
1560 
1561  /// Change values in a shuffle permute mask assuming
1562  /// the two vector operands have swapped position.
1564  unsigned NumElems = Mask.size();
1565  for (unsigned i = 0; i != NumElems; ++i) {
1566  int idx = Mask[i];
1567  if (idx < 0)
1568  continue;
1569  else if (idx < (int)NumElems)
1570  Mask[i] = idx + NumElems;
1571  else
1572  Mask[i] = idx - NumElems;
1573  }
1574  }
1575 
1576  static bool classof(const SDNode *N) {
1577  return N->getOpcode() == ISD::VECTOR_SHUFFLE;
1578  }
1579 };
1580 
1581 class ConstantSDNode : public SDNode {
1582  friend class SelectionDAG;
1583 
1584  const ConstantInt *Value;
1585 
1586  ConstantSDNode(bool isTarget, bool isOpaque, const ConstantInt *val, EVT VT)
1587  : SDNode(isTarget ? ISD::TargetConstant : ISD::Constant, 0, DebugLoc(),
1588  getSDVTList(VT)),
1589  Value(val) {
1590  ConstantSDNodeBits.IsOpaque = isOpaque;
1591  }
1592 
1593 public:
1594  const ConstantInt *getConstantIntValue() const { return Value; }
1595  const APInt &getAPIntValue() const { return Value->getValue(); }
1596  uint64_t getZExtValue() const { return Value->getZExtValue(); }
1597  int64_t getSExtValue() const { return Value->getSExtValue(); }
1599  return Value->getLimitedValue(Limit);
1600  }
1601  MaybeAlign getMaybeAlignValue() const { return Value->getMaybeAlignValue(); }
1602  Align getAlignValue() const { return Value->getAlignValue(); }
1603 
1604  bool isOne() const { return Value->isOne(); }
1605  bool isZero() const { return Value->isZero(); }
1606  // NOTE: This is soft-deprecated. Please use `isZero()` instead.
1607  bool isNullValue() const { return isZero(); }
1608  bool isAllOnes() const { return Value->isMinusOne(); }
1609  // NOTE: This is soft-deprecated. Please use `isAllOnes()` instead.
1610  bool isAllOnesValue() const { return isAllOnes(); }
1611  bool isMaxSignedValue() const { return Value->isMaxValue(true); }
1612  bool isMinSignedValue() const { return Value->isMinValue(true); }
1613 
1614  bool isOpaque() const { return ConstantSDNodeBits.IsOpaque; }
1615 
1616  static bool classof(const SDNode *N) {
1617  return N->getOpcode() == ISD::Constant ||
1618  N->getOpcode() == ISD::TargetConstant;
1619  }
1620 };
1621 
1623  return cast<ConstantSDNode>(getOperand(Num))->getZExtValue();
1624 }
1625 
1626 const APInt &SDNode::getConstantOperandAPInt(unsigned Num) const {
1627  return cast<ConstantSDNode>(getOperand(Num))->getAPIntValue();
1628 }
1629 
1630 class ConstantFPSDNode : public SDNode {
1631  friend class SelectionDAG;
1632 
1633  const ConstantFP *Value;
1634 
1635  ConstantFPSDNode(bool isTarget, const ConstantFP *val, EVT VT)
1636  : SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP, 0,
1637  DebugLoc(), getSDVTList(VT)),
1638  Value(val) {}
1639 
1640 public:
1641  const APFloat& getValueAPF() const { return Value->getValueAPF(); }
1642  const ConstantFP *getConstantFPValue() const { return Value; }
1643 
1644  /// Return true if the value is positive or negative zero.
1645  bool isZero() const { return Value->isZero(); }
1646 
1647  /// Return true if the value is a NaN.
1648  bool isNaN() const { return Value->isNaN(); }
1649 
1650  /// Return true if the value is an infinity
1651  bool isInfinity() const { return Value->isInfinity(); }
1652 
1653  /// Return true if the value is negative.
1654  bool isNegative() const { return Value->isNegative(); }
1655 
1656  /// We don't rely on operator== working on double values, as
1657  /// it returns true for things that are clearly not equal, like -0.0 and 0.0.
1658  /// As such, this method can be used to do an exact bit-for-bit comparison of
1659  /// two floating point values.
1660 
1661  /// We leave the version with the double argument here because it's just so
1662  /// convenient to write "2.0" and the like. Without this function we'd
1663  /// have to duplicate its logic everywhere it's called.
1664  bool isExactlyValue(double V) const {
1665  return Value->getValueAPF().isExactlyValue(V);
1666  }
1667  bool isExactlyValue(const APFloat& V) const;
1668 
1669  static bool isValueValidForType(EVT VT, const APFloat& Val);
1670 
1671  static bool classof(const SDNode *N) {
1672  return N->getOpcode() == ISD::ConstantFP ||
1673  N->getOpcode() == ISD::TargetConstantFP;
1674  }
1675 };
1676 
1677 /// Returns true if \p V is a constant integer zero.
1678 bool isNullConstant(SDValue V);
1679 
1680 /// Returns true if \p V is an FP constant with a value of positive zero.
1681 bool isNullFPConstant(SDValue V);
1682 
1683 /// Returns true if \p V is an integer constant with all bits set.
1684 bool isAllOnesConstant(SDValue V);
1685 
1686 /// Returns true if \p V is a constant integer one.
1687 bool isOneConstant(SDValue V);
1688 
1689 /// Returns true if \p V is a constant min signed integer value.
1690 bool isMinSignedConstant(SDValue V);
1691 
1692 /// Return the non-bitcasted source operand of \p V if it exists.
1693 /// If \p V is not a bitcasted value, it is returned as-is.
1694 SDValue peekThroughBitcasts(SDValue V);
1695 
1696 /// Return the non-bitcasted and one-use source operand of \p V if it exists.
1697 /// If \p V is not a bitcasted one-use value, it is returned as-is.
1698 SDValue peekThroughOneUseBitcasts(SDValue V);
1699 
1700 /// Return the non-extracted vector source operand of \p V if it exists.
1701 /// If \p V is not an extracted subvector, it is returned as-is.
1702 SDValue peekThroughExtractSubvectors(SDValue V);
1703 
1704 /// Returns true if \p V is a bitwise not operation. Assumes that an all ones
1705 /// constant is canonicalized to be operand 1.
1706 bool isBitwiseNot(SDValue V, bool AllowUndefs = false);
1707 
1708 /// If \p V is a bitwise not, returns the inverted operand. Otherwise returns
1709 /// an empty SDValue. Only bits set in \p Mask are required to be inverted,
1710 /// other bits may be arbitrary.
1711 SDValue getBitwiseNotOperand(SDValue V, SDValue Mask, bool AllowUndefs);
1712 
1713 /// Returns the SDNode if it is a constant splat BuildVector or constant int.
1714 ConstantSDNode *isConstOrConstSplat(SDValue N, bool AllowUndefs = false,
1715  bool AllowTruncation = false);
1716 
1717 /// Returns the SDNode if it is a demanded constant splat BuildVector or
1718 /// constant int.
1719 ConstantSDNode *isConstOrConstSplat(SDValue N, const APInt &DemandedElts,
1720  bool AllowUndefs = false,
1721  bool AllowTruncation = false);
1722 
1723 /// Returns the SDNode if it is a constant splat BuildVector or constant float.
1724 ConstantFPSDNode *isConstOrConstSplatFP(SDValue N, bool AllowUndefs = false);
1725 
1726 /// Returns the SDNode if it is a demanded constant splat BuildVector or
1727 /// constant float.
1728 ConstantFPSDNode *isConstOrConstSplatFP(SDValue N, const APInt &DemandedElts,
1729  bool AllowUndefs = false);
1730 
1731 /// Return true if the value is a constant 0 integer or a splatted vector of
1732 /// a constant 0 integer (with no undefs by default).
1733 /// Build vector implicit truncation is not an issue for null values.
1734 bool isNullOrNullSplat(SDValue V, bool AllowUndefs = false);
1735 
1736 /// Return true if the value is a constant 1 integer or a splatted vector of a
1737 /// constant 1 integer (with no undefs).
1738 /// Does not permit build vector implicit truncation.
1739 bool isOneOrOneSplat(SDValue V, bool AllowUndefs = false);
1740 
1741 /// Return true if the value is a constant -1 integer or a splatted vector of a
1742 /// constant -1 integer (with no undefs).
1743 /// Does not permit build vector implicit truncation.
1744 bool isAllOnesOrAllOnesSplat(SDValue V, bool AllowUndefs = false);
1745 
1746 /// Return true if \p V is either a integer or FP constant.
1747 inline bool isIntOrFPConstant(SDValue V) {
1748  return isa<ConstantSDNode>(V) || isa<ConstantFPSDNode>(V);
1749 }
1750 
1751 class GlobalAddressSDNode : public SDNode {
1752  friend class SelectionDAG;
1753 
1754  const GlobalValue *TheGlobal;
1755  int64_t Offset;
1756  unsigned TargetFlags;
1757 
1758  GlobalAddressSDNode(unsigned Opc, unsigned Order, const DebugLoc &DL,
1759  const GlobalValue *GA, EVT VT, int64_t o,
1760  unsigned TF);
1761 
1762 public:
1763  const GlobalValue *getGlobal() const { return TheGlobal; }
1764  int64_t getOffset() const { return Offset; }
1765  unsigned getTargetFlags() const { return TargetFlags; }
1766  // Return the address space this GlobalAddress belongs to.
1767  unsigned getAddressSpace() const;
1768 
1769  static bool classof(const SDNode *N) {
1770  return N->getOpcode() == ISD::GlobalAddress ||
1771  N->getOpcode() == ISD::TargetGlobalAddress ||
1772  N->getOpcode() == ISD::GlobalTLSAddress ||
1773  N->getOpcode() == ISD::TargetGlobalTLSAddress;
1774  }
1775 };
1776 
1777 class FrameIndexSDNode : public SDNode {
1778  friend class SelectionDAG;
1779 
1780  int FI;
1781 
1782  FrameIndexSDNode(int fi, EVT VT, bool isTarg)
1783  : SDNode(isTarg ? ISD::TargetFrameIndex : ISD::FrameIndex,
1784  0, DebugLoc(), getSDVTList(VT)), FI(fi) {
1785  }
1786 
1787 public:
1788  int getIndex() const { return FI; }
1789 
1790  static bool classof(const SDNode *N) {
1791  return N->getOpcode() == ISD::FrameIndex ||
1792  N->getOpcode() == ISD::TargetFrameIndex;
1793  }
1794 };
1795 
1796 /// This SDNode is used for LIFETIME_START/LIFETIME_END values, which indicate
1797 /// the offet and size that are started/ended in the underlying FrameIndex.
1798 class LifetimeSDNode : public SDNode {
1799  friend class SelectionDAG;
1800  int64_t Size;
1801  int64_t Offset; // -1 if offset is unknown.
1802 
1803  LifetimeSDNode(unsigned Opcode, unsigned Order, const DebugLoc &dl,
1804  SDVTList VTs, int64_t Size, int64_t Offset)
1805  : SDNode(Opcode, Order, dl, VTs), Size(Size), Offset(Offset) {}
1806 public:
1807  int64_t getFrameIndex() const {
1808  return cast<FrameIndexSDNode>(getOperand(1))->getIndex();
1809  }
1810 
1811  bool hasOffset() const { return Offset >= 0; }
1812  int64_t getOffset() const {
1813  assert(hasOffset() && "offset is unknown");
1814  return Offset;
1815  }
1816  int64_t getSize() const {
1817  assert(hasOffset() && "offset is unknown");
1818  return Size;
1819  }
1820 
1821  // Methods to support isa and dyn_cast
1822  static bool classof(const SDNode *N) {
1823  return N->getOpcode() == ISD::LIFETIME_START ||
1824  N->getOpcode() == ISD::LIFETIME_END;
1825  }
1826 };
1827 
1828 /// This SDNode is used for PSEUDO_PROBE values, which are the function guid and
1829 /// the index of the basic block being probed. A pseudo probe serves as a place
1830 /// holder and will be removed at the end of compilation. It does not have any
1831 /// operand because we do not want the instruction selection to deal with any.
1832 class PseudoProbeSDNode : public SDNode {
1833  friend class SelectionDAG;
1834  uint64_t Guid;
1835  uint64_t Index;
1837 
1838  PseudoProbeSDNode(unsigned Opcode, unsigned Order, const DebugLoc &Dl,
1839  SDVTList VTs, uint64_t Guid, uint64_t Index, uint32_t Attr)
1840  : SDNode(Opcode, Order, Dl, VTs), Guid(Guid), Index(Index),
1841  Attributes(Attr) {}
1842 
1843 public:
1844  uint64_t getGuid() const { return Guid; }
1845  uint64_t getIndex() const { return Index; }
1846  uint32_t getAttributes() const { return Attributes; }
1847 
1848  // Methods to support isa and dyn_cast
1849  static bool classof(const SDNode *N) {
1850  return N->getOpcode() == ISD::PSEUDO_PROBE;
1851  }
1852 };
1853 
1854 class JumpTableSDNode : public SDNode {
1855  friend class SelectionDAG;
1856 
1857  int JTI;
1858  unsigned TargetFlags;
1859 
1860  JumpTableSDNode(int jti, EVT VT, bool isTarg, unsigned TF)
1861  : SDNode(isTarg ? ISD::TargetJumpTable : ISD::JumpTable,
1862  0, DebugLoc(), getSDVTList(VT)), JTI(jti), TargetFlags(TF) {
1863  }
1864 
1865 public:
1866  int getIndex() const { return JTI; }
1867  unsigned getTargetFlags() const { return TargetFlags; }
1868 
1869  static bool classof(const SDNode *N) {
1870  return N->getOpcode() == ISD::JumpTable ||
1871  N->getOpcode() == ISD::TargetJumpTable;
1872  }
1873 };
1874 
1875 class ConstantPoolSDNode : public SDNode {
1876  friend class SelectionDAG;
1877 
1878  union {
1881  } Val;
1882  int Offset; // It's a MachineConstantPoolValue if top bit is set.
1883  Align Alignment; // Minimum alignment requirement of CP.
1884  unsigned TargetFlags;
1885 
1886  ConstantPoolSDNode(bool isTarget, const Constant *c, EVT VT, int o,
1887  Align Alignment, unsigned TF)
1888  : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0,
1889  DebugLoc(), getSDVTList(VT)),
1890  Offset(o), Alignment(Alignment), TargetFlags(TF) {
1891  assert(Offset >= 0 && "Offset is too large");
1892  Val.ConstVal = c;
1893  }
1894 
1895  ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v, EVT VT, int o,
1896  Align Alignment, unsigned TF)
1897  : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0,
1898  DebugLoc(), getSDVTList(VT)),
1899  Offset(o), Alignment(Alignment), TargetFlags(TF) {
1900  assert(Offset >= 0 && "Offset is too large");
1901  Val.MachineCPVal = v;
1902  Offset |= 1 << (sizeof(unsigned)*CHAR_BIT-1);
1903  }
1904 
1905 public:
1907  return Offset < 0;
1908  }
1909 
1910  const Constant *getConstVal() const {
1911  assert(!isMachineConstantPoolEntry() && "Wrong constantpool type");
1912  return Val.ConstVal;
1913  }
1914 
1916  assert(isMachineConstantPoolEntry() && "Wrong constantpool type");
1917  return Val.MachineCPVal;
1918  }
1919 
1920  int getOffset() const {
1921  return Offset & ~(1 << (sizeof(unsigned)*CHAR_BIT-1));
1922  }
1923 
1924  // Return the alignment of this constant pool object, which is either 0 (for
1925  // default alignment) or the desired value.
1926  Align getAlign() const { return Alignment; }
1927  unsigned getTargetFlags() const { return TargetFlags; }
1928 
1929  Type *getType() const;
1930 
1931  static bool classof(const SDNode *N) {
1932  return N->getOpcode() == ISD::ConstantPool ||
1933  N->getOpcode() == ISD::TargetConstantPool;
1934  }
1935 };
1936 
1937 /// Completely target-dependent object reference.
1938 class TargetIndexSDNode : public SDNode {
1939  friend class SelectionDAG;
1940 
1941  unsigned TargetFlags;
1942  int Index;
1943  int64_t Offset;
1944 
1945 public:
1946  TargetIndexSDNode(int Idx, EVT VT, int64_t Ofs, unsigned TF)
1947  : SDNode(ISD::TargetIndex, 0, DebugLoc(), getSDVTList(VT)),
1948  TargetFlags(TF), Index(Idx), Offset(Ofs) {}
1949 
1950  unsigned getTargetFlags() const { return TargetFlags; }
1951  int getIndex() const { return Index; }
1952  int64_t getOffset() const { return Offset; }
1953 
1954  static bool classof(const SDNode *N) {
1955  return N->getOpcode() == ISD::TargetIndex;
1956  }
1957 };
1958 
1959 class BasicBlockSDNode : public SDNode {
1960  friend class SelectionDAG;
1961 
1963 
1964  /// Debug info is meaningful and potentially useful here, but we create
1965  /// blocks out of order when they're jumped to, which makes it a bit
1966  /// harder. Let's see if we need it first.
1967  explicit BasicBlockSDNode(MachineBasicBlock *mbb)
1968  : SDNode(ISD::BasicBlock, 0, DebugLoc(), getSDVTList(MVT::Other)), MBB(mbb)
1969  {}
1970 
1971 public:
1972  MachineBasicBlock *getBasicBlock() const { return MBB; }
1973 
1974  static bool classof(const SDNode *N) {
1975  return N->getOpcode() == ISD::BasicBlock;
1976  }
1977 };
1978 
1979 /// A "pseudo-class" with methods for operating on BUILD_VECTORs.
1980 class BuildVectorSDNode : public SDNode {
1981 public:
1982  // These are constructed as SDNodes and then cast to BuildVectorSDNodes.
1983  explicit BuildVectorSDNode() = delete;
1984 
1985  /// Check if this is a constant splat, and if so, find the
1986  /// smallest element size that splats the vector. If MinSplatBits is
1987  /// nonzero, the element size must be at least that large. Note that the
1988  /// splat element may be the entire vector (i.e., a one element vector).
1989  /// Returns the splat element value in SplatValue. Any undefined bits in
1990  /// that value are zero, and the corresponding bits in the SplatUndef mask
1991  /// are set. The SplatBitSize value is set to the splat element size in
1992  /// bits. HasAnyUndefs is set to true if any bits in the vector are
1993  /// undefined. isBigEndian describes the endianness of the target.
1994  bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef,
1995  unsigned &SplatBitSize, bool &HasAnyUndefs,
1996  unsigned MinSplatBits = 0,
1997  bool isBigEndian = false) const;
1998 
1999  /// Returns the demanded splatted value or a null value if this is not a
2000  /// splat.
2001  ///
2002  /// The DemandedElts mask indicates the elements that must be in the splat.
2003  /// If passed a non-null UndefElements bitvector, it will resize it to match
2004  /// the vector width and set the bits where elements are undef.
2005  SDValue getSplatValue(const APInt &DemandedElts,
2006  BitVector *UndefElements = nullptr) const;
2007 
2008  /// Returns the splatted value or a null value if this is not a splat.
2009  ///
2010  /// If passed a non-null UndefElements bitvector, it will resize it to match
2011  /// the vector width and set the bits where elements are undef.
2012  SDValue getSplatValue(BitVector *UndefElements = nullptr) const;
2013 
2014  /// Find the shortest repeating sequence of values in the build vector.
2015  ///
2016  /// e.g. { u, X, u, X, u, u, X, u } -> { X }
2017  /// { X, Y, u, Y, u, u, X, u } -> { X, Y }
2018  ///
2019  /// Currently this must be a power-of-2 build vector.
2020  /// The DemandedElts mask indicates the elements that must be present,
2021  /// undemanded elements in Sequence may be null (SDValue()). If passed a
2022  /// non-null UndefElements bitvector, it will resize it to match the original
2023  /// vector width and set the bits where elements are undef. If result is
2024  /// false, Sequence will be empty.
2025  bool getRepeatedSequence(const APInt &DemandedElts,
2027  BitVector *UndefElements = nullptr) const;
2028 
2029  /// Find the shortest repeating sequence of values in the build vector.
2030  ///
2031  /// e.g. { u, X, u, X, u, u, X, u } -> { X }
2032  /// { X, Y, u, Y, u, u, X, u } -> { X, Y }
2033  ///
2034  /// Currently this must be a power-of-2 build vector.
2035  /// If passed a non-null UndefElements bitvector, it will resize it to match
2036  /// the original vector width and set the bits where elements are undef.
2037  /// If result is false, Sequence will be empty.
2039  BitVector *UndefElements = nullptr) const;
2040 
2041  /// Returns the demanded splatted constant or null if this is not a constant
2042  /// splat.
2043  ///
2044  /// The DemandedElts mask indicates the elements that must be in the splat.
2045  /// If passed a non-null UndefElements bitvector, it will resize it to match
2046  /// the vector width and set the bits where elements are undef.
2047  ConstantSDNode *
2048  getConstantSplatNode(const APInt &DemandedElts,
2049  BitVector *UndefElements = nullptr) const;
2050 
2051  /// Returns the splatted constant or null if this is not a constant
2052  /// splat.
2053  ///
2054  /// If passed a non-null UndefElements bitvector, it will resize it to match
2055  /// the vector width and set the bits where elements are undef.
2056  ConstantSDNode *
2057  getConstantSplatNode(BitVector *UndefElements = nullptr) const;
2058 
2059  /// Returns the demanded splatted constant FP or null if this is not a
2060  /// constant FP splat.
2061  ///
2062  /// The DemandedElts mask indicates the elements that must be in the splat.
2063  /// If passed a non-null UndefElements bitvector, it will resize it to match
2064  /// the vector width and set the bits where elements are undef.
2066  getConstantFPSplatNode(const APInt &DemandedElts,
2067  BitVector *UndefElements = nullptr) const;
2068 
2069  /// Returns the splatted constant FP or null if this is not a constant
2070  /// FP splat.
2071  ///
2072  /// If passed a non-null UndefElements bitvector, it will resize it to match
2073  /// the vector width and set the bits where elements are undef.
2075  getConstantFPSplatNode(BitVector *UndefElements = nullptr) const;
2076 
2077  /// If this is a constant FP splat and the splatted constant FP is an
2078  /// exact power or 2, return the log base 2 integer value. Otherwise,
2079  /// return -1.
2080  ///
2081  /// The BitWidth specifies the necessary bit precision.
2082  int32_t getConstantFPSplatPow2ToLog2Int(BitVector *UndefElements,
2083  uint32_t BitWidth) const;
2084 
2085  /// Extract the raw bit data from a build vector of Undef, Constant or
2086  /// ConstantFP node elements. Each raw bit element will be \p
2087  /// DstEltSizeInBits wide, undef elements are treated as zero, and entirely
2088  /// undefined elements are flagged in \p UndefElements.
2089  bool getConstantRawBits(bool IsLittleEndian, unsigned DstEltSizeInBits,
2090  SmallVectorImpl<APInt> &RawBitElements,
2091  BitVector &UndefElements) const;
2092 
2093  bool isConstant() const;
2094 
2095  /// If this BuildVector is constant and represents the numerical series
2096  /// "<a, a+n, a+2n, a+3n, ...>" where a is integer and n is a non-zero integer,
2097  /// the value "<a,n>" is returned.
2099 
2100  /// Recast bit data \p SrcBitElements to \p DstEltSizeInBits wide elements.
2101  /// Undef elements are treated as zero, and entirely undefined elements are
2102  /// flagged in \p DstUndefElements.
2103  static void recastRawBits(bool IsLittleEndian, unsigned DstEltSizeInBits,
2104  SmallVectorImpl<APInt> &DstBitElements,
2105  ArrayRef<APInt> SrcBitElements,
2106  BitVector &DstUndefElements,
2107  const BitVector &SrcUndefElements);
2108 
2109  static bool classof(const SDNode *N) {
2110  return N->getOpcode() == ISD::BUILD_VECTOR;
2111  }
2112 };
2113 
2114 /// An SDNode that holds an arbitrary LLVM IR Value. This is
2115 /// used when the SelectionDAG needs to make a simple reference to something
2116 /// in the LLVM IR representation.
2117 ///
2118 class SrcValueSDNode : public SDNode {
2119  friend class SelectionDAG;
2120 
2121  const Value *V;
2122 
2123  /// Create a SrcValue for a general value.
2124  explicit SrcValueSDNode(const Value *v)
2125  : SDNode(ISD::SRCVALUE, 0, DebugLoc(), getSDVTList(MVT::Other)), V(v) {}
2126 
2127 public:
2128  /// Return the contained Value.
2129  const Value *getValue() const { return V; }
2130 
2131  static bool classof(const SDNode *N) {
2132  return N->getOpcode() == ISD::SRCVALUE;
2133  }
2134 };
2135 
2136 class MDNodeSDNode : public SDNode {
2137  friend class SelectionDAG;
2138 
2139  const MDNode *MD;
2140 
2141  explicit MDNodeSDNode(const MDNode *md)
2142  : SDNode(ISD::MDNODE_SDNODE, 0, DebugLoc(), getSDVTList(MVT::Other)), MD(md)
2143  {}
2144 
2145 public:
2146  const MDNode *getMD() const { return MD; }
2147 
2148  static bool classof(const SDNode *N) {
2149  return N->getOpcode() == ISD::MDNODE_SDNODE;
2150  }
2151 };
2152 
2153 class RegisterSDNode : public SDNode {
2154  friend class SelectionDAG;
2155 
2156  Register Reg;
2157 
2158  RegisterSDNode(Register reg, EVT VT)
2159  : SDNode(ISD::Register, 0, DebugLoc(), getSDVTList(VT)), Reg(reg) {}
2160 
2161 public:
2162  Register getReg() const { return Reg; }
2163 
2164  static bool classof(const SDNode *N) {
2165  return N->getOpcode() == ISD::Register;
2166  }
2167 };
2168 
2169 class RegisterMaskSDNode : public SDNode {
2170  friend class SelectionDAG;
2171 
2172  // The memory for RegMask is not owned by the node.
2173  const uint32_t *RegMask;
2174 
2175  RegisterMaskSDNode(const uint32_t *mask)
2177  RegMask(mask) {}
2178 
2179 public:
2180  const uint32_t *getRegMask() const { return RegMask; }
2181 
2182  static bool classof(const SDNode *N) {
2183  return N->getOpcode() == ISD::RegisterMask;
2184  }
2185 };
2186 
2187 class BlockAddressSDNode : public SDNode {
2188  friend class SelectionDAG;
2189 
2190  const BlockAddress *BA;
2191  int64_t Offset;
2192  unsigned TargetFlags;
2193 
2194  BlockAddressSDNode(unsigned NodeTy, EVT VT, const BlockAddress *ba,
2195  int64_t o, unsigned Flags)
2196  : SDNode(NodeTy, 0, DebugLoc(), getSDVTList(VT)),
2197  BA(ba), Offset(o), TargetFlags(Flags) {}
2198 
2199 public:
2200  const BlockAddress *getBlockAddress() const { return BA; }
2201  int64_t getOffset() const { return Offset; }
2202  unsigned getTargetFlags() const { return TargetFlags; }
2203 
2204  static bool classof(const SDNode *N) {
2205  return N->getOpcode() == ISD::BlockAddress ||
2206  N->getOpcode() == ISD::TargetBlockAddress;
2207  }
2208 };
2209 
2210 class LabelSDNode : public SDNode {
2211  friend class SelectionDAG;
2212 
2213  MCSymbol *Label;
2214 
2215  LabelSDNode(unsigned Opcode, unsigned Order, const DebugLoc &dl, MCSymbol *L)
2216  : SDNode(Opcode, Order, dl, getSDVTList(MVT::Other)), Label(L) {
2217  assert(LabelSDNode::classof(this) && "not a label opcode");
2218  }
2219 
2220 public:
2221  MCSymbol *getLabel() const { return Label; }
2222 
2223  static bool classof(const SDNode *N) {
2224  return N->getOpcode() == ISD::EH_LABEL ||
2225  N->getOpcode() == ISD::ANNOTATION_LABEL;
2226  }
2227 };
2228 
2230  friend class SelectionDAG;
2231 
2232  const char *Symbol;
2233  unsigned TargetFlags;
2234 
2235  ExternalSymbolSDNode(bool isTarget, const char *Sym, unsigned TF, EVT VT)
2236  : SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol, 0,
2237  DebugLoc(), getSDVTList(VT)),
2238  Symbol(Sym), TargetFlags(TF) {}
2239 
2240 public:
2241  const char *getSymbol() const { return Symbol; }
2242  unsigned getTargetFlags() const { return TargetFlags; }
2243 
2244  static bool classof(const SDNode *N) {
2245  return N->getOpcode() == ISD::ExternalSymbol ||
2246  N->getOpcode() == ISD::TargetExternalSymbol;
2247  }
2248 };
2249 
2250 class MCSymbolSDNode : public SDNode {
2251  friend class SelectionDAG;
2252 
2253  MCSymbol *Symbol;
2254 
2256  : SDNode(ISD::MCSymbol, 0, DebugLoc(), getSDVTList(VT)), Symbol(Symbol) {}
2257 
2258 public:
2259  MCSymbol *getMCSymbol() const { return Symbol; }
2260 
2261  static bool classof(const SDNode *N) {
2262  return N->getOpcode() == ISD::MCSymbol;
2263  }
2264 };
2265 
2266 class CondCodeSDNode : public SDNode {
2267  friend class SelectionDAG;
2268 
2269  ISD::CondCode Condition;
2270 
2272  : SDNode(ISD::CONDCODE, 0, DebugLoc(), getSDVTList(MVT::Other)),
2273  Condition(Cond) {}
2274 
2275 public:
2276  ISD::CondCode get() const { return Condition; }
2277 
2278  static bool classof(const SDNode *N) {
2279  return N->getOpcode() == ISD::CONDCODE;
2280  }
2281 };
2282 
2283 /// This class is used to represent EVT's, which are used
2284 /// to parameterize some operations.
2285 class VTSDNode : public SDNode {
2286  friend class SelectionDAG;
2287 
2288  EVT ValueType;
2289 
2290  explicit VTSDNode(EVT VT)
2291  : SDNode(ISD::VALUETYPE, 0, DebugLoc(), getSDVTList(MVT::Other)),
2292  ValueType(VT) {}
2293 
2294 public:
2295  EVT getVT() const { return ValueType; }
2296 
2297  static bool classof(const SDNode *N) {
2298  return N->getOpcode() == ISD::VALUETYPE;
2299  }
2300 };
2301 
2302 /// Base class for LoadSDNode and StoreSDNode
2303 class LSBaseSDNode : public MemSDNode {
2304 public:
2305  LSBaseSDNode(ISD::NodeType NodeTy, unsigned Order, const DebugLoc &dl,
2306  SDVTList VTs, ISD::MemIndexedMode AM, EVT MemVT,
2308  : MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {
2309  LSBaseSDNodeBits.AddressingMode = AM;
2310  assert(getAddressingMode() == AM && "Value truncated");
2311  }
2312 
2313  const SDValue &getOffset() const {
2314  return getOperand(getOpcode() == ISD::LOAD ? 2 : 3);
2315  }
2316 
2317  /// Return the addressing mode for this load or store:
2318  /// unindexed, pre-inc, pre-dec, post-inc, or post-dec.
2320  return static_cast<ISD::MemIndexedMode>(LSBaseSDNodeBits.AddressingMode);
2321  }
2322 
2323  /// Return true if this is a pre/post inc/dec load/store.
2324  bool isIndexed() const { return getAddressingMode() != ISD::UNINDEXED; }
2325 
2326  /// Return true if this is NOT a pre/post inc/dec load/store.
2327  bool isUnindexed() const { return getAddressingMode() == ISD::UNINDEXED; }
2328 
2329  static bool classof(const SDNode *N) {
2330  return N->getOpcode() == ISD::LOAD ||
2331  N->getOpcode() == ISD::STORE;
2332  }
2333 };
2334 
2335 /// This class is used to represent ISD::LOAD nodes.
2336 class LoadSDNode : public LSBaseSDNode {
2337  friend class SelectionDAG;
2338 
2339  LoadSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs,
2340  ISD::MemIndexedMode AM, ISD::LoadExtType ETy, EVT MemVT,
2342  : LSBaseSDNode(ISD::LOAD, Order, dl, VTs, AM, MemVT, MMO) {
2343  LoadSDNodeBits.ExtTy = ETy;
2344  assert(readMem() && "Load MachineMemOperand is not a load!");
2345  assert(!writeMem() && "Load MachineMemOperand is a store!");
2346  }
2347 
2348 public:
2349  /// Return whether this is a plain node,
2350  /// or one of the varieties of value-extending loads.
2352  return static_cast<ISD::LoadExtType>(LoadSDNodeBits.ExtTy);
2353  }
2354 
2355  const SDValue &getBasePtr() const { return getOperand(1); }
2356  const SDValue &getOffset() const { return getOperand(2); }
2357 
2358  static bool classof(const SDNode *N) {
2359  return N->getOpcode() == ISD::LOAD;
2360  }
2361 };
2362 
2363 /// This class is used to represent ISD::STORE nodes.
2364 class StoreSDNode : public LSBaseSDNode {
2365  friend class SelectionDAG;
2366 
2367  StoreSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs,
2368  ISD::MemIndexedMode AM, bool isTrunc, EVT MemVT,
2370  : LSBaseSDNode(ISD::STORE, Order, dl, VTs, AM, MemVT, MMO) {
2371  StoreSDNodeBits.IsTruncating = isTrunc;
2372  assert(!readMem() && "Store MachineMemOperand is a load!");
2373  assert(writeMem() && "Store MachineMemOperand is not a store!");
2374  }
2375 
2376 public:
2377  /// Return true if the op does a truncation before store.
2378  /// For integers this is the same as doing a TRUNCATE and storing the result.
2379  /// For floats, it is the same as doing an FP_ROUND and storing the result.
2380  bool isTruncatingStore() const { return StoreSDNodeBits.IsTruncating; }
2381  void setTruncatingStore(bool Truncating) {
2382  StoreSDNodeBits.IsTruncating = Truncating;
2383  }
2384 
2385  const SDValue &getValue() const { return getOperand(1); }
2386  const SDValue &getBasePtr() const { return getOperand(2); }
2387  const SDValue &getOffset() const { return getOperand(3); }
2388 
2389  static bool classof(const SDNode *N) {
2390  return N->getOpcode() == ISD::STORE;
2391  }
2392 };
2393 
2394 /// This base class is used to represent VP_LOAD, VP_STORE,
2395 /// EXPERIMENTAL_VP_STRIDED_LOAD and EXPERIMENTAL_VP_STRIDED_STORE nodes
2397 public:
2398  friend class SelectionDAG;
2399 
2400  VPBaseLoadStoreSDNode(ISD::NodeType NodeTy, unsigned Order,
2401  const DebugLoc &DL, SDVTList VTs,
2402  ISD::MemIndexedMode AM, EVT MemVT,
2404  : MemSDNode(NodeTy, Order, DL, VTs, MemVT, MMO) {
2405  LSBaseSDNodeBits.AddressingMode = AM;
2406  assert(getAddressingMode() == AM && "Value truncated");
2407  }
2408 
2409  // VPStridedStoreSDNode (Chain, Data, Ptr, Offset, Stride, Mask, EVL)
2410  // VPStoreSDNode (Chain, Data, Ptr, Offset, Mask, EVL)
2411  // VPStridedLoadSDNode (Chain, Ptr, Offset, Stride, Mask, EVL)
2412  // VPLoadSDNode (Chain, Ptr, Offset, Mask, EVL)
2413  // Mask is a vector of i1 elements;
2414  // the type of EVL is TLI.getVPExplicitVectorLengthTy().
2415  const SDValue &getOffset() const {
2416  return getOperand((getOpcode() == ISD::EXPERIMENTAL_VP_STRIDED_LOAD ||
2417  getOpcode() == ISD::VP_LOAD)
2418  ? 2
2419  : 3);
2420  }
2421  const SDValue &getBasePtr() const {
2422  return getOperand((getOpcode() == ISD::EXPERIMENTAL_VP_STRIDED_LOAD ||
2423  getOpcode() == ISD::VP_LOAD)
2424  ? 1
2425  : 2);
2426  }
2427  const SDValue &getMask() const {
2428  switch (getOpcode()) {
2429  default:
2430  llvm_unreachable("Invalid opcode");
2431  case ISD::VP_LOAD:
2432  return getOperand(3);
2433  case ISD::VP_STORE:
2434  case ISD::EXPERIMENTAL_VP_STRIDED_LOAD:
2435  return getOperand(4);
2436  case ISD::EXPERIMENTAL_VP_STRIDED_STORE:
2437  return getOperand(5);
2438  }
2439  }
2440  const SDValue &getVectorLength() const {
2441  switch (getOpcode()) {
2442  default:
2443  llvm_unreachable("Invalid opcode");
2444  case ISD::VP_LOAD:
2445  return getOperand(4);
2446  case ISD::VP_STORE:
2447  case ISD::EXPERIMENTAL_VP_STRIDED_LOAD:
2448  return getOperand(5);
2449  case ISD::EXPERIMENTAL_VP_STRIDED_STORE:
2450  return getOperand(6);
2451  }
2452  }
2453 
2454  /// Return the addressing mode for this load or store:
2455  /// unindexed, pre-inc, pre-dec, post-inc, or post-dec.
2457  return static_cast<ISD::MemIndexedMode>(LSBaseSDNodeBits.AddressingMode);
2458  }
2459 
2460  /// Return true if this is a pre/post inc/dec load/store.
2461  bool isIndexed() const { return getAddressingMode() != ISD::UNINDEXED; }
2462 
2463  /// Return true if this is NOT a pre/post inc/dec load/store.
2464  bool isUnindexed() const { return getAddressingMode() == ISD::UNINDEXED; }
2465 
2466  static bool classof(const SDNode *N) {
2467  return N->getOpcode() == ISD::EXPERIMENTAL_VP_STRIDED_LOAD ||
2468  N->getOpcode() == ISD::EXPERIMENTAL_VP_STRIDED_STORE ||
2469  N->getOpcode() == ISD::VP_LOAD || N->getOpcode() == ISD::VP_STORE;
2470  }
2471 };
2472 
2473 /// This class is used to represent a VP_LOAD node
2475 public:
2476  friend class SelectionDAG;
2477 
2478  VPLoadSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs,
2479  ISD::MemIndexedMode AM, ISD::LoadExtType ETy, bool isExpanding,
2480  EVT MemVT, MachineMemOperand *MMO)
2481  : VPBaseLoadStoreSDNode(ISD::VP_LOAD, Order, dl, VTs, AM, MemVT, MMO) {
2482  LoadSDNodeBits.ExtTy = ETy;
2483  LoadSDNodeBits.IsExpanding = isExpanding;
2484  }
2485 
2487  return static_cast<ISD::LoadExtType>(LoadSDNodeBits.ExtTy);
2488  }
2489 
2490  const SDValue &getBasePtr() const { return getOperand(1); }
2491  const SDValue &getOffset() const { return getOperand(2); }
2492  const SDValue &getMask() const { return getOperand(3); }
2493  const SDValue &getVectorLength() const { return getOperand(4); }
2494 
2495  static bool classof(const SDNode *N) {
2496  return N->getOpcode() == ISD::VP_LOAD;
2497  }
2498  bool isExpandingLoad() const { return LoadSDNodeBits.IsExpanding; }
2499 };
2500 
2501 /// This class is used to represent an EXPERIMENTAL_VP_STRIDED_LOAD node.
2503 public:
2504  friend class SelectionDAG;
2505 
2506  VPStridedLoadSDNode(unsigned Order, const DebugLoc &DL, SDVTList VTs,
2508  bool IsExpanding, EVT MemVT, MachineMemOperand *MMO)
2509  : VPBaseLoadStoreSDNode(ISD::EXPERIMENTAL_VP_STRIDED_LOAD, Order, DL, VTs,
2510  AM, MemVT, MMO) {
2511  LoadSDNodeBits.ExtTy = ETy;
2512  LoadSDNodeBits.IsExpanding = IsExpanding;
2513  }
2514 
2516  return static_cast<ISD::LoadExtType>(LoadSDNodeBits.ExtTy);
2517  }
2518 
2519  const SDValue &getBasePtr() const { return getOperand(1); }
2520  const SDValue &getOffset() const { return getOperand(2); }
2521  const SDValue &getStride() const { return getOperand(3); }
2522  const SDValue &getMask() const { return getOperand(4); }
2523  const SDValue &getVectorLength() const { return getOperand(5); }
2524 
2525  static bool classof(const SDNode *N) {
2526  return N->getOpcode() == ISD::EXPERIMENTAL_VP_STRIDED_LOAD;
2527  }
2528  bool isExpandingLoad() const { return LoadSDNodeBits.IsExpanding; }
2529 };
2530 
2531 /// This class is used to represent a VP_STORE node
2533 public:
2534  friend class SelectionDAG;
2535 
2536  VPStoreSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs,
2537  ISD::MemIndexedMode AM, bool isTrunc, bool isCompressing,
2538  EVT MemVT, MachineMemOperand *MMO)
2539  : VPBaseLoadStoreSDNode(ISD::VP_STORE, Order, dl, VTs, AM, MemVT, MMO) {
2540  StoreSDNodeBits.IsTruncating = isTrunc;
2541  StoreSDNodeBits.IsCompressing = isCompressing;
2542  }
2543 
2544  /// Return true if this is a truncating store.
2545  /// For integers this is the same as doing a TRUNCATE and storing the result.
2546  /// For floats, it is the same as doing an FP_ROUND and storing the result.
2547  bool isTruncatingStore() const { return StoreSDNodeBits.IsTruncating; }
2548 
2549  /// Returns true if the op does a compression to the vector before storing.
2550  /// The node contiguously stores the active elements (integers or floats)
2551  /// in src (those with their respective bit set in writemask k) to unaligned
2552  /// memory at base_addr.
2553  bool isCompressingStore() const { return StoreSDNodeBits.IsCompressing; }
2554 
2555  const SDValue &getValue() const { return getOperand(1); }
2556  const SDValue &getBasePtr() const { return getOperand(2); }
2557  const SDValue &getOffset() const { return getOperand(3); }
2558  const SDValue &getMask() const { return getOperand(4); }
2559  const SDValue &getVectorLength() const { return getOperand(5); }
2560 
2561  static bool classof(const SDNode *N) {
2562  return N->getOpcode() == ISD::VP_STORE;
2563  }
2564 };
2565 
2566 /// This class is used to represent an EXPERIMENTAL_VP_STRIDED_STORE node.
2568 public:
2569  friend class SelectionDAG;
2570 
2571  VPStridedStoreSDNode(unsigned Order, const DebugLoc &DL, SDVTList VTs,
2572  ISD::MemIndexedMode AM, bool IsTrunc, bool IsCompressing,
2573  EVT MemVT, MachineMemOperand *MMO)
2574  : VPBaseLoadStoreSDNode(ISD::EXPERIMENTAL_VP_STRIDED_STORE, Order, DL,
2575  VTs, AM, MemVT, MMO) {
2576  StoreSDNodeBits.IsTruncating = IsTrunc;
2577  StoreSDNodeBits.IsCompressing = IsCompressing;
2578  }
2579 
2580  /// Return true if this is a truncating store.
2581  /// For integers this is the same as doing a TRUNCATE and storing the result.
2582  /// For floats, it is the same as doing an FP_ROUND and storing the result.
2583  bool isTruncatingStore() const { return StoreSDNodeBits.IsTruncating; }
2584 
2585  /// Returns true if the op does a compression to the vector before storing.
2586  /// The node contiguously stores the active elements (integers or floats)
2587  /// in src (those with their respective bit set in writemask k) to unaligned
2588  /// memory at base_addr.
2589  bool isCompressingStore() const { return StoreSDNodeBits.IsCompressing; }
2590 
2591  const SDValue &getValue() const { return getOperand(1); }
2592  const SDValue &getBasePtr() const { return getOperand(2); }
2593  const SDValue &getOffset() const { return getOperand(3); }
2594  const SDValue &getStride() const { return getOperand(4); }
2595  const SDValue &getMask() const { return getOperand(5); }
2596  const SDValue &getVectorLength() const { return getOperand(6); }
2597 
2598  static bool classof(const SDNode *N) {
2599  return N->getOpcode() == ISD::EXPERIMENTAL_VP_STRIDED_STORE;
2600  }
2601 };
2602 
2603 /// This base class is used to represent MLOAD and MSTORE nodes
2605 public:
2606  friend class SelectionDAG;
2607 
2608  MaskedLoadStoreSDNode(ISD::NodeType NodeTy, unsigned Order,
2609  const DebugLoc &dl, SDVTList VTs,
2610  ISD::MemIndexedMode AM, EVT MemVT,
2612  : MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {
2613  LSBaseSDNodeBits.AddressingMode = AM;
2614  assert(getAddressingMode() == AM && "Value truncated");
2615  }
2616 
2617  // MaskedLoadSDNode (Chain, ptr, offset, mask, passthru)
2618  // MaskedStoreSDNode (Chain, data, ptr, offset, mask)
2619  // Mask is a vector of i1 elements
2620  const SDValue &getOffset() const {
2621  return getOperand(getOpcode() == ISD::MLOAD ? 2 : 3);
2622  }
2623  const SDValue &getMask() const {
2624  return getOperand(getOpcode() == ISD::MLOAD ? 3 : 4);
2625  }
2626 
2627  /// Return the addressing mode for this load or store:
2628  /// unindexed, pre-inc, pre-dec, post-inc, or post-dec.
2630  return static_cast<ISD::MemIndexedMode>(LSBaseSDNodeBits.AddressingMode);
2631  }
2632 
2633  /// Return true if this is a pre/post inc/dec load/store.
2634  bool isIndexed() const { return getAddressingMode() != ISD::UNINDEXED; }
2635 
2636  /// Return true if this is NOT a pre/post inc/dec load/store.
2637  bool isUnindexed() const { return getAddressingMode() == ISD::UNINDEXED; }
2638 
2639  static bool classof(const SDNode *N) {
2640  return N->getOpcode() == ISD::MLOAD ||
2641  N->getOpcode() == ISD::MSTORE;
2642  }
2643 };
2644 
2645 /// This class is used to represent an MLOAD node
2647 public:
2648  friend class SelectionDAG;
2649 
2650  MaskedLoadSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs,
2652  bool IsExpanding, EVT MemVT, MachineMemOperand *MMO)
2653  : MaskedLoadStoreSDNode(ISD::MLOAD, Order, dl, VTs, AM, MemVT, MMO) {
2654  LoadSDNodeBits.ExtTy = ETy;
2655  LoadSDNodeBits.IsExpanding = IsExpanding;
2656  }
2657 
2659  return static_cast<ISD::LoadExtType>(LoadSDNodeBits.ExtTy);
2660  }
2661 
2662  const SDValue &getBasePtr() const { return getOperand(1); }
2663  const SDValue &getOffset() const { return getOperand(2); }
2664  const SDValue &getMask() const { return getOperand(3); }
2665  const SDValue &getPassThru() const { return getOperand(4); }
2666 
2667  static bool classof(const SDNode *N) {
2668  return N->getOpcode() == ISD::MLOAD;
2669  }
2670 
2671  bool isExpandingLoad() const { return LoadSDNodeBits.IsExpanding; }
2672 };
2673 
2674 /// This class is used to represent an MSTORE node
2676 public:
2677  friend class SelectionDAG;
2678 
2679  MaskedStoreSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs,
2680  ISD::MemIndexedMode AM, bool isTrunc, bool isCompressing,
2681  EVT MemVT, MachineMemOperand *MMO)
2682  : MaskedLoadStoreSDNode(ISD::MSTORE, Order, dl, VTs, AM, MemVT, MMO) {
2683  StoreSDNodeBits.IsTruncating = isTrunc;
2684  StoreSDNodeBits.IsCompressing = isCompressing;
2685  }
2686 
2687  /// Return true if the op does a truncation before store.
2688  /// For integers this is the same as doing a TRUNCATE and storing the result.
2689  /// For floats, it is the same as doing an FP_ROUND and storing the result.
2690  bool isTruncatingStore() const { return StoreSDNodeBits.IsTruncating; }
2691 
2692  /// Returns true if the op does a compression to the vector before storing.
2693  /// The node contiguously stores the active elements (integers or floats)
2694  /// in src (those with their respective bit set in writemask k) to unaligned
2695  /// memory at base_addr.
2696  bool isCompressingStore() const { return StoreSDNodeBits.IsCompressing; }
2697 
2698  const SDValue &getValue() const { return getOperand(1); }
2699  const SDValue &getBasePtr() const { return getOperand(2); }
2700  const SDValue &getOffset() const { return getOperand(3); }
2701  const SDValue &getMask() const { return getOperand(4); }
2702 
2703  static bool classof(const SDNode *N) {
2704  return N->getOpcode() == ISD::MSTORE;
2705  }
2706 };
2707 
2708 /// This is a base class used to represent
2709 /// VP_GATHER and VP_SCATTER nodes
2710 ///
2712 public:
2713  friend class SelectionDAG;
2714 
2715  VPGatherScatterSDNode(ISD::NodeType NodeTy, unsigned Order,
2716  const DebugLoc &dl, SDVTList VTs, EVT MemVT,
2718  : MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {
2719  LSBaseSDNodeBits.AddressingMode = IndexType;
2720  assert(getIndexType() == IndexType && "Value truncated");
2721  }
2722 
2723  /// How is Index applied to BasePtr when computing addresses.
2725  return static_cast<ISD::MemIndexType>(LSBaseSDNodeBits.AddressingMode);
2726  }
2727  bool isIndexScaled() const {
2728  return !cast<ConstantSDNode>(getScale())->isOne();
2729  }
2730  bool isIndexSigned() const { return isIndexTypeSigned(getIndexType()); }
2731 
2732  // In the both nodes address is Op1, mask is Op2:
2733  // VPGatherSDNode (Chain, base, index, scale, mask, vlen)
2734  // VPScatterSDNode (Chain, value, base, index, scale, mask, vlen)
2735  // Mask is a vector of i1 elements
2736  const SDValue &getBasePtr() const {
2737  return getOperand((getOpcode() == ISD::VP_GATHER) ? 1 : 2);
2738  }
2739  const SDValue &getIndex() const {
2740  return getOperand((getOpcode() == ISD::VP_GATHER) ? 2 : 3);
2741  }
2742  const SDValue &getScale() const {
2743  return getOperand((getOpcode() == ISD::VP_GATHER) ? 3 : 4);
2744  }
2745  const SDValue &getMask() const {
2746  return getOperand((getOpcode() == ISD::VP_GATHER) ? 4 : 5);
2747  }
2748  const SDValue &getVectorLength() const {
2749  return getOperand((getOpcode() == ISD::VP_GATHER) ? 5 : 6);
2750  }
2751 
2752  static bool classof(const SDNode *N) {
2753  return N->getOpcode() == ISD::VP_GATHER ||
2754  N->getOpcode() == ISD::VP_SCATTER;
2755  }
2756 };
2757 
2758 /// This class is used to represent an VP_GATHER node
2759 ///
2761 public:
2762  friend class SelectionDAG;
2763 
2764  VPGatherSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT,
2766  : VPGatherScatterSDNode(ISD::VP_GATHER, Order, dl, VTs, MemVT, MMO,
2767  IndexType) {}
2768 
2769  static bool classof(const SDNode *N) {
2770  return N->getOpcode() == ISD::VP_GATHER;
2771  }
2772 };
2773 
2774 /// This class is used to represent an VP_SCATTER node
2775 ///
2777 public:
2778  friend class SelectionDAG;
2779 
2780  VPScatterSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT,
2782  : VPGatherScatterSDNode(ISD::VP_SCATTER, Order, dl, VTs, MemVT, MMO,
2783  IndexType) {}
2784 
2785  const SDValue &getValue() const { return getOperand(1); }
2786 
2787  static bool classof(const SDNode *N) {
2788  return N->getOpcode() == ISD::VP_SCATTER;
2789  }
2790 };
2791 
2792 /// This is a base class used to represent
2793 /// MGATHER and MSCATTER nodes
2794 ///
2796 public:
2797  friend class SelectionDAG;
2798 
2800  const DebugLoc &dl, SDVTList VTs, EVT MemVT,
2802  : MemSDNode(NodeTy, Order, dl, VTs, MemVT, MMO) {
2803  LSBaseSDNodeBits.AddressingMode = IndexType;
2804  assert(getIndexType() == IndexType && "Value truncated");
2805  }
2806 
2807  /// How is Index applied to BasePtr when computing addresses.
2809  return static_cast<ISD::MemIndexType>(LSBaseSDNodeBits.AddressingMode);
2810  }
2811  bool isIndexScaled() const {
2812  return !cast<ConstantSDNode>(getScale())->isOne();
2813  }
2814  bool isIndexSigned() const { return isIndexTypeSigned(getIndexType()); }
2815 
2816  // In the both nodes address is Op1, mask is Op2:
2817  // MaskedGatherSDNode (Chain, passthru, mask, base, index, scale)
2818  // MaskedScatterSDNode (Chain, value, mask, base, index, scale)
2819  // Mask is a vector of i1 elements
2820  const SDValue &getBasePtr() const { return getOperand(3); }
2821  const SDValue &getIndex() const { return getOperand(4); }
2822  const SDValue &getMask() const { return getOperand(2); }
2823  const SDValue &getScale() const { return getOperand(5); }
2824 
2825  static bool classof(const SDNode *N) {
2826  return N->getOpcode() == ISD::MGATHER ||
2827  N->getOpcode() == ISD::MSCATTER;
2828  }
2829 };
2830 
2831 /// This class is used to represent an MGATHER node
2832 ///
2834 public:
2835  friend class SelectionDAG;
2836 
2837  MaskedGatherSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs,
2838  EVT MemVT, MachineMemOperand *MMO,
2839  ISD::MemIndexType IndexType, ISD::LoadExtType ETy)
2840  : MaskedGatherScatterSDNode(ISD::MGATHER, Order, dl, VTs, MemVT, MMO,
2841  IndexType) {
2842  LoadSDNodeBits.ExtTy = ETy;
2843  }
2844 
2845  const SDValue &getPassThru() const { return getOperand(1); }
2846 
2848  return ISD::LoadExtType(LoadSDNodeBits.ExtTy);
2849  }
2850 
2851  static bool classof(const SDNode *N) {
2852  return N->getOpcode() == ISD::MGATHER;
2853  }
2854 };
2855 
2856 /// This class is used to represent an MSCATTER node
2857 ///
2859 public:
2860  friend class SelectionDAG;
2861 
2862  MaskedScatterSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs,
2863  EVT MemVT, MachineMemOperand *MMO,
2864  ISD::MemIndexType IndexType, bool IsTrunc)
2865  : MaskedGatherScatterSDNode(ISD::MSCATTER, Order, dl, VTs, MemVT, MMO,
2866  IndexType) {
2867  StoreSDNodeBits.IsTruncating = IsTrunc;
2868  }
2869 
2870  /// Return true if the op does a truncation before store.
2871  /// For integers this is the same as doing a TRUNCATE and storing the result.
2872  /// For floats, it is the same as doing an FP_ROUND and storing the result.
2873  bool isTruncatingStore() const { return StoreSDNodeBits.IsTruncating; }
2874 
2875  const SDValue &getValue() const { return getOperand(1); }
2876 
2877  static bool classof(const SDNode *N) {
2878  return N->getOpcode() == ISD::MSCATTER;
2879  }
2880 };
2881 
2882 /// An SDNode that represents everything that will be needed
2883 /// to construct a MachineInstr. These nodes are created during the
2884 /// instruction selection proper phase.
2885 ///
2886 /// Note that the only supported way to set the `memoperands` is by calling the
2887 /// `SelectionDAG::setNodeMemRefs` function as the memory management happens
2888 /// inside the DAG rather than in the node.
2889 class MachineSDNode : public SDNode {
2890 private:
2891  friend class SelectionDAG;
2892 
2893  MachineSDNode(unsigned Opc, unsigned Order, const DebugLoc &DL, SDVTList VTs)
2894  : SDNode(Opc, Order, DL, VTs) {}
2895 
2896  // We use a pointer union between a single `MachineMemOperand` pointer and
2897  // a pointer to an array of `MachineMemOperand` pointers. This is null when
2898  // the number of these is zero, the single pointer variant used when the
2899  // number is one, and the array is used for larger numbers.
2900  //
2901  // The array is allocated via the `SelectionDAG`'s allocator and so will
2902  // always live until the DAG is cleaned up and doesn't require ownership here.
2903  //
2904  // We can't use something simpler like `TinyPtrVector` here because `SDNode`
2905  // subclasses aren't managed in a conforming C++ manner. See the comments on
2906  // `SelectionDAG::MorphNodeTo` which details what all goes on, but the
2907  // constraint here is that these don't manage memory with their constructor or
2908  // destructor and can be initialized to a good state even if they start off
2909  // uninitialized.
2911 
2912  // Note that this could be folded into the above `MemRefs` member if doing so
2913  // is advantageous at some point. We don't need to store this in most cases.
2914  // However, at the moment this doesn't appear to make the allocation any
2915  // smaller and makes the code somewhat simpler to read.
2916  int NumMemRefs = 0;
2917 
2918 public:
2920 
2922  // Special case the common cases.
2923  if (NumMemRefs == 0)
2924  return {};
2925  if (NumMemRefs == 1)
2926  return makeArrayRef(MemRefs.getAddrOfPtr1(), 1);
2927 
2928  // Otherwise we have an actual array.
2929  return makeArrayRef(MemRefs.get<MachineMemOperand **>(), NumMemRefs);
2930  }
2931  mmo_iterator memoperands_begin() const { return memoperands().begin(); }
2932  mmo_iterator memoperands_end() const { return memoperands().end(); }
2933  bool memoperands_empty() const { return memoperands().empty(); }
2934 
2935  /// Clear out the memory reference descriptor list.
2936  void clearMemRefs() {
2937  MemRefs = nullptr;
2938  NumMemRefs = 0;
2939  }
2940 
2941  static bool classof(const SDNode *N) {
2942  return N->isMachineOpcode();
2943  }
2944 };
2945 
2946 /// An SDNode that records if a register contains a value that is guaranteed to
2947 /// be aligned accordingly.
2948 class AssertAlignSDNode : public SDNode {
2949  Align Alignment;
2950 
2951 public:
2952  AssertAlignSDNode(unsigned Order, const DebugLoc &DL, EVT VT, Align A)
2953  : SDNode(ISD::AssertAlign, Order, DL, getSDVTList(VT)), Alignment(A) {}
2954 
2955  Align getAlign() const { return Alignment; }
2956 
2957  static bool classof(const SDNode *N) {
2958  return N->getOpcode() == ISD::AssertAlign;
2959  }
2960 };
2961 
2963  const SDNode *Node;
2964  unsigned Operand;
2965 
2966  SDNodeIterator(const SDNode *N, unsigned Op) : Node(N), Operand(Op) {}
2967 
2968 public:
2969  using iterator_category = std::forward_iterator_tag;
2971  using difference_type = std::ptrdiff_t;
2972  using pointer = value_type *;
2974 
2975  bool operator==(const SDNodeIterator& x) const {
2976  return Operand == x.Operand;
2977  }
2978  bool operator!=(const SDNodeIterator& x) const { return !operator==(x); }
2979 
2980  pointer operator*() const {
2981  return Node->getOperand(Operand).getNode();
2982  }
2983  pointer operator->() const { return operator*(); }
2984 
2985  SDNodeIterator& operator++() { // Preincrement
2986  ++Operand;
2987  return *this;
2988  }
2989  SDNodeIterator operator++(int) { // Postincrement
2990  SDNodeIterator tmp = *this; ++*this; return tmp;
2991  }
2992  size_t operator-(SDNodeIterator Other) const {
2993  assert(Node == Other.Node &&
2994  "Cannot compare iterators of two different nodes!");
2995  return Operand - Other.Operand;
2996  }
2997 
2998  static SDNodeIterator begin(const SDNode *N) { return SDNodeIterator(N, 0); }
2999  static SDNodeIterator end (const SDNode *N) {
3000  return SDNodeIterator(N, N->getNumOperands());
3001  }
3002 
3003  unsigned getOperand() const { return Operand; }
3004  const SDNode *getNode() const { return Node; }
3005 };
3006 
3007 template <> struct GraphTraits<SDNode*> {
3008  using NodeRef = SDNode *;
3010 
3011  static NodeRef getEntryNode(SDNode *N) { return N; }
3012 
3014  return SDNodeIterator::begin(N);
3015  }
3016 
3018  return SDNodeIterator::end(N);
3019  }
3020 };
3021 
3022 /// A representation of the largest SDNode, for use in sizeof().
3023 ///
3024 /// This needs to be a union because the largest node differs on 32 bit systems
3025 /// with 4 and 8 byte pointer alignment, respectively.
3026 using LargestSDNode = AlignedCharArrayUnion<AtomicSDNode, TargetIndexSDNode,
3027  BlockAddressSDNode,
3028  GlobalAddressSDNode,
3030 
3031 /// The SDNode class with the greatest alignment requirement.
3033 
3034 namespace ISD {
3035 
3036  /// Returns true if the specified node is a non-extending and unindexed load.
3037  inline bool isNormalLoad(const SDNode *N) {
3038  const LoadSDNode *Ld = dyn_cast<LoadSDNode>(N);
3039  return Ld && Ld->getExtensionType() == ISD::NON_EXTLOAD &&
3041  }
3042 
3043  /// Returns true if the specified node is a non-extending load.
3044  inline bool isNON_EXTLoad(const SDNode *N) {
3045  return isa<LoadSDNode>(N) &&
3046  cast<LoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD;
3047  }
3048 
3049  /// Returns true if the specified node is a EXTLOAD.
3050  inline bool isEXTLoad(const SDNode *N) {
3051  return isa<LoadSDNode>(N) &&
3052  cast<LoadSDNode>(N)->getExtensionType() == ISD::EXTLOAD;
3053  }
3054 
3055  /// Returns true if the specified node is a SEXTLOAD.
3056  inline bool isSEXTLoad(const SDNode *N) {
3057  return isa<LoadSDNode>(N) &&
3058  cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD;
3059  }
3060 
3061  /// Returns true if the specified node is a ZEXTLOAD.
3062  inline bool isZEXTLoad(const SDNode *N) {
3063  return isa<LoadSDNode>(N) &&
3064  cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD;
3065  }
3066 
3067  /// Returns true if the specified node is an unindexed load.
3068  inline bool isUNINDEXEDLoad(const SDNode *N) {
3069  return isa<LoadSDNode>(N) &&
3070  cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
3071  }
3072 
3073  /// Returns true if the specified node is a non-truncating
3074  /// and unindexed store.
3075  inline bool isNormalStore(const SDNode *N) {
3076  const StoreSDNode *St = dyn_cast<StoreSDNode>(N);
3077  return St && !St->isTruncatingStore() &&
3079  }
3080 
3081  /// Returns true if the specified node is an unindexed store.
3082  inline bool isUNINDEXEDStore(const SDNode *N) {
3083  return isa<StoreSDNode>(N) &&
3084  cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
3085  }
3086 
3087  /// Attempt to match a unary predicate against a scalar/splat constant or
3088  /// every element of a constant BUILD_VECTOR.
3089  /// If AllowUndef is true, then UNDEF elements will pass nullptr to Match.
3091  std::function<bool(ConstantSDNode *)> Match,
3092  bool AllowUndefs = false);
3093 
3094  /// Attempt to match a binary predicate against a pair of scalar/splat
3095  /// constants or every element of a pair of constant BUILD_VECTORs.
3096  /// If AllowUndef is true, then UNDEF elements will pass nullptr to Match.
3097  /// If AllowTypeMismatch is true then RetType + ArgTypes don't need to match.
3098  bool matchBinaryPredicate(
3100  std::function<bool(ConstantSDNode *, ConstantSDNode *)> Match,
3101  bool AllowUndefs = false, bool AllowTypeMismatch = false);
3102 
3103  /// Returns true if the specified value is the overflow result from one
3104  /// of the overflow intrinsic nodes.
3106  unsigned Opc = Op.getOpcode();
3107  return (Op.getResNo() == 1 &&
3108  (Opc == ISD::SADDO || Opc == ISD::UADDO || Opc == ISD::SSUBO ||
3109  Opc == ISD::USUBO || Opc == ISD::SMULO || Opc == ISD::UMULO));
3110  }
3111 
3112 } // end namespace ISD
3113 
3114 } // end namespace llvm
3115 
3116 #endif // LLVM_CODEGEN_SELECTIONDAGNODES_H
llvm::SDNode::getConstantOperandVal
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
Definition: SelectionDAGNodes.h:1622
llvm::AddrSpaceCastSDNode::AddrSpaceCastSDNode
AddrSpaceCastSDNode(unsigned Order, const DebugLoc &dl, EVT VT, unsigned SrcAS, unsigned DestAS)
Definition: SelectionDAG.cpp:10892
i
i
Definition: README.txt:29
llvm::ISD::ExternalSymbol
@ ExternalSymbol
Definition: ISDOpcodes.h:83
llvm::ISD::isUNINDEXEDStore
bool isUNINDEXEDStore(const SDNode *N)
Returns true if the specified node is an unindexed store.
Definition: SelectionDAGNodes.h:3082
llvm::SDNodeFlags::hasAllowReciprocal
bool hasAllowReciprocal() const
Definition: SelectionDAGNodes.h:437
llvm::MCSymbolSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2261
llvm::SDNode::use_iterator::use_iterator
use_iterator()=default
llvm::LoadSDNode::getOffset
const SDValue & getOffset() const
Definition: SelectionDAGNodes.h:2356
set
We currently generate a but we really shouldn eax ecx xorl edx divl ecx eax divl ecx movl eax ret A similar code sequence works for division We currently compile i32 v2 eax eax jo LBB1_2 atomic and others It is also currently not done for read modify write instructions It is also current not done if the OF or CF flags are needed The shift operators have the complication that when the shift count is EFLAGS is not set
Definition: README.txt:1277
ValueTypes.h
llvm::SDNode::StoreSDNodeBits
StoreSDNodeBitfields StoreSDNodeBits
Definition: SelectionDAGNodes.h:572
llvm::ShuffleVectorSDNode::getSplatIndex
int getSplatIndex() const
Definition: SelectionDAGNodes.h:1547
llvm::ConstantSDNode
Definition: SelectionDAGNodes.h:1581
llvm::RegisterSDNode
Definition: SelectionDAGNodes.h:2153
llvm::MaskedLoadSDNode::getExtensionType
ISD::LoadExtType getExtensionType() const
Definition: SelectionDAGNodes.h:2658
llvm::SDNode::Profile
void Profile(FoldingSetNodeID &ID) const
Gather unique data for the node.
Definition: SelectionDAG.cpp:10916
llvm::MachineMemOperand::isStore
bool isStore() const
Definition: MachineMemOperand.h:288
llvm::StoreSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:2386
llvm::isConstOrConstSplat
ConstantSDNode * isConstOrConstSplat(SDValue N, bool AllowUndefs=false, bool AllowTruncation=false)
Returns the SDNode if it is a constant splat BuildVector or constant int.
Definition: SelectionDAG.cpp:10766
llvm::ISD::VECTOR_SHUFFLE
@ VECTOR_SHUFFLE
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
Definition: ISDOpcodes.h:586
llvm::SDValue::dump
void dump() const
Definition: SelectionDAGNodes.h:1190
Signed
@ Signed
Definition: NVPTXISelLowering.cpp:4709
llvm::ISD::INTRINSIC_VOID
@ INTRINSIC_VOID
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
Definition: ISDOpcodes.h:199
llvm::ISD::isOverflowIntrOpRes
bool isOverflowIntrOpRes(SDValue Op)
Returns true if the specified value is the overflow result from one of the overflow intrinsic nodes.
Definition: SelectionDAGNodes.h:3105
llvm::SDUse
Represents a use of a SDNode.
Definition: SelectionDAGNodes.h:284
llvm::ISD::MemIndexedMode
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
Definition: ISDOpcodes.h:1373
llvm::AddrSpaceCastSDNode::getSrcAddressSpace
unsigned getSrcAddressSpace() const
Definition: SelectionDAGNodes.h:1263
llvm::isConstOrConstSplatFP
ConstantFPSDNode * isConstOrConstSplatFP(SDValue N, bool AllowUndefs=false)
Returns the SDNode if it is a constant splat BuildVector or constant float.
Definition: SelectionDAG.cpp:10825
llvm::VPStridedStoreSDNode::isTruncatingStore
bool isTruncatingStore() const
Return true if this is a truncating store.
Definition: SelectionDAGNodes.h:2583
llvm::MaskedLoadStoreSDNode::getMask
const SDValue & getMask() const
Definition: SelectionDAGNodes.h:2623
llvm::MaskedGatherSDNode
This class is used to represent an MGATHER node.
Definition: SelectionDAGNodes.h:2833
llvm::ISD::UMULO
@ UMULO
Definition: ISDOpcodes.h:332
llvm::VPLoadSDNode::getOffset
const SDValue & getOffset() const
Definition: SelectionDAGNodes.h:2491
llvm::MemSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1396
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::ISD::JumpTable
@ JumpTable
Definition: ISDOpcodes.h:81
llvm::LifetimeSDNode::getSize
int64_t getSize() const
Definition: SelectionDAGNodes.h:1816
llvm::SDNode::getIROrder
unsigned getIROrder() const
Return the node ordering.
Definition: SelectionDAGNodes.h:729
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::objcarc::Sequence
Sequence
Definition: PtrState.h:41
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::ISD::ATOMIC_LOAD_FMIN
@ ATOMIC_LOAD_FMIN
Definition: ISDOpcodes.h:1199
llvm::SDNode::getValueType
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
Definition: SelectionDAGNodes.h:983
llvm::SDNodeFlags::setNoSignedZeros
void setNoSignedZeros(bool b)
Definition: SelectionDAGNodes.h:423
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
llvm::SDNode::value_op_iterator::operator*
const SDValue & operator*() const
Definition: SelectionDAGNodes.h:938
llvm::VPStoreSDNode::getVectorLength
const SDValue & getVectorLength() const
Definition: SelectionDAGNodes.h:2559
llvm::SDLoc
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Definition: SelectionDAGNodes.h:1103
llvm::VPStridedStoreSDNode
This class is used to represent an EXPERIMENTAL_VP_STRIDED_STORE node.
Definition: SelectionDAGNodes.h:2567
llvm::VPLoadSDNode::getVectorLength
const SDValue & getVectorLength() const
Definition: SelectionDAGNodes.h:2493
Metadata.h
llvm::ISD::LIFETIME_END
@ LIFETIME_END
Definition: ISDOpcodes.h:1225
llvm::VPStoreSDNode::getMask
const SDValue & getMask() const
Definition: SelectionDAGNodes.h:2558
llvm::VPStridedStoreSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2598
llvm::simplify_type< SDValue >::getSimplifiedValue
static SimpleType getSimplifiedValue(SDValue &Val)
Definition: SelectionDAGNodes.h:267
llvm::SDNode::setIROrder
void setIROrder(unsigned Order)
Set the node ordering.
Definition: SelectionDAGNodes.h:732
llvm::MachineMemOperand::getAlign
Align getAlign() const
Return the minimum known alignment in bytes of the actual memory reference.
Definition: MachineOperand.cpp:1099
llvm::ConstantSDNode::getAPIntValue
const APInt & getAPIntValue() const
Definition: SelectionDAGNodes.h:1595
llvm::SDValue::use_empty
bool use_empty() const
Return true if there are no nodes using value ResNo of Node.
Definition: SelectionDAGNodes.h:1178
llvm::ConstantFPSDNode::isNegative
bool isNegative() const
Return true if the value is negative.
Definition: SelectionDAGNodes.h:1654
llvm::ISD::NON_EXTLOAD
@ NON_EXTLOAD
Definition: ISDOpcodes.h:1404
AtomicOrdering.h
llvm::VPGatherScatterSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2752
llvm::EVT::getFixedSizeInBits
uint64_t getFixedSizeInBits() const
Return the size of the specified fixed width value type in bits.
Definition: ValueTypes.h:348
llvm::AssertAlignSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2957
llvm::ISD::ATOMIC_LOAD_UMAX
@ ATOMIC_LOAD_UMAX
Definition: ISDOpcodes.h:1195
llvm::SDValue::getNode
SDNode * getNode() const
get the SDNode which holds the desired result
Definition: SelectionDAGNodes.h:159
llvm::isOneConstant
bool isOneConstant(SDValue V)
Returns true if V is a constant integer one.
Definition: SelectionDAG.cpp:10728
llvm::SDNode::use_size
size_t use_size() const
Return the number of uses of this node.
Definition: SelectionDAGNodes.h:720
llvm::ISD::ConstantFP
@ ConstantFP
Definition: ISDOpcodes.h:77
llvm::VPStoreSDNode::getOffset
const SDValue & getOffset() const
Definition: SelectionDAGNodes.h:2557
llvm::VPGatherScatterSDNode::isIndexScaled
bool isIndexScaled() const
Definition: SelectionDAGNodes.h:2727
llvm::ISD::LIFETIME_START
@ LIFETIME_START
This corresponds to the llvm.lifetime.
Definition: ISDOpcodes.h:1224
llvm::SDNode::getMaxNumOperands
static constexpr size_t getMaxNumOperands()
Return the maximum number of operands that a SDNode can hold.
Definition: SelectionDAGNodes.h:908
llvm::SDNodeFlags::setAllowContract
void setAllowContract(bool b)
Definition: SelectionDAGNodes.h:425
llvm::ISD::UADDO
@ UADDO
Definition: ISDOpcodes.h:324
llvm::SDNode::intersectFlagsWith
void intersectFlagsWith(const SDNodeFlags Flags)
Clear any flags in this node that aren't also set in Flags.
Definition: SelectionDAG.cpp:11071
llvm::ISD::ATOMIC_LOAD_CLR
@ ATOMIC_LOAD_CLR
Definition: ISDOpcodes.h:1188
llvm::SDNode::use_iterator::atEnd
bool atEnd() const
Return true if this iterator is at the end of uses list.
Definition: SelectionDAGNodes.h:766
llvm::SDNode::isUndef
bool isUndef() const
Return true if the type of the node type undefined.
Definition: SelectionDAGNodes.h:665
llvm::SDNode::isTargetStrictFPOpcode
bool isTargetStrictFPOpcode() const
Test if this node has a target-specific opcode that may raise FP exceptions (in the <target>ISD names...
Definition: SelectionDAGNodes.h:653
llvm::BuildVectorSDNode::getConstantFPSplatPow2ToLog2Int
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,...
Definition: SelectionDAG.cpp:11676
llvm::TargetIndexSDNode::getOffset
int64_t getOffset() const
Definition: SelectionDAGNodes.h:1952
llvm::DenseMapInfo< SDValue >::isEqual
static bool isEqual(const SDValue &LHS, const SDValue &RHS)
Definition: SelectionDAGNodes.h:257
llvm::SDNode::op_values
iterator_range< value_op_iterator > op_values() const
Definition: SelectionDAGNodes.h:941
llvm::AtomicSDNode::isCompareAndSwap
bool isCompareAndSwap() const
Returns true if this SDNode represents cmpxchg atomic operation, false otherwise.
Definition: SelectionDAGNodes.h:1455
TypeSize.h
llvm::VPStridedStoreSDNode::getOffset
const SDValue & getOffset() const
Definition: SelectionDAGNodes.h:2593
llvm::ISD::MLOAD
@ MLOAD
Definition: ISDOpcodes.h:1207
llvm::MemSDNode::getSyncScopeID
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID for this memory operation.
Definition: SelectionDAGNodes.h:1328
op
#define op(i)
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1182
llvm::SDNodeFlags::hasNoNaNs
bool hasNoNaNs() const
Definition: SelectionDAGNodes.h:434
llvm::isMinSignedConstant
bool isMinSignedConstant(SDValue V)
Returns true if V is a constant min signed integer value.
Definition: SelectionDAG.cpp:10733
llvm::MemSDNode::getMergedOrdering
AtomicOrdering getMergedOrdering() const
Return a single atomic ordering that is at least as strong as both the success and failure orderings ...
Definition: SelectionDAGNodes.h:1340
llvm::ISD::isVectorShrinkable
bool isVectorShrinkable(const SDNode *N, unsigned NewEltSize, bool Signed)
Returns true if the specified node is a vector where all elements can be truncated to the specified e...
Definition: SelectionDAG.cpp:295
llvm::MaskedStoreSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2703
llvm::MachineMemOperand::isLoad
bool isLoad() const
Definition: MachineMemOperand.h:287
llvm::MachineMemOperand::getOffset
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
Definition: MachineMemOperand.h:226
llvm::ISD::CONDCODE
@ CONDCODE
Definition: ISDOpcodes.h:73
llvm::iterator_adaptor_base< value_op_iterator, op_iterator, std::random_access_iterator_tag, SDValue, ptrdiff_t, value_op_iterator *, value_op_iterator * >::I
op_iterator I
Definition: iterator.h:241
llvm::ISD::TargetIndex
@ TargetIndex
TargetIndex - Like a constant pool entry, but with completely target-dependent semantics.
Definition: ISDOpcodes.h:177
llvm::SDVTList::NumVTs
unsigned int NumVTs
Definition: SelectionDAGNodes.h:81
llvm::MachineSDNode
An SDNode that represents everything that will be needed to construct a MachineInstr.
Definition: SelectionDAGNodes.h:2889
llvm::ConstantSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1616
llvm::SDNodeFlags::SDNodeFlags
SDNodeFlags()
Default constructor turns off all optimization flags.
Definition: SelectionDAGNodes.h:400
ErrorHandling.h
llvm::isBitwiseNot
bool isBitwiseNot(SDValue V, bool AllowUndefs=false)
Returns true if V is a bitwise not operation.
Definition: SelectionDAG.cpp:10756
llvm::SDValue::SDValue
SDValue()=default
llvm::X86Disassembler::Reg
Reg
All possible values of the reg field in the ModR/M byte.
Definition: X86DisassemblerDecoder.h:462
llvm::ISD::MGATHER
@ MGATHER
Definition: ISDOpcodes.h:1219
llvm::VTSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2297
llvm::SDNodeIterator::operator->
pointer operator->() const
Definition: SelectionDAGNodes.h:2983
llvm::LifetimeSDNode::hasOffset
bool hasOffset() const
Definition: SelectionDAGNodes.h:1811
llvm::ShuffleVectorSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1576
llvm::ISD::EH_LABEL
@ EH_LABEL
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
Definition: ISDOpcodes.h:1033
llvm::MachineSDNode::memoperands_begin
mmo_iterator memoperands_begin() const
Definition: SelectionDAGNodes.h:2931
llvm::isAllOnesOrAllOnesSplat
bool isAllOnesOrAllOnesSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI, bool AllowUndefs=false)
Return true if the value is a constant -1 integer or a splatted vector of a constant -1 integer (with...
Definition: Utils.cpp:1221
llvm::HandleSDNode
This class is used to form a handle around another node that is persistent and is updated across invo...
Definition: SelectionDAGNodes.h:1230
llvm::ISD::MemIndexType
MemIndexType
MemIndexType enum - This enum defines how to interpret MGATHER/SCATTER's index parameter when calcula...
Definition: ISDOpcodes.h:1386
llvm::MemSDNode::getMemoryVT
EVT getMemoryVT() const
Return the type of the in-memory value.
Definition: SelectionDAGNodes.h:1354
llvm::MemSDNode::getChain
const SDValue & getChain() const
Definition: SelectionDAGNodes.h:1377
llvm::LifetimeSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1822
llvm::SDNode
Represents one node in the SelectionDAG.
Definition: SelectionDAGNodes.h:462
llvm::GlobalAddressSDNode::getTargetFlags
unsigned getTargetFlags() const
Definition: SelectionDAGNodes.h:1765
llvm::ConstantPool
Definition: ConstantPools.h:43
llvm::ConstantSDNode::isAllOnes
bool isAllOnes() const
Definition: SelectionDAGNodes.h:1608
llvm::SDNodeIterator::operator-
size_t operator-(SDNodeIterator Other) const
Definition: SelectionDAGNodes.h:2992
llvm::LoadSDNode
This class is used to represent ISD::LOAD nodes.
Definition: SelectionDAGNodes.h:2336
llvm::MVT::Glue
@ Glue
Definition: MachineValueType.h:272
llvm::RegisterMaskSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2182
llvm::SDNode::use_iterator
This class provides iterator support for SDUse operands that use a specific SDNode.
Definition: SelectionDAGNodes.h:743
llvm::VPLoadSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2495
llvm::MaskedGatherScatterSDNode::getMask
const SDValue & getMask() const
Definition: SelectionDAGNodes.h:2822
llvm::MachineSDNode::memoperands_empty
bool memoperands_empty() const
Definition: SelectionDAGNodes.h:2933
llvm::MachineConstantPoolValue
Abstract base class for all machine specific constantpool value subclasses.
Definition: MachineConstantPool.h:35
llvm::Depth
@ Depth
Definition: SIMachineScheduler.h:36
llvm::VPStridedLoadSDNode::getOffset
const SDValue & getOffset() const
Definition: SelectionDAGNodes.h:2520
llvm::MemIntrinsicSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1506
llvm::AAMDNodes
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition: Metadata.h:652
llvm::VPStridedStoreSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:2592
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::MemSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:1379
llvm::MachineMemOperand
A description of a memory reference used in the backend.
Definition: MachineMemOperand.h:127
llvm::iterator_adaptor_base
CRTP base class for adapting an iterator to a different type.
Definition: iterator.h:235
llvm::VPGatherScatterSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:2736
llvm::MaskedLoadSDNode::MaskedLoadSDNode
MaskedLoadSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, ISD::MemIndexedMode AM, ISD::LoadExtType ETy, bool IsExpanding, EVT MemVT, MachineMemOperand *MMO)
Definition: SelectionDAGNodes.h:2650
llvm::SDNode::StoreSDNodeBitfields
Definition: SelectionDAGNodes.h:551
llvm::LargestSDNode
AlignedCharArrayUnion< AtomicSDNode, TargetIndexSDNode, BlockAddressSDNode, GlobalAddressSDNode, PseudoProbeSDNode > LargestSDNode
A representation of the largest SDNode, for use in sizeof().
Definition: SelectionDAGNodes.h:3029
llvm::MaskedStoreSDNode
This class is used to represent an MSTORE node.
Definition: SelectionDAGNodes.h:2675
llvm::SDValue::isTargetOpcode
bool isTargetOpcode() const
Definition: SelectionDAGNodes.h:1158
isBigEndian
static Optional< bool > isBigEndian(const SmallDenseMap< int64_t, int64_t, 8 > &MemOffset2Idx, int64_t LowestIdx)
Given a map from byte offsets in memory to indices in a load/store, determine if that map corresponds...
Definition: CombinerHelper.cpp:108
llvm::LabelSDNode::getLabel
MCSymbol * getLabel() const
Definition: SelectionDAGNodes.h:2221
llvm::VPGatherSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2769
llvm::Optional
Definition: APInt.h:33
llvm::SDNode::isPredecessorOf
bool isPredecessorOf(const SDNode *N) const
Return true if this node is a predecessor of N.
Definition: SelectionDAGNodes.h:827
llvm::SDNode::MemSDNodeBits
MemSDNodeBitfields MemSDNodeBits
Definition: SelectionDAGNodes.h:569
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:79
llvm::MemSDNode
This is an abstract virtual class for memory operations.
Definition: SelectionDAGNodes.h:1272
llvm::VPLoadSDNode::VPLoadSDNode
VPLoadSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, ISD::MemIndexedMode AM, ISD::LoadExtType ETy, bool isExpanding, EVT MemVT, MachineMemOperand *MMO)
Definition: SelectionDAGNodes.h:2478
llvm::SDNodeFlags::setAllowReassociation
void setAllowReassociation(bool b)
Definition: SelectionDAGNodes.h:427
llvm::SDNode::printrFull
void printrFull(raw_ostream &O, const SelectionDAG *G=nullptr) const
Print a SelectionDAG node and all children down to the leaves.
Definition: SelectionDAGDumper.cpp:1043
llvm::SDNodeIterator::getOperand
unsigned getOperand() const
Definition: SelectionDAGNodes.h:3003
llvm::ISD::isConstantSplatVectorAllZeros
bool isConstantSplatVectorAllZeros(const SDNode *N, bool BuildVectorOnly=false)
Return true if the specified node is a BUILD_VECTOR or SPLAT_VECTOR where all of the elements are 0 o...
Definition: SelectionDAG.cpp:219
Operator.h
llvm::VPLoadSDNode::isExpandingLoad
bool isExpandingLoad() const
Definition: SelectionDAGNodes.h:2498
llvm::ConstantSDNode::isZero
bool isZero() const
Definition: SelectionDAGNodes.h:1605
llvm::AddrSpaceCastSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1266
llvm::simplify_type< const SDValue >::getSimplifiedValue
static SimpleType getSimplifiedValue(const SDValue &Val)
Definition: SelectionDAGNodes.h:274
llvm::max
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Definition: FileCheck.cpp:337
llvm::AtomicSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1469
AlignOf.h
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:119
llvm::SDNode::printr
void printr(raw_ostream &OS, const SelectionDAG *G=nullptr) const
Definition: SelectionDAGDumper.cpp:951
llvm::ISD::EXTLOAD
@ EXTLOAD
Definition: ISDOpcodes.h:1404
llvm::LSBaseSDNode::isIndexed
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
Definition: SelectionDAGNodes.h:2324
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::FPMathOperator::hasNoNaNs
bool hasNoNaNs() const
Test if this operation's arguments and results are assumed not-NaN.
Definition: Operator.h:254
llvm::SDNodeIterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: SelectionDAGNodes.h:2969
llvm::HandleSDNode::HandleSDNode
HandleSDNode(SDValue X)
Definition: SelectionDAGNodes.h:1234
llvm::AssertAlignSDNode::getAlign
Align getAlign() const
Definition: SelectionDAGNodes.h:2955
llvm::SDNode::SDNodeBitfields
Definition: SelectionDAGNodes.h:483
llvm::MaskedGatherScatterSDNode
This is a base class used to represent MGATHER and MSCATTER nodes.
Definition: SelectionDAGNodes.h:2795
tmp
alloca< 16 x float >, align 16 %tmp2=alloca< 16 x float >, align 16 store< 16 x float > %A,< 16 x float > *%tmp %s=bitcast< 16 x float > *%tmp to i8 *%s2=bitcast< 16 x float > *%tmp2 to i8 *call void @llvm.memcpy.i64(i8 *%s, i8 *%s2, i64 64, i32 16) %R=load< 16 x float > *%tmp2 ret< 16 x float > %R } declare void @llvm.memcpy.i64(i8 *nocapture, i8 *nocapture, i64, i32) nounwind which compiles to:_foo:subl $140, %esp movaps %xmm3, 112(%esp) movaps %xmm2, 96(%esp) movaps %xmm1, 80(%esp) movaps %xmm0, 64(%esp) movl 60(%esp), %eax movl %eax, 124(%esp) movl 56(%esp), %eax movl %eax, 120(%esp) movl 52(%esp), %eax< many many more 32-bit copies > movaps(%esp), %xmm0 movaps 16(%esp), %xmm1 movaps 32(%esp), %xmm2 movaps 48(%esp), %xmm3 addl $140, %esp ret On Nehalem, it may even be cheaper to just use movups when unaligned than to fall back to lower-granularity chunks. Implement processor-specific optimizations for parity with GCC on these processors. GCC does two optimizations:1. ix86_pad_returns inserts a noop before ret instructions if immediately preceded by a conditional branch or is the target of a jump. 2. ix86_avoid_jump_misspredicts inserts noops in cases where a 16-byte block of code contains more than 3 branches. The first one is done for all AMDs, Core2, and "Generic" The second one is done for:Atom, Pentium Pro, all AMDs, Pentium 4, Nocona, Core 2, and "Generic" Testcase:int x(int a) { return(a &0xf0)> >4 tmp
Definition: README.txt:1347
llvm::VPStoreSDNode::getValue
const SDValue & getValue() const
Definition: SelectionDAGNodes.h:2555
llvm::SDNodeIterator::difference_type
std::ptrdiff_t difference_type
Definition: SelectionDAGNodes.h:2971
llvm::SDNode::isDivergent
bool isDivergent() const
Definition: SelectionDAGNodes.h:710
llvm::SDNode::use_iterator::operator*
SDNode * operator*() const
Retrieve a pointer to the current user node.
Definition: SelectionDAGNodes.h:780
llvm::BlockAddressSDNode
Definition: SelectionDAGNodes.h:2187
llvm::ConstantPoolSDNode::getAlign
Align getAlign() const
Definition: SelectionDAGNodes.h:1926
llvm::SDNode::use_iterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: SelectionDAGNodes.h:751
llvm::MachineMemOperand::getAAInfo
AAMDNodes getAAInfo() const
Return the AA tags for the memory reference.
Definition: MachineMemOperand.h:257
llvm::MachineMemOperand::isUnordered
bool isUnordered() const
Returns true if this memory operation doesn't have any ordering constraints other than normal aliasin...
Definition: MachineMemOperand.h:303
llvm::ArrayRef::const_iterator
const_pointer const_iterator
Definition: ArrayRef.h:50
llvm::GraphTraits< SDNode * >::child_end
static ChildIteratorType child_end(NodeRef N)
Definition: SelectionDAGNodes.h:3017
llvm::SDNode::RawSDNodeBits
char RawSDNodeBits[sizeof(uint16_t)]
Definition: SelectionDAGNodes.h:566
llvm::VPStridedLoadSDNode
This class is used to represent an EXPERIMENTAL_VP_STRIDED_LOAD node.
Definition: SelectionDAGNodes.h:2502
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::PointerUnion::get
T get() const
Returns the value of the specified pointer type.
Definition: PointerUnion.h:155
llvm::SDUse::SDUse
SDUse()=default
p
the resulting code requires compare and branches when and if * p
Definition: README.txt:396
llvm::SDUse::get
const SDValue & get() const
If implicit conversion to SDValue doesn't work, the get() method returns the SDValue.
Definition: SelectionDAGNodes.h:304
llvm::MaskedScatterSDNode::isTruncatingStore
bool isTruncatingStore() const
Return true if the op does a truncation before store.
Definition: SelectionDAGNodes.h:2873
llvm::VPScatterSDNode::getValue
const SDValue & getValue() const
Definition: SelectionDAGNodes.h:2785
llvm::ConstantSDNode::getConstantIntValue
const ConstantInt * getConstantIntValue() const
Definition: SelectionDAGNodes.h:1594
llvm::VPBaseLoadStoreSDNode::getVectorLength
const SDValue & getVectorLength() const
Definition: SelectionDAGNodes.h:2440
llvm::ISD::ATOMIC_LOAD_OR
@ ATOMIC_LOAD_OR
Definition: ISDOpcodes.h:1189
llvm::SDUse::getResNo
unsigned getResNo() const
Convenience function for get().getResNo().
Definition: SelectionDAGNodes.h:315
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:265
llvm::SDNode::getVTList
SDVTList getVTList() const
Definition: SelectionDAGNodes.h:946
llvm::SDNode::NumMemSDNodeBits
@ NumMemSDNodeBits
Definition: SelectionDAGNodes.h:515
llvm::ConstantSDNode::getLimitedValue
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX)
Definition: SelectionDAGNodes.h:1598
llvm::MDNodeSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2148
llvm::MemSDNode::isUnordered
bool isUnordered() const
Returns true if the memory operation doesn't imply any ordering constraints on surrounding memory ope...
Definition: SelectionDAGNodes.h:1348
llvm::ShuffleVectorSDNode
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
Definition: SelectionDAGNodes.h:1523
llvm::FPMathOperator::hasNoInfs
bool hasNoInfs() const
Test if this operation's arguments and results are assumed not-infinite.
Definition: Operator.h:259
llvm::MaskedLoadStoreSDNode::isIndexed
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
Definition: SelectionDAGNodes.h:2634
llvm::ConstantFPSDNode::isNaN
bool isNaN() const
Return true if the value is a NaN.
Definition: SelectionDAGNodes.h:1648
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
llvm::ISD::PSEUDO_PROBE
@ PSEUDO_PROBE
Pseudo probe for AutoFDO, as a place holder in a basic block to improve the sample counts quality.
Definition: ISDOpcodes.h:1244
llvm::SDNodeIterator::begin
static SDNodeIterator begin(const SDNode *N)
Definition: SelectionDAGNodes.h:2998
MachineValueType.h
llvm::SDNode::value_begin
value_iterator value_begin() const
Definition: SelectionDAGNodes.h:1004
llvm::SDNodeFlags::setApproximateFuncs
void setApproximateFuncs(bool b)
Definition: SelectionDAGNodes.h:426
llvm::MaskedLoadSDNode::getPassThru
const SDValue & getPassThru() const
Definition: SelectionDAGNodes.h:2665
llvm::MaskedGatherSDNode::getPassThru
const SDValue & getPassThru() const
Definition: SelectionDAGNodes.h:2845
GraphTraits.h
llvm::ConstantFPSDNode::isValueValidForType
static bool isValueValidForType(EVT VT, const APFloat &Val)
Definition: SelectionDAG.cpp:123
llvm::SDNode::op_end
op_iterator op_end() const
Definition: SelectionDAGNodes.h:926
llvm::SDNodeFlags::copyFMF
void copyFMF(const FPMathOperator &FPMO)
Propagate the fast-math-flags from an IR FPMathOperator.
Definition: SelectionDAGNodes.h:407
llvm::MaskedLoadStoreSDNode
This base class is used to represent MLOAD and MSTORE nodes.
Definition: SelectionDAGNodes.h:2604
llvm::SDNode::SDNode
SDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs)
Create an SDNode.
Definition: SelectionDAGNodes.h:1081
llvm::MachineMemOperand::getPointerInfo
const MachinePointerInfo & getPointerInfo() const
Definition: MachineMemOperand.h:201
llvm::MemSDNode::isInvariant
bool isInvariant() const
Definition: SelectionDAGNodes.h:1316
llvm::BitmaskEnumDetail::Mask
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
Instruction.h
llvm::VPStridedStoreSDNode::VPStridedStoreSDNode
VPStridedStoreSDNode(unsigned Order, const DebugLoc &DL, SDVTList VTs, ISD::MemIndexedMode AM, bool IsTrunc, bool IsCompressing, EVT MemVT, MachineMemOperand *MMO)
Definition: SelectionDAGNodes.h:2571
llvm::ISD::LoadExtType
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
Definition: ISDOpcodes.h:1404
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::BlockAddressSDNode::getOffset
int64_t getOffset() const
Definition: SelectionDAGNodes.h:2201
llvm::HandleSDNode::getValue
const SDValue & getValue() const
Definition: SelectionDAGNodes.h:1251
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:79
llvm::DenseMapInfo
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition: APInt.h:34
llvm::SDNode::getOpcode
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
Definition: SelectionDAGNodes.h:642
llvm::AMDGPU::TargetIndex
TargetIndex
Definition: AMDGPU.h:347
llvm::SDNode::LoadSDNodeBits
LoadSDNodeBitfields LoadSDNodeBits
Definition: SelectionDAGNodes.h:571
llvm::StoreSDNode::setTruncatingStore
void setTruncatingStore(bool Truncating)
Definition: SelectionDAGNodes.h:2381
llvm::JumpTableSDNode::getTargetFlags
unsigned getTargetFlags() const
Definition: SelectionDAGNodes.h:1867
llvm::SDNode::SDNodeBits
SDNodeBitfields SDNodeBits
Definition: SelectionDAGNodes.h:567
llvm::ISD::GlobalAddress
@ GlobalAddress
Definition: ISDOpcodes.h:78
llvm::ExternalSymbolSDNode
Definition: SelectionDAGNodes.h:2229
llvm::SDValue::getValueType
EVT getValueType() const
Return the ValueType of the referenced return value.
Definition: SelectionDAGNodes.h:1138
llvm::SDValue::operator!=
bool operator!=(const SDValue &O) const
Definition: SelectionDAGNodes.h:169
llvm::MemIntrinsicSDNode
This SDNode is used for target intrinsics that touch memory and need an associated MachineMemOperand.
Definition: SelectionDAGNodes.h:1497
llvm::MutableArrayRef
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:28
llvm::SelectionDAG
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Definition: SelectionDAG.h:220
Constants.h
llvm::MachineMemOperand::getBaseAlign
Align getBaseAlign() const
Return the minimum known alignment in bytes of the base address, without the offset.
Definition: MachineMemOperand.h:254
llvm::LoadSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2358
llvm::SDNode::hasOneUse
bool hasOneUse() const
Return true if there is exactly one use of this node.
Definition: SelectionDAGNodes.h:716
llvm::SDNode::areOnlyUsersOf
static bool areOnlyUsersOf(ArrayRef< const SDNode * > Nodes, const SDNode *N)
Return true if all the users of N are contained in Nodes.
Definition: SelectionDAG.cpp:10994
llvm::ISD::Constant
@ Constant
Definition: ISDOpcodes.h:76
llvm::ISD::isBuildVectorOfConstantFPSDNodes
bool isBuildVectorOfConstantFPSDNodes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR node of all ConstantFPSDNode or undef.
Definition: SelectionDAG.cpp:282
llvm::SDValue::reachesChainWithoutSideEffects
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...
Definition: SelectionDAG.cpp:11026
llvm::BuildVectorSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2109
llvm::User
Definition: User.h:44
llvm::SDNode::setFlags
void setFlags(SDNodeFlags NewFlags)
Definition: SelectionDAGNodes.h:970
llvm::EVT
Extended Value Type.
Definition: ValueTypes.h:34
llvm::MemSDNode::isDereferenceable
bool isDereferenceable() const
Definition: SelectionDAGNodes.h:1315
llvm::SDValue::operator==
bool operator==(const SDValue &O) const
Definition: SelectionDAGNodes.h:166
llvm::SDNodeIterator::operator++
SDNodeIterator operator++(int)
Definition: SelectionDAGNodes.h:2989
llvm::SDNode::isStrictFPOpcode
bool isStrictFPOpcode()
Test if this node is a strict floating point pseudo-op.
Definition: SelectionDAGNodes.h:679
llvm::JumpTableSDNode
Definition: SelectionDAGNodes.h:1854
llvm::EVT::getVectorNumElements
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
Definition: ValueTypes.h:308
llvm::AtomicSDNode::getFailureOrdering
AtomicOrdering getFailureOrdering() const
For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur.
Definition: SelectionDAGNodes.h:1463
llvm::VPScatterSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2787
llvm::ISD::STRICT_FP16_TO_FP
@ STRICT_FP16_TO_FP
Definition: ISDOpcodes.h:898
llvm::MaskedLoadStoreSDNode::MaskedLoadStoreSDNode
MaskedLoadStoreSDNode(ISD::NodeType NodeTy, unsigned Order, const DebugLoc &dl, SDVTList VTs, ISD::MemIndexedMode AM, EVT MemVT, MachineMemOperand *MMO)
Definition: SelectionDAGNodes.h:2608
llvm::MemIntrinsicSDNode::MemIntrinsicSDNode
MemIntrinsicSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemoryVT, MachineMemOperand *MMO)
Definition: SelectionDAGNodes.h:1499
llvm::BasicBlockSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1974
llvm::VPStridedStoreSDNode::getVectorLength
const SDValue & getVectorLength() const
Definition: SelectionDAGNodes.h:2596
llvm::SDLoc::getIROrder
unsigned getIROrder() const
Definition: SelectionDAGNodes.h:1118
b
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int b
Definition: README.txt:418
llvm::MemSDNode::getRawSubclassData
unsigned getRawSubclassData() const
Return the SubclassData value, without HasDebugValue.
Definition: SelectionDAGNodes.h:1300
llvm::SDNode::dumprWithDepth
void dumprWithDepth(const SelectionDAG *G=nullptr, unsigned depth=100) const
printrWithDepth to dbgs().
Definition: SelectionDAGDumper.cpp:1050
llvm::TargetIndexSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1954
llvm::MaskedGatherScatterSDNode::MaskedGatherScatterSDNode
MaskedGatherScatterSDNode(ISD::NodeType NodeTy, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
Definition: SelectionDAGNodes.h:2799
llvm::isIntOrFPConstant
bool isIntOrFPConstant(SDValue V)
Return true if V is either a integer or FP constant.
Definition: SelectionDAGNodes.h:1747
llvm::VPScatterSDNode
This class is used to represent an VP_SCATTER node.
Definition: SelectionDAGNodes.h:2776
UINT64_MAX
#define UINT64_MAX
Definition: DataTypes.h:77
llvm::FrameIndexSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1790
llvm::simplify_type
Define a template that can be specialized by smart pointers to reflect the fact that they are automat...
Definition: ilist_iterator.h:178
false
Definition: StackSlotColoring.cpp:141
llvm::SrcValueSDNode::getValue
const Value * getValue() const
Return the contained Value.
Definition: SelectionDAGNodes.h:2129
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117
llvm::SDNode::ConstantSDNodeBitfields
Definition: SelectionDAGNodes.h:495
llvm::ShuffleVectorSDNode::isSplat
bool isSplat() const
Definition: SelectionDAGNodes.h:1545
llvm::ISD::NodeType
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
Definition: ISDOpcodes.h:40
llvm::ISD::isUNINDEXEDLoad
bool isUNINDEXEDLoad(const SDNode *N)
Returns true if the specified node is an unindexed load.
Definition: SelectionDAGNodes.h:3068
llvm::SDNodeFlags::setExact
void setExact(bool b)
Definition: SelectionDAGNodes.h:420
llvm::ISD::ADDRSPACECAST
@ ADDRSPACECAST
ADDRSPACECAST - This operator converts between pointers of different address spaces.
Definition: ISDOpcodes.h:890
llvm::SDNode::uses
iterator_range< use_iterator > uses()
Definition: SelectionDAGNodes.h:803
llvm::ISD::ATOMIC_LOAD_AND
@ ATOMIC_LOAD_AND
Definition: ISDOpcodes.h:1187
llvm::SDNode::use_iterator::operator++
use_iterator & operator++()
Definition: SelectionDAGNodes.h:769
llvm::StoreSDNode::getOffset
const SDValue & getOffset() const
Definition: SelectionDAGNodes.h:2387
llvm::RegisterSDNode::getReg
Register getReg() const
Definition: SelectionDAGNodes.h:2162
llvm::MaskedLoadSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:2662
llvm::MaskedStoreSDNode::getMask
const SDValue & getMask() const
Definition: SelectionDAGNodes.h:2701
llvm::Instruction
Definition: Instruction.h:42
llvm::rdf::NodeId
uint32_t NodeId
Definition: RDFGraph.h:261
llvm::ISD::MDNODE_SDNODE
@ MDNODE_SDNODE
MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to reference metadata in the IR.
Definition: ISDOpcodes.h:1102
llvm::ISD::ATOMIC_LOAD_UMIN
@ ATOMIC_LOAD_UMIN
Definition: ISDOpcodes.h:1194
llvm::LabelSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2223
llvm::ShuffleVectorSDNode::getMask
ArrayRef< int > getMask() const
Definition: SelectionDAGNodes.h:1535
llvm::peekThroughOneUseBitcasts
SDValue peekThroughOneUseBitcasts(SDValue V)
Return the non-bitcasted and one-use source operand of V if it exists.
Definition: SelectionDAG.cpp:10744
llvm::SDNodeIterator::operator==
bool operator==(const SDNodeIterator &x) const
Definition: SelectionDAGNodes.h:2975
llvm::BuildVectorSDNode::getSplatValue
SDValue getSplatValue(const APInt &DemandedElts, BitVector *UndefElements=nullptr) const
Returns the demanded splatted value or a null value if this is not a splat.
Definition: SelectionDAG.cpp:11559
llvm::SDNode::use_empty
bool use_empty() const
Return true if there are no uses of this node.
Definition: SelectionDAGNodes.h:713
llvm::DenseMapInfo< SDValue >::getHashValue
static unsigned getHashValue(const SDValue &Val)
Definition: SelectionDAGNodes.h:252
llvm::SDNode::isTargetOpcode
bool isTargetOpcode() const
Test if this node has a target-specific opcode (in the <target>ISD namespace).
Definition: SelectionDAGNodes.h:646
llvm::ISD::isBuildVectorOfConstantSDNodes
bool isBuildVectorOfConstantSDNodes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR node of all ConstantSDNode or undef.
Definition: SelectionDAG.cpp:269
llvm::VPStoreSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:2556
llvm::isOneOrOneSplat
bool isOneOrOneSplat(SDValue V, bool AllowUndefs=false)
Return true if the value is a constant 1 integer or a splatted vector of a constant 1 integer (with n...
Definition: SelectionDAG.cpp:10867
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::ConstantFP
ConstantFP - Floating Point Values [float, double].
Definition: Constants.h:257
llvm::MaskedStoreSDNode::getValue
const SDValue & getValue() const
Definition: SelectionDAGNodes.h:2698
APFloat.h
llvm::SDNode::getCFIType
uint32_t getCFIType() const
Definition: SelectionDAGNodes.h:977
llvm::ISD::ATOMIC_STORE
@ ATOMIC_STORE
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
Definition: ISDOpcodes.h:1163
llvm::LSBaseSDNode::isUnindexed
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
Definition: SelectionDAGNodes.h:2327
llvm::FrameIndexSDNode
Definition: SelectionDAGNodes.h:1777
BitVector.h
llvm::ConstantSDNode::isMinSignedValue
bool isMinSignedValue() const
Definition: SelectionDAGNodes.h:1612
llvm::MaskedGatherSDNode::MaskedGatherSDNode
MaskedGatherSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexType IndexType, ISD::LoadExtType ETy)
Definition: SelectionDAGNodes.h:2837
llvm::ISD::AssertAlign
@ AssertAlign
AssertAlign - These nodes record if a register contains a value that has a known alignment and the tr...
Definition: ISDOpcodes.h:68
DebugLoc.h
SmallPtrSet.h
llvm::SDNode::value_op_iterator::value_op_iterator
value_op_iterator(SDUse *U=nullptr)
Definition: SelectionDAGNodes.h:935
llvm::LabelSDNode
Definition: SelectionDAGNodes.h:2210
llvm::BitVector
Definition: BitVector.h:75
llvm::CondCodeSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2278
llvm::SmallVectorImpl::append
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:670
llvm::ISD::SMULO
@ SMULO
Same for multiplication.
Definition: ISDOpcodes.h:331
llvm::VPStridedLoadSDNode::getVectorLength
const SDValue & getVectorLength() const
Definition: SelectionDAGNodes.h:2523
llvm::MemSDNode::isNonTemporal
bool isNonTemporal() const
Definition: SelectionDAGNodes.h:1314
llvm::ISD::TargetGlobalAddress
@ TargetGlobalAddress
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
Definition: ISDOpcodes.h:164
Align
uint64_t Align
Definition: ELFObjHandler.cpp:81
llvm::MaskedScatterSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2877
llvm::GlobalAddressSDNode::getGlobal
const GlobalValue * getGlobal() const
Definition: SelectionDAGNodes.h:1763
llvm::MaskedLoadStoreSDNode::isUnindexed
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
Definition: SelectionDAGNodes.h:2637
llvm::FPMathOperator::hasNoSignedZeros
bool hasNoSignedZeros() const
Test if this operation can ignore the sign of zero.
Definition: Operator.h:264
llvm::ConstantSDNode::isOne
bool isOne() const
Definition: SelectionDAGNodes.h:1604
llvm::ISD::UNINDEXED
@ UNINDEXED
Definition: ISDOpcodes.h:1373
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::DenseMapInfo< SDValue >::getEmptyKey
static SDValue getEmptyKey()
Definition: SelectionDAGNodes.h:240
llvm::SDValue::getConstantOperandVal
uint64_t getConstantOperandVal(unsigned i) const
Definition: SelectionDAGNodes.h:1150
force
therefore end up llgh r3 lr r0 br r14 but truncating the load would lh r3 br r14 Functions ret i64 and ought to be implemented ngr r0 br r14 but two address optimizations reverse the order of the AND and force
Definition: README.txt:112
c
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int int c
Definition: README.txt:418
llvm::SDValue::getValueSizeInBits
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
Definition: SelectionDAGNodes.h:199
llvm::LSBaseSDNode::getOffset
const SDValue & getOffset() const
Definition: SelectionDAGNodes.h:2313
llvm::ISD::USUBO
@ USUBO
Definition: ISDOpcodes.h:328
llvm::MemSDNode::isVolatile
bool isVolatile() const
Definition: SelectionDAGNodes.h:1313
llvm::MachineMemOperand::getSyncScopeID
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID for this memory operation.
Definition: MachineMemOperand.h:263
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::StoreSDNode::isTruncatingStore
bool isTruncatingStore() const
Return true if the op does a truncation before store.
Definition: SelectionDAGNodes.h:2380
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::RegisterMaskSDNode
Definition: SelectionDAGNodes.h:2169
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:94
llvm::ISD::VALUETYPE
@ VALUETYPE
Definition: ISDOpcodes.h:72
llvm::TargetIndexSDNode::getTargetFlags
unsigned getTargetFlags() const
Definition: SelectionDAGNodes.h:1950
llvm::SDNode::setDebugLoc
void setDebugLoc(DebugLoc dl)
Set source location info.
Definition: SelectionDAGNodes.h:739
llvm::VPStridedStoreSDNode::isCompressingStore
bool isCompressingStore() const
Returns true if the op does a compression to the vector before storing.
Definition: SelectionDAGNodes.h:2589
llvm::MachineSDNode::memoperands
ArrayRef< MachineMemOperand * > memoperands() const
Definition: SelectionDAGNodes.h:2921
llvm::ISD::ATOMIC_LOAD_FADD
@ ATOMIC_LOAD_FADD
Definition: ISDOpcodes.h:1196
llvm::SDNode::value_op_iterator
Iterator for directly iterating over the operand SDValue's.
Definition: SelectionDAGNodes.h:930
llvm::ISD::TargetConstantFP
@ TargetConstantFP
Definition: ISDOpcodes.h:159
llvm::SDLoc::SDLoc
SDLoc(const SDValue V)
Definition: SelectionDAGNodes.h:1111
llvm::BlockAddressSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2204
llvm::VTSDNode::getVT
EVT getVT() const
Definition: SelectionDAGNodes.h:2295
llvm::SDNode::getGluedUser
SDNode * getGluedUser() const
If this node has a glue value with a user, return the user (there is at most one).
Definition: SelectionDAGNodes.h:962
llvm::MaskedScatterSDNode::MaskedScatterSDNode
MaskedScatterSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexType IndexType, bool IsTrunc)
Definition: SelectionDAGNodes.h:2862
Node::dump
DEMANGLE_DUMP_METHOD void dump() const
llvm::MaskedLoadStoreSDNode::getOffset
const SDValue & getOffset() const
Definition: SelectionDAGNodes.h:2620
llvm::SDNodeIterator::operator++
SDNodeIterator & operator++()
Definition: SelectionDAGNodes.h:2985
llvm::ISD::BlockAddress
@ BlockAddress
Definition: ISDOpcodes.h:84
llvm::checkForCycles
void checkForCycles(const SelectionDAG *DAG, bool force=false)
Definition: SelectionDAG.cpp:12000
llvm::SDNode::MemSDNodeBitfields
Definition: SelectionDAGNodes.h:503
llvm::AssertAlignSDNode
An SDNode that records if a register contains a value that is guaranteed to be aligned accordingly.
Definition: SelectionDAGNodes.h:2948
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:200
llvm::BuildVectorSDNode::isConstantSequence
Optional< std::pair< APInt, APInt > > isConstantSequence() const
If this BuildVector is constant and represents the numerical series "<a, a+n, a+2n,...
Definition: SelectionDAG.cpp:11793
llvm::AtomicOrdering
AtomicOrdering
Atomic ordering for LLVM's memory model.
Definition: AtomicOrdering.h:56
llvm::ISD::matchUnaryPredicate
bool matchUnaryPredicate(SDValue Op, std::function< bool(ConstantSDNode *)> Match, bool AllowUndefs=false)
Attempt to match a unary predicate against a scalar/splat constant or every element of a constant BUI...
Definition: SelectionDAG.cpp:333
llvm::MaskedScatterSDNode::getValue
const SDValue & getValue() const
Definition: SelectionDAGNodes.h:2875
val
The initial backend is deliberately restricted to z10 We should add support for later architectures at some point If an asm ties an i32 r result to an i64 the input will be treated as an leaving the upper bits uninitialised For i64 store i32 val
Definition: README.txt:15
llvm::APFloat
Definition: APFloat.h:701
llvm::SDNode::use_begin
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
Definition: SelectionDAGNodes.h:797
llvm::ISD::Register
@ Register
Definition: ISDOpcodes.h:74
llvm::ISD::isVPOpcode
bool isVPOpcode(unsigned Opcode)
Whether this is a vector-predicated Opcode.
Definition: SelectionDAG.cpp:447
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:264
llvm::SDValue::getNumOperands
unsigned getNumOperands() const
Definition: SelectionDAGNodes.h:1142
llvm::isNullFPConstant
bool isNullFPConstant(SDValue V)
Returns true if V is an FP constant with a value of positive zero.
Definition: SelectionDAG.cpp:10718
llvm::ISD::SADDO
@ SADDO
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
Definition: ISDOpcodes.h:323
llvm::SDUse::getNext
SDUse * getNext() const
Get the next SDUse in the use list.
Definition: SelectionDAGNodes.h:310
llvm::VPGatherScatterSDNode::getIndexType
ISD::MemIndexType getIndexType() const
How is Index applied to BasePtr when computing addresses.
Definition: SelectionDAGNodes.h:2724
llvm::peekThroughBitcasts
SDValue peekThroughBitcasts(SDValue V)
Return the non-bitcasted source operand of V if it exists.
Definition: SelectionDAG.cpp:10738
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::BuildVectorSDNode::getConstantFPSplatNode
ConstantFPSDNode * getConstantFPSplatNode(const APInt &DemandedElts, BitVector *UndefElements=nullptr) const
Returns the demanded splatted constant FP or null if this is not a constant FP splat.
Definition: SelectionDAG.cpp:11664
llvm::StoreSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2389
llvm::VPGatherScatterSDNode::getScale
const SDValue & getScale() const
Definition: SelectionDAGNodes.h:2742
llvm::EVT::getSizeInBits
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
Definition: ValueTypes.h:340
Index
uint32_t Index
Definition: ELFObjHandler.cpp:82
uint64_t
llvm::ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS
@ ATOMIC_CMP_SWAP_WITH_SUCCESS
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
Definition: ISDOpcodes.h:1176
llvm::ISD::ATOMIC_LOAD_MIN
@ ATOMIC_LOAD_MIN
Definition: ISDOpcodes.h:1192
llvm::MemSDNode::refineAlignment
void refineAlignment(const MachineMemOperand *NewMMO)
Update this MemSDNode's MachineMemOperand information to reflect the alignment of NewMMO,...
Definition: SelectionDAGNodes.h:1373
llvm::RegisterSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2164
llvm::LifetimeSDNode
This SDNode is used for LIFETIME_START/LIFETIME_END values, which indicate the offet and size that ar...
Definition: SelectionDAGNodes.h:1798
llvm::ConstantFPSDNode
Definition: SelectionDAGNodes.h:1630
llvm::MemSDNode::getMemOperand
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
Definition: SelectionDAGNodes.h:1358
llvm::ISD::FIRST_TARGET_STRICTFP_OPCODE
static const int FIRST_TARGET_STRICTFP_OPCODE
FIRST_TARGET_STRICTFP_OPCODE - Target-specific pre-isel operations which cannot raise FP exceptions s...
Definition: ISDOpcodes.h:1313
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
llvm::ISD::LOAD
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
Definition: ISDOpcodes.h:966
llvm::SDUse::getValueType
EVT getValueType() const
Convenience function for get().getValueType().
Definition: SelectionDAGNodes.h:317
llvm::ConstantPoolSDNode::getType
Type * getType() const
Definition: SelectionDAG.cpp:11487
llvm::SDNode::print_details
void print_details(raw_ostream &OS, const SelectionDAG *G) const
Definition: SelectionDAGDumper.cpp:567
llvm::SDNode::hasPredecessor
bool hasPredecessor(const SDNode *N) const
Return true if N is a predecessor of this node.
Definition: SelectionDAG.cpp:11064
llvm::SDValue::isTargetMemoryOpcode
bool isTargetMemoryOpcode() const
Definition: SelectionDAGNodes.h:1162
llvm::ISD::SRCVALUE
@ SRCVALUE
SRCVALUE - This is a node type that holds a Value* that is used to make reference to a value in the L...
Definition: ISDOpcodes.h:1098
llvm::VPLoadSDNode
This class is used to represent a VP_LOAD node.
Definition: SelectionDAGNodes.h:2474
llvm::MaskedStoreSDNode::isTruncatingStore
bool isTruncatingStore() const
Return true if the op does a truncation before store.
Definition: SelectionDAGNodes.h:2690
llvm::ConstantSDNode::getMaybeAlignValue
MaybeAlign getMaybeAlignValue() const
Definition: SelectionDAGNodes.h:1601
llvm::FPMathOperator::hasAllowReciprocal
bool hasAllowReciprocal() const
Test if this operation can use reciprocal multiply instead of division.
Definition: Operator.h:269
llvm::MachinePointerInfo
This class contains a discriminated union of information about pointers in memory operands,...
Definition: MachineMemOperand.h:39
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::BuildVectorSDNode::BuildVectorSDNode
BuildVectorSDNode()=delete
llvm::ISD::isConstantSplatVector
bool isConstantSplatVector(const SDNode *N, APInt &SplatValue)
Node predicates.
Definition: SelectionDAG.cpp:140
llvm::VPBaseLoadStoreSDNode::getOffset
const SDValue & getOffset() const
Definition: SelectionDAGNodes.h:2415
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:54
llvm::SDNode::setNodeId
void setNodeId(int Id)
Set unique node id.
Definition: SelectionDAGNodes.h:726
llvm::VPGatherScatterSDNode::getMask
const SDValue & getMask() const
Definition: SelectionDAGNodes.h:2745
llvm::SDLoc::getDebugLoc
const DebugLoc & getDebugLoc() const
Definition: SelectionDAGNodes.h:1119
llvm::SyncScope::ID
uint8_t ID
Definition: LLVMContext.h:46
llvm::SDNode::LSBaseSDNodeBitfields
Definition: SelectionDAGNodes.h:517
llvm::MaskedGatherScatterSDNode::isIndexScaled
bool isIndexScaled() const
Definition: SelectionDAGNodes.h:2811
llvm::ISD::ATOMIC_LOAD_NAND
@ ATOMIC_LOAD_NAND
Definition: ISDOpcodes.h:1191
llvm::SDNode::getOperand
const SDValue & getOperand(unsigned Num) const
Definition: SelectionDAGNodes.h:918
llvm::MaskedStoreSDNode::MaskedStoreSDNode
MaskedStoreSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, ISD::MemIndexedMode AM, bool isTrunc, bool isCompressing, EVT MemVT, MachineMemOperand *MMO)
Definition: SelectionDAGNodes.h:2679
iterator.h
llvm::MaskedLoadSDNode::isExpandingLoad
bool isExpandingLoad() const
Definition: SelectionDAGNodes.h:2671
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::FrameIndexSDNode::getIndex
int getIndex() const
Definition: SelectionDAGNodes.h:1788
llvm::SDNode::use_iterator::getUse
SDUse & getUse() const
Definition: SelectionDAGNodes.h:787
llvm::SDNodeIterator::operator*
pointer operator*() const
Definition: SelectionDAGNodes.h:2980
llvm::SDNodeFlags::setAllowReciprocal
void setAllowReciprocal(bool b)
Definition: SelectionDAGNodes.h:424
llvm::BuildVectorSDNode::recastRawBits
static void recastRawBits(bool IsLittleEndian, unsigned DstEltSizeInBits, SmallVectorImpl< APInt > &DstBitElements, ArrayRef< APInt > SrcBitElements, BitVector &DstUndefElements, const BitVector &SrcUndefElements)
Recast bit data SrcBitElements to DstEltSizeInBits wide elements.
Definition: SelectionDAG.cpp:11729
Attributes
AMDGPU Kernel Attributes
Definition: AMDGPULowerKernelAttributes.cpp:244
llvm::CondCodeSDNode
Definition: SelectionDAGNodes.h:2266
llvm::ISD::ATOMIC_CMP_SWAP
@ ATOMIC_CMP_SWAP
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo,...
Definition: ISDOpcodes.h:1170
node
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper node
Definition: README-SSE.txt:406
llvm::ISD::ATOMIC_LOAD_ADD
@ ATOMIC_LOAD_ADD
Definition: ISDOpcodes.h:1185
llvm::SDNode::use_iterator::difference_type
std::ptrdiff_t difference_type
Definition: SelectionDAGNodes.h:753
llvm::VPStridedLoadSDNode::getExtensionType
ISD::LoadExtType getExtensionType() const
Definition: SelectionDAGNodes.h:2515
llvm::LoadSDNode::getExtensionType
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
Definition: SelectionDAGNodes.h:2351
llvm::SDNode::dump
void dump() const
Dump this node, for debugging.
Definition: SelectionDAGDumper.cpp:549
llvm::BasicBlockSDNode
Definition: SelectionDAGNodes.h:1959
llvm::MemSDNode::getOriginalAlign
Align getOriginalAlign() const
Returns alignment and volatility of the memory access.
Definition: SelectionDAGNodes.h:1289
ArrayRef.h
llvm::MachineSDNode::mmo_iterator
ArrayRef< MachineMemOperand * >::const_iterator mmo_iterator
Definition: SelectionDAGNodes.h:2919
llvm::SDValue::getScalarValueSizeInBits
uint64_t getScalarValueSizeInBits() const
Definition: SelectionDAGNodes.h:203
TemplateParamKind::Type
@ Type
llvm::SDNode::ConstantSDNodeBits
ConstantSDNodeBitfields ConstantSDNodeBits
Definition: SelectionDAGNodes.h:568
llvm::ISD::isFreezeUndef
bool isFreezeUndef(const SDNode *N)
Return true if the specified node is FREEZE(UNDEF).
Definition: SelectionDAG.cpp:329
END_TWO_BYTE_PACK
#define END_TWO_BYTE_PACK()
Definition: SelectionDAGNodes.h:479
llvm::GlobalAddressSDNode::getOffset
int64_t getOffset() const
Definition: SelectionDAGNodes.h:1764
llvm::BlockAddressSDNode::getTargetFlags
unsigned getTargetFlags() const
Definition: SelectionDAGNodes.h:2202
llvm::ISD::MSTORE
@ MSTORE
Definition: ISDOpcodes.h:1208
llvm::JumpTableSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1869
llvm::StoreSDNode
This class is used to represent ISD::STORE nodes.
Definition: SelectionDAGNodes.h:2364
llvm::ISD::ZEXTLOAD
@ ZEXTLOAD
Definition: ISDOpcodes.h:1404
llvm::SDValue::getValue
SDValue getValue(unsigned R) const
Definition: SelectionDAGNodes.h:179
llvm::AMDGPU::HSAMD::ValueType
ValueType
Value types.
Definition: AMDGPUMetadata.h:100
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::SDNodeFlags::hasNoUnsignedWrap
bool hasNoUnsignedWrap() const
Definition: SelectionDAGNodes.h:431
llvm::FPMathOperator::hasAllowReassoc
bool hasAllowReassoc() const
Test if this operation may be simplified with reassociative transforms.
Definition: Operator.h:249
llvm::FPMathOperator
Utility class for floating point operations which can have information about relaxed accuracy require...
Definition: Operator.h:167
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1666
llvm::LifetimeSDNode::getOffset
int64_t getOffset() const
Definition: SelectionDAGNodes.h:1812
llvm::SDNode::getNodeId
int getNodeId() const
Return the unique node id.
Definition: SelectionDAGNodes.h:723
llvm::SDLoc::SDLoc
SDLoc(const Instruction *I, int Order)
Definition: SelectionDAGNodes.h:1112
memcpy
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
llvm::ConstantSDNode::getZExtValue
uint64_t getZExtValue() const
Definition: SelectionDAGNodes.h:1596
llvm::SDValue::getResNo
unsigned getResNo() const
get the index which selects a specific result in the SDNode
Definition: SelectionDAGNodes.h:156
llvm::SDNode::print
void print(raw_ostream &OS, const SelectionDAG *G=nullptr) const
Definition: SelectionDAGDumper.cpp:1060
llvm::MaskedLoadSDNode
This class is used to represent an MLOAD node.
Definition: SelectionDAGNodes.h:2646
llvm::MachineMemOperand::getSuccessOrdering
AtomicOrdering getSuccessOrdering() const
Return the atomic ordering requirements for this memory operation.
Definition: MachineMemOperand.h:270
llvm::MCSymbolSDNode
Definition: SelectionDAGNodes.h:2250
llvm::ISD::CondCode
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
Definition: ISDOpcodes.h:1424
llvm::MaskedStoreSDNode::getOffset
const SDValue & getOffset() const
Definition: SelectionDAGNodes.h:2700
iterator_range.h
llvm::ISD::BasicBlock
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:82
llvm::MemSDNode::MemSDNode
MemSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT memvt, MachineMemOperand *MMO)
Definition: SelectionDAG.cpp:10898
llvm::ExternalSymbolSDNode::getTargetFlags
unsigned getTargetFlags() const
Definition: SelectionDAGNodes.h:2242
llvm::ISD::ATOMIC_LOAD_FSUB
@ ATOMIC_LOAD_FSUB
Definition: ISDOpcodes.h:1197
llvm::ISD::TargetGlobalTLSAddress
@ TargetGlobalTLSAddress
Definition: ISDOpcodes.h:165
llvm::DenseMapInfo< SDValue >::getTombstoneKey
static SDValue getTombstoneKey()
Definition: SelectionDAGNodes.h:246
llvm::MVT
Machine Value Type.
Definition: MachineValueType.h:31
llvm::ISD::isNON_EXTLoad
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
Definition: SelectionDAGNodes.h:3044
llvm::SDNode::use_iterator::operator==
bool operator==(const use_iterator &x) const
Definition: SelectionDAGNodes.h:760
llvm::SDNode::dumpr
void dumpr() const
Dump (recursively) this node and its use-def subgraph.
Definition: SelectionDAGDumper.cpp:1008
llvm::SDLoc::SDLoc
SDLoc(const SDNode *N)
Definition: SelectionDAGNodes.h:1110
llvm::SDVTList::VTs
const EVT * VTs
Definition: SelectionDAGNodes.h:80
llvm::MDNode
Metadata node.
Definition: Metadata.h:944
llvm::ShuffleVectorSDNode::ShuffleVectorSDNode
ShuffleVectorSDNode(EVT VT, unsigned Order, const DebugLoc &dl, const int *M)
Definition: SelectionDAGNodes.h:1531
llvm::SDNode::getSimpleValueType
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
Definition: SelectionDAGNodes.h:989
llvm::StoreSDNode::getValue
const SDValue & getValue() const
Definition: SelectionDAGNodes.h:2385
llvm::SDNode::getValueSizeInBits
TypeSize getValueSizeInBits(unsigned ResNo) const
Returns MVT::getSizeInBits(getValueType(ResNo)).
Definition: SelectionDAGNodes.h:998
llvm::SDNodeFlags::setNoInfs
void setNoInfs(bool b)
Definition: SelectionDAGNodes.h:422
llvm::AssertAlignSDNode::AssertAlignSDNode
AssertAlignSDNode(unsigned Order, const DebugLoc &DL, EVT VT, Align A)
Definition: SelectionDAGNodes.h:2952
llvm::DebugLoc::hasTrivialDestructor
bool hasTrivialDestructor() const
Check whether this has a trivial destructor.
Definition: DebugLoc.h:69
llvm::SmallPtrSetImpl::count
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
Definition: SmallPtrSet.h:383
llvm::FPMathOperator::hasApproxFunc
bool hasApproxFunc() const
Test if this operation allows approximations of math library functions or intrinsics.
Definition: Operator.h:280
llvm::SDNode::isMachineOpcode
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode.
Definition: SelectionDAGNodes.h:697
llvm::ISD::TargetBlockAddress
@ TargetBlockAddress
Definition: ISDOpcodes.h:170
llvm::SDNode::values
iterator_range< value_iterator > values() const
Definition: SelectionDAGNodes.h:1006
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::VPBaseLoadStoreSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:2421
llvm::PseudoProbeSDNode::getGuid
uint64_t getGuid() const
Definition: SelectionDAGNodes.h:1844
llvm::ISD::ANNOTATION_LABEL
@ ANNOTATION_LABEL
ANNOTATION_LABEL - Represents a mid basic block label used by annotations.
Definition: ISDOpcodes.h:1039
llvm::MDNodeSDNode
Definition: SelectionDAGNodes.h:2136
llvm::ISD::HANDLENODE
@ HANDLENODE
HANDLENODE node - Used as a handle for various purposes.
Definition: ISDOpcodes.h:1116
llvm::ISD::ConstantPool
@ ConstantPool
Definition: ISDOpcodes.h:82
llvm::SDLoc::SDLoc
SDLoc()=default
llvm::hasSingleElement
bool hasSingleElement(ContainerTy &&C)
Returns true if the given container only contains a single element.
Definition: STLExtras.h:261
llvm::LSBaseSDNode::LSBaseSDNode
LSBaseSDNode(ISD::NodeType NodeTy, unsigned Order, const DebugLoc &dl, SDVTList VTs, ISD::MemIndexedMode AM, EVT MemVT, MachineMemOperand *MMO)
Definition: SelectionDAGNodes.h:2305
ConstantPool
MIPS Relocation Principles In there are several elements of the llvm::ISD::NodeType enum that deal with addresses and or relocations These are defined in include llvm Target TargetSelectionDAG td ConstantPool
Definition: Relocation.txt:6
llvm::SDUse::getUser
SDNode * getUser()
This returns the SDNode that contains this Use.
Definition: SelectionDAGNodes.h:307
llvm::ISD::GlobalTLSAddress
@ GlobalTLSAddress
Definition: ISDOpcodes.h:79
llvm::MemSDNode::getAAInfo
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
Definition: SelectionDAGNodes.h:1322
llvm::BlockAddress
The address of a basic block.
Definition: Constants.h:849
llvm::ISD::TargetConstantPool
@ TargetConstantPool
Definition: ISDOpcodes.h:168
llvm::BuildVectorSDNode::isConstant
bool isConstant() const
Definition: SelectionDAG.cpp:11783
llvm::SDNode::use_iterator::operator->
SDNode * operator->() const
Definition: SelectionDAGNodes.h:785
llvm::MemSDNode::isAtomic
bool isAtomic() const
Return true if the memory operation ordering is Unordered or higher.
Definition: SelectionDAGNodes.h:1343
llvm::VPStridedStoreSDNode::getStride
const SDValue & getStride() const
Definition: SelectionDAGNodes.h:2594
llvm::LifetimeSDNode::getFrameIndex
int64_t getFrameIndex() const
Definition: SelectionDAGNodes.h:1807
llvm::SDNode::print_types
void print_types(raw_ostream &OS, const SelectionDAG *G) const
Definition: SelectionDAGDumper.cpp:557
llvm::ISD::isSEXTLoad
bool isSEXTLoad(const SDNode *N)
Returns true if the specified node is a SEXTLOAD.
Definition: SelectionDAGNodes.h:3056
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::ISD::isNormalLoad
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
Definition: SelectionDAGNodes.h:3037
llvm::ConstantPoolSDNode
Definition: SelectionDAGNodes.h:1875
llvm::BlockAddressSDNode::getBlockAddress
const BlockAddress * getBlockAddress() const
Definition: SelectionDAGNodes.h:2200
llvm::SrcValueSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2131
llvm::VPBaseLoadStoreSDNode::getAddressingMode
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc,...
Definition: SelectionDAGNodes.h:2456
llvm::BuildVectorSDNode::isConstantSplat
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.
Definition: SelectionDAG.cpp:11493
llvm::SDNode::use_end
static use_iterator use_end()
Definition: SelectionDAGNodes.h:801
Cond
SmallVector< MachineOperand, 4 > Cond
Definition: BasicBlockSections.cpp:137
llvm::SDNodeFlags::intersectWith
void intersectWith(const SDNodeFlags Flags)
Clear any flags in this flag set that aren't also set in Flags.
Definition: SelectionDAGNodes.h:445
llvm::HandleSDNode::~HandleSDNode
~HandleSDNode()
Definition: SelectionDAG.cpp:10880
llvm::BuildVectorSDNode
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Definition: SelectionDAGNodes.h:1980
llvm::FoldingSetBase::Node
Node - This class is used to maintain the singly linked bucket list in a folding set.
Definition: FoldingSet.h:136
llvm::SDNodeFlags::setNoFPExcept
void setNoFPExcept(bool b)
Definition: SelectionDAGNodes.h:428
llvm::SDNodeFlags::hasApproximateFuncs
bool hasApproximateFuncs() const
Definition: SelectionDAGNodes.h:439
llvm::ShuffleVectorSDNode::getMaskElt
int getMaskElt(unsigned Idx) const
Definition: SelectionDAGNodes.h:1540
llvm::SDNode::uses
iterator_range< use_iterator > uses() const
Definition: SelectionDAGNodes.h:806
llvm::ConstantPoolSDNode::getConstVal
const Constant * getConstVal() const
Definition: SelectionDAGNodes.h:1910
llvm::ConstantPoolSDNode::getOffset
int getOffset() const
Definition: SelectionDAGNodes.h:1920
llvm::SDValue::getMachineOpcode
unsigned getMachineOpcode() const
Definition: SelectionDAGNodes.h:1170
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::VPGatherSDNode
This class is used to represent an VP_GATHER node.
Definition: SelectionDAGNodes.h:2760
llvm::VPGatherScatterSDNode::isIndexSigned
bool isIndexSigned() const
Definition: SelectionDAGNodes.h:2730
llvm::BasicBlockSDNode::getBasicBlock
MachineBasicBlock * getBasicBlock() const
Definition: SelectionDAGNodes.h:1972
llvm::ISD::ATOMIC_LOAD_SUB
@ ATOMIC_LOAD_SUB
Definition: ISDOpcodes.h:1186
llvm::PseudoProbeSDNode::getIndex
uint64_t getIndex() const
Definition: SelectionDAGNodes.h:1845
uint32_t
llvm::SDNode::use_iterator::operator++
use_iterator operator++(int)
Definition: SelectionDAGNodes.h:775
llvm::SDNode::isOperandOf
bool isOperandOf(const SDNode *N) const
Return true if this node is an operand of N.
Definition: SelectionDAG.cpp:11011
llvm::MaskedGatherScatterSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:2820
llvm::RegisterMaskSDNode::getRegMask
const uint32_t * getRegMask() const
Definition: SelectionDAGNodes.h:2180
llvm::SDValue::getOperand
const SDValue & getOperand(unsigned i) const
Definition: SelectionDAGNodes.h:1146
llvm::SDNode::LSBaseSDNodeBits
LSBaseSDNodeBitfields LSBaseSDNodeBits
Definition: SelectionDAGNodes.h:570
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
BEGIN_TWO_BYTE_PACK
#define BEGIN_TWO_BYTE_PACK()
Definition: SelectionDAGNodes.h:478
llvm::VTSDNode
This class is used to represent EVT's, which are used to parameterize some operations.
Definition: SelectionDAGNodes.h:2285
llvm::MaskedStoreSDNode::isCompressingStore
bool isCompressingStore() const
Returns true if the op does a compression to the vector before storing.
Definition: SelectionDAGNodes.h:2696
llvm::SDNode::getIndexedModeName
static const char * getIndexedModeName(ISD::MemIndexedMode AM)
Definition: SelectionDAGDumper.cpp:502
llvm::FoldingSetNodeID
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:318
llvm::ConstantSDNode::getSExtValue
int64_t getSExtValue() const
Definition: SelectionDAGNodes.h:1597
llvm::SDNodeFlags::hasNoInfs
bool hasNoInfs() const
Definition: SelectionDAGNodes.h:435
llvm::ISD::UNDEF
@ UNDEF
UNDEF - An undefined node.
Definition: ISDOpcodes.h:211
llvm::SDValue::hasOneUse
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
Definition: SelectionDAGNodes.h:1182
llvm::ISD::BUILTIN_OP_END
@ BUILTIN_OP_END
BUILTIN_OP_END - This must be the last enum value in this list.
Definition: ISDOpcodes.h:1307
llvm::VPLoadSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:2490
llvm::VPBaseLoadStoreSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2466
llvm::ISD::isIndexTypeSigned
bool isIndexTypeSigned(MemIndexType IndexType)
Definition: ISDOpcodes.h:1390
llvm::ISD::ATOMIC_LOAD_FMAX
@ ATOMIC_LOAD_FMAX
Definition: ISDOpcodes.h:1198
llvm::SDValue::getSimpleValueType
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
Definition: SelectionDAGNodes.h:190
llvm::SDNode::ops
ArrayRef< SDUse > ops() const
Definition: SelectionDAGNodes.h:927
Node
Definition: ItaniumDemangle.h:155
llvm::AMDGPU::HSAMD::Kernel::Arg::Key::IsVolatile
constexpr char IsVolatile[]
Key for Kernel::Arg::Metadata::mIsVolatile.
Definition: AMDGPUMetadata.h:199
llvm::NVPTX::PTXLdStInstCode::Untyped
@ Untyped
Definition: NVPTX.h:119
llvm::peekThroughExtractSubvectors
SDValue peekThroughExtractSubvectors(SDValue V)
Return the non-extracted vector source operand of V if it exists.
Definition: SelectionDAG.cpp:10750
llvm::JumpTableSDNode::getIndex
int getIndex() const
Definition: SelectionDAGNodes.h:1866
llvm::SDVTList
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
Definition: SelectionDAGNodes.h:79
llvm::ISD::ATOMIC_SWAP
@ ATOMIC_SWAP
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN,...
Definition: ISDOpcodes.h:1184
llvm::MaskedGatherScatterSDNode::getIndexType
ISD::MemIndexType getIndexType() const
How is Index applied to BasePtr when computing addresses.
Definition: SelectionDAGNodes.h:2808
llvm::ISD::SEXTLOAD
@ SEXTLOAD
Definition: ISDOpcodes.h:1404
llvm::VPLoadSDNode::getMask
const SDValue & getMask() const
Definition: SelectionDAGNodes.h:2492
llvm::FPMathOperator::hasAllowContract
bool hasAllowContract() const
Test if this operation can be floating-point contracted (FMA).
Definition: Operator.h:274
llvm::VPBaseLoadStoreSDNode::isIndexed
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
Definition: SelectionDAGNodes.h:2461
llvm::VPGatherScatterSDNode::getIndex
const SDValue & getIndex() const
Definition: SelectionDAGNodes.h:2739
llvm::MachinePointerInfo::getAddrSpace
unsigned getAddrSpace() const
Return the LLVM IR address space number that this pointer points into.
Definition: MachineOperand.cpp:993
llvm::PointerUnion< const Value *, const PseudoSourceValue * >
llvm::isNullOrNullSplat
bool isNullOrNullSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI, bool AllowUndefs=false)
Return true if the value is a constant 0 integer or a splatted vector of a constant 0 integer (with n...
Definition: Utils.cpp:1203
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::ilist_node
Definition: ilist_node.h:149
llvm::SmallPtrSetImplBase::size
size_type size() const
Definition: SmallPtrSet.h:93
llvm::SDNode::NumSDNodeBits
@ NumSDNodeBits
Definition: SelectionDAGNodes.h:493
FoldingSet.h
llvm::LoadSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:2355
llvm::VPStridedLoadSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2525
llvm::AddrSpaceCastSDNode::getDestAddressSpace
unsigned getDestAddressSpace() const
Definition: SelectionDAGNodes.h:1264
llvm::SDNode::getOperationName
std::string getOperationName(const SelectionDAG *G=nullptr) const
Return the opcode of this operation for printing.
Definition: SelectionDAGDumper.cpp:58
llvm::SDUse::operator<
bool operator<(const SDValue &V) const
Convenience function for get().operator<.
Definition: SelectionDAGNodes.h:330
llvm::SDNode::isMemIntrinsic
bool isMemIntrinsic() const
Test if this node is a memory intrinsic (with valid pointer information).
Definition: SelectionDAGNodes.h:672
llvm::AtomicSDNode
This is an SDNode representing atomic operations.
Definition: SelectionDAGNodes.h:1441
llvm::ISD::FrameIndex
@ FrameIndex
Definition: ISDOpcodes.h:80
llvm::MemSDNode::writeMem
bool writeMem() const
Definition: SelectionDAGNodes.h:1286
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::SDNode::dumprFull
void dumprFull(const SelectionDAG *G=nullptr) const
printrFull to dbgs().
Definition: SelectionDAGDumper.cpp:1054
llvm::SDNode::isVPOpcode
bool isVPOpcode() const
Test if this node is a vector predication operation.
Definition: SelectionDAGNodes.h:693
llvm::VPStridedLoadSDNode::getMask
const SDValue & getMask() const
Definition: SelectionDAGNodes.h:2522
llvm::SDNode::isOnlyUserOf
bool isOnlyUserOf(const SDNode *N) const
Return true if this node is the only use of N.
Definition: SelectionDAG.cpp:10981
ExternalSymbol
MIPS Relocation Principles In there are several elements of the llvm::ISD::NodeType enum that deal with addresses and or relocations These are defined in include llvm Target TargetSelectionDAG td ExternalSymbol
Definition: Relocation.txt:7
llvm::ConstantFPSDNode::isExactlyValue
bool isExactlyValue(double V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
Definition: SelectionDAGNodes.h:1664
llvm::MaskedGatherScatterSDNode::getScale
const SDValue & getScale() const
Definition: SelectionDAGNodes.h:2823
llvm::VPBaseLoadStoreSDNode::VPBaseLoadStoreSDNode
VPBaseLoadStoreSDNode(ISD::NodeType NodeTy, unsigned Order, const DebugLoc &DL, SDVTList VTs, ISD::MemIndexedMode AM, EVT MemVT, MachineMemOperand *MMO)
Definition: SelectionDAGNodes.h:2400
llvm::isAllOnesConstant
bool isAllOnesConstant(SDValue V)
Returns true if V is an integer constant with all bits set.
Definition: SelectionDAG.cpp:10723
llvm::MachineSDNode::clearMemRefs
void clearMemRefs()
Clear out the memory reference descriptor list.
Definition: SelectionDAGNodes.h:2936
llvm::ConstantFPSDNode::getConstantFPValue
const ConstantFP * getConstantFPValue() const
Definition: SelectionDAGNodes.h:1642
llvm::SDValue::operator<
bool operator<(const SDValue &O) const
Definition: SelectionDAGNodes.h:172
llvm::MaskedStoreSDNode::getBasePtr
const SDValue & getBasePtr() const
Definition: SelectionDAGNodes.h:2699
llvm::VPGatherSDNode::VPGatherSDNode
VPGatherSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
Definition: SelectionDAGNodes.h:2764
llvm::SDNodeIterator::operator!=
bool operator!=(const SDNodeIterator &x) const
Definition: SelectionDAGNodes.h:2978
std
Definition: BitVector.h:851
llvm::GlobalAddressSDNode
Definition: SelectionDAGNodes.h:1751
llvm::VPStridedLoadSDNode::VPStridedLoadSDNode
VPStridedLoadSDNode(unsigned Order, const DebugLoc &DL, SDVTList VTs, ISD::MemIndexedMode AM, ISD::LoadExtType ETy, bool IsExpanding, EVT MemVT, MachineMemOperand *MMO)
Definition: SelectionDAGNodes.h:2506
llvm::SDNode::LoadSDNodeBitfields
Definition: SelectionDAGNodes.h:537
llvm::VPScatterSDNode::VPScatterSDNode
VPScatterSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
Definition: SelectionDAGNodes.h:2780
llvm::SDNode::getNumOperands
unsigned getNumOperands() const
Return the number of values used by this operation.
Definition: SelectionDAGNodes.h:905
llvm::GraphTraits< SDNode * >::getEntryNode
static NodeRef getEntryNode(SDNode *N)
Definition: SelectionDAGNodes.h:3011
llvm::SDNodeFlags::hasNoSignedWrap
bool hasNoSignedWrap() const
Definition: SelectionDAGNodes.h:432
llvm::ISD::isEXTLoad
bool isEXTLoad(const SDNode *N)
Returns true if the specified node is a EXTLOAD.
Definition: SelectionDAGNodes.h:3050
llvm::ConstantSDNode::isMaxSignedValue
bool isMaxSignedValue() const
Definition: SelectionDAGNodes.h:1611
uint16_t
llvm::SDNodeIterator
Definition: SelectionDAGNodes.h:2962
llvm::ConstantPoolSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:1931
llvm::MaskedLoadStoreSDNode::getAddressingMode
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc,...
Definition: SelectionDAGNodes.h:2629
llvm::isNullConstant
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
Definition: SelectionDAG.cpp:10713
llvm::EVT::getScalarType
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
Definition: ValueTypes.h:295
llvm::getBitwiseNotOperand
SDValue getBitwiseNotOperand(SDValue V, SDValue Mask, bool AllowUndefs)
If V is a bitwise not, returns the inverted operand.
Definition: SelectionDAG.cpp:4831
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:348
llvm::ISD::STRICT_FP_TO_FP16
@ STRICT_FP_TO_FP16
Definition: ISDOpcodes.h:899
llvm::ISD::TargetExternalSymbol
@ TargetExternalSymbol
Definition: ISDOpcodes.h:169
llvm::MemSDNode::getAddressSpace
unsigned getAddressSpace() const
Return the address space for the associated pointer.
Definition: SelectionDAGNodes.h:1365
llvm::BuildVectorSDNode::getConstantSplatNode
ConstantSDNode * getConstantSplatNode(const APInt &DemandedElts, BitVector *UndefElements=nullptr) const
Returns the demanded splatted constant or null if this is not a constant splat.
Definition: SelectionDAG.cpp:11652
llvm::Align::value
uint64_t value() const
This is a hole in the type system and should not be abused.
Definition: Alignment.h:85
llvm::MCSymbolSDNode::getMCSymbol
MCSymbol * getMCSymbol() const
Definition: SelectionDAGNodes.h:2259
llvm::MDNodeSDNode::getMD
const MDNode * getMD() const
Definition: SelectionDAGNodes.h:2146
llvm::MemSDNode::getAlignment
unsigned getAlignment() const
Definition: SelectionDAGNodes.h:1292
llvm::SDNode::printrWithDepth
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...
Definition: SelectionDAGDumper.cpp:1038
JumpTable
MIPS Relocation Principles In there are several elements of the llvm::ISD::NodeType enum that deal with addresses and or relocations These are defined in include llvm Target TargetSelectionDAG td JumpTable
Definition: Relocation.txt:6
llvm::SDNode::NumLSBaseSDNodeBits
@ NumLSBaseSDNodeBits
Definition: SelectionDAGNodes.h:535
llvm::ConstantFPSDNode::isInfinity
bool isInfinity() const
Return true if the value is an infinity.
Definition: SelectionDAGNodes.h:1651
llvm::VPStridedLoadSDNode::isExpandingLoad
bool isExpandingLoad() const
Definition: SelectionDAGNodes.h:2528
ISDOpcodes.h
llvm::TypeSize
Definition: TypeSize.h:435
llvm::TargetIndexSDNode
Completely target-dependent object reference.
Definition: SelectionDAGNodes.h:1938
llvm::MaskedLoadStoreSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2639
llvm::ISD::BUILD_VECTOR
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
Definition: ISDOpcodes.h:514
Casting.h
llvm::MemSDNode::MMO
MachineMemOperand * MMO
Memory reference information.
Definition: SelectionDAGNodes.h:1279
llvm::PointerUnion::getAddrOfPtr1
const First * getAddrOfPtr1() const
If the union is set to the first pointer type get an address pointing to it.
Definition: PointerUnion.h:168
llvm::BitWidth
constexpr unsigned BitWidth
Definition: BitmaskEnum.h:147
llvm::SDNode::use_iterator::operator!=
bool operator!=(const use_iterator &x) const
Definition: SelectionDAGNodes.h:761
llvm::ConstantPoolSDNode::ConstVal
const Constant * ConstVal
Definition: SelectionDAGNodes.h:1879
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::MachineSDNode::memoperands_end
mmo_iterator memoperands_end() const
Definition: SelectionDAGNodes.h:2932
x
TODO unsigned x
Definition: README.txt:10
llvm::SDValue
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
Definition: SelectionDAGNodes.h:145
llvm::SDValue::operator->
SDNode * operator->() const
Definition: SelectionDAGNodes.h:164
llvm::AddrSpaceCastSDNode
Definition: SelectionDAGNodes.h:1254
llvm::LSBaseSDNode::getAddressingMode
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc,...
Definition: SelectionDAGNodes.h:2319
llvm::SDNode::addUse
void addUse(SDUse &U)
This method should only be used by the SDUse class.
Definition: SelectionDAGNodes.h:1069
llvm::ISD::TargetConstant
@ TargetConstant
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification,...
Definition: ISDOpcodes.h:158
llvm::SDUse::operator!=
bool operator!=(const SDValue &V) const
Convenience function for get().operator!=.
Definition: SelectionDAGNodes.h:325
llvm::MaskedGatherSDNode::getExtensionType
ISD::LoadExtType getExtensionType() const
Definition: SelectionDAGNodes.h:2847
llvm::SDNode::getNumValues
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
Definition: SelectionDAGNodes.h:980
llvm::SrcValueSDNode
An SDNode that holds an arbitrary LLVM IR Value.
Definition: SelectionDAGNodes.h:2118
llvm::MachineSDNode::classof
static bool classof(const SDNode *N)
Definition: SelectionDAGNodes.h:2941
llvm::MachineMemOperand::isAtomic
bool isAtomic() const
Returns true if this operation has an atomic ordering requirement of unordered or higher,...
Definition: MachineMemOperand.h:296