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