LLVM  16.0.0git
SelectionDAG.h
Go to the documentation of this file.
1 //===- llvm/CodeGen/SelectionDAG.h - InstSelection DAG ----------*- 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 SelectionDAG class, and transitively defines the
10 // SDNode class and subclasses.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CODEGEN_SELECTIONDAG_H
15 #define LLVM_CODEGEN_SELECTIONDAG_H
16 
17 #include "llvm/ADT/APFloat.h"
18 #include "llvm/ADT/APInt.h"
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/ADT/DenseMap.h"
21 #include "llvm/ADT/DenseSet.h"
22 #include "llvm/ADT/FoldingSet.h"
23 #include "llvm/ADT/SmallVector.h"
24 #include "llvm/ADT/StringMap.h"
25 #include "llvm/ADT/ilist.h"
26 #include "llvm/ADT/iterator.h"
34 #include "llvm/IR/DebugLoc.h"
35 #include "llvm/IR/Metadata.h"
36 #include "llvm/Support/Allocator.h"
38 #include "llvm/Support/CodeGen.h"
42 #include <cassert>
43 #include <cstdint>
44 #include <functional>
45 #include <map>
46 #include <string>
47 #include <tuple>
48 #include <utility>
49 #include <vector>
50 
51 namespace llvm {
52 
53 class DIExpression;
54 class DILabel;
55 class DIVariable;
56 class Function;
57 class Pass;
58 class Type;
59 template <class GraphType> struct GraphTraits;
60 template <typename T, unsigned int N> class SmallSetVector;
61 template <typename T, typename Enable> struct FoldingSetTrait;
62 class AAResults;
63 class BlockAddress;
64 class BlockFrequencyInfo;
65 class Constant;
66 class ConstantFP;
67 class ConstantInt;
68 class DataLayout;
69 struct fltSemantics;
70 class FunctionLoweringInfo;
71 class GlobalValue;
72 struct KnownBits;
73 class LegacyDivergenceAnalysis;
74 class LLVMContext;
75 class MachineBasicBlock;
76 class MachineConstantPoolValue;
77 class MCSymbol;
78 class OptimizationRemarkEmitter;
79 class ProfileSummaryInfo;
80 class SDDbgValue;
81 class SDDbgOperand;
82 class SDDbgLabel;
83 class SelectionDAG;
84 class SelectionDAGTargetInfo;
85 class TargetLibraryInfo;
86 class TargetLowering;
87 class TargetMachine;
88 class TargetSubtargetInfo;
89 class Value;
90 
91 class SDVTListNode : public FoldingSetNode {
92  friend struct FoldingSetTrait<SDVTListNode>;
93 
94  /// A reference to an Interned FoldingSetNodeID for this node.
95  /// The Allocator in SelectionDAG holds the data.
96  /// SDVTList contains all types which are frequently accessed in SelectionDAG.
97  /// The size of this list is not expected to be big so it won't introduce
98  /// a memory penalty.
99  FoldingSetNodeIDRef FastID;
100  const EVT *VTs;
101  unsigned int NumVTs;
102  /// The hash value for SDVTList is fixed, so cache it to avoid
103  /// hash calculation.
104  unsigned HashValue;
105 
106 public:
107  SDVTListNode(const FoldingSetNodeIDRef ID, const EVT *VT, unsigned int Num) :
108  FastID(ID), VTs(VT), NumVTs(Num) {
109  HashValue = ID.ComputeHash();
110  }
111 
113  SDVTList result = {VTs, NumVTs};
114  return result;
115  }
116 };
117 
118 /// Specialize FoldingSetTrait for SDVTListNode
119 /// to avoid computing temp FoldingSetNodeID and hash value.
120 template<> struct FoldingSetTrait<SDVTListNode> : DefaultFoldingSetTrait<SDVTListNode> {
121  static void Profile(const SDVTListNode &X, FoldingSetNodeID& ID) {
122  ID = X.FastID;
123  }
124 
125  static bool Equals(const SDVTListNode &X, const FoldingSetNodeID &ID,
126  unsigned IDHash, FoldingSetNodeID &TempID) {
127  if (X.HashValue != IDHash)
128  return false;
129  return ID == X.FastID;
130  }
131 
132  static unsigned ComputeHash(const SDVTListNode &X, FoldingSetNodeID &TempID) {
133  return X.HashValue;
134  }
135 };
136 
137 template <> struct ilist_alloc_traits<SDNode> {
138  static void deleteNode(SDNode *) {
139  llvm_unreachable("ilist_traits<SDNode> shouldn't see a deleteNode call!");
140  }
141 };
142 
143 /// Keeps track of dbg_value information through SDISel. We do
144 /// not build SDNodes for these so as not to perturb the generated code;
145 /// instead the info is kept off to the side in this structure. Each SDNode may
146 /// have one or more associated dbg_value entries. This information is kept in
147 /// DbgValMap.
148 /// Byval parameters are handled separately because they don't use alloca's,
149 /// which busts the normal mechanism. There is good reason for handling all
150 /// parameters separately: they may not have code generated for them, they
151 /// should always go at the beginning of the function regardless of other code
152 /// motion, and debug info for them is potentially useful even if the parameter
153 /// is unused. Right now only byval parameters are handled separately.
154 class SDDbgInfo {
155  BumpPtrAllocator Alloc;
157  SmallVector<SDDbgValue*, 32> ByvalParmDbgValues;
158  SmallVector<SDDbgLabel*, 4> DbgLabels;
160  DbgValMapType DbgValMap;
161 
162 public:
163  SDDbgInfo() = default;
164  SDDbgInfo(const SDDbgInfo &) = delete;
165  SDDbgInfo &operator=(const SDDbgInfo &) = delete;
166 
167  void add(SDDbgValue *V, bool isParameter);
168 
169  void add(SDDbgLabel *L) { DbgLabels.push_back(L); }
170 
171  /// Invalidate all DbgValues attached to the node and remove
172  /// it from the Node-to-DbgValues map.
173  void erase(const SDNode *Node);
174 
175  void clear() {
176  DbgValMap.clear();
177  DbgValues.clear();
178  ByvalParmDbgValues.clear();
179  DbgLabels.clear();
180  Alloc.Reset();
181  }
182 
183  BumpPtrAllocator &getAlloc() { return Alloc; }
184 
185  bool empty() const {
186  return DbgValues.empty() && ByvalParmDbgValues.empty() && DbgLabels.empty();
187  }
188 
190  auto I = DbgValMap.find(Node);
191  if (I != DbgValMap.end())
192  return I->second;
193  return ArrayRef<SDDbgValue*>();
194  }
195 
198 
199  DbgIterator DbgBegin() { return DbgValues.begin(); }
200  DbgIterator DbgEnd() { return DbgValues.end(); }
201  DbgIterator ByvalParmDbgBegin() { return ByvalParmDbgValues.begin(); }
202  DbgIterator ByvalParmDbgEnd() { return ByvalParmDbgValues.end(); }
203  DbgLabelIterator DbgLabelBegin() { return DbgLabels.begin(); }
204  DbgLabelIterator DbgLabelEnd() { return DbgLabels.end(); }
205 };
206 
207 void checkForCycles(const SelectionDAG *DAG, bool force = false);
208 
209 /// This is used to represent a portion of an LLVM function in a low-level
210 /// Data Dependence DAG representation suitable for instruction selection.
211 /// This DAG is constructed as the first step of instruction selection in order
212 /// to allow implementation of machine specific optimizations
213 /// and code simplifications.
214 ///
215 /// The representation used by the SelectionDAG is a target-independent
216 /// representation, which has some similarities to the GCC RTL representation,
217 /// but is significantly more simple, powerful, and is a graph form instead of a
218 /// linear form.
219 ///
221  const TargetMachine &TM;
222  const SelectionDAGTargetInfo *TSI = nullptr;
223  const TargetLowering *TLI = nullptr;
224  const TargetLibraryInfo *LibInfo = nullptr;
225  MachineFunction *MF;
226  Pass *SDAGISelPass = nullptr;
227  LLVMContext *Context;
228  CodeGenOpt::Level OptLevel;
229 
230  LegacyDivergenceAnalysis * DA = nullptr;
231  FunctionLoweringInfo * FLI = nullptr;
232 
233  /// The function-level optimization remark emitter. Used to emit remarks
234  /// whenever manipulating the DAG.
236 
237  ProfileSummaryInfo *PSI = nullptr;
238  BlockFrequencyInfo *BFI = nullptr;
239 
240  /// The starting token.
241  SDNode EntryNode;
242 
243  /// The root of the entire DAG.
244  SDValue Root;
245 
246  /// A linked list of nodes in the current DAG.
247  ilist<SDNode> AllNodes;
248 
249  /// The AllocatorType for allocating SDNodes. We use
250  /// pool allocation with recycling.
252  sizeof(LargestSDNode),
253  alignof(MostAlignedSDNode)>;
254 
255  /// Pool allocation for nodes.
256  NodeAllocatorType NodeAllocator;
257 
258  /// This structure is used to memoize nodes, automatically performing
259  /// CSE with existing nodes when a duplicate is requested.
260  FoldingSet<SDNode> CSEMap;
261 
262  /// Pool allocation for machine-opcode SDNode operands.
263  BumpPtrAllocator OperandAllocator;
264  ArrayRecycler<SDUse> OperandRecycler;
265 
266  /// Pool allocation for misc. objects that are created once per SelectionDAG.
267  BumpPtrAllocator Allocator;
268 
269  /// Tracks dbg_value and dbg_label information through SDISel.
270  SDDbgInfo *DbgInfo;
271 
274 
275  struct NodeExtraInfo {
276  CallSiteInfo CSInfo;
277  MDNode *HeapAllocSite = nullptr;
278  MDNode *PCSections = nullptr;
279  bool NoMerge = false;
280  };
281  /// Out-of-line extra information for SDNodes.
283 
284  /// PersistentId counter to be used when inserting the next
285  /// SDNode to this SelectionDAG. We do not place that under
286  /// `#if LLVM_ENABLE_ABI_BREAKING_CHECKS` intentionally because
287  /// it adds unneeded complexity without noticeable
288  /// benefits (see discussion with @thakis in D120714).
289  uint16_t NextPersistentId = 0;
290 
291  /// Are instruction referencing variable locations desired for this function?
292  bool UseInstrRefDebugInfo = false;
293 
294 public:
295  /// Clients of various APIs that cause global effects on
296  /// the DAG can optionally implement this interface. This allows the clients
297  /// to handle the various sorts of updates that happen.
298  ///
299  /// A DAGUpdateListener automatically registers itself with DAG when it is
300  /// constructed, and removes itself when destroyed in RAII fashion.
304 
306  : Next(D.UpdateListeners), DAG(D) {
307  DAG.UpdateListeners = this;
308  }
309 
310  virtual ~DAGUpdateListener() {
311  assert(DAG.UpdateListeners == this &&
312  "DAGUpdateListeners must be destroyed in LIFO order");
313  DAG.UpdateListeners = Next;
314  }
315 
316  /// The node N that was deleted and, if E is not null, an
317  /// equivalent node E that replaced it.
318  virtual void NodeDeleted(SDNode *N, SDNode *E);
319 
320  /// The node N that was updated.
321  virtual void NodeUpdated(SDNode *N);
322 
323  /// The node N that was inserted.
324  virtual void NodeInserted(SDNode *N);
325  };
326 
329 
331  std::function<void(SDNode *, SDNode *)> Callback)
333 
334  void NodeDeleted(SDNode *N, SDNode *E) override { Callback(N, E); }
335 
336  private:
337  virtual void anchor();
338  };
339 
342 
344  std::function<void(SDNode *)> Callback)
346 
347  void NodeInserted(SDNode *N) override { Callback(N); }
348 
349  private:
350  virtual void anchor();
351  };
352 
353  /// Help to insert SDNodeFlags automatically in transforming. Use
354  /// RAII to save and resume flags in current scope.
355  class FlagInserter {
356  SelectionDAG &DAG;
357  SDNodeFlags Flags;
358  FlagInserter *LastInserter;
359 
360  public:
362  : DAG(SDAG), Flags(Flags),
363  LastInserter(SDAG.getFlagInserter()) {
364  SDAG.setFlagInserter(this);
365  }
367  : FlagInserter(SDAG, N->getFlags()) {}
368 
369  FlagInserter(const FlagInserter &) = delete;
370  FlagInserter &operator=(const FlagInserter &) = delete;
371  ~FlagInserter() { DAG.setFlagInserter(LastInserter); }
372 
373  SDNodeFlags getFlags() const { return Flags; }
374  };
375 
376  /// When true, additional steps are taken to
377  /// ensure that getConstant() and similar functions return DAG nodes that
378  /// have legal types. This is important after type legalization since
379  /// any illegally typed nodes generated after this point will not experience
380  /// type legalization.
382 
383 private:
384  /// DAGUpdateListener is a friend so it can manipulate the listener stack.
385  friend struct DAGUpdateListener;
386 
387  /// Linked list of registered DAGUpdateListener instances.
388  /// This stack is maintained by DAGUpdateListener RAII.
389  DAGUpdateListener *UpdateListeners = nullptr;
390 
391  /// Implementation of setSubgraphColor.
392  /// Return whether we had to truncate the search.
393  bool setSubgraphColorHelper(SDNode *N, const char *Color,
394  DenseSet<SDNode *> &visited,
395  int level, bool &printed);
396 
397  template <typename SDNodeT, typename... ArgTypes>
398  SDNodeT *newSDNode(ArgTypes &&... Args) {
399  return new (NodeAllocator.template Allocate<SDNodeT>())
400  SDNodeT(std::forward<ArgTypes>(Args)...);
401  }
402 
403  /// Build a synthetic SDNodeT with the given args and extract its subclass
404  /// data as an integer (e.g. for use in a folding set).
405  ///
406  /// The args to this function are the same as the args to SDNodeT's
407  /// constructor, except the second arg (assumed to be a const DebugLoc&) is
408  /// omitted.
409  template <typename SDNodeT, typename... ArgTypes>
410  static uint16_t getSyntheticNodeSubclassData(unsigned IROrder,
411  ArgTypes &&... Args) {
412  // The compiler can reduce this expression to a constant iff we pass an
413  // empty DebugLoc. Thankfully, the debug location doesn't have any bearing
414  // on the subclass data.
415  return SDNodeT(IROrder, DebugLoc(), std::forward<ArgTypes>(Args)...)
416  .getRawSubclassData();
417  }
418 
419  template <typename SDNodeTy>
420  static uint16_t getSyntheticNodeSubclassData(unsigned Opc, unsigned Order,
421  SDVTList VTs, EVT MemoryVT,
422  MachineMemOperand *MMO) {
423  return SDNodeTy(Opc, Order, DebugLoc(), VTs, MemoryVT, MMO)
424  .getRawSubclassData();
425  }
426 
427  void createOperands(SDNode *Node, ArrayRef<SDValue> Vals);
428 
429  void removeOperands(SDNode *Node) {
430  if (!Node->OperandList)
431  return;
432  OperandRecycler.deallocate(
434  Node->OperandList);
435  Node->NumOperands = 0;
436  Node->OperandList = nullptr;
437  }
438  void CreateTopologicalOrder(std::vector<SDNode*>& Order);
439 
440 public:
441  // Maximum depth for recursive analysis such as computeKnownBits, etc.
442  static constexpr unsigned MaxRecursionDepth = 6;
443 
445  SelectionDAG(const SelectionDAG &) = delete;
446  SelectionDAG &operator=(const SelectionDAG &) = delete;
447  ~SelectionDAG();
448 
449  /// Prepare this SelectionDAG to process code in the given MachineFunction.
450  void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE,
451  Pass *PassPtr, const TargetLibraryInfo *LibraryInfo,
452  LegacyDivergenceAnalysis * Divergence,
453  ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin);
454 
456  FLI = FuncInfo;
457  }
458 
459  /// Clear state and free memory necessary to make this
460  /// SelectionDAG ready to process a new block.
461  void clear();
462 
463  MachineFunction &getMachineFunction() const { return *MF; }
464  const Pass *getPass() const { return SDAGISelPass; }
465 
466  const DataLayout &getDataLayout() const { return MF->getDataLayout(); }
467  const TargetMachine &getTarget() const { return TM; }
468  const TargetSubtargetInfo &getSubtarget() const { return MF->getSubtarget(); }
469  template <typename STC> const STC &getSubtarget() const {
470  return MF->getSubtarget<STC>();
471  }
472  const TargetLowering &getTargetLoweringInfo() const { return *TLI; }
473  const TargetLibraryInfo &getLibInfo() const { return *LibInfo; }
474  const SelectionDAGTargetInfo &getSelectionDAGInfo() const { return *TSI; }
476  LLVMContext *getContext() const { return Context; }
477  OptimizationRemarkEmitter &getORE() const { return *ORE; }
478  ProfileSummaryInfo *getPSI() const { return PSI; }
479  BlockFrequencyInfo *getBFI() const { return BFI; }
480 
481  FlagInserter *getFlagInserter() { return Inserter; }
482  void setFlagInserter(FlagInserter *FI) { Inserter = FI; }
483 
484  /// Just dump dot graph to a user-provided path and title.
485  /// This doesn't open the dot viewer program and
486  /// helps visualization when outside debugging session.
487  /// FileName expects absolute path. If provided
488  /// without any path separators then the file
489  /// will be created in the current directory.
490  /// Error will be emitted if the path is insane.
491 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
492  LLVM_DUMP_METHOD void dumpDotGraph(const Twine &FileName, const Twine &Title);
493 #endif
494 
495  /// Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
496  void viewGraph(const std::string &Title);
497  void viewGraph();
498 
499 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
500  std::map<const SDNode *, std::string> NodeGraphAttrs;
501 #endif
502 
503  /// Clear all previously defined node graph attributes.
504  /// Intended to be used from a debugging tool (eg. gdb).
505  void clearGraphAttrs();
506 
507  /// Set graph attributes for a node. (eg. "color=red".)
508  void setGraphAttrs(const SDNode *N, const char *Attrs);
509 
510  /// Get graph attributes for a node. (eg. "color=red".)
511  /// Used from getNodeAttributes.
512  std::string getGraphAttrs(const SDNode *N) const;
513 
514  /// Convenience for setting node color attribute.
515  void setGraphColor(const SDNode *N, const char *Color);
516 
517  /// Convenience for setting subgraph color attribute.
518  void setSubgraphColor(SDNode *N, const char *Color);
519 
521 
522  allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); }
523  allnodes_const_iterator allnodes_end() const { return AllNodes.end(); }
524 
526 
527  allnodes_iterator allnodes_begin() { return AllNodes.begin(); }
528  allnodes_iterator allnodes_end() { return AllNodes.end(); }
529 
531  return AllNodes.size();
532  }
533 
536  }
539  }
540 
541  /// Return the root tag of the SelectionDAG.
542  const SDValue &getRoot() const { return Root; }
543 
544  /// Return the token chain corresponding to the entry of the function.
546  return SDValue(const_cast<SDNode *>(&EntryNode), 0);
547  }
548 
549  /// Set the current root tag of the SelectionDAG.
550  ///
552  assert((!N.getNode() || N.getValueType() == MVT::Other) &&
553  "DAG root value is not a chain!");
554  if (N.getNode())
555  checkForCycles(N.getNode(), this);
556  Root = N;
557  if (N.getNode())
558  checkForCycles(this);
559  return Root;
560  }
561 
562 #ifndef NDEBUG
563  void VerifyDAGDivergence();
564 #endif
565 
566  /// This iterates over the nodes in the SelectionDAG, folding
567  /// certain types of nodes together, or eliminating superfluous nodes. The
568  /// Level argument controls whether Combine is allowed to produce nodes and
569  /// types that are illegal on the target.
571  CodeGenOpt::Level OptLevel);
572 
573  /// This transforms the SelectionDAG into a SelectionDAG that
574  /// only uses types natively supported by the target.
575  /// Returns "true" if it made any changes.
576  ///
577  /// Note that this is an involved process that may invalidate pointers into
578  /// the graph.
579  bool LegalizeTypes();
580 
581  /// This transforms the SelectionDAG into a SelectionDAG that is
582  /// compatible with the target instruction selector, as indicated by the
583  /// TargetLowering object.
584  ///
585  /// Note that this is an involved process that may invalidate pointers into
586  /// the graph.
587  void Legalize();
588 
589  /// Transforms a SelectionDAG node and any operands to it into a node
590  /// that is compatible with the target instruction selector, as indicated by
591  /// the TargetLowering object.
592  ///
593  /// \returns true if \c N is a valid, legal node after calling this.
594  ///
595  /// This essentially runs a single recursive walk of the \c Legalize process
596  /// over the given node (and its operands). This can be used to incrementally
597  /// legalize the DAG. All of the nodes which are directly replaced,
598  /// potentially including N, are added to the output parameter \c
599  /// UpdatedNodes so that the delta to the DAG can be understood by the
600  /// caller.
601  ///
602  /// When this returns false, N has been legalized in a way that make the
603  /// pointer passed in no longer valid. It may have even been deleted from the
604  /// DAG, and so it shouldn't be used further. When this returns true, the
605  /// N passed in is a legal node, and can be immediately processed as such.
606  /// This may still have done some work on the DAG, and will still populate
607  /// UpdatedNodes with any new nodes replacing those originally in the DAG.
608  bool LegalizeOp(SDNode *N, SmallSetVector<SDNode *, 16> &UpdatedNodes);
609 
610  /// This transforms the SelectionDAG into a SelectionDAG
611  /// that only uses vector math operations supported by the target. This is
612  /// necessary as a separate step from Legalize because unrolling a vector
613  /// operation can introduce illegal types, which requires running
614  /// LegalizeTypes again.
615  ///
616  /// This returns true if it made any changes; in that case, LegalizeTypes
617  /// is called again before Legalize.
618  ///
619  /// Note that this is an involved process that may invalidate pointers into
620  /// the graph.
621  bool LegalizeVectors();
622 
623  /// This method deletes all unreachable nodes in the SelectionDAG.
624  void RemoveDeadNodes();
625 
626  /// Remove the specified node from the system. This node must
627  /// have no referrers.
628  void DeleteNode(SDNode *N);
629 
630  /// Return an SDVTList that represents the list of values specified.
631  SDVTList getVTList(EVT VT);
632  SDVTList getVTList(EVT VT1, EVT VT2);
633  SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3);
634  SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3, EVT VT4);
636 
637  //===--------------------------------------------------------------------===//
638  // Node creation methods.
639 
640  /// Create a ConstantSDNode wrapping a constant value.
641  /// If VT is a vector type, the constant is splatted into a BUILD_VECTOR.
642  ///
643  /// If only legal types can be produced, this does the necessary
644  /// transformations (e.g., if the vector element type is illegal).
645  /// @{
646  SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT,
647  bool isTarget = false, bool isOpaque = false);
648  SDValue getConstant(const APInt &Val, const SDLoc &DL, EVT VT,
649  bool isTarget = false, bool isOpaque = false);
650 
651  SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget = false,
652  bool IsOpaque = false) {
654  IsTarget, IsOpaque);
655  }
656 
657  SDValue getConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT,
658  bool isTarget = false, bool isOpaque = false);
660  bool isTarget = false);
662  bool LegalTypes = true);
664  bool isTarget = false);
665 
667  bool isOpaque = false) {
668  return getConstant(Val, DL, VT, true, isOpaque);
669  }
670  SDValue getTargetConstant(const APInt &Val, const SDLoc &DL, EVT VT,
671  bool isOpaque = false) {
672  return getConstant(Val, DL, VT, true, isOpaque);
673  }
675  bool isOpaque = false) {
676  return getConstant(Val, DL, VT, true, isOpaque);
677  }
678 
679  /// Create a true or false constant of type \p VT using the target's
680  /// BooleanContent for type \p OpVT.
681  SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT);
682  /// @}
683 
684  /// Create a ConstantFPSDNode wrapping a constant value.
685  /// If VT is a vector type, the constant is splatted into a BUILD_VECTOR.
686  ///
687  /// If only legal types can be produced, this does the necessary
688  /// transformations (e.g., if the vector element type is illegal).
689  /// The forms that take a double should only be used for simple constants
690  /// that can be exactly represented in VT. No checks are made.
691  /// @{
692  SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT,
693  bool isTarget = false);
694  SDValue getConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT,
695  bool isTarget = false);
696  SDValue getConstantFP(const ConstantFP &V, const SDLoc &DL, EVT VT,
697  bool isTarget = false);
698  SDValue getTargetConstantFP(double Val, const SDLoc &DL, EVT VT) {
699  return getConstantFP(Val, DL, VT, true);
700  }
701  SDValue getTargetConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT) {
702  return getConstantFP(Val, DL, VT, true);
703  }
704  SDValue getTargetConstantFP(const ConstantFP &Val, const SDLoc &DL, EVT VT) {
705  return getConstantFP(Val, DL, VT, true);
706  }
707  /// @}
708 
709  SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT,
710  int64_t offset = 0, bool isTargetGA = false,
711  unsigned TargetFlags = 0);
713  int64_t offset = 0, unsigned TargetFlags = 0) {
714  return getGlobalAddress(GV, DL, VT, offset, true, TargetFlags);
715  }
716  SDValue getFrameIndex(int FI, EVT VT, bool isTarget = false);
718  return getFrameIndex(FI, VT, true);
719  }
720  SDValue getJumpTable(int JTI, EVT VT, bool isTarget = false,
721  unsigned TargetFlags = 0);
722  SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags = 0) {
723  return getJumpTable(JTI, VT, true, TargetFlags);
724  }
726  int Offs = 0, bool isT = false,
727  unsigned TargetFlags = 0);
729  MaybeAlign Align = None, int Offset = 0,
730  unsigned TargetFlags = 0) {
731  return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
732  }
734  MaybeAlign Align = None, int Offs = 0,
735  bool isT = false, unsigned TargetFlags = 0);
737  MaybeAlign Align = None, int Offset = 0,
738  unsigned TargetFlags = 0) {
739  return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
740  }
741  SDValue getTargetIndex(int Index, EVT VT, int64_t Offset = 0,
742  unsigned TargetFlags = 0);
743  // When generating a branch to a BB, we don't in general know enough
744  // to provide debug info for the BB at that time, so keep this one around.
746  SDValue getExternalSymbol(const char *Sym, EVT VT);
747  SDValue getTargetExternalSymbol(const char *Sym, EVT VT,
748  unsigned TargetFlags = 0);
749  SDValue getMCSymbol(MCSymbol *Sym, EVT VT);
750 
752  SDValue getRegister(unsigned Reg, EVT VT);
753  SDValue getRegisterMask(const uint32_t *RegMask);
754  SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label);
755  SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root,
756  MCSymbol *Label);
757  SDValue getBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset = 0,
758  bool isTarget = false, unsigned TargetFlags = 0);
760  int64_t Offset = 0, unsigned TargetFlags = 0) {
761  return getBlockAddress(BA, VT, Offset, true, TargetFlags);
762  }
763 
764  SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg,
765  SDValue N) {
766  return getNode(ISD::CopyToReg, dl, MVT::Other, Chain,
767  getRegister(Reg, N.getValueType()), N);
768  }
769 
770  // This version of the getCopyToReg method takes an extra operand, which
771  // indicates that there is potentially an incoming glue value (if Glue is not
772  // null) and that there should be a glue result.
773  SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N,
774  SDValue Glue) {
776  SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Glue };
777  return getNode(ISD::CopyToReg, dl, VTs,
778  makeArrayRef(Ops, Glue.getNode() ? 4 : 3));
779  }
780 
781  // Similar to last getCopyToReg() except parameter Reg is a SDValue
783  SDValue Glue) {
785  SDValue Ops[] = { Chain, Reg, N, Glue };
786  return getNode(ISD::CopyToReg, dl, VTs,
787  makeArrayRef(Ops, Glue.getNode() ? 4 : 3));
788  }
789 
790  SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT) {
791  SDVTList VTs = getVTList(VT, MVT::Other);
792  SDValue Ops[] = { Chain, getRegister(Reg, VT) };
793  return getNode(ISD::CopyFromReg, dl, VTs, Ops);
794  }
795 
796  // This version of the getCopyFromReg method takes an extra operand, which
797  // indicates that there is potentially an incoming glue value (if Glue is not
798  // null) and that there should be a glue result.
799  SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT,
800  SDValue Glue) {
802  SDValue Ops[] = { Chain, getRegister(Reg, VT), Glue };
803  return getNode(ISD::CopyFromReg, dl, VTs,
804  makeArrayRef(Ops, Glue.getNode() ? 3 : 2));
805  }
806 
808 
809  /// Return an ISD::VECTOR_SHUFFLE node. The number of elements in VT,
810  /// which must be a vector type, must match the number of mask elements
811  /// NumElts. An integer mask element equal to -1 is treated as undefined.
812  SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2,
814 
815  /// Return an ISD::BUILD_VECTOR node. The number of elements in VT,
816  /// which must be a vector type, must match the number of operands in Ops.
817  /// The operands must have the same type as (or, for integers, a type wider
818  /// than) VT's element type.
820  // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
821  return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
822  }
823 
824  /// Return an ISD::BUILD_VECTOR node. The number of elements in VT,
825  /// which must be a vector type, must match the number of operands in Ops.
826  /// The operands must have the same type as (or, for integers, a type wider
827  /// than) VT's element type.
829  // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
830  return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
831  }
832 
833  /// Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all
834  /// elements. VT must be a vector type. Op's type must be the same as (or,
835  /// for integers, a type wider than) VT's element type.
837  // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
838  if (Op.getOpcode() == ISD::UNDEF) {
839  assert((VT.getVectorElementType() == Op.getValueType() ||
840  (VT.isInteger() &&
841  VT.getVectorElementType().bitsLE(Op.getValueType()))) &&
842  "A splatted value must have a width equal or (for integers) "
843  "greater than the vector element type!");
844  return getNode(ISD::UNDEF, SDLoc(), VT);
845  }
846 
848  return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
849  }
850 
851  // Return a splat ISD::SPLAT_VECTOR node, consisting of Op splatted to all
852  // elements.
854  if (Op.getOpcode() == ISD::UNDEF) {
855  assert((VT.getVectorElementType() == Op.getValueType() ||
856  (VT.isInteger() &&
857  VT.getVectorElementType().bitsLE(Op.getValueType()))) &&
858  "A splatted value must have a width equal or (for integers) "
859  "greater than the vector element type!");
860  return getNode(ISD::UNDEF, SDLoc(), VT);
861  }
862  return getNode(ISD::SPLAT_VECTOR, DL, VT, Op);
863  }
864 
865  /// Returns a vector of type ResVT whose elements contain the linear sequence
866  /// <0, Step, Step * 2, Step * 3, ...>
867  SDValue getStepVector(const SDLoc &DL, EVT ResVT, APInt StepVal);
868 
869  /// Returns a vector of type ResVT whose elements contain the linear sequence
870  /// <0, 1, 2, 3, ...>
871  SDValue getStepVector(const SDLoc &DL, EVT ResVT);
872 
873  /// Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to
874  /// the shuffle node in input but with swapped operands.
875  ///
876  /// Example: shuffle A, B, <0,5,2,7> -> shuffle B, A, <4,1,6,3>
878 
879  /// Convert Op, which must be of float type, to the
880  /// float type VT, by either extending or rounding (by truncation).
882 
883  /// Convert Op, which must be a STRICT operation of float type, to the
884  /// float type VT, by either extending or rounding (by truncation).
885  std::pair<SDValue, SDValue>
886  getStrictFPExtendOrRound(SDValue Op, SDValue Chain, const SDLoc &DL, EVT VT);
887 
888  /// Convert Op, which must be of integer type, to the
889  /// integer type VT, by either any-extending or truncating it.
891 
892  /// Convert Op, which must be of integer type, to the
893  /// integer type VT, by either sign-extending or truncating it.
894  SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT);
895 
896  /// Convert Op, which must be of integer type, to the
897  /// integer type VT, by either zero-extending or truncating it.
898  SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT);
899 
900  /// Return the expression required to zero extend the Op
901  /// value assuming it was the smaller SrcTy value.
903 
904  /// Convert Op, which must be of integer type, to the integer type VT, by
905  /// either truncating it or performing either zero or sign extension as
906  /// appropriate extension for the pointer's semantics.
908 
909  /// Return the expression required to extend the Op as a pointer value
910  /// assuming it was the smaller SrcTy value. This may be either a zero extend
911  /// or a sign extend.
913 
914  /// Convert Op, which must be of integer type, to the integer type VT,
915  /// by using an extension appropriate for the target's
916  /// BooleanContent for type OpVT or truncating it.
917  SDValue getBoolExtOrTrunc(SDValue Op, const SDLoc &SL, EVT VT, EVT OpVT);
918 
919  /// Create a bitwise NOT operation as (XOR Val, -1).
920  SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT);
921 
922  /// Create a logical NOT operation as (XOR Val, BooleanOne).
923  SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT);
924 
925  /// Create a vector-predicated logical NOT operation as (VP_XOR Val,
926  /// BooleanOne, Mask, EVL).
928  SDValue EVL, EVT VT);
929 
930  /// Returns sum of the base pointer and offset.
931  /// Unlike getObjectPtrOffset this does not set NoUnsignedWrap by default.
933  const SDNodeFlags Flags = SDNodeFlags());
935  const SDNodeFlags Flags = SDNodeFlags());
936 
937  /// Create an add instruction with appropriate flags when used for
938  /// addressing some offset of an object. i.e. if a load is split into multiple
939  /// components, create an add nuw from the base pointer to the offset.
941  SDNodeFlags Flags;
942  Flags.setNoUnsignedWrap(true);
943  return getMemBasePlusOffset(Ptr, Offset, SL, Flags);
944  }
945 
947  // The object itself can't wrap around the address space, so it shouldn't be
948  // possible for the adds of the offsets to the split parts to overflow.
949  SDNodeFlags Flags;
950  Flags.setNoUnsignedWrap(true);
951  return getMemBasePlusOffset(Ptr, Offset, SL, Flags);
952  }
953 
954  /// Return a new CALLSEQ_START node, that starts new call frame, in which
955  /// InSize bytes are set up inside CALLSEQ_START..CALLSEQ_END sequence and
956  /// OutSize specifies part of the frame set up prior to the sequence.
958  const SDLoc &DL) {
960  SDValue Ops[] = { Chain,
961  getIntPtrConstant(InSize, DL, true),
962  getIntPtrConstant(OutSize, DL, true) };
963  return getNode(ISD::CALLSEQ_START, DL, VTs, Ops);
964  }
965 
966  /// Return a new CALLSEQ_END node, which always must have a
967  /// glue result (to ensure it's not CSE'd).
968  /// CALLSEQ_END does not have a useful SDLoc.
970  SDValue InGlue, const SDLoc &DL) {
973  Ops.push_back(Chain);
974  Ops.push_back(Op1);
975  Ops.push_back(Op2);
976  if (InGlue.getNode())
977  Ops.push_back(InGlue);
978  return getNode(ISD::CALLSEQ_END, DL, NodeTys, Ops);
979  }
980 
982  SDValue Glue, const SDLoc &DL) {
983  return getCALLSEQ_END(
984  Chain, getIntPtrConstant(Size1, DL, /*isTarget=*/true),
985  getIntPtrConstant(Size2, DL, /*isTarget=*/true), Glue, DL);
986  }
987 
988  /// Return true if the result of this operation is always undefined.
989  bool isUndef(unsigned Opcode, ArrayRef<SDValue> Ops);
990 
991  /// Return an UNDEF node. UNDEF does not have a useful SDLoc.
993  return getNode(ISD::UNDEF, SDLoc(), VT);
994  }
995 
996  /// Return a node that represents the runtime scaling 'MulImm * RuntimeVL'.
997  SDValue getVScale(const SDLoc &DL, EVT VT, APInt MulImm) {
998  assert(MulImm.getMinSignedBits() <= VT.getSizeInBits() &&
999  "Immediate does not fit VT");
1000  return getNode(ISD::VSCALE, DL, VT,
1001  getConstant(MulImm.sextOrTrunc(VT.getSizeInBits()), DL, VT));
1002  }
1003 
1004  /// Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
1006  return getNode(ISD::GLOBAL_OFFSET_TABLE, SDLoc(), VT);
1007  }
1008 
1009  /// Gets or creates the specified node.
1010  ///
1011  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1012  ArrayRef<SDUse> Ops);
1013  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1014  ArrayRef<SDValue> Ops, const SDNodeFlags Flags);
1015  SDValue getNode(unsigned Opcode, const SDLoc &DL, ArrayRef<EVT> ResultTys,
1016  ArrayRef<SDValue> Ops);
1017  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1018  ArrayRef<SDValue> Ops, const SDNodeFlags Flags);
1019 
1020  // Use flags from current flag inserter.
1021  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1022  ArrayRef<SDValue> Ops);
1023  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1024  ArrayRef<SDValue> Ops);
1025  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue Operand);
1026  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1027  SDValue N2);
1028  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1029  SDValue N2, SDValue N3);
1030 
1031  // Specialize based on number of operands.
1032  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT);
1033  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue Operand,
1034  const SDNodeFlags Flags);
1035  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1036  SDValue N2, const SDNodeFlags Flags);
1037  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1038  SDValue N2, SDValue N3, const SDNodeFlags Flags);
1039  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1040  SDValue N2, SDValue N3, SDValue N4);
1041  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1042  SDValue N2, SDValue N3, SDValue N4, SDValue N5);
1043 
1044  // Specialize again based on number of operands for nodes with a VTList
1045  // rather than a single VT.
1046  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList);
1047  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N);
1048  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1,
1049  SDValue N2);
1050  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1,
1051  SDValue N2, SDValue N3);
1052  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1,
1053  SDValue N2, SDValue N3, SDValue N4);
1054  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1,
1055  SDValue N2, SDValue N3, SDValue N4, SDValue N5);
1056 
1057  /// Compute a TokenFactor to force all the incoming stack arguments to be
1058  /// loaded from the stack. This is used in tail call lowering to protect
1059  /// stack arguments from being clobbered.
1061 
1062  SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
1063  SDValue Size, Align Alignment, bool isVol,
1064  bool AlwaysInline, bool isTailCall,
1065  MachinePointerInfo DstPtrInfo,
1066  MachinePointerInfo SrcPtrInfo,
1067  const AAMDNodes &AAInfo = AAMDNodes(),
1068  AAResults *AA = nullptr);
1069 
1070  SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
1071  SDValue Size, Align Alignment, bool isVol, bool isTailCall,
1072  MachinePointerInfo DstPtrInfo,
1073  MachinePointerInfo SrcPtrInfo,
1074  const AAMDNodes &AAInfo = AAMDNodes(),
1075  AAResults *AA = nullptr);
1076 
1077  SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
1078  SDValue Size, Align Alignment, bool isVol,
1079  bool AlwaysInline, bool isTailCall,
1080  MachinePointerInfo DstPtrInfo,
1081  const AAMDNodes &AAInfo = AAMDNodes());
1082 
1083  SDValue getAtomicMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst,
1084  SDValue Src, SDValue Size, Type *SizeTy,
1085  unsigned ElemSz, bool isTailCall,
1086  MachinePointerInfo DstPtrInfo,
1087  MachinePointerInfo SrcPtrInfo);
1088 
1089  SDValue getAtomicMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst,
1090  SDValue Src, SDValue Size, Type *SizeTy,
1091  unsigned ElemSz, bool isTailCall,
1092  MachinePointerInfo DstPtrInfo,
1093  MachinePointerInfo SrcPtrInfo);
1094 
1095  SDValue getAtomicMemset(SDValue Chain, const SDLoc &dl, SDValue Dst,
1096  SDValue Value, SDValue Size, Type *SizeTy,
1097  unsigned ElemSz, bool isTailCall,
1098  MachinePointerInfo DstPtrInfo);
1099 
1100  /// Helper function to make it easier to build SetCC's if you just have an
1101  /// ISD::CondCode instead of an SDValue.
1103  ISD::CondCode Cond, SDValue Chain = SDValue(),
1104  bool IsSignaling = false) {
1105  assert(LHS.getValueType().isVector() == RHS.getValueType().isVector() &&
1106  "Cannot compare scalars to vectors");
1107  assert(LHS.getValueType().isVector() == VT.isVector() &&
1108  "Cannot compare scalars to vectors");
1110  "Cannot create a setCC of an invalid node.");
1111  if (Chain)
1112  return getNode(IsSignaling ? ISD::STRICT_FSETCCS : ISD::STRICT_FSETCC, DL,
1113  {VT, MVT::Other}, {Chain, LHS, RHS, getCondCode(Cond)});
1114  return getNode(ISD::SETCC, DL, VT, LHS, RHS, getCondCode(Cond));
1115  }
1116 
1117  /// Helper function to make it easier to build VP_SETCCs if you just have an
1118  /// ISD::CondCode instead of an SDValue.
1121  assert(LHS.getValueType().isVector() && RHS.getValueType().isVector() &&
1122  "Cannot compare scalars");
1124  "Cannot create a setCC of an invalid node.");
1125  return getNode(ISD::VP_SETCC, DL, VT, LHS, RHS, getCondCode(Cond), Mask,
1126  EVL);
1127  }
1128 
1129  /// Helper function to make it easier to build Select's if you just have
1130  /// operands and don't want to check for vector.
1132  SDValue RHS) {
1133  assert(LHS.getValueType() == VT && RHS.getValueType() == VT &&
1134  "Cannot use select on differing types");
1135  auto Opcode = Cond.getValueType().isVector() ? ISD::VSELECT : ISD::SELECT;
1136  return getNode(Opcode, DL, VT, Cond, LHS, RHS);
1137  }
1138 
1139  /// Helper function to make it easier to build SelectCC's if you just have an
1140  /// ISD::CondCode instead of an SDValue.
1142  SDValue False, ISD::CondCode Cond) {
1143  return getNode(ISD::SELECT_CC, DL, True.getValueType(), LHS, RHS, True,
1144  False, getCondCode(Cond));
1145  }
1146 
1147  /// Try to simplify a select/vselect into 1 of its operands or a constant.
1149 
1150  /// Try to simplify a shift into 1 of its operands or a constant.
1152 
1153  /// Try to simplify a floating-point binary operation into 1 of its operands
1154  /// or a constant.
1155  SDValue simplifyFPBinop(unsigned Opcode, SDValue X, SDValue Y,
1156  SDNodeFlags Flags);
1157 
1158  /// VAArg produces a result and token chain, and takes a pointer
1159  /// and a source value as input.
1160  SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1161  SDValue SV, unsigned Align);
1162 
1163  /// Gets a node for an atomic cmpxchg op. There are two
1164  /// valid Opcodes. ISD::ATOMIC_CMO_SWAP produces the value loaded and a
1165  /// chain result. ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS produces the value loaded,
1166  /// a success flag (initially i1), and a chain.
1167  SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT,
1168  SDVTList VTs, SDValue Chain, SDValue Ptr,
1169  SDValue Cmp, SDValue Swp, MachineMemOperand *MMO);
1170 
1171  /// Gets a node for an atomic op, produces result (if relevant)
1172  /// and chain and takes 2 operands.
1173  SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain,
1174  SDValue Ptr, SDValue Val, MachineMemOperand *MMO);
1175 
1176  /// Gets a node for an atomic op, produces result and chain and
1177  /// takes 1 operand.
1178  SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, EVT VT,
1179  SDValue Chain, SDValue Ptr, MachineMemOperand *MMO);
1180 
1181  /// Gets a node for an atomic op, produces result and chain and takes N
1182  /// operands.
1183  SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT,
1184  SDVTList VTList, ArrayRef<SDValue> Ops,
1185  MachineMemOperand *MMO);
1186 
1187  /// Creates a MemIntrinsicNode that may produce a
1188  /// result and takes a list of operands. Opcode may be INTRINSIC_VOID,
1189  /// INTRINSIC_W_CHAIN, or a target-specific opcode with a value not
1190  /// less than FIRST_TARGET_MEMORY_OPCODE.
1192  unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
1193  EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment,
1196  uint64_t Size = 0, const AAMDNodes &AAInfo = AAMDNodes());
1197 
1199  unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
1200  EVT MemVT, MachinePointerInfo PtrInfo, MaybeAlign Alignment = None,
1203  uint64_t Size = 0, const AAMDNodes &AAInfo = AAMDNodes()) {
1204  // Ensure that codegen never sees alignment 0
1205  return getMemIntrinsicNode(Opcode, dl, VTList, Ops, MemVT, PtrInfo,
1206  Alignment.value_or(getEVTAlign(MemVT)), Flags,
1207  Size, AAInfo);
1208  }
1209 
1210  SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList,
1211  ArrayRef<SDValue> Ops, EVT MemVT,
1212  MachineMemOperand *MMO);
1213 
1214  /// Creates a LifetimeSDNode that starts (`IsStart==true`) or ends
1215  /// (`IsStart==false`) the lifetime of the portion of `FrameIndex` between
1216  /// offsets `Offset` and `Offset + Size`.
1217  SDValue getLifetimeNode(bool IsStart, const SDLoc &dl, SDValue Chain,
1218  int FrameIndex, int64_t Size, int64_t Offset = -1);
1219 
1220  /// Creates a PseudoProbeSDNode with function GUID `Guid` and
1221  /// the index of the block `Index` it is probing, as well as the attributes
1222  /// `attr` of the probe.
1223  SDValue getPseudoProbeNode(const SDLoc &Dl, SDValue Chain, uint64_t Guid,
1224  uint64_t Index, uint32_t Attr);
1225 
1226  /// Create a MERGE_VALUES node from the given operands.
1228 
1229  /// Loads are not normal binary operators: their result type is not
1230  /// determined by their operands, and they produce a value AND a token chain.
1231  ///
1232  /// This function will set the MOLoad flag on MMOFlags, but you can set it if
1233  /// you want. The MOStore flag must not be set.
1234  SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1235  MachinePointerInfo PtrInfo,
1236  MaybeAlign Alignment = MaybeAlign(),
1238  const AAMDNodes &AAInfo = AAMDNodes(),
1239  const MDNode *Ranges = nullptr);
1240  /// FIXME: Remove once transition to Align is over.
1241  inline SDValue
1242  getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1243  MachinePointerInfo PtrInfo, unsigned Alignment,
1245  const AAMDNodes &AAInfo = AAMDNodes(),
1246  const MDNode *Ranges = nullptr) {
1247  return getLoad(VT, dl, Chain, Ptr, PtrInfo, MaybeAlign(Alignment), MMOFlags,
1248  AAInfo, Ranges);
1249  }
1250  SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1251  MachineMemOperand *MMO);
1252  SDValue
1253  getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain,
1254  SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT,
1255  MaybeAlign Alignment = MaybeAlign(),
1257  const AAMDNodes &AAInfo = AAMDNodes());
1258  /// FIXME: Remove once transition to Align is over.
1259  inline SDValue
1260  getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain,
1261  SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT,
1262  unsigned Alignment,
1264  const AAMDNodes &AAInfo = AAMDNodes()) {
1265  return getExtLoad(ExtType, dl, VT, Chain, Ptr, PtrInfo, MemVT,
1266  MaybeAlign(Alignment), MMOFlags, AAInfo);
1267  }
1268  SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
1269  SDValue Chain, SDValue Ptr, EVT MemVT,
1270  MachineMemOperand *MMO);
1271  SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base,
1274  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1275  MachinePointerInfo PtrInfo, EVT MemVT, Align Alignment,
1277  const AAMDNodes &AAInfo = AAMDNodes(),
1278  const MDNode *Ranges = nullptr);
1280  ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl,
1282  EVT MemVT, MaybeAlign Alignment = MaybeAlign(),
1284  const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr) {
1285  // Ensures that codegen never sees a None Alignment.
1286  return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, PtrInfo, MemVT,
1287  Alignment.value_or(getEVTAlign(MemVT)), MMOFlags, AAInfo,
1288  Ranges);
1289  }
1290  /// FIXME: Remove once transition to Align is over.
1291  inline SDValue
1293  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1294  MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment,
1296  const AAMDNodes &AAInfo = AAMDNodes(),
1297  const MDNode *Ranges = nullptr) {
1298  return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, PtrInfo, MemVT,
1299  MaybeAlign(Alignment), MMOFlags, AAInfo, Ranges);
1300  }
1302  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1303  EVT MemVT, MachineMemOperand *MMO);
1304 
1305  /// Helper function to build ISD::STORE nodes.
1306  ///
1307  /// This function will set the MOStore flag on MMOFlags, but you can set it if
1308  /// you want. The MOLoad and MOInvariant flags must not be set.
1309 
1310  SDValue
1311  getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1312  MachinePointerInfo PtrInfo, Align Alignment,
1314  const AAMDNodes &AAInfo = AAMDNodes());
1315  inline SDValue
1316  getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1317  MachinePointerInfo PtrInfo, MaybeAlign Alignment = MaybeAlign(),
1319  const AAMDNodes &AAInfo = AAMDNodes()) {
1320  return getStore(Chain, dl, Val, Ptr, PtrInfo,
1321  Alignment.value_or(getEVTAlign(Val.getValueType())),
1322  MMOFlags, AAInfo);
1323  }
1324  /// FIXME: Remove once transition to Align is over.
1325  inline SDValue
1326  getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1327  MachinePointerInfo PtrInfo, unsigned Alignment,
1329  const AAMDNodes &AAInfo = AAMDNodes()) {
1330  return getStore(Chain, dl, Val, Ptr, PtrInfo, MaybeAlign(Alignment),
1331  MMOFlags, AAInfo);
1332  }
1333  SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1334  MachineMemOperand *MMO);
1335  SDValue
1336  getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1337  MachinePointerInfo PtrInfo, EVT SVT, Align Alignment,
1339  const AAMDNodes &AAInfo = AAMDNodes());
1340  inline SDValue
1341  getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1342  MachinePointerInfo PtrInfo, EVT SVT,
1343  MaybeAlign Alignment = MaybeAlign(),
1345  const AAMDNodes &AAInfo = AAMDNodes()) {
1346  return getTruncStore(Chain, dl, Val, Ptr, PtrInfo, SVT,
1347  Alignment.value_or(getEVTAlign(SVT)), MMOFlags,
1348  AAInfo);
1349  }
1350  /// FIXME: Remove once transition to Align is over.
1351  inline SDValue
1352  getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1353  MachinePointerInfo PtrInfo, EVT SVT, unsigned Alignment,
1355  const AAMDNodes &AAInfo = AAMDNodes()) {
1356  return getTruncStore(Chain, dl, Val, Ptr, PtrInfo, SVT,
1357  MaybeAlign(Alignment), MMOFlags, AAInfo);
1358  }
1359  SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1360  SDValue Ptr, EVT SVT, MachineMemOperand *MMO);
1361  SDValue getIndexedStore(SDValue OrigStore, const SDLoc &dl, SDValue Base,
1363 
1365  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1366  SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo,
1367  EVT MemVT, Align Alignment,
1368  MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo,
1369  const MDNode *Ranges = nullptr, bool IsExpanding = false);
1370  inline SDValue
1372  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1373  SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1374  MaybeAlign Alignment = MaybeAlign(),
1376  const AAMDNodes &AAInfo = AAMDNodes(),
1377  const MDNode *Ranges = nullptr, bool IsExpanding = false) {
1378  // Ensures that codegen never sees a None Alignment.
1379  return getLoadVP(AM, ExtType, VT, dl, Chain, Ptr, Offset, Mask, EVL,
1380  PtrInfo, MemVT, Alignment.value_or(getEVTAlign(MemVT)),
1381  MMOFlags, AAInfo, Ranges, IsExpanding);
1382  }
1384  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1385  SDValue Mask, SDValue EVL, EVT MemVT,
1386  MachineMemOperand *MMO, bool IsExpanding = false);
1387  SDValue getLoadVP(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1388  SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo,
1389  MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags,
1390  const AAMDNodes &AAInfo, const MDNode *Ranges = nullptr,
1391  bool IsExpanding = false);
1392  SDValue getLoadVP(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1394  bool IsExpanding = false);
1395  SDValue getExtLoadVP(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
1396  SDValue Chain, SDValue Ptr, SDValue Mask, SDValue EVL,
1397  MachinePointerInfo PtrInfo, EVT MemVT,
1398  MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags,
1399  const AAMDNodes &AAInfo, bool IsExpanding = false);
1400  SDValue getExtLoadVP(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
1401  SDValue Chain, SDValue Ptr, SDValue Mask, SDValue EVL,
1402  EVT MemVT, MachineMemOperand *MMO,
1403  bool IsExpanding = false);
1404  SDValue getIndexedLoadVP(SDValue OrigLoad, const SDLoc &dl, SDValue Base,
1406  SDValue getStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1407  SDValue Offset, SDValue Mask, SDValue EVL, EVT MemVT,
1409  bool IsTruncating = false, bool IsCompressing = false);
1410  SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val,
1411  SDValue Ptr, SDValue Mask, SDValue EVL,
1412  MachinePointerInfo PtrInfo, EVT SVT, Align Alignment,
1413  MachineMemOperand::Flags MMOFlags,
1414  const AAMDNodes &AAInfo, bool IsCompressing = false);
1415  SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val,
1416  SDValue Ptr, SDValue Mask, SDValue EVL, EVT SVT,
1417  MachineMemOperand *MMO, bool IsCompressing = false);
1418  SDValue getIndexedStoreVP(SDValue OrigStore, const SDLoc &dl, SDValue Base,
1420 
1422  EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr,
1423  SDValue Offset, SDValue Stride, SDValue Mask,
1424  SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1425  Align Alignment, MachineMemOperand::Flags MMOFlags,
1426  const AAMDNodes &AAInfo,
1427  const MDNode *Ranges = nullptr,
1428  bool IsExpanding = false);
1430  ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &DL,
1431  SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Stride, SDValue Mask,
1432  SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1433  MaybeAlign Alignment = MaybeAlign(),
1435  const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr,
1436  bool IsExpanding = false) {
1437  // Ensures that codegen never sees a None Alignment.
1438  return getStridedLoadVP(AM, ExtType, VT, DL, Chain, Ptr, Offset, Stride,
1439  Mask, EVL, PtrInfo, MemVT,
1440  Alignment.value_or(getEVTAlign(MemVT)), MMOFlags,
1441  AAInfo, Ranges, IsExpanding);
1442  }
1444  EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr,
1445  SDValue Offset, SDValue Stride, SDValue Mask,
1446  SDValue EVL, EVT MemVT, MachineMemOperand *MMO,
1447  bool IsExpanding = false);
1448  SDValue getStridedLoadVP(EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr,
1449  SDValue Stride, SDValue Mask, SDValue EVL,
1450  MachinePointerInfo PtrInfo, MaybeAlign Alignment,
1451  MachineMemOperand::Flags MMOFlags,
1452  const AAMDNodes &AAInfo,
1453  const MDNode *Ranges = nullptr,
1454  bool IsExpanding = false);
1455  SDValue getStridedLoadVP(EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr,
1456  SDValue Stride, SDValue Mask, SDValue EVL,
1457  MachineMemOperand *MMO, bool IsExpanding = false);
1458  SDValue
1459  getExtStridedLoadVP(ISD::LoadExtType ExtType, const SDLoc &DL, EVT VT,
1460  SDValue Chain, SDValue Ptr, SDValue Stride, SDValue Mask,
1461  SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1462  MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags,
1463  const AAMDNodes &AAInfo, bool IsExpanding = false);
1465  SDValue Chain, SDValue Ptr, SDValue Stride,
1466  SDValue Mask, SDValue EVL, EVT MemVT,
1467  MachineMemOperand *MMO, bool IsExpanding = false);
1468  SDValue getIndexedStridedLoadVP(SDValue OrigLoad, const SDLoc &DL,
1470  ISD::MemIndexedMode AM);
1471  SDValue getStridedStoreVP(SDValue Chain, const SDLoc &DL, SDValue Val,
1472  SDValue Ptr, SDValue Offset, SDValue Stride,
1473  SDValue Mask, SDValue EVL, EVT MemVT,
1475  bool IsTruncating = false,
1476  bool IsCompressing = false);
1478  SDValue Ptr, SDValue Stride, SDValue Mask,
1479  SDValue EVL, MachinePointerInfo PtrInfo,
1480  EVT SVT, Align Alignment,
1481  MachineMemOperand::Flags MMOFlags,
1482  const AAMDNodes &AAInfo,
1483  bool IsCompressing = false);
1485  SDValue Ptr, SDValue Stride, SDValue Mask,
1486  SDValue EVL, EVT SVT, MachineMemOperand *MMO,
1487  bool IsCompressing = false);
1488  SDValue getIndexedStridedStoreVP(SDValue OrigStore, const SDLoc &DL,
1490  ISD::MemIndexedMode AM);
1491 
1492  SDValue getGatherVP(SDVTList VTs, EVT VT, const SDLoc &dl,
1494  ISD::MemIndexType IndexType);
1495  SDValue getScatterVP(SDVTList VTs, EVT VT, const SDLoc &dl,
1497  ISD::MemIndexType IndexType);
1498 
1499  SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Base,
1500  SDValue Offset, SDValue Mask, SDValue Src0, EVT MemVT,
1502  ISD::LoadExtType, bool IsExpanding = false);
1503  SDValue getIndexedMaskedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base,
1505  SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1508  bool IsTruncating = false, bool IsCompressing = false);
1509  SDValue getIndexedMaskedStore(SDValue OrigStore, const SDLoc &dl,
1511  ISD::MemIndexedMode AM);
1512  SDValue getMaskedGather(SDVTList VTs, EVT MemVT, const SDLoc &dl,
1514  ISD::MemIndexType IndexType, ISD::LoadExtType ExtTy);
1515  SDValue getMaskedScatter(SDVTList VTs, EVT MemVT, const SDLoc &dl,
1517  ISD::MemIndexType IndexType,
1518  bool IsTruncating = false);
1519 
1520  /// Construct a node to track a Value* through the backend.
1521  SDValue getSrcValue(const Value *v);
1522 
1523  /// Return an MDNodeSDNode which holds an MDNode.
1524  SDValue getMDNode(const MDNode *MD);
1525 
1526  /// Return a bitcast using the SDLoc of the value operand, and casting to the
1527  /// provided type. Use getNode to set a custom SDLoc.
1528  SDValue getBitcast(EVT VT, SDValue V);
1529 
1530  /// Return an AddrSpaceCastSDNode.
1531  SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr, unsigned SrcAS,
1532  unsigned DestAS);
1533 
1534  /// Return a freeze using the SDLoc of the value operand.
1536 
1537  /// Return an AssertAlignSDNode.
1539 
1540  /// Swap N1 and N2 if Opcode is a commutative binary opcode
1541  /// and the canonical form expects the opposite order.
1542  void canonicalizeCommutativeBinop(unsigned Opcode, SDValue &N1,
1543  SDValue &N2) const;
1544 
1545  /// Return the specified value casted to
1546  /// the target's desired shift amount type.
1548 
1549  /// Expand the specified \c ISD::VAARG node as the Legalize pass would.
1551 
1552  /// Expand the specified \c ISD::VACOPY node as the Legalize pass would.
1554 
1555  /// Returs an GlobalAddress of the function from the current module with
1556  /// name matching the given ExternalSymbol. Additionally can provide the
1557  /// matched function.
1558  /// Panics the function doesn't exists.
1560  Function **TargetFunction = nullptr);
1561 
1562  /// *Mutate* the specified node in-place to have the
1563  /// specified operands. If the resultant node already exists in the DAG,
1564  /// this does not modify the specified node, instead it returns the node that
1565  /// already exists. If the resultant node does not exist in the DAG, the
1566  /// input node is returned. As a degenerate case, if you specify the same
1567  /// input operands as the node already has, the input node is returned.
1571  SDValue Op3);
1573  SDValue Op3, SDValue Op4);
1575  SDValue Op3, SDValue Op4, SDValue Op5);
1577 
1578  /// Creates a new TokenFactor containing \p Vals. If \p Vals contains 64k
1579  /// values or more, move values into new TokenFactors in 64k-1 blocks, until
1580  /// the final TokenFactor has less than 64k operands.
1582 
1583  /// *Mutate* the specified machine node's memory references to the provided
1584  /// list.
1586  ArrayRef<MachineMemOperand *> NewMemRefs);
1587 
1588  // Calculate divergence of node \p N based on its operands.
1589  bool calculateDivergence(SDNode *N);
1590 
1591  // Propagates the change in divergence to users
1592  void updateDivergence(SDNode * N);
1593 
1594  /// These are used for target selectors to *mutate* the
1595  /// specified node to have the specified return type, Target opcode, and
1596  /// operands. Note that target opcodes are stored as
1597  /// ~TargetOpcode in the node opcode field. The resultant node is returned.
1598  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT);
1599  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT, SDValue Op1);
1600  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1601  SDValue Op1, SDValue Op2);
1602  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1603  SDValue Op1, SDValue Op2, SDValue Op3);
1604  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1605  ArrayRef<SDValue> Ops);
1606  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1, EVT VT2);
1607  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1608  EVT VT2, ArrayRef<SDValue> Ops);
1609  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1610  EVT VT2, EVT VT3, ArrayRef<SDValue> Ops);
1611  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1612  EVT VT2, SDValue Op1, SDValue Op2);
1613  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, SDVTList VTs,
1614  ArrayRef<SDValue> Ops);
1615 
1616  /// This *mutates* the specified node to have the specified
1617  /// return type, opcode, and operands.
1618  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs,
1619  ArrayRef<SDValue> Ops);
1620 
1621  /// Mutate the specified strict FP node to its non-strict equivalent,
1622  /// unlinking the node from its chain and dropping the metadata arguments.
1623  /// The node must be a strict FP node.
1625 
1626  /// These are used for target selectors to create a new node
1627  /// with specified return type(s), MachineInstr opcode, and operands.
1628  ///
1629  /// Note that getMachineNode returns the resultant node. If there is already
1630  /// a node of the specified opcode and operands, it returns that node instead
1631  /// of the current one.
1632  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT);
1633  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
1634  SDValue Op1);
1635  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
1636  SDValue Op1, SDValue Op2);
1637  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
1638  SDValue Op1, SDValue Op2, SDValue Op3);
1639  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
1640  ArrayRef<SDValue> Ops);
1641  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1642  EVT VT2, SDValue Op1, SDValue Op2);
1643  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1644  EVT VT2, SDValue Op1, SDValue Op2, SDValue Op3);
1645  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1646  EVT VT2, ArrayRef<SDValue> Ops);
1647  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1648  EVT VT2, EVT VT3, SDValue Op1, SDValue Op2);
1649  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1650  EVT VT2, EVT VT3, SDValue Op1, SDValue Op2,
1651  SDValue Op3);
1652  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1653  EVT VT2, EVT VT3, ArrayRef<SDValue> Ops);
1654  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1655  ArrayRef<EVT> ResultTys, ArrayRef<SDValue> Ops);
1656  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, SDVTList VTs,
1657  ArrayRef<SDValue> Ops);
1658 
1659  /// A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
1660  SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT,
1661  SDValue Operand);
1662 
1663  /// A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
1664  SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT,
1665  SDValue Operand, SDValue Subreg);
1666 
1667  /// Get the specified node if it's already available, or else return NULL.
1668  SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTList,
1669  ArrayRef<SDValue> Ops, const SDNodeFlags Flags);
1670  SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTList,
1671  ArrayRef<SDValue> Ops);
1672 
1673  /// Check if a node exists without modifying its flags.
1674  bool doesNodeExist(unsigned Opcode, SDVTList VTList, ArrayRef<SDValue> Ops);
1675 
1676  /// Creates a SDDbgValue node.
1678  unsigned R, bool IsIndirect, const DebugLoc &DL,
1679  unsigned O);
1680 
1681  /// Creates a constant SDDbgValue node.
1683  const Value *C, const DebugLoc &DL,
1684  unsigned O);
1685 
1686  /// Creates a FrameIndex SDDbgValue node.
1688  unsigned FI, bool IsIndirect,
1689  const DebugLoc &DL, unsigned O);
1690 
1691  /// Creates a FrameIndex SDDbgValue node.
1693  unsigned FI,
1694  ArrayRef<SDNode *> Dependencies,
1695  bool IsIndirect, const DebugLoc &DL,
1696  unsigned O);
1697 
1698  /// Creates a VReg SDDbgValue node.
1700  unsigned VReg, bool IsIndirect,
1701  const DebugLoc &DL, unsigned O);
1702 
1703  /// Creates a SDDbgValue node from a list of locations.
1706  ArrayRef<SDNode *> Dependencies, bool IsIndirect,
1707  const DebugLoc &DL, unsigned O, bool IsVariadic);
1708 
1709  /// Creates a SDDbgLabel node.
1710  SDDbgLabel *getDbgLabel(DILabel *Label, const DebugLoc &DL, unsigned O);
1711 
1712  /// Transfer debug values from one node to another, while optionally
1713  /// generating fragment expressions for split-up values. If \p InvalidateDbg
1714  /// is set, debug values are invalidated after they are transferred.
1715  void transferDbgValues(SDValue From, SDValue To, unsigned OffsetInBits = 0,
1716  unsigned SizeInBits = 0, bool InvalidateDbg = true);
1717 
1718  /// Remove the specified node from the system. If any of its
1719  /// operands then becomes dead, remove them as well. Inform UpdateListener
1720  /// for each node deleted.
1721  void RemoveDeadNode(SDNode *N);
1722 
1723  /// This method deletes the unreachable nodes in the
1724  /// given list, and any nodes that become unreachable as a result.
1725  void RemoveDeadNodes(SmallVectorImpl<SDNode *> &DeadNodes);
1726 
1727  /// Modify anything using 'From' to use 'To' instead.
1728  /// This can cause recursive merging of nodes in the DAG. Use the first
1729  /// version if 'From' is known to have a single result, use the second
1730  /// if you have two nodes with identical results (or if 'To' has a superset
1731  /// of the results of 'From'), use the third otherwise.
1732  ///
1733  /// These methods all take an optional UpdateListener, which (if not null) is
1734  /// informed about nodes that are deleted and modified due to recursive
1735  /// changes in the dag.
1736  ///
1737  /// These functions only replace all existing uses. It's possible that as
1738  /// these replacements are being performed, CSE may cause the From node
1739  /// to be given new uses. These new uses of From are left in place, and
1740  /// not automatically transferred to To.
1741  ///
1743  void ReplaceAllUsesWith(SDNode *From, SDNode *To);
1744  void ReplaceAllUsesWith(SDNode *From, const SDValue *To);
1745 
1746  /// Replace any uses of From with To, leaving
1747  /// uses of other values produced by From.getNode() alone.
1749 
1750  /// Like ReplaceAllUsesOfValueWith, but for multiple values at once.
1751  /// This correctly handles the case where
1752  /// there is an overlap between the From values and the To values.
1753  void ReplaceAllUsesOfValuesWith(const SDValue *From, const SDValue *To,
1754  unsigned Num);
1755 
1756  /// If an existing load has uses of its chain, create a token factor node with
1757  /// that chain and the new memory node's chain and update users of the old
1758  /// chain to the token factor. This ensures that the new memory node will have
1759  /// the same relative memory dependency position as the old load. Returns the
1760  /// new merged load chain.
1761  SDValue makeEquivalentMemoryOrdering(SDValue OldChain, SDValue NewMemOpChain);
1762 
1763  /// If an existing load has uses of its chain, create a token factor node with
1764  /// that chain and the new memory node's chain and update users of the old
1765  /// chain to the token factor. This ensures that the new memory node will have
1766  /// the same relative memory dependency position as the old load. Returns the
1767  /// new merged load chain.
1769 
1770  /// Topological-sort the AllNodes list and a
1771  /// assign a unique node id for each node in the DAG based on their
1772  /// topological order. Returns the number of nodes.
1773  unsigned AssignTopologicalOrder();
1774 
1775  /// Move node N in the AllNodes list to be immediately
1776  /// before the given iterator Position. This may be used to update the
1777  /// topological ordering when the list of nodes is modified.
1779  AllNodes.insert(Position, AllNodes.remove(N));
1780  }
1781 
1782  /// Returns an APFloat semantics tag appropriate for the given type. If VT is
1783  /// a vector type, the element semantics are returned.
1785  switch (VT.getScalarType().getSimpleVT().SimpleTy) {
1786  default: llvm_unreachable("Unknown FP format");
1787  case MVT::f16: return APFloat::IEEEhalf();
1788  case MVT::bf16: return APFloat::BFloat();
1789  case MVT::f32: return APFloat::IEEEsingle();
1790  case MVT::f64: return APFloat::IEEEdouble();
1791  case MVT::f80: return APFloat::x87DoubleExtended();
1792  case MVT::f128: return APFloat::IEEEquad();
1793  case MVT::ppcf128: return APFloat::PPCDoubleDouble();
1794  }
1795  }
1796 
1797  /// Add a dbg_value SDNode. If SD is non-null that means the
1798  /// value is produced by SD.
1799  void AddDbgValue(SDDbgValue *DB, bool isParameter);
1800 
1801  /// Add a dbg_label SDNode.
1802  void AddDbgLabel(SDDbgLabel *DB);
1803 
1804  /// Get the debug values which reference the given SDNode.
1806  return DbgInfo->getSDDbgValues(SD);
1807  }
1808 
1809 public:
1810  /// Return true if there are any SDDbgValue nodes associated
1811  /// with this SelectionDAG.
1812  bool hasDebugValues() const { return !DbgInfo->empty(); }
1813 
1814  SDDbgInfo::DbgIterator DbgBegin() const { return DbgInfo->DbgBegin(); }
1815  SDDbgInfo::DbgIterator DbgEnd() const { return DbgInfo->DbgEnd(); }
1816 
1818  return DbgInfo->ByvalParmDbgBegin();
1819  }
1821  return DbgInfo->ByvalParmDbgEnd();
1822  }
1823 
1825  return DbgInfo->DbgLabelBegin();
1826  }
1828  return DbgInfo->DbgLabelEnd();
1829  }
1830 
1831  /// To be invoked on an SDNode that is slated to be erased. This
1832  /// function mirrors \c llvm::salvageDebugInfo.
1833  void salvageDebugInfo(SDNode &N);
1834 
1835  /// Signal whether instruction referencing variable locations are desired for
1836  /// this function's debug-info.
1838  UseInstrRefDebugInfo = Flag;
1839  }
1840 
1842  return UseInstrRefDebugInfo;
1843  }
1844 
1845  void dump() const;
1846 
1847  /// In most cases this function returns the ABI alignment for a given type,
1848  /// except for illegal vector types where the alignment exceeds that of the
1849  /// stack. In such cases we attempt to break the vector down to a legal type
1850  /// and return the ABI alignment for that instead.
1851  Align getReducedAlign(EVT VT, bool UseABI);
1852 
1853  /// Create a stack temporary based on the size in bytes and the alignment
1854  SDValue CreateStackTemporary(TypeSize Bytes, Align Alignment);
1855 
1856  /// Create a stack temporary, suitable for holding the specified value type.
1857  /// If minAlign is specified, the slot size will have at least that alignment.
1858  SDValue CreateStackTemporary(EVT VT, unsigned minAlign = 1);
1859 
1860  /// Create a stack temporary suitable for holding either of the specified
1861  /// value types.
1862  SDValue CreateStackTemporary(EVT VT1, EVT VT2);
1863 
1864  SDValue FoldSymbolOffset(unsigned Opcode, EVT VT,
1865  const GlobalAddressSDNode *GA,
1866  const SDNode *N2);
1867 
1868  SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT,
1869  ArrayRef<SDValue> Ops);
1870 
1871  /// Fold floating-point operations with 2 operands when both operands are
1872  /// constants and/or undefined.
1873  SDValue foldConstantFPMath(unsigned Opcode, const SDLoc &DL, EVT VT,
1874  SDValue N1, SDValue N2);
1875 
1876  /// Constant fold a setcc to true or false.
1878  const SDLoc &dl);
1879 
1880  /// Return true if the sign bit of Op is known to be zero.
1881  /// We use this predicate to simplify operations downstream.
1882  bool SignBitIsZero(SDValue Op, unsigned Depth = 0) const;
1883 
1884  /// Return true if 'Op & Mask' is known to be zero. We
1885  /// use this predicate to simplify operations downstream. Op and Mask are
1886  /// known to be the same type.
1887  bool MaskedValueIsZero(SDValue Op, const APInt &Mask,
1888  unsigned Depth = 0) const;
1889 
1890  /// Return true if 'Op & Mask' is known to be zero in DemandedElts. We
1891  /// use this predicate to simplify operations downstream. Op and Mask are
1892  /// known to be the same type.
1893  bool MaskedValueIsZero(SDValue Op, const APInt &Mask,
1894  const APInt &DemandedElts, unsigned Depth = 0) const;
1895 
1896  /// Return true if 'Op' is known to be zero in DemandedElts. We
1897  /// use this predicate to simplify operations downstream.
1898  bool MaskedVectorIsZero(SDValue Op, const APInt &DemandedElts,
1899  unsigned Depth = 0) const;
1900 
1901  /// Return true if '(Op & Mask) == Mask'.
1902  /// Op and Mask are known to be the same type.
1903  bool MaskedValueIsAllOnes(SDValue Op, const APInt &Mask,
1904  unsigned Depth = 0) const;
1905 
1906  /// Determine which bits of Op are known to be either zero or one and return
1907  /// them in Known. For vectors, the known bits are those that are shared by
1908  /// every vector element.
1909  /// Targets can implement the computeKnownBitsForTargetNode method in the
1910  /// TargetLowering class to allow target nodes to be understood.
1911  KnownBits computeKnownBits(SDValue Op, unsigned Depth = 0) const;
1912 
1913  /// Determine which bits of Op are known to be either zero or one and return
1914  /// them in Known. The DemandedElts argument allows us to only collect the
1915  /// known bits that are shared by the requested vector elements.
1916  /// Targets can implement the computeKnownBitsForTargetNode method in the
1917  /// TargetLowering class to allow target nodes to be understood.
1918  KnownBits computeKnownBits(SDValue Op, const APInt &DemandedElts,
1919  unsigned Depth = 0) const;
1920 
1921  /// Used to represent the possible overflow behavior of an operation.
1922  /// Never: the operation cannot overflow.
1923  /// Always: the operation will always overflow.
1924  /// Sometime: the operation may or may not overflow.
1929  };
1930 
1931  /// Determine if the result of the addition of 2 node can overflow.
1933 
1934  /// Test if the given value is known to have exactly one bit set. This differs
1935  /// from computeKnownBits in that it doesn't necessarily determine which bit
1936  /// is set.
1937  bool isKnownToBeAPowerOfTwo(SDValue Val) const;
1938 
1939  /// Return the number of times the sign bit of the register is replicated into
1940  /// the other bits. We know that at least 1 bit is always equal to the sign
1941  /// bit (itself), but other cases can give us information. For example,
1942  /// immediately after an "SRA X, 2", we know that the top 3 bits are all equal
1943  /// to each other, so we return 3. Targets can implement the
1944  /// ComputeNumSignBitsForTarget method in the TargetLowering class to allow
1945  /// target nodes to be understood.
1946  unsigned ComputeNumSignBits(SDValue Op, unsigned Depth = 0) const;
1947 
1948  /// Return the number of times the sign bit of the register is replicated into
1949  /// the other bits. We know that at least 1 bit is always equal to the sign
1950  /// bit (itself), but other cases can give us information. For example,
1951  /// immediately after an "SRA X, 2", we know that the top 3 bits are all equal
1952  /// to each other, so we return 3. The DemandedElts argument allows
1953  /// us to only collect the minimum sign bits of the requested vector elements.
1954  /// Targets can implement the ComputeNumSignBitsForTarget method in the
1955  /// TargetLowering class to allow target nodes to be understood.
1956  unsigned ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
1957  unsigned Depth = 0) const;
1958 
1959  /// Get the upper bound on bit size for this Value \p Op as a signed integer.
1960  /// i.e. x == sext(trunc(x to MaxSignedBits) to bitwidth(x)).
1961  /// Similar to the APInt::getSignificantBits function.
1962  /// Helper wrapper to ComputeNumSignBits.
1963  unsigned ComputeMaxSignificantBits(SDValue Op, unsigned Depth = 0) const;
1964 
1965  /// Get the upper bound on bit size for this Value \p Op as a signed integer.
1966  /// i.e. x == sext(trunc(x to MaxSignedBits) to bitwidth(x)).
1967  /// Similar to the APInt::getSignificantBits function.
1968  /// Helper wrapper to ComputeNumSignBits.
1969  unsigned ComputeMaxSignificantBits(SDValue Op, const APInt &DemandedElts,
1970  unsigned Depth = 0) const;
1971 
1972  /// Return true if this function can prove that \p Op is never poison
1973  /// and, if \p PoisonOnly is false, does not have undef bits.
1974  bool isGuaranteedNotToBeUndefOrPoison(SDValue Op, bool PoisonOnly = false,
1975  unsigned Depth = 0) const;
1976 
1977  /// Return true if this function can prove that \p Op is never poison
1978  /// and, if \p PoisonOnly is false, does not have undef bits. The DemandedElts
1979  /// argument limits the check to the requested vector elements.
1980  bool isGuaranteedNotToBeUndefOrPoison(SDValue Op, const APInt &DemandedElts,
1981  bool PoisonOnly = false,
1982  unsigned Depth = 0) const;
1983 
1984  /// Return true if this function can prove that \p Op is never poison.
1985  bool isGuaranteedNotToBePoison(SDValue Op, unsigned Depth = 0) const {
1986  return isGuaranteedNotToBeUndefOrPoison(Op, /*PoisonOnly*/ true, Depth);
1987  }
1988 
1989  /// Return true if this function can prove that \p Op is never poison. The
1990  /// DemandedElts argument limits the check to the requested vector elements.
1991  bool isGuaranteedNotToBePoison(SDValue Op, const APInt &DemandedElts,
1992  unsigned Depth = 0) const {
1993  return isGuaranteedNotToBeUndefOrPoison(Op, DemandedElts,
1994  /*PoisonOnly*/ true, Depth);
1995  }
1996 
1997  /// Return true if Op can create undef or poison from non-undef & non-poison
1998  /// operands. The DemandedElts argument limits the check to the requested
1999  /// vector elements.
2000  ///
2001  /// \p ConsiderFlags controls whether poison producing flags on the
2002  /// instruction are considered. This can be used to see if the instruction
2003  /// could still introduce undef or poison even without poison generating flags
2004  /// which might be on the instruction. (i.e. could the result of
2005  /// Op->dropPoisonGeneratingFlags() still create poison or undef)
2006  bool canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
2007  bool PoisonOnly = false,
2008  bool ConsiderFlags = true,
2009  unsigned Depth = 0) const;
2010 
2011  /// Return true if Op can create undef or poison from non-undef & non-poison
2012  /// operands.
2013  ///
2014  /// \p ConsiderFlags controls whether poison producing flags on the
2015  /// instruction are considered. This can be used to see if the instruction
2016  /// could still introduce undef or poison even without poison generating flags
2017  /// which might be on the instruction. (i.e. could the result of
2018  /// Op->dropPoisonGeneratingFlags() still create poison or undef)
2019  bool canCreateUndefOrPoison(SDValue Op, bool PoisonOnly = false,
2020  bool ConsiderFlags = true,
2021  unsigned Depth = 0) const;
2022 
2023  /// Return true if the specified operand is an ISD::ADD with a ConstantSDNode
2024  /// on the right-hand side, or if it is an ISD::OR with a ConstantSDNode that
2025  /// is guaranteed to have the same semantics as an ADD. This handles the
2026  /// equivalence:
2027  /// X|Cst == X+Cst iff X&Cst = 0.
2028  bool isBaseWithConstantOffset(SDValue Op) const;
2029 
2030  /// Test whether the given SDValue is known to never be NaN. If \p SNaN is
2031  /// true, returns if \p Op is known to never be a signaling NaN (it may still
2032  /// be a qNaN).
2033  bool isKnownNeverNaN(SDValue Op, bool SNaN = false, unsigned Depth = 0) const;
2034 
2035  /// \returns true if \p Op is known to never be a signaling NaN.
2036  bool isKnownNeverSNaN(SDValue Op, unsigned Depth = 0) const {
2037  return isKnownNeverNaN(Op, true, Depth);
2038  }
2039 
2040  /// Test whether the given floating point SDValue is known to never be
2041  /// positive or negative zero.
2042  bool isKnownNeverZeroFloat(SDValue Op) const;
2043 
2044  /// Test whether the given SDValue is known to contain non-zero value(s).
2045  bool isKnownNeverZero(SDValue Op) const;
2046 
2047  /// Test whether two SDValues are known to compare equal. This
2048  /// is true if they are the same value, or if one is negative zero and the
2049  /// other positive zero.
2050  bool isEqualTo(SDValue A, SDValue B) const;
2051 
2052  /// Return true if A and B have no common bits set. As an example, this can
2053  /// allow an 'add' to be transformed into an 'or'.
2054  bool haveNoCommonBitsSet(SDValue A, SDValue B) const;
2055 
2056  /// Test whether \p V has a splatted value for all the demanded elements.
2057  ///
2058  /// On success \p UndefElts will indicate the elements that have UNDEF
2059  /// values instead of the splat value, this is only guaranteed to be correct
2060  /// for \p DemandedElts.
2061  ///
2062  /// NOTE: The function will return true for a demanded splat of UNDEF values.
2063  bool isSplatValue(SDValue V, const APInt &DemandedElts, APInt &UndefElts,
2064  unsigned Depth = 0) const;
2065 
2066  /// Test whether \p V has a splatted value.
2067  bool isSplatValue(SDValue V, bool AllowUndefs = false) const;
2068 
2069  /// If V is a splatted value, return the source vector and its splat index.
2070  SDValue getSplatSourceVector(SDValue V, int &SplatIndex);
2071 
2072  /// If V is a splat vector, return its scalar source operand by extracting
2073  /// that element from the source vector. If LegalTypes is true, this method
2074  /// may only return a legally-typed splat value. If it cannot legalize the
2075  /// splatted value it will return SDValue().
2076  SDValue getSplatValue(SDValue V, bool LegalTypes = false);
2077 
2078  /// If a SHL/SRA/SRL node \p V has a constant or splat constant shift amount
2079  /// that is less than the element bit-width of the shift node, return it.
2081  const APInt &DemandedElts) const;
2082 
2083  /// If a SHL/SRA/SRL node \p V has constant shift amounts that are all less
2084  /// than the element bit-width of the shift node, return the minimum value.
2085  const APInt *
2087  const APInt &DemandedElts) const;
2088 
2089  /// If a SHL/SRA/SRL node \p V has constant shift amounts that are all less
2090  /// than the element bit-width of the shift node, return the maximum value.
2091  const APInt *
2093  const APInt &DemandedElts) const;
2094 
2095  /// Match a binop + shuffle pyramid that represents a horizontal reduction
2096  /// over the elements of a vector starting from the EXTRACT_VECTOR_ELT node /p
2097  /// Extract. The reduction must use one of the opcodes listed in /p
2098  /// CandidateBinOps and on success /p BinOp will contain the matching opcode.
2099  /// Returns the vector that is being reduced on, or SDValue() if a reduction
2100  /// was not matched. If \p AllowPartials is set then in the case of a
2101  /// reduction pattern that only matches the first few stages, the extracted
2102  /// subvector of the start of the reduction is returned.
2104  ArrayRef<ISD::NodeType> CandidateBinOps,
2105  bool AllowPartials = false);
2106 
2107  /// Utility function used by legalize and lowering to
2108  /// "unroll" a vector operation by splitting out the scalars and operating
2109  /// on each element individually. If the ResNE is 0, fully unroll the vector
2110  /// op. If ResNE is less than the width of the vector op, unroll up to ResNE.
2111  /// If the ResNE is greater than the width of the vector op, unroll the
2112  /// vector op and fill the end of the resulting vector with UNDEFS.
2113  SDValue UnrollVectorOp(SDNode *N, unsigned ResNE = 0);
2114 
2115  /// Like UnrollVectorOp(), but for the [US](ADD|SUB|MUL)O family of opcodes.
2116  /// This is a separate function because those opcodes have two results.
2117  std::pair<SDValue, SDValue> UnrollVectorOverflowOp(SDNode *N,
2118  unsigned ResNE = 0);
2119 
2120  /// Return true if loads are next to each other and can be
2121  /// merged. Check that both are nonvolatile and if LD is loading
2122  /// 'Bytes' bytes from a location that is 'Dist' units away from the
2123  /// location that the 'Base' load is loading from.
2125  unsigned Bytes, int Dist) const;
2126 
2127  /// Infer alignment of a load / store address. Return None if it cannot be
2128  /// inferred.
2130 
2131  /// Compute the VTs needed for the low/hi parts of a type
2132  /// which is split (or expanded) into two not necessarily identical pieces.
2133  std::pair<EVT, EVT> GetSplitDestVTs(const EVT &VT) const;
2134 
2135  /// Compute the VTs needed for the low/hi parts of a type, dependent on an
2136  /// enveloping VT that has been split into two identical pieces. Sets the
2137  /// HisIsEmpty flag when hi type has zero storage size.
2138  std::pair<EVT, EVT> GetDependentSplitDestVTs(const EVT &VT, const EVT &EnvVT,
2139  bool *HiIsEmpty) const;
2140 
2141  /// Split the vector with EXTRACT_SUBVECTOR using the provides
2142  /// VTs and return the low/high part.
2143  std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL,
2144  const EVT &LoVT, const EVT &HiVT);
2145 
2146  /// Split the vector with EXTRACT_SUBVECTOR and return the low/high part.
2147  std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL) {
2148  EVT LoVT, HiVT;
2149  std::tie(LoVT, HiVT) = GetSplitDestVTs(N.getValueType());
2150  return SplitVector(N, DL, LoVT, HiVT);
2151  }
2152 
2153  /// Split the explicit vector length parameter of a VP operation.
2154  std::pair<SDValue, SDValue> SplitEVL(SDValue N, EVT VecVT, const SDLoc &DL);
2155 
2156  /// Split the node's operand with EXTRACT_SUBVECTOR and
2157  /// return the low/high part.
2158  std::pair<SDValue, SDValue> SplitVectorOperand(const SDNode *N, unsigned OpNo)
2159  {
2160  return SplitVector(N->getOperand(OpNo), SDLoc(N));
2161  }
2162 
2163  /// Widen the vector up to the next power of two using INSERT_SUBVECTOR.
2164  SDValue WidenVector(const SDValue &N, const SDLoc &DL);
2165 
2166  /// Append the extracted elements from Start to Count out of the vector Op in
2167  /// Args. If Count is 0, all of the elements will be extracted. The extracted
2168  /// elements will have type EVT if it is provided, and otherwise their type
2169  /// will be Op's element type.
2171  unsigned Start = 0, unsigned Count = 0,
2172  EVT EltVT = EVT());
2173 
2174  /// Compute the default alignment value for the given type.
2175  Align getEVTAlign(EVT MemoryVT) const;
2176 
2177  /// Test whether the given value is a constant int or similar node.
2179 
2180  /// Test whether the given value is a constant FP or similar node.
2182 
2183  /// \returns true if \p N is any kind of constant or build_vector of
2184  /// constants, int or float. If a vector, it may not necessarily be a splat.
2185  inline bool isConstantValueOfAnyType(SDValue N) const {
2188  }
2189 
2190  /// Set CallSiteInfo to be associated with Node.
2192  SDEI[Node].CSInfo = std::move(CallInfo);
2193  }
2194  /// Return CallSiteInfo associated with Node, or a default if none exists.
2196  auto I = SDEI.find(Node);
2197  return I != SDEI.end() ? std::move(I->second).CSInfo : CallSiteInfo();
2198  }
2199  /// Set HeapAllocSite to be associated with Node.
2200  void addHeapAllocSite(const SDNode *Node, MDNode *MD) {
2201  SDEI[Node].HeapAllocSite = MD;
2202  }
2203  /// Return HeapAllocSite associated with Node, or nullptr if none exists.
2205  auto I = SDEI.find(Node);
2206  return I != SDEI.end() ? I->second.HeapAllocSite : nullptr;
2207  }
2208  /// Set PCSections to be associated with Node.
2209  void addPCSections(const SDNode *Node, MDNode *MD) {
2210  SDEI[Node].PCSections = MD;
2211  }
2212  /// Return PCSections associated with Node, or nullptr if none exists.
2213  MDNode *getPCSections(const SDNode *Node) const {
2214  auto It = SDEI.find(Node);
2215  return It != SDEI.end() ? It->second.PCSections : nullptr;
2216  }
2217  /// Set NoMergeSiteInfo to be associated with Node if NoMerge is true.
2218  void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge) {
2219  if (NoMerge)
2220  SDEI[Node].NoMerge = NoMerge;
2221  }
2222  /// Return NoMerge info associated with Node.
2223  bool getNoMergeSiteInfo(const SDNode *Node) const {
2224  auto I = SDEI.find(Node);
2225  return I != SDEI.end() ? I->second.NoMerge : false;
2226  }
2227 
2228  /// Copy extra info associated with one node to another.
2229  void copyExtraInfo(SDNode *From, SDNode *To);
2230 
2231  /// Return the current function's default denormal handling kind for the given
2232  /// floating point type.
2234  return MF->getDenormalMode(EVTToAPFloatSemantics(VT));
2235  }
2236 
2237  bool shouldOptForSize() const;
2238 
2239  /// Get the (commutative) neutral element for the given opcode, if it exists.
2240  SDValue getNeutralElement(unsigned Opcode, const SDLoc &DL, EVT VT,
2241  SDNodeFlags Flags);
2242 
2243 private:
2244  void InsertNode(SDNode *N);
2245  bool RemoveNodeFromCSEMaps(SDNode *N);
2246  void AddModifiedNodeToCSEMaps(SDNode *N);
2247  SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op, void *&InsertPos);
2248  SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op1, SDValue Op2,
2249  void *&InsertPos);
2250  SDNode *FindModifiedNodeSlot(SDNode *N, ArrayRef<SDValue> Ops,
2251  void *&InsertPos);
2252  SDNode *UpdateSDLocOnMergeSDNode(SDNode *N, const SDLoc &loc);
2253 
2254  void DeleteNodeNotInCSEMaps(SDNode *N);
2255  void DeallocateNode(SDNode *N);
2256 
2257  void allnodes_clear();
2258 
2259  /// Look up the node specified by ID in CSEMap. If it exists, return it. If
2260  /// not, return the insertion token that will make insertion faster. This
2261  /// overload is for nodes other than Constant or ConstantFP, use the other one
2262  /// for those.
2263  SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos);
2264 
2265  /// Look up the node specified by ID in CSEMap. If it exists, return it. If
2266  /// not, return the insertion token that will make insertion faster. Performs
2267  /// additional processing for constant nodes.
2268  SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, const SDLoc &DL,
2269  void *&InsertPos);
2270 
2271  /// List of non-single value types.
2272  FoldingSet<SDVTListNode> VTListMap;
2273 
2274  /// Maps to auto-CSE operations.
2275  std::vector<CondCodeSDNode*> CondCodeNodes;
2276 
2277  std::vector<SDNode*> ValueTypeNodes;
2278  std::map<EVT, SDNode*, EVT::compareRawBits> ExtendedValueTypeNodes;
2279  StringMap<SDNode*> ExternalSymbols;
2280 
2281  std::map<std::pair<std::string, unsigned>, SDNode *> TargetExternalSymbols;
2283 
2284  FlagInserter *Inserter = nullptr;
2285 };
2286 
2287 template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> {
2289 
2291  return nodes_iterator(G->allnodes_begin());
2292  }
2293 
2295  return nodes_iterator(G->allnodes_end());
2296  }
2297 };
2298 
2299 } // end namespace llvm
2300 
2301 #endif // LLVM_CODEGEN_SELECTIONDAG_H
removeOperands
static void removeOperands(MachineInstr &MI, unsigned i)
Definition: ThumbRegisterInfo.cpp:338
llvm::SelectionDAG::expandVACopy
SDValue expandVACopy(SDNode *Node)
Expand the specified ISD::VACOPY node as the Legalize pass would.
Definition: SelectionDAG.cpp:2274
llvm::SelectionDAG::getMemcpy
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVol, bool AlwaysInline, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo=AAMDNodes(), AAResults *AA=nullptr)
Definition: SelectionDAG.cpp:7256
llvm::SelectionDAG::getGLOBAL_OFFSET_TABLE
SDValue getGLOBAL_OFFSET_TABLE(EVT VT)
Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
Definition: SelectionDAG.h:1005
llvm::SelectionDAG::getConstantDbgValue
SDDbgValue * getConstantDbgValue(DIVariable *Var, DIExpression *Expr, const Value *C, const DebugLoc &DL, unsigned O)
Creates a constant SDDbgValue node.
Definition: SelectionDAG.cpp:9931
llvm::SelectionDAG::getTargetConstantFP
SDValue getTargetConstantFP(const ConstantFP &Val, const SDLoc &DL, EVT VT)
Definition: SelectionDAG.h:704
llvm::SelectionDAG::DAGNodeInsertedListener::DAGNodeInsertedListener
DAGNodeInsertedListener(SelectionDAG &DAG, std::function< void(SDNode *)> Callback)
Definition: SelectionDAG.h:343
ValueTypes.h
llvm::SelectionDAG::transferDbgValues
void transferDbgValues(SDValue From, SDValue To, unsigned OffsetInBits=0, unsigned SizeInBits=0, bool InvalidateDbg=true)
Transfer debug values from one node to another, while optionally generating fragment expressions for ...
Definition: SelectionDAG.cpp:9993
llvm::SelectionDAG::getTargetConstantPool
SDValue getTargetConstantPool(MachineConstantPoolValue *C, EVT VT, MaybeAlign Align=None, int Offset=0, unsigned TargetFlags=0)
Definition: SelectionDAG.h:736
llvm::SDDbgValue
Holds the information from a dbg_value node through SDISel.
Definition: SDNodeDbgValue.h:133
llvm::ISD::STRICT_FSETCC
@ STRICT_FSETCC
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only.
Definition: ISDOpcodes.h:475
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
llvm::SelectionDAG::getStore
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Definition: SelectionDAG.h:1316
llvm::SelectionDAG::GetDbgValues
ArrayRef< SDDbgValue * > GetDbgValues(const SDNode *SD) const
Get the debug values which reference the given SDNode.
Definition: SelectionDAG.h:1805
llvm::SelectionDAG::getCALLSEQ_START
SDValue getCALLSEQ_START(SDValue Chain, uint64_t InSize, uint64_t OutSize, const SDLoc &DL)
Return a new CALLSEQ_START node, that starts new call frame, in which InSize bytes are set up inside ...
Definition: SelectionDAG.h:957
llvm::ISD::MemIndexedMode
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
Definition: ISDOpcodes.h:1373
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:492
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::SelectionDAG::AssignTopologicalOrder
unsigned AssignTopologicalOrder()
Topological-sort the AllNodes list and a assign a unique node id for each node in the DAG based on th...
Definition: SelectionDAG.cpp:10562
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::SelectionDAG::getValidMaximumShiftAmountConstant
const APInt * getValidMaximumShiftAmountConstant(SDValue V, const APInt &DemandedElts) const
If a SHL/SRA/SRL node V has constant shift amounts that are all less than the element bit-width of th...
Definition: SelectionDAG.cpp:2850
Pass
print lazy value Lazy Value Info Printer Pass
Definition: LazyValueInfo.cpp:1979
llvm::SelectionDAG::getSelectionDAGInfo
const SelectionDAGTargetInfo & getSelectionDAGInfo() const
Definition: SelectionDAG.h:474
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::M68kBeads::DA
@ DA
Definition: M68kBaseInfo.h:59
llvm::SelectionDAG::isGuaranteedNotToBePoison
bool isGuaranteedNotToBePoison(SDValue Op, const APInt &DemandedElts, unsigned Depth=0) const
Return true if this function can prove that Op is never poison.
Definition: SelectionDAG.h:1991
llvm::SelectionDAG::canCreateUndefOrPoison
bool canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts, bool PoisonOnly=false, bool ConsiderFlags=true, unsigned Depth=0) const
Return true if Op can create undef or poison from non-undef & non-poison operands.
Definition: SelectionDAG.cpp:4597
llvm::SDLoc
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Definition: SelectionDAGNodes.h:1103
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:113
llvm::SelectionDAG::isKnownNeverZero
bool isKnownNeverZero(SDValue Op) const
Test whether the given SDValue is known to contain non-zero value(s).
Definition: SelectionDAG.cpp:4795
llvm::SelectionDAG::setSubgraphColor
void setSubgraphColor(SDNode *N, const char *Color)
Convenience for setting subgraph color attribute.
Definition: SelectionDAGPrinter.cpp:265
llvm::SelectionDAG::setGraphColor
void setGraphColor(const SDNode *N, const char *Color)
Convenience for setting node color attribute.
Definition: SelectionDAGPrinter.cpp:221
llvm::SelectionDAG::GetDependentSplitDestVTs
std::pair< EVT, EVT > GetDependentSplitDestVTs(const EVT &VT, const EVT &EnvVT, bool *HiIsEmpty) const
Compute the VTs needed for the low/hi parts of a type, dependent on an enveloping VT that has been sp...
Definition: SelectionDAG.cpp:11389
Metadata.h
llvm::SelectionDAG::SignBitIsZero
bool SignBitIsZero(SDValue Op, unsigned Depth=0) const
Return true if the sign bit of Op is known to be zero.
Definition: SelectionDAG.cpp:2498
llvm::SelectionDAG::getSplatVector
SDValue getSplatVector(EVT VT, const SDLoc &DL, SDValue Op)
Definition: SelectionDAG.h:853
llvm::SelectionDAG::addNoMergeSiteInfo
void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge)
Set NoMergeSiteInfo to be associated with Node if NoMerge is true.
Definition: SelectionDAG.h:2218
llvm::APFloatBase::IEEEsingle
static const fltSemantics & IEEEsingle() LLVM_READNONE
Definition: APFloat.cpp:170
llvm::SelectionDAG::DAGUpdateListener::NodeDeleted
virtual void NodeDeleted(SDNode *N, SDNode *E)
The node N that was deleted and, if E is not null, an equivalent node E that replaced it.
Definition: SelectionDAG.cpp:90
llvm::SelectionDAG::getCopyToReg
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
Definition: SelectionDAG.h:764
llvm::MVT::ppcf128
@ ppcf128
Definition: MachineValueType.h:61
llvm::SDValue::getNode
SDNode * getNode() const
get the SDNode which holds the desired result
Definition: SelectionDAGNodes.h:159
llvm::SelectionDAG::VerifyDAGDivergence
void VerifyDAGDivergence()
Definition: SelectionDAG.cpp:10481
llvm::Function
Definition: Function.h:60
llvm::ISD::ConstantFP
@ ConstantFP
Definition: ISDOpcodes.h:77
llvm::SelectionDAG::allnodes_end
allnodes_const_iterator allnodes_end() const
Definition: SelectionDAG.h:523
llvm::SDDbgInfo
Keeps track of dbg_value information through SDISel.
Definition: SelectionDAG.h:154
llvm::SelectionDAG::getValueType
SDValue getValueType(EVT)
Definition: SelectionDAG.cpp:1832
llvm::ARM_MB::LD
@ LD
Definition: ARMBaseInfo.h:72
llvm::SelectionDAG::setGraphAttrs
void setGraphAttrs(const SDNode *N, const char *Attrs)
Set graph attributes for a node. (eg. "color=red".)
Definition: SelectionDAGPrinter.cpp:191
llvm::APInt::getMinSignedBits
unsigned getMinSignedBits() const
NOTE: This is soft-deprecated. Please use getSignificantBits() instead.
Definition: APInt.h:1459
llvm::SelectionDAG::getExtLoad
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
FIXME: Remove once transition to Align is over.
Definition: SelectionDAG.h:1260
llvm::SDDbgInfo::SDDbgInfo
SDDbgInfo()=default
llvm::SelectionDAG::getStridedLoadVP
SDValue getStridedLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Stride, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, bool IsExpanding=false)
Definition: SelectionDAG.h:1429
llvm::SelectionDAG::FlagInserter
Help to insert SDNodeFlags automatically in transforming.
Definition: SelectionDAG.h:355
llvm::SelectionDAG::getTargetConstantFP
SDValue getTargetConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT)
Definition: SelectionDAG.h:701
llvm::SelectionDAG::getFrameIndex
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
Definition: SelectionDAG.cpp:1713
llvm::SelectionDAG::getIndexedStoreVP
SDValue getIndexedStoreVP(SDValue OrigStore, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8335
llvm::SDDbgInfo::DbgLabelIterator
SmallVectorImpl< SDDbgLabel * >::iterator DbgLabelIterator
Definition: SelectionDAG.h:197
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1182
ilist.h
llvm::SelectionDAG::init
void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE, Pass *PassPtr, const TargetLibraryInfo *LibraryInfo, LegacyDivergenceAnalysis *Divergence, ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin)
Prepare this SelectionDAG to process code in the given MachineFunction.
Definition: SelectionDAG.cpp:1272
llvm::SelectionDAG::allnodes_begin
allnodes_iterator allnodes_begin()
Definition: SelectionDAG.h:527
llvm::SelectionDAG::getVTList
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
Definition: SelectionDAG.cpp:9304
llvm::MachineSDNode
An SDNode that represents everything that will be needed to construct a MachineInstr.
Definition: SelectionDAGNodes.h:2889
llvm::SelectionDAG::FoldSetCC
SDValue FoldSetCC(EVT VT, SDValue N1, SDValue N2, ISD::CondCode Cond, const SDLoc &dl)
Constant fold a setcc to true or false.
Definition: SelectionDAG.cpp:2352
llvm::SDDbgInfo::operator=
SDDbgInfo & operator=(const SDDbgInfo &)=delete
llvm::SelectionDAG::isSplatValue
bool isSplatValue(SDValue V, const APInt &DemandedElts, APInt &UndefElts, unsigned Depth=0) const
Test whether V has a splatted value for all the demanded elements.
Definition: SelectionDAG.cpp:2537
ErrorHandling.h
llvm::SelectionDAG::allnodes_begin
allnodes_const_iterator allnodes_begin() const
Definition: SelectionDAG.h:522
llvm::SelectionDAG::getRoot
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
Definition: SelectionDAG.h:542
llvm::X86Disassembler::Reg
Reg
All possible values of the reg field in the ModR/M byte.
Definition: X86DisassemblerDecoder.h:462
llvm::SelectionDAG::setFlagInserter
void setFlagInserter(FlagInserter *FI)
Definition: SelectionDAG.h:482
llvm::SelectionDAG::getVectorIdxConstant
SDValue getVectorIdxConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
Definition: SelectionDAG.cpp:1618
Allocator.h
llvm::ISD::MemIndexType
MemIndexType
MemIndexType enum - This enum defines how to interpret MGATHER/SCATTER's index parameter when calcula...
Definition: ISDOpcodes.h:1386
llvm::SDNode
Represents one node in the SelectionDAG.
Definition: SelectionDAGNodes.h:462
llvm::SelectionDAG::hasDebugValues
bool hasDebugValues() const
Return true if there are any SDDbgValue nodes associated with this SelectionDAG.
Definition: SelectionDAG.h:1812
llvm::SelectionDAG::getVPLogicalNOT
SDValue getVPLogicalNOT(const SDLoc &DL, SDValue Val, SDValue Mask, SDValue EVL, EVT VT)
Create a vector-predicated logical NOT operation as (VP_XOR Val, BooleanOne, Mask,...
Definition: SelectionDAG.cpp:1462
llvm::SelectionDAG::ReplaceAllUsesWith
void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
Definition: SelectionDAG.cpp:10176
llvm::APFloatBase::x87DoubleExtended
static const fltSemantics & x87DoubleExtended() LLVM_READNONE
Definition: APFloat.cpp:179
llvm::LoadSDNode
This class is used to represent ISD::LOAD nodes.
Definition: SelectionDAGNodes.h:2336
llvm::SelectionDAG::EVTToAPFloatSemantics
static const fltSemantics & EVTToAPFloatSemantics(EVT VT)
Returns an APFloat semantics tag appropriate for the given type.
Definition: SelectionDAG.h:1784
llvm::SelectionDAG::getSplatSourceVector
SDValue getSplatSourceVector(SDValue V, int &SplatIndex)
If V is a splatted value, return the source vector and its splat index.
Definition: SelectionDAG.cpp:2734
llvm::MVT::Glue
@ Glue
Definition: MachineValueType.h:272
llvm::SelectionDAG::getMemBasePlusOffset
SDValue getMemBasePlusOffset(SDValue Base, TypeSize Offset, const SDLoc &DL, const SDNodeFlags Flags=SDNodeFlags())
Returns sum of the base pointer and offset.
Definition: SelectionDAG.cpp:6759
APInt.h
llvm::ArrayRecycler::Capacity::get
static Capacity get(size_t N)
Get the capacity of an array that can hold at least N elements.
Definition: ArrayRecycler.h:79
llvm::MachineConstantPoolValue
Abstract base class for all machine specific constantpool value subclasses.
Definition: MachineConstantPool.h:35
llvm::Depth
@ Depth
Definition: SIMachineScheduler.h:36
llvm::SelectionDAG::getLoad
SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Definition: SelectionDAG.h:1279
llvm::AAMDNodes
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition: Metadata.h:652
llvm::SelectionDAG::getCopyToReg
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, SDValue Reg, SDValue N, SDValue Glue)
Definition: SelectionDAG.h:782
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
DenseMap.h
llvm::APFloatBase::BFloat
static const fltSemantics & BFloat() LLVM_READNONE
Definition: APFloat.cpp:167
llvm::SelectionDAG::getZeroExtendInReg
SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value.
Definition: SelectionDAG.cpp:1422
llvm::MachineMemOperand
A description of a memory reference used in the backend.
Definition: MachineMemOperand.h:127
llvm::SelectionDAG::getSymbolFunctionGlobalAddress
SDValue getSymbolFunctionGlobalAddress(SDValue Op, Function **TargetFunction=nullptr)
Returs an GlobalAddress of the function from the current module with name matching the given External...
Definition: SelectionDAG.cpp:10686
llvm::SelectionDAG::getStore
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
Definition: SelectionDAG.cpp:7964
llvm::SelectionDAG::getPtrExtOrTrunc
SDValue getPtrExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either truncating it or perform...
Definition: SelectionDAG.cpp:1440
llvm::SelectionDAG::ExtractVectorElements
void ExtractVectorElements(SDValue Op, SmallVectorImpl< SDValue > &Args, unsigned Start=0, unsigned Count=0, EVT EltVT=EVT())
Append the extracted elements from Start to Count out of the vector Op in Args.
Definition: SelectionDAG.cpp:11466
llvm::SDDbgInfo::DbgBegin
DbgIterator DbgBegin()
Definition: SelectionDAG.h:199
llvm::SelectionDAG::getValidMinimumShiftAmountConstant
const APInt * getValidMinimumShiftAmountConstant(SDValue V, const APInt &DemandedElts) const
If a SHL/SRA/SRL node V has constant shift amounts that are all less than the element bit-width of th...
Definition: SelectionDAG.cpp:2821
llvm::SelectionDAG::isBaseWithConstantOffset
bool isBaseWithConstantOffset(SDValue Op) const
Return true if the specified operand is an ISD::ADD with a ConstantSDNode on the right-hand side,...
Definition: SelectionDAG.cpp:4654
llvm::LargestSDNode
AlignedCharArrayUnion< AtomicSDNode, TargetIndexSDNode, BlockAddressSDNode, GlobalAddressSDNode, PseudoProbeSDNode > LargestSDNode
A representation of the largest SDNode, for use in sizeof().
Definition: SelectionDAGNodes.h:3029
llvm::ISD::SETCC
@ SETCC
SetCC operator - This evaluates to a true value iff the condition is true.
Definition: ISDOpcodes.h:736
llvm::ISD::CALLSEQ_START
@ CALLSEQ_START
CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of a call sequence,...
Definition: ISDOpcodes.h:1071
llvm::SelectionDAG::getSplatBuildVector
SDValue getSplatBuildVector(EVT VT, const SDLoc &DL, SDValue Op)
Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all elements.
Definition: SelectionDAG.h:836
llvm::SelectionDAG::simplifySelect
SDValue simplifySelect(SDValue Cond, SDValue TVal, SDValue FVal)
Try to simplify a select/vselect into 1 of its operands or a constant.
Definition: SelectionDAG.cpp:8893
llvm::SelectionDAG::getFPExtendOrRound
SDValue getFPExtendOrRound(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of float type, to the float type VT, by either extending or rounding (by tr...
Definition: SelectionDAG.cpp:1374
llvm::BumpPtrAllocator
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition: Allocator.h:375
llvm::SelectionDAG::getCopyToReg
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N, SDValue Glue)
Definition: SelectionDAG.h:773
llvm::SelectionDAG::doesNodeExist
bool doesNodeExist(unsigned Opcode, SDVTList VTList, ArrayRef< SDValue > Ops)
Check if a node exists without modifying its flags.
Definition: SelectionDAG.cpp:9904
llvm::SelectionDAG::getNodeIfExists
SDNode * getNodeIfExists(unsigned Opcode, SDVTList VTList, ArrayRef< SDValue > Ops, const SDNodeFlags Flags)
Get the specified node if it's already available, or else return NULL.
Definition: SelectionDAG.cpp:9888
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:79
llvm::SelectionDAG::getEHLabel
SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label)
Definition: SelectionDAG.cpp:2124
llvm::iplist_impl< simple_ilist< T, Options... >, ilist_traits< T > >::remove
pointer remove(iterator &IT)
Definition: ilist.h:252
llvm::SelectionDAG::getCommutedVectorShuffle
SDValue getCommutedVectorShuffle(const ShuffleVectorSDNode &SV)
Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to the shuffle node in input but with swa...
Definition: SelectionDAG.cpp:2085
llvm::SelectionDAG::getTruncStore
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, unsigned Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
FIXME: Remove once transition to Align is over.
Definition: SelectionDAG.h:1352
llvm::SelectionDAG::RemoveDeadNodes
void RemoveDeadNodes()
This method deletes all unreachable nodes in the SelectionDAG.
Definition: SelectionDAG.cpp:930
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2558
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::SelectionDAG::getZExtOrTrunc
SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either zero-extending or trunca...
Definition: SelectionDAG.cpp:1407
llvm::SDDbgInfo::getAlloc
BumpPtrAllocator & getAlloc()
Definition: SelectionDAG.h:183
llvm::EVT::bitsLE
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
Definition: ValueTypes.h:280
llvm::SelectionDAG::isConstantIntBuildVectorOrConstantInt
SDNode * isConstantIntBuildVectorOrConstantInt(SDValue N) const
Test whether the given value is a constant int or similar node.
Definition: SelectionDAG.cpp:11842
llvm::SelectionDAG::getStrictFPExtendOrRound
std::pair< SDValue, SDValue > getStrictFPExtendOrRound(SDValue Op, SDValue Chain, const SDLoc &DL, EVT VT)
Convert Op, which must be a STRICT operation of float type, to the float type VT, by either extending...
Definition: SelectionDAG.cpp:1382
llvm::SelectionDAG::~SelectionDAG
~SelectionDAG()
Definition: SelectionDAG.cpp:1290
llvm::SelectionDAG::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
Definition: SelectionDAG.h:468
llvm::SelectionDAG::clear
void clear()
Clear state and free memory necessary to make this SelectionDAG ready to process a new block.
Definition: SelectionDAG.cpp:1352
llvm::SelectionDAG::getDbgLabel
SDDbgLabel * getDbgLabel(DILabel *Label, const DebugLoc &DL, unsigned O)
Creates a SDDbgLabel node.
Definition: SelectionDAG.cpp:10139
llvm::SelectionDAG::DAGUpdateListener::DAGUpdateListener
DAGUpdateListener(SelectionDAG &D)
Definition: SelectionDAG.h:305
llvm::ISD::CALLSEQ_END
@ CALLSEQ_END
Definition: ISDOpcodes.h:1072
llvm::iplist
An intrusive list with ownership and callbacks specified/controlled by ilist_traits,...
Definition: ilist.h:391
llvm::SelectionDAG::getIndexedStore
SDValue getIndexedStore(SDValue OrigStore, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8083
llvm::SDDbgInfo::ByvalParmDbgBegin
DbgIterator ByvalParmDbgBegin()
Definition: SelectionDAG.h:201
llvm::SDVTListNode::getSDVTList
SDVTList getSDVTList()
Definition: SelectionDAG.h:112
llvm::SelectionDAG::ReplaceAllUsesOfValuesWith
void ReplaceAllUsesOfValuesWith(const SDValue *From, const SDValue *To, unsigned Num)
Like ReplaceAllUsesOfValueWith, but for multiple values at once.
Definition: SelectionDAG.cpp:10495
llvm::FoldingSetTrait< SDVTListNode >::ComputeHash
static unsigned ComputeHash(const SDVTListNode &X, FoldingSetNodeID &TempID)
Definition: SelectionDAG.h:132
llvm::SelectionDAG::getContext
LLVMContext * getContext() const
Definition: SelectionDAG.h:476
size_t
llvm::SelectionDAG::DbgBegin
SDDbgInfo::DbgIterator DbgBegin() const
Definition: SelectionDAG.h:1814
llvm::SelectionDAG::isKnownNeverSNaN
bool isKnownNeverSNaN(SDValue Op, unsigned Depth=0) const
Definition: SelectionDAG.h:2036
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:265
llvm::ShuffleVectorSDNode
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
Definition: SelectionDAGNodes.h:1523
llvm::SelectionDAG::getRegister
SDValue getRegister(unsigned Reg, EVT VT)
Definition: SelectionDAG.cpp:2095
llvm::APFloatBase::IEEEquad
static const fltSemantics & IEEEquad() LLVM_READNONE
Definition: APFloat.cpp:176
MachineValueType.h
result
It looks like we only need to define PPCfmarto for these because according to these instructions perform RTO on fma s result
Definition: README_P9.txt:256
llvm::SelectionDAG::FlagInserter::~FlagInserter
~FlagInserter()
Definition: SelectionDAG.h:371
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::SelectionDAG::getVRegDbgValue
SDDbgValue * getVRegDbgValue(DIVariable *Var, DIExpression *Expr, unsigned VReg, bool IsIndirect, const DebugLoc &DL, unsigned O)
Creates a VReg SDDbgValue node.
Definition: SelectionDAG.cpp:9970
llvm::SelectionDAG::foldConstantFPMath
SDValue foldConstantFPMath(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, SDValue N2)
Fold floating-point operations with 2 operands when both operands are constants and/or undefined.
Definition: SelectionDAG.cpp:5859
llvm::CallInfo
Definition: GVNHoist.cpp:217
llvm::BitmaskEnumDetail::Mask
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
llvm::ISD::LoadExtType
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
Definition: ISDOpcodes.h:1404
llvm::SelectionDAG::getVScale
SDValue getVScale(const SDLoc &DL, EVT VT, APInt MulImm)
Return a node that represents the runtime scaling 'MulImm * RuntimeVL'.
Definition: SelectionDAG.h:997
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::SelectionDAG::getStridedStoreVP
SDValue getStridedStoreVP(SDValue Chain, const SDLoc &DL, SDValue Val, SDValue Ptr, SDValue Offset, SDValue Stride, SDValue Mask, SDValue EVL, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, bool IsTruncating=false, bool IsCompressing=false)
Definition: SelectionDAG.cpp:8481
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:79
llvm::SelectionDAG::getLoad
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands,...
Definition: SelectionDAG.cpp:7914
llvm::SelectionDAG::getDbgValue
SDDbgValue * getDbgValue(DIVariable *Var, DIExpression *Expr, SDNode *N, unsigned R, bool IsIndirect, const DebugLoc &DL, unsigned O)
Creates a SDDbgValue node.
Definition: SelectionDAG.cpp:9919
llvm::BlockFrequencyInfo
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Definition: BlockFrequencyInfo.h:37
llvm::SelectionDAG::DAGNodeDeletedListener::DAGNodeDeletedListener
DAGNodeDeletedListener(SelectionDAG &DAG, std::function< void(SDNode *, SDNode *)> Callback)
Definition: SelectionDAG.h:330
llvm::SelectionDAG::getMaskedStore
SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Base, SDValue Offset, SDValue Mask, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, bool IsTruncating=false, bool IsCompressing=false)
Definition: SelectionDAG.cpp:8751
llvm::SelectionDAG::isGuaranteedNotToBeUndefOrPoison
bool isGuaranteedNotToBeUndefOrPoison(SDValue Op, bool PoisonOnly=false, unsigned Depth=0) const
Return true if this function can prove that Op is never poison and, if PoisonOnly is false,...
Definition: SelectionDAG.cpp:4506
llvm::ISD::SELECT_CC
@ SELECT_CC
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
Definition: ISDOpcodes.h:728
llvm::SelectionDAG::getIndexedMaskedLoad
SDValue getIndexedMaskedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8740
llvm::SelectionDAG::getTargetFrameIndex
SDValue getTargetFrameIndex(int FI, EVT VT)
Definition: SelectionDAG.h:717
llvm::SelectionDAG::DAGUpdateListener::DAG
SelectionDAG & DAG
Definition: SelectionDAG.h:303
llvm::SDValue::getValueType
EVT getValueType() const
Return the ValueType of the referenced return value.
Definition: SelectionDAGNodes.h:1138
llvm::SelectionDAG::isKnownToBeAPowerOfTwo
bool isKnownToBeAPowerOfTwo(SDValue Val) const
Test if the given value is known to have exactly one bit set.
Definition: SelectionDAG.cpp:3851
llvm::SDDbgLabel
Holds the information from a dbg_label node through SDISel.
Definition: SDNodeDbgValue.h:242
llvm::SelectionDAG::matchBinOpReduction
SDValue matchBinOpReduction(SDNode *Extract, ISD::NodeType &BinOp, ArrayRef< ISD::NodeType > CandidateBinOps, bool AllowPartials=false)
Match a binop + shuffle pyramid that represents a horizontal reduction over the elements of a vector ...
Definition: SelectionDAG.cpp:11076
llvm::SelectionDAG::DAGUpdateListener::~DAGUpdateListener
virtual ~DAGUpdateListener()
Definition: SelectionDAG.h:310
llvm::SelectionDAG::getTargetConstant
SDValue getTargetConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
Definition: SelectionDAG.h:674
llvm::SelectionDAG
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Definition: SelectionDAG.h:220
SelectionDAGNodes.h
llvm::ISD::SELECT
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
Definition: ISDOpcodes.h:713
llvm::SelectionDAG::UpdateNodeOperands
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
Definition: SelectionDAG.cpp:9394
llvm::ISD::Constant
@ Constant
Definition: ISDOpcodes.h:76
llvm::SelectionDAG::getScatterVP
SDValue getScatterVP(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
Definition: SelectionDAG.cpp:8661
llvm::SelectionDAG::getBoolExtOrTrunc
SDValue getBoolExtOrTrunc(SDValue Op, const SDLoc &SL, EVT VT, EVT OpVT)
Convert Op, which must be of integer type, to the integer type VT, by using an extension appropriate ...
Definition: SelectionDAG.cpp:1413
llvm::AAResults
Definition: AliasAnalysis.h:518
llvm::SelectionDAG::getTargetBlockAddress
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned TargetFlags=0)
Definition: SelectionDAG.h:759
llvm::SelectionDAG::getStoreVP
SDValue getStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Offset, SDValue Mask, SDValue EVL, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, bool IsTruncating=false, bool IsCompressing=false)
Definition: SelectionDAG.cpp:8229
llvm::SelectionDAG::getTruncStore
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Definition: SelectionDAG.cpp:8016
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::APFloatBase::IEEEhalf
static const fltSemantics & IEEEhalf() LLVM_READNONE
Definition: APFloat.cpp:164
llvm::SelectionDAG::LegalizeTypes
bool LegalizeTypes()
This transforms the SelectionDAG into a SelectionDAG that only uses types natively supported by the t...
Definition: LegalizeTypes.cpp:1059
llvm::SelectionDAG::getObjectPtrOffset
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, TypeSize Offset)
Create an add instruction with appropriate flags when used for addressing some offset of an object.
Definition: SelectionDAG.h:940
llvm::SelectionDAG::getVAArg
SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue SV, unsigned Align)
VAArg produces a result and token chain, and takes a pointer and a source value as input.
Definition: SelectionDAG.cpp:8992
llvm::SelectionDAG::getUNDEF
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
Definition: SelectionDAG.h:992
llvm::ISD::CopyToReg
@ CopyToReg
CopyToReg - This node has three operands: a chain, a register number to set to this value,...
Definition: ISDOpcodes.h:203
llvm::SelectionDAG::FlagInserter::FlagInserter
FlagInserter(SelectionDAG &SDAG, SDNode *N)
Definition: SelectionDAG.h:366
llvm::SelectionDAG::getTargetLoweringInfo
const TargetLowering & getTargetLoweringInfo() const
Definition: SelectionDAG.h:472
llvm::EVT
Extended Value Type.
Definition: ValueTypes.h:34
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::SelectionDAG::getSrcValue
SDValue getSrcValue(const Value *v)
Construct a node to track a Value* through the backend.
Definition: SelectionDAG.cpp:2168
llvm::MachineFunction::getDenormalMode
DenormalMode getDenormalMode(const fltSemantics &FPType) const
Returns the denormal handling type for the default rounding mode of the function.
Definition: MachineFunction.cpp:300
llvm::MVT::f64
@ f64
Definition: MachineValueType.h:58
llvm::SelectionDAG::getConstant
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
Definition: SelectionDAG.cpp:1483
llvm::EVT::getVectorNumElements
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
Definition: ValueTypes.h:308
llvm::TargetLowering
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Definition: TargetLowering.h:3434
llvm::SelectionDAG::isUndef
bool isUndef(unsigned Opcode, ArrayRef< SDValue > Ops)
Return true if the result of this operation is always undefined.
Definition: SelectionDAG.cpp:5622
llvm::SelectionDAG::allnodes
iterator_range< allnodes_const_iterator > allnodes() const
Definition: SelectionDAG.h:537
Y
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
llvm::SelectionDAG::MaskedValueIsZero
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
Definition: SelectionDAG.cpp:2506
llvm::SelectionDAG::getFlagInserter
FlagInserter * getFlagInserter()
Definition: SelectionDAG.h:481
llvm::SelectionDAG::FlagInserter::getFlags
SDNodeFlags getFlags() const
Definition: SelectionDAG.h:373
llvm::SelectionDAG::getDivergenceAnalysis
const LegacyDivergenceAnalysis * getDivergenceAnalysis() const
Definition: SelectionDAG.h:475
llvm::SelectionDAG::DAGUpdateListener::NodeInserted
virtual void NodeInserted(SDNode *N)
The node N that was inserted.
Definition: SelectionDAG.cpp:92
llvm::SelectionDAG::Legalize
void Legalize()
This transforms the SelectionDAG into a SelectionDAG that is compatible with the target instruction s...
Definition: LegalizeDAG.cpp:5066
llvm::SelectionDAG::simplifyFPBinop
SDValue simplifyFPBinop(unsigned Opcode, SDValue X, SDValue Y, SDNodeFlags Flags)
Try to simplify a floating-point binary operation into 1 of its operands or a constant.
Definition: SelectionDAG.cpp:8947
llvm::SelectionDAG::InferPtrAlign
MaybeAlign InferPtrAlign(SDValue Ptr) const
Infer alignment of a load / store address.
Definition: SelectionDAG.cpp:11338
llvm::SelectionDAG::DAGNodeInsertedListener::NodeInserted
void NodeInserted(SDNode *N) override
The node N that was inserted.
Definition: SelectionDAG.h:347
llvm::MVT::SimpleTy
SimpleValueType SimpleTy
Definition: MachineValueType.h:331
llvm::SelectionDAG::DAGUpdateListener::NodeUpdated
virtual void NodeUpdated(SDNode *N)
The node N that was updated.
Definition: SelectionDAG.cpp:91
llvm::APInt::getAllOnes
static APInt getAllOnes(unsigned numBits)
Return an APInt of a specified width with all bits set.
Definition: APInt.h:214
llvm::SelectionDAG::getFreeze
SDValue getFreeze(SDValue V)
Return a freeze using the SDLoc of the value operand.
Definition: SelectionDAG.cpp:2226
DAGCombine.h
llvm::SelectionDAG::getIndexedStridedStoreVP
SDValue getIndexedStridedStoreVP(SDValue OrigStore, const SDLoc &DL, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8586
llvm::ArrayRecycler::deallocate
void deallocate(Capacity Cap, T *Ptr)
Deallocate an array with the specified Capacity.
Definition: ArrayRecycler.h:137
llvm::SelectionDAGTargetInfo
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
Definition: SelectionDAGTargetInfo.h:31
DenseSet.h
llvm::ISD::GLOBAL_OFFSET_TABLE
@ GLOBAL_OFFSET_TABLE
The address of the GOT.
Definition: ISDOpcodes.h:87
llvm::SelectionDAG::DbgLabelBegin
SDDbgInfo::DbgLabelIterator DbgLabelBegin() const
Definition: SelectionDAG.h:1824
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
llvm::SDDbgInfo::empty
bool empty() const
Definition: SelectionDAG.h:185
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
SDAG
QP Compare Ordered outs ins xscmpudp No SDAG
Definition: README_P9.txt:301
llvm::ISD::NodeType
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
Definition: ISDOpcodes.h:40
llvm::SelectionDAG::setRoot
const SDValue & setRoot(SDValue N)
Set the current root tag of the SelectionDAG.
Definition: SelectionDAG.h:551
llvm::SelectionDAG::getTruncStoreVP
SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo, bool IsCompressing=false)
Definition: SelectionDAG.cpp:8263
llvm::SelectionDAG::MaskedVectorIsZero
bool MaskedVectorIsZero(SDValue Op, const APInt &DemandedElts, unsigned Depth=0) const
Return true if 'Op' is known to be zero in DemandedElts.
Definition: SelectionDAG.cpp:2522
llvm::SelectionDAG::FlagInserter::FlagInserter
FlagInserter(SelectionDAG &SDAG, SDNodeFlags Flags)
Definition: SelectionDAG.h:361
llvm::EVT::isInteger
bool isInteger() const
Return true if this is an integer or a vector integer type.
Definition: ValueTypes.h:144
llvm::MCID::Flag
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:147
llvm::SelectionDAG::getGatherVP
SDValue getGatherVP(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
Definition: SelectionDAG.cpp:8618
llvm::SelectionDAG::getMemIntrinsicNode
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, MaybeAlign Alignment=None, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, uint64_t Size=0, const AAMDNodes &AAInfo=AAMDNodes())
Definition: SelectionDAG.h:1198
llvm::SDVTListNode
Definition: SelectionDAG.h:91
llvm::SelectionDAG::DAGNodeDeletedListener
Definition: SelectionDAG.h:327
llvm::SelectionDAG::getAddrSpaceCast
SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr, unsigned SrcAS, unsigned DestAS)
Return an AddrSpaceCastSDNode.
Definition: SelectionDAG.cpp:2205
llvm::ConstantFP
ConstantFP - Floating Point Values [float, double].
Definition: Constants.h:257
llvm::SelectionDAG::getSetCCVP
SDValue getSetCCVP(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Mask, SDValue EVL)
Helper function to make it easier to build VP_SETCCs if you just have an ISD::CondCode instead of an ...
Definition: SelectionDAG.h:1119
APFloat.h
llvm::SelectionDAG::isEqualTo
bool isEqualTo(SDValue A, SDValue B) const
Test whether two SDValues are known to compare equal.
Definition: SelectionDAG.cpp:4817
llvm::SelectionDAG::getMemIntrinsicNode
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, uint64_t Size=0, const AAMDNodes &AAInfo=AAMDNodes())
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
Definition: SelectionDAG.cpp:7689
llvm::LegacyDivergenceAnalysis
Definition: LegacyDivergenceAnalysis.h:31
llvm::SelectionDAG::dump
void dump() const
Definition: SelectionDAGDumper.cpp:925
DebugLoc.h
llvm::ISD::SETCC_INVALID
@ SETCC_INVALID
Definition: ISDOpcodes.h:1452
llvm::SelectionDAG::SplitVectorOperand
std::pair< SDValue, SDValue > SplitVectorOperand(const SDNode *N, unsigned OpNo)
Split the node's operand with EXTRACT_SUBVECTOR and return the low/high part.
Definition: SelectionDAG.h:2158
llvm::SelectionDAG::ComputeMaxSignificantBits
unsigned ComputeMaxSignificantBits(SDValue Op, unsigned Depth=0) const
Get the upper bound on bit size for this Value Op as a signed integer.
Definition: SelectionDAG.cpp:4493
llvm::SelectionDAG::getAssertAlign
SDValue getAssertAlign(const SDLoc &DL, SDValue V, Align A)
Return an AssertAlignSDNode.
Definition: SelectionDAG.cpp:5932
llvm::SelectionDAG::getIndexedLoadVP
SDValue getIndexedLoadVP(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8213
llvm::ISD::SPLAT_VECTOR
@ SPLAT_VECTOR
SPLAT_VECTOR(VAL) - Returns a vector with the scalar value VAL duplicated in all lanes.
Definition: ISDOpcodes.h:613
llvm::SelectionDAG::getTruncStridedStoreVP
SDValue getTruncStridedStoreVP(SDValue Chain, const SDLoc &DL, SDValue Val, SDValue Ptr, SDValue Stride, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo, bool IsCompressing=false)
Definition: SelectionDAG.cpp:8517
llvm::SelectionDAG::isKnownNeverNaN
bool isKnownNeverNaN(SDValue Op, bool SNaN=false, unsigned Depth=0) const
Test whether the given SDValue is known to never be NaN.
Definition: SelectionDAG.cpp:4666
llvm::SDDbgInfo::DbgLabelBegin
DbgLabelIterator DbgLabelBegin()
Definition: SelectionDAG.h:203
llvm::SelectionDAG::viewGraph
void viewGraph()
Definition: SelectionDAGPrinter.cpp:159
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
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
llvm::ISD::CopyFromReg
@ CopyFromReg
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
Definition: ISDOpcodes.h:208
llvm::None
const NoneType None
Definition: None.h:24
llvm::SelectionDAG::getEVTAlign
Align getEVTAlign(EVT MemoryVT) const
Compute the default alignment value for the given type.
Definition: SelectionDAG.cpp:1255
llvm::SelectionDAG::getStridedLoadVP
SDValue getStridedLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Stride, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT, Align Alignment, MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo, const MDNode *Ranges=nullptr, bool IsExpanding=false)
Definition: SelectionDAG.cpp:8365
llvm::SelectionDAG::getObjectPtrOffset
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, SDValue Offset)
Definition: SelectionDAG.h:946
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::SelectionDAG::canonicalizeCommutativeBinop
void canonicalizeCommutativeBinop(unsigned Opcode, SDValue &N1, SDValue &N2) const
Swap N1 and N2 if Opcode is a commutative binary opcode and the canonical form expects the opposite o...
Definition: SelectionDAG.cpp:5968
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:94
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:110
llvm::SelectionDAG::getTargetGlobalAddress
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned TargetFlags=0)
Definition: SelectionDAG.h:712
llvm::SelectionDAG::expandVAArg
SDValue expandVAArg(SDNode *Node)
Expand the specified ISD::VAARG node as the Legalize pass would.
Definition: SelectionDAG.cpp:2240
llvm::ProfileSummaryInfo
Analysis providing profile information.
Definition: ProfileSummaryInfo.h:39
llvm::SelectionDAG::SelectionDAG
SelectionDAG(const TargetMachine &TM, CodeGenOpt::Level)
Definition: SelectionDAG.cpp:1264
llvm::MVT::f80
@ f80
Definition: MachineValueType.h:59
llvm::GraphTraits< SDNode * >
Definition: SelectionDAGNodes.h:3007
llvm::SelectionDAG::getValidShiftAmountConstant
const APInt * getValidShiftAmountConstant(SDValue V, const APInt &DemandedElts) const
If a SHL/SRA/SRL node V has a constant or splat constant shift amount that is less than the element b...
Definition: SelectionDAG.cpp:2806
llvm::ISD::BlockAddress
@ BlockAddress
Definition: ISDOpcodes.h:84
llvm::SDDbgInfo::clear
void clear()
Definition: SelectionDAG.h:175
llvm::SelectionDAG::getBFI
BlockFrequencyInfo * getBFI() const
Definition: SelectionDAG.h:479
llvm::checkForCycles
void checkForCycles(const SelectionDAG *DAG, bool force=false)
Definition: SelectionDAG.cpp:12000
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:200
llvm::ISD::STRICT_FSETCCS
@ STRICT_FSETCCS
Definition: ISDOpcodes.h:476
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition: MachineFunction.h:656
llvm::pointer_iterator
Definition: iterator.h:344
llvm::SelectionDAG::ByvalParmDbgBegin
SDDbgInfo::DbgIterator ByvalParmDbgBegin() const
Definition: SelectionDAG.h:1817
llvm::SelectionDAG::OFK_Sometime
@ OFK_Sometime
Definition: SelectionDAG.h:1927
llvm::APFloat
Definition: APFloat.h:701
llvm::SelectionDAG::isKnownNeverZeroFloat
bool isKnownNeverZeroFloat(SDValue Op) const
Test whether the given floating point SDValue is known to never be positive or negative zero.
Definition: SelectionDAG.cpp:4784
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:264
llvm::FoldingSetTrait< SDVTListNode >::Profile
static void Profile(const SDVTListNode &X, FoldingSetNodeID &ID)
Definition: SelectionDAG.h:121
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::SelectionDAG::RemoveDeadNode
void RemoveDeadNode(SDNode *N)
Remove the specified node from the system.
Definition: SelectionDAG.cpp:984
llvm::SelectionDAG::getLoad
SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
FIXME: Remove once transition to Align is over.
Definition: SelectionDAG.h:1292
llvm::SelectionDAG::addCallSiteInfo
void addCallSiteInfo(const SDNode *Node, CallSiteInfoImpl &&CallInfo)
Set CallSiteInfo to be associated with Node.
Definition: SelectionDAG.h:2191
llvm::SelectionDAG::SplitVector
std::pair< SDValue, SDValue > SplitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the vector with EXTRACT_SUBVECTOR using the provides VTs and return the low/high part.
Definition: SelectionDAG.cpp:11419
llvm::EVT::getSizeInBits
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
Definition: ValueTypes.h:340
llvm::SelectionDAG::getAtomicMemmove
SDValue getAtomicMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
Definition: SelectionDAG.cpp:7432
llvm::FoldingSetTrait
FoldingSetTrait - This trait class is used to define behavior of how to "profile" (in the FoldingSet ...
Definition: FoldingSet.h:261
llvm::DenseMapBase::clear
void clear()
Definition: DenseMap.h:110
llvm::SelectionDAG::MaxRecursionDepth
static constexpr unsigned MaxRecursionDepth
Definition: SelectionDAG.h:442
uint64_t
llvm::SelectionDAG::getLifetimeNode
SDValue getLifetimeNode(bool IsStart, const SDLoc &dl, SDValue Chain, int FrameIndex, int64_t Size, int64_t Offset=-1)
Creates a LifetimeSDNode that starts (IsStart==true) or ends (IsStart==false) the lifetime of the por...
Definition: SelectionDAG.cpp:7747
llvm::GraphTraits< SelectionDAG * >::nodes_begin
static nodes_iterator nodes_begin(SelectionDAG *G)
Definition: SelectionDAG.h:2290
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::SelectionDAG::getLibInfo
const TargetLibraryInfo & getLibInfo() const
Definition: SelectionDAG.h:473
llvm::SDDbgInfo::erase
void erase(const SDNode *Node)
Invalidate all DbgValues attached to the node and remove it from the Node-to-DbgValues map.
Definition: SelectionDAG.cpp:1026
llvm::SelectionDAG::getIntPtrConstant
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
Definition: SelectionDAG.cpp:1606
llvm::SelectionDAG::getMemset
SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVol, bool AlwaysInline, bool isTailCall, MachinePointerInfo DstPtrInfo, const AAMDNodes &AAInfo=AAMDNodes())
Definition: SelectionDAG.cpp:7472
llvm::ilist_alloc_traits< SDNode >::deleteNode
static void deleteNode(SDNode *)
Definition: SelectionDAG.h:138
llvm::SelectionDAG::getMaskedGather
SDValue getMaskedGather(SDVTList VTs, EVT MemVT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType, ISD::LoadExtType ExtTy)
Definition: SelectionDAG.cpp:8800
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:63
llvm::SelectionDAG::mutateStrictFPToFP
SDNode * mutateStrictFPToFP(SDNode *Node)
Mutate the specified strict FP node to its non-strict equivalent, unlinking the node from its chain a...
Definition: SelectionDAG.cpp:9694
llvm::MachinePointerInfo
This class contains a discriminated union of information about pointers in memory operands,...
Definition: MachineMemOperand.h:39
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
llvm::SelectionDAG::getConstantPool
SDValue getConstantPool(const Constant *C, EVT VT, MaybeAlign Align=None, int Offs=0, bool isT=false, unsigned TargetFlags=0)
Definition: SelectionDAG.cpp:1747
llvm::SelectionDAG::getGraphAttrs
std::string getGraphAttrs(const SDNode *N) const
Get graph attributes for a node.
Definition: SelectionDAGPrinter.cpp:203
llvm::SelectionDAG::getCopyFromReg
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT)
Definition: SelectionDAG.h:790
llvm::DenseMap< const SDNode *, SmallVector< SDDbgValue *, 2 > >
llvm::SelectionDAG::shouldOptForSize
bool shouldOptForSize() const
Definition: SelectionDAG.cpp:1297
llvm::SelectionDAG::getLogicalNOT
SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a logical NOT operation as (XOR Val, BooleanOne).
Definition: SelectionDAG.cpp:1457
iterator.h
llvm::SelectionDAG::getLoadVP
SDValue getLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT, Align Alignment, MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo, const MDNode *Ranges=nullptr, bool IsExpanding=false)
Definition: SelectionDAG.cpp:8112
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::SelectionDAG::getNode
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
Definition: SelectionDAG.cpp:8998
llvm::SelectionDAG::getNOT
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
Definition: SelectionDAG.cpp:1453
llvm::SelectionDAG::updateDivergence
void updateDivergence(SDNode *N)
Definition: SelectionDAG.cpp:10449
llvm::SelectionDAG::allnodes
iterator_range< allnodes_iterator > allnodes()
Definition: SelectionDAG.h:534
llvm::DenormalMode
Represent subnormal handling kind for floating point instruction inputs and outputs.
Definition: FloatingPointMode.h:69
llvm::SelectionDAG::getPseudoProbeNode
SDValue getPseudoProbeNode(const SDLoc &Dl, SDValue Chain, uint64_t Guid, uint64_t Index, uint32_t Attr)
Creates a PseudoProbeSDNode with function GUID Guid and the index of the block Index it is probing,...
Definition: SelectionDAG.cpp:7777
llvm::SelectionDAG::getLoadVP
SDValue getLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, bool IsExpanding=false)
Definition: SelectionDAG.h:1371
llvm::ilist_alloc_traits
Use delete by default for iplist and ilist.
Definition: ilist.h:41
llvm::SelectionDAG::getSExtOrTrunc
SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either sign-extending or trunca...
Definition: SelectionDAG.cpp:1401
ArrayRef.h
llvm::SelectionDAG::OFK_Always
@ OFK_Always
Definition: SelectionDAG.h:1928
llvm::SelectionDAG::operator=
SelectionDAG & operator=(const SelectionDAG &)=delete
llvm::SelectionDAG::getAnyExtOrTrunc
SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either any-extending or truncat...
Definition: SelectionDAG.cpp:1395
llvm::SelectionDAG::getCALLSEQ_END
SDValue getCALLSEQ_END(SDValue Chain, uint64_t Size1, uint64_t Size2, SDValue Glue, const SDLoc &DL)
Definition: SelectionDAG.h:981
llvm::SelectionDAG::getPSI
ProfileSummaryInfo * getPSI() const
Definition: SelectionDAG.h:478
llvm::SelectionDAG::getSubtarget
const STC & getSubtarget() const
Definition: SelectionDAG.h:469
llvm::SelectionDAG::getIndexedStridedLoadVP
SDValue getIndexedStridedLoadVP(SDValue OrigLoad, const SDLoc &DL, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8464
TemplateParamKind::Type
@ Type
llvm::SelectionDAG::MorphNodeTo
SDNode * MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs, ArrayRef< SDValue > Ops)
This mutates the specified node to have the specified return type, opcode, and operands.
Definition: SelectionDAG.cpp:9641
llvm::SelectionDAG::getExtStridedLoadVP
SDValue getExtStridedLoadVP(ISD::LoadExtType ExtType, const SDLoc &DL, EVT VT, SDValue Chain, SDValue Ptr, SDValue Stride, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo, bool IsExpanding=false)
Definition: SelectionDAG.cpp:8443
llvm::SelectionDAG::getAllOnesConstant
SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget=false, bool IsOpaque=false)
Definition: SelectionDAG.h:651
llvm::SelectionDAG::NewNodesMustHaveLegalTypes
bool NewNodesMustHaveLegalTypes
When true, additional steps are taken to ensure that getConstant() and similar functions return DAG n...
Definition: SelectionDAG.h:381
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:150
llvm::MachineMemOperand::Flags
Flags
Flags values. These may be or'd together.
Definition: MachineMemOperand.h:130
llvm::APFloatBase::PPCDoubleDouble
static const fltSemantics & PPCDoubleDouble() LLVM_READNONE
Definition: APFloat.cpp:185
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::SelectionDAG::getVectorShuffle
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
Definition: SelectionDAG.cpp:1912
llvm::SelectionDAG::getMaskedLoad
SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Base, SDValue Offset, SDValue Mask, SDValue Src0, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, ISD::LoadExtType, bool IsExpanding=false)
Definition: SelectionDAG.cpp:8705
llvm::MachineFunction::CallSiteInfoImpl
SmallVectorImpl< ArgRegPair > CallSiteInfoImpl
Definition: MachineFunction.h:440
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::SelectionDAG::getAtomic
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, MachineMemOperand *MMO)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands.
Definition: SelectionDAG.cpp:7637
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1666
llvm::FunctionLoweringInfo
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Definition: FunctionLoweringInfo.h:52
llvm::MVT::Other
@ Other
Definition: MachineValueType.h:42
llvm::SelectionDAG::getSelectCC
SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond)
Helper function to make it easier to build SelectCC's if you just have an ISD::CondCode instead of an...
Definition: SelectionDAG.h:1141
Ptr
@ Ptr
Definition: TargetLibraryInfo.cpp:60
llvm::ISD::CondCode
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
Definition: ISDOpcodes.h:1424
iterator_range.h
llvm::SelectionDAG::getCallSiteInfo
CallSiteInfo getCallSiteInfo(const SDNode *Node)
Return CallSiteInfo associated with Node, or a default if none exists.
Definition: SelectionDAG.h:2195
llvm::SelectionDAG::getCopyFromReg
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT, SDValue Glue)
Definition: SelectionDAG.h:799
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:82
llvm::SelectionDAG::getMachineNode
MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s),...
Definition: SelectionDAG.cpp:9742
llvm::SelectionDAG::getBitcast
SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type.
Definition: SelectionDAG.cpp:2198
llvm::MachineFunction::CallSiteInfo
SmallVector< ArgRegPair, 1 > CallSiteInfo
Vector of call argument and its forwarding register.
Definition: MachineFunction.h:439
llvm::SelectionDAG::isGuaranteedNotToBePoison
bool isGuaranteedNotToBePoison(SDValue Op, unsigned Depth=0) const
Return true if this function can prove that Op is never poison.
Definition: SelectionDAG.h:1985
llvm::SelectionDAG::setNodeMemRefs
void setNodeMemRefs(MachineSDNode *N, ArrayRef< MachineMemOperand * > NewMemRefs)
Mutate the specified machine node's memory references to the provided list.
Definition: SelectionDAG.cpp:9510
llvm::MDNode
Metadata node.
Definition: Metadata.h:944
llvm::SelectionDAG::haveNoCommonBitsSet
bool haveNoCommonBitsSet(SDValue A, SDValue B) const
Return true if A and B have no common bits set.
Definition: SelectionDAG.cpp:4872
llvm::SelectionDAG::CreateStackTemporary
SDValue CreateStackTemporary(TypeSize Bytes, Align Alignment)
Create a stack temporary based on the size in bytes and the alignment.
Definition: SelectionDAG.cpp:2316
llvm::FoldingSetTrait< SDVTListNode >::Equals
static bool Equals(const SDVTListNode &X, const FoldingSetNodeID &ID, unsigned IDHash, FoldingSetNodeID &TempID)
Definition: SelectionDAG.h:125
llvm::SelectionDAG::SelectNodeTo
SDNode * SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT)
These are used for target selectors to mutate the specified node to have the specified return type,...
Definition: SelectionDAG.cpp:9534
llvm::SelectionDAG::getPCSections
MDNode * getPCSections(const SDNode *Node) const
Return PCSections associated with Node, or nullptr if none exists.
Definition: SelectionDAG.h:2213
llvm::MVT::bf16
@ bf16
Definition: MachineValueType.h:55
llvm::SelectionDAG::getTokenFactor
SDValue getTokenFactor(const SDLoc &DL, SmallVectorImpl< SDValue > &Vals)
Creates a new TokenFactor containing Vals.
Definition: SelectionDAG.cpp:11898
llvm::SelectionDAG::getGlobalAddress
SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, bool isTargetGA=false, unsigned TargetFlags=0)
Definition: SelectionDAG.cpp:1680
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::SelectionDAG::getORE
OptimizationRemarkEmitter & getORE() const
Definition: SelectionDAG.h:477
llvm::SelectionDAG::getCALLSEQ_END
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, SDValue InGlue, const SDLoc &DL)
Return a new CALLSEQ_END node, which always must have a glue result (to ensure it's not CSE'd).
Definition: SelectionDAG.h:969
llvm::ISD::VSCALE
@ VSCALE
VSCALE(IMM) - Returns the runtime scaling factor used to calculate the number of elements within a sc...
Definition: ISDOpcodes.h:1249
llvm::SelectionDAG::DAGNodeInsertedListener
Definition: SelectionDAG.h:340
llvm::SelectionDAG::allnodes_size
ilist< SDNode >::size_type allnodes_size() const
Definition: SelectionDAG.h:530
llvm::SDDbgInfo::DbgLabelEnd
DbgLabelIterator DbgLabelEnd()
Definition: SelectionDAG.h:204
llvm::BlockAddress
The address of a basic block.
Definition: Constants.h:849
llvm::SelectionDAG::clearGraphAttrs
void clearGraphAttrs()
Clear all previously defined node graph attributes.
Definition: SelectionDAGPrinter.cpp:179
llvm::SelectionDAG::getTargetConstantPool
SDValue getTargetConstantPool(const Constant *C, EVT VT, MaybeAlign Align=None, int Offset=0, unsigned TargetFlags=0)
Definition: SelectionDAG.h:728
llvm::FoldingSet
FoldingSet - This template class is used to instantiate a specialized implementation of the folding s...
Definition: FoldingSet.h:520
llvm::SelectionDAG::SplitVector
std::pair< SDValue, SDValue > SplitVector(const SDValue &N, const SDLoc &DL)
Split the vector with EXTRACT_SUBVECTOR and return the low/high part.
Definition: SelectionDAG.h:2147
llvm::SelectionDAG::getDbgValueList
SDDbgValue * getDbgValueList(DIVariable *Var, DIExpression *Expr, ArrayRef< SDDbgOperand > Locs, ArrayRef< SDNode * > Dependencies, bool IsIndirect, const DebugLoc &DL, unsigned O, bool IsVariadic)
Creates a SDDbgValue node from a list of locations.
Definition: SelectionDAG.cpp:9981
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::EVT::isVector
bool isVector() const
Return true if this is a vector value type.
Definition: ValueTypes.h:154
llvm::SelectionDAG::getSelect
SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS, SDValue RHS)
Helper function to make it easier to build Select's if you just have operands and don't want to check...
Definition: SelectionDAG.h:1131
llvm::SelectionDAG::getTargetConstant
SDValue getTargetConstant(const APInt &Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
Definition: SelectionDAG.h:670
llvm::OptimizationRemarkEmitter
The optimization diagnostic interface.
Definition: OptimizationRemarkEmitter.h:33
Cond
SmallVector< MachineOperand, 4 > Cond
Definition: BasicBlockSections.cpp:137
llvm::APFloatBase::IEEEdouble
static const fltSemantics & IEEEdouble() LLVM_READNONE
Definition: APFloat.cpp:173
llvm::SelectionDAG::getTargetInsertSubreg
SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand, SDValue Subreg)
A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
Definition: SelectionDAG.cpp:9870
llvm::EVT::getScalarSizeInBits
uint64_t getScalarSizeInBits() const
Definition: ValueTypes.h:352
llvm::FoldingSetBase::Node
Node - This class is used to maintain the singly linked bucket list in a folding set.
Definition: FoldingSet.h:136
llvm::SelectionDAG::getLoad
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
FIXME: Remove once transition to Align is over.
Definition: SelectionDAG.h:1242
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::SDDbgInfo::add
void add(SDDbgLabel *L)
Definition: SelectionDAG.h:169
llvm::SelectionDAG::getBlockAddress
SDValue getBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, bool isTarget=false, unsigned TargetFlags=0)
Definition: SelectionDAG.cpp:2148
llvm::SelectionDAG::ReplaceAllUsesOfValueWith
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.getNode() alone.
Definition: SelectionDAG.cpp:10337
llvm::SelectionDAG::WidenVector
SDValue WidenVector(const SDValue &N, const SDLoc &DL)
Widen the vector up to the next power of two using INSERT_SUBVECTOR.
Definition: SelectionDAG.cpp:11458
A
* A
Definition: README_ALTIVEC.txt:89
llvm::SelectionDAG::useInstrRefDebugInfo
void useInstrRefDebugInfo(bool Flag)
Signal whether instruction referencing variable locations are desired for this function's debug-info.
Definition: SelectionDAG.h:1837
uint32_t
llvm::SelectionDAG::setFunctionLoweringInfo
void setFunctionLoweringInfo(FunctionLoweringInfo *FuncInfo)
Definition: SelectionDAG.h:455
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::SelectionDAG::addHeapAllocSite
void addHeapAllocSite(const SDNode *Node, MDNode *MD)
Set HeapAllocSite to be associated with Node.
Definition: SelectionDAG.h:2200
llvm::FoldingSetNodeID
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:318
llvm::ISD::UNDEF
@ UNDEF
UNDEF - An undefined node.
Definition: ISDOpcodes.h:211
llvm::PICLevel::Level
Level
Definition: CodeGen.h:33
llvm::SelectionDAG::getMemmove
SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVol, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo=AAMDNodes(), AAResults *AA=nullptr)
Definition: SelectionDAG.cpp:7370
llvm::SelectionDAG::getAtomicMemcpy
SDValue getAtomicMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
Definition: SelectionDAG.cpp:7330
Node
Definition: ItaniumDemangle.h:155
llvm::DIVariable
Base class for variables.
Definition: DebugInfoMetadata.h:2492
llvm::AMDGPUISD::BFI
@ BFI
Definition: AMDGPUISelLowering.h:429
llvm::SelectionDAG::getShiftAmountOperand
SDValue getShiftAmountOperand(EVT LHSTy, SDValue Op)
Return the specified value casted to the target's desired shift amount type.
Definition: SelectionDAG.cpp:2232
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
llvm::SelectionDAG::getBasicBlock
SDValue getBasicBlock(MachineBasicBlock *MBB)
Definition: SelectionDAG.cpp:1818
llvm::SDVTList
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
Definition: SelectionDAGNodes.h:79
llvm::SelectionDAG::getReducedAlign
Align getReducedAlign(EVT VT, bool UseABI)
In most cases this function returns the ABI alignment for a given type, except for illegal vector typ...
Definition: SelectionDAG.cpp:2288
llvm::TargetSubtargetInfo
TargetSubtargetInfo - Generic base class for all target subtargets.
Definition: TargetSubtargetInfo.h:60
llvm::SelectionDAG::LegalizeOp
bool LegalizeOp(SDNode *N, SmallSetVector< SDNode *, 16 > &UpdatedNodes)
Transforms a SelectionDAG node and any operands to it into a node that is compatible with the target ...
Definition: LegalizeDAG.cpp:5115
llvm::SelectionDAG::getNeutralElement
SDValue getNeutralElement(unsigned Opcode, const SDLoc &DL, EVT VT, SDNodeFlags Flags)
Get the (commutative) neutral element for the given opcode, if it exists.
Definition: SelectionDAG.cpp:11911
llvm::SelectionDAG::getBuildVector
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
Definition: SelectionDAG.h:819
llvm::SelectionDAG::DAGUpdateListener::Next
DAGUpdateListener *const Next
Definition: SelectionDAG.h:302
llvm::SelectionDAG::getConstantFP
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
Definition: SelectionDAG.cpp:1662
llvm::MachineMemOperand::MOLoad
@ MOLoad
The memory access reads data.
Definition: MachineMemOperand.h:134
llvm::GraphTraits< SelectionDAG * >::nodes_end
static nodes_iterator nodes_end(SelectionDAG *G)
Definition: SelectionDAG.h:2294
llvm::SDVTListNode::SDVTListNode
SDVTListNode(const FoldingSetNodeIDRef ID, const EVT *VT, unsigned int Num)
Definition: SelectionDAG.h:107
FoldingSet.h
llvm::SelectionDAG::getTargetJumpTable
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags=0)
Definition: SelectionDAG.h:722
llvm::ArrayRecycler
Recycle small arrays allocated from a BumpPtrAllocator.
Definition: ArrayRecycler.h:28
llvm::SelectionDAG::OFK_Never
@ OFK_Never
Definition: SelectionDAG.h:1926
llvm::ISD::FrameIndex
@ FrameIndex
Definition: ISDOpcodes.h:80
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::SelectionDAG::getAtomicMemset
SDValue getAtomicMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Value, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo)
Definition: SelectionDAG.cpp:7562
llvm::SelectionDAG::getDenormalMode
DenormalMode getDenormalMode(EVT VT) const
Return the current function's default denormal handling kind for the given floating point type.
Definition: SelectionDAG.h:2233
llvm::SelectionDAG::isConstantFPBuildVectorOrConstantFP
SDNode * isConstantFPBuildVectorOrConstantFP(SDValue N) const
Test whether the given value is a constant FP or similar node.
Definition: SelectionDAG.cpp:11861
llvm::SelectionDAG::ByvalParmDbgEnd
SDDbgInfo::DbgIterator ByvalParmDbgEnd() const
Definition: SelectionDAG.h:1820
llvm::SelectionDAG::FoldSymbolOffset
SDValue FoldSymbolOffset(unsigned Opcode, EVT VT, const GlobalAddressSDNode *GA, const SDNode *N2)
Definition: SelectionDAG.cpp:5602
llvm::RecyclingAllocator< BumpPtrAllocator, SDNode, sizeof(LargestSDNode), alignof(MostAlignedSDNode)>
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
llvm::SelectionDAG::salvageDebugInfo
void salvageDebugInfo(SDNode &N)
To be invoked on an SDNode that is slated to be erased.
Definition: SelectionDAG.cpp:10075
llvm::SelectionDAG::DAGNodeDeletedListener::Callback
std::function< void(SDNode *, SDNode *)> Callback
Definition: SelectionDAG.h:328
std
Definition: BitVector.h:851
llvm::SelectionDAG::computeKnownBits
KnownBits computeKnownBits(SDValue Op, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
Definition: SelectionDAG.cpp:2882
llvm::GlobalAddressSDNode
Definition: SelectionDAGNodes.h:1751
llvm::KnownBits
Definition: KnownBits.h:23
llvm::SelectionDAG::SplitEVL
std::pair< SDValue, SDValue > SplitEVL(SDValue N, EVT VecVT, const SDLoc &DL)
Split the explicit vector length parameter of a VP operation.
Definition: SelectionDAG.cpp:11440
llvm::SelectionDAG::UnrollVectorOp
SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
Definition: SelectionDAG.cpp:11192
uint16_t
llvm::SelectionDAG::copyExtraInfo
void copyExtraInfo(SDNode *From, SDNode *To)
Copy extra info associated with one node to another.
Definition: SelectionDAG.cpp:11949
llvm::EVT::getScalarType
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
Definition: ValueTypes.h:295
llvm::DenseMapBase::end
iterator end()
Definition: DenseMap.h:84
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:348
llvm::ilist_iterator
Iterator for intrusive lists based on ilist_node.
Definition: ilist_iterator.h:57
llvm::SelectionDAG::getEntryNode
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
Definition: SelectionDAG.h:545
llvm::APInt::sextOrTrunc
APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
Definition: APInt.cpp:1002
llvm::SelectionDAG::getDataLayout
const DataLayout & getDataLayout() const
Definition: SelectionDAG.h:466
llvm::SelectionDAG::dumpDotGraph
LLVM_DUMP_METHOD void dumpDotGraph(const Twine &FileName, const Twine &Title)
Just dump dot graph to a user-provided path and title.
Definition: SelectionDAGPrinter.cpp:171
ISDOpcodes.h
llvm::DefaultFoldingSetTrait
DefaultFoldingSetTrait - This class provides default implementations for FoldingSetTrait implementati...
Definition: FoldingSet.h:231
llvm::TypeSize
Definition: TypeSize.h:435
llvm::SelectionDAG::getHeapAllocSite
MDNode * getHeapAllocSite(const SDNode *Node) const
Return HeapAllocSite associated with Node, or nullptr if none exists.
Definition: SelectionDAG.h:2204
llvm::ISD::BUILD_VECTOR
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
Definition: ISDOpcodes.h:514
llvm::fltSemantics
Definition: APFloat.cpp:54
llvm::SelectionDAG::Combine
void Combine(CombineLevel Level, AAResults *AA, CodeGenOpt::Level OptLevel)
This iterates over the nodes in the SelectionDAG, folding certain types of nodes together,...
Definition: DAGCombiner.cpp:25197
llvm::SelectionDAG::getTargetExtractSubreg
SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand)
A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
Definition: SelectionDAG.cpp:9860
llvm::SelectionDAG::AddDbgValue
void AddDbgValue(SDDbgValue *DB, bool isParameter)
Add a dbg_value SDNode.
Definition: SelectionDAG.cpp:10648
llvm::SelectionDAG::OverflowKind
OverflowKind
Used to represent the possible overflow behavior of an operation.
Definition: SelectionDAG.h:1925
llvm::SelectionDAG::calculateDivergence
bool calculateDivergence(SDNode *N)
Definition: SelectionDAG.cpp:10434
llvm::SDDbgInfo::getSDDbgValues
ArrayRef< SDDbgValue * > getSDDbgValues(const SDNode *Node) const
Definition: SelectionDAG.h:189
llvm::SelectionDAG::getTargetExternalSymbol
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
Definition: SelectionDAG.cpp:1863
llvm::SelectionDAG::getMCSymbol
SDValue getMCSymbol(MCSymbol *Sym, EVT VT)
Definition: SelectionDAG.cpp:1854
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::SelectionDAG::getNoMergeSiteInfo
bool getNoMergeSiteInfo(const SDNode *Node) const
Return NoMerge info associated with Node.
Definition: SelectionDAG.h:2223
llvm::SelectionDAG::simplifyShift
SDValue simplifyShift(SDValue X, SDValue Y)
Try to simplify a shift into 1 of its operands or a constant.
Definition: SelectionDAG.cpp:8923
llvm::TargetLibraryInfo
Provides information about what library functions are available for the current target.
Definition: TargetLibraryInfo.h:222
llvm::SDValue
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
Definition: SelectionDAGNodes.h:145
llvm::SelectionDAG::LegalizeVectors
bool LegalizeVectors()
This transforms the SelectionDAG into a SelectionDAG that only uses vector math operations supported ...
Definition: LegalizeVectorOps.cpp:1686
RecyclingAllocator.h
llvm::SDNodeFlags
These are IR-level optimization flags that may be propagated to SDNodes.
Definition: SelectionDAGNodes.h:378
llvm::SmallVectorImpl::clear
void clear()
Definition: SmallVector.h:597
llvm::SelectionDAG::RepositionNode
void RepositionNode(allnodes_iterator Position, SDNode *N)
Move node N in the AllNodes list to be immediately before the given iterator Position.
Definition: SelectionDAG.h:1778
llvm::SelectionDAG::FoldConstantArithmetic
SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops)
Definition: SelectionDAG.cpp:5647
llvm::SelectionDAG::getStore
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
FIXME: Remove once transition to Align is over.
Definition: SelectionDAG.h:1326
llvm::MachineMemOperand::MOStore
@ MOStore
The memory access writes data.
Definition: MachineMemOperand.h:136
llvm::SelectionDAG::DbgEnd
SDDbgInfo::DbgIterator DbgEnd() const
Definition: SelectionDAG.h:1815
llvm::FoldingSetNodeIDRef
FoldingSetNodeIDRef - This class describes a reference to an interned FoldingSetNodeID,...
Definition: FoldingSet.h:288
llvm::SelectionDAG::getBuildVector
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDUse > Ops)
Return an ISD::BUILD_VECTOR node.
Definition: SelectionDAG.h:828
llvm::makeArrayRef
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:475
llvm::SelectionDAG::getShiftAmountConstant
SDValue getShiftAmountConstant(uint64_t Val, EVT VT, const SDLoc &DL, bool LegalTypes=true)
Definition: SelectionDAG.cpp:1611
llvm::SelectionDAG::computeOverflowKind
OverflowKind computeOverflowKind(SDValue N0, SDValue N1) const
Determine if the result of the addition of 2 node can overflow.
Definition: SelectionDAG.cpp:3820
llvm::iplist_impl< simple_ilist< T, Options... >, ilist_traits< T > >::insert
iterator insert(iterator where, pointer New)
Definition: ilist.h:229
AA
CodeGen.h
llvm::SelectionDAG::getBoolConstant
SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT)
Create a true or false constant of type VT using the target's BooleanContent for type OpVT.
Definition: SelectionDAG.cpp:1468
llvm::SelectionDAG::getExtLoadVP
SDValue getExtLoadVP(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo, bool IsExpanding=false)
Definition: SelectionDAG.cpp:8191
llvm::EVT::getVectorElementType
EVT getVectorElementType() const
Given a vector type, return the type of each element.
Definition: ValueTypes.h:300
llvm::SelectionDAG::GetSplitDestVTs
std::pair< EVT, EVT > GetSplitDestVTs(const EVT &VT) const
Compute the VTs needed for the low/hi parts of a type which is split (or expanded) into two not neces...
Definition: SelectionDAG.cpp:11374
llvm::CombineLevel
CombineLevel
Definition: DAGCombine.h:15
llvm::Pass
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:91
llvm::MVT::f128
@ f128
Definition: MachineValueType.h:60
SmallVector.h
ArrayRecycler.h
llvm::SelectionDAG::getIndexedLoad
SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:7950
llvm::SelectionDAG::MaskedValueIsAllOnes
bool MaskedValueIsAllOnes(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if '(Op & Mask) == Mask'.
Definition: SelectionDAG.cpp:2528
llvm::MVT::f16
@ f16
Definition: MachineValueType.h:56
llvm::SmallVectorImpl::iterator
typename SuperClass::iterator iterator
Definition: SmallVector.h:564
llvm::SDNodeFlags::setNoUnsignedWrap
void setNoUnsignedWrap(bool b)
Definition: SelectionDAGNodes.h:418
N
#define N
llvm::SelectionDAG::FlagInserter::operator=
FlagInserter & operator=(const FlagInserter &)=delete
llvm::SelectionDAG::getTargetConstantFP
SDValue getTargetConstantFP(double Val, const SDLoc &DL, EVT VT)
Definition: SelectionDAG.h:698
llvm::SelectionDAG::AddDbgLabel
void AddDbgLabel(SDDbgLabel *DB)
Add a dbg_label SDNode.
Definition: SelectionDAG.cpp:10658
llvm::SelectionDAG::allnodes_end
allnodes_iterator allnodes_end()
Definition: SelectionDAG.h:528
llvm::SelectionDAG::getRegisterMask
SDValue getRegisterMask(const uint32_t *RegMask)
Definition: SelectionDAG.cpp:2110
llvm::SelectionDAG::getLabelNode
SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root, MCSymbol *Label)
Definition: SelectionDAG.cpp:2129
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::SelectionDAG::getPtrExtendInReg
SDValue getPtrExtendInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return the expression required to extend the Op as a pointer value assuming it was the smaller SrcTy ...
Definition: SelectionDAG.cpp:1446
llvm::MachineFunction::getDataLayout
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
Definition: MachineFunction.cpp:285
llvm::SelectionDAG::getStepVector
SDValue getStepVector(const SDLoc &DL, EVT ResVT, APInt StepVal)
Returns a vector of type ResVT whose elements contain the linear sequence <0, Step,...
Definition: SelectionDAG.cpp:1891
llvm::SelectionDAG::getPass
const Pass * getPass() const
Definition: SelectionDAG.h:464
llvm::SelectionDAG::getJumpTable
SDValue getJumpTable(int JTI, EVT VT, bool isTarget=false, unsigned TargetFlags=0)
Definition: SelectionDAG.cpp:1728
MachineMemOperand.h
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
llvm::SelectionDAG::getAtomicCmpSwap
SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDVTList VTs, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp, MachineMemOperand *MMO)
Gets a node for an atomic cmpxchg op.
Definition: SelectionDAG.cpp:7625
llvm::SelectionDAG::DAGNodeDeletedListener::NodeDeleted
void NodeDeleted(SDNode *N, SDNode *E) override
The node N that was deleted and, if E is not null, an equivalent node E that replaced it.
Definition: SelectionDAG.h:334
llvm::SelectionDAG::getTargetConstant
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
Definition: SelectionDAG.h:666
llvm::SmallSetVector
A SetVector that performs no allocations if smaller than a certain size.
Definition: SetVector.h:307
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::SelectionDAG::DeleteNode
void DeleteNode(SDNode *N)
Remove the specified node from the system.
Definition: SelectionDAG.cpp:995
llvm::SelectionDAG::getTruncStore
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Definition: SelectionDAG.h:1341
llvm::SelectionDAG::getMachineFunction
MachineFunction & getMachineFunction() const
Definition: SelectionDAG.h:463
llvm::SelectionDAG::ComputeNumSignBits
unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits.
Definition: SelectionDAG.cpp:3904
llvm::SelectionDAG::UnrollVectorOverflowOp
std::pair< SDValue, SDValue > UnrollVectorOverflowOp(SDNode *N, unsigned ResNE=0)
Like UnrollVectorOp(), but for the [US](ADD|SUB|MUL)O family of opcodes.
Definition: SelectionDAG.cpp:11260
llvm::DILabel
Label.
Definition: DebugInfoMetadata.h:3148
llvm::SelectionDAG::addPCSections
void addPCSections(const SDNode *Node, MDNode *MD)
Set PCSections to be associated with Node.
Definition: SelectionDAG.h:2209
llvm::SelectionDAG::getExternalSymbol
SDValue getExternalSymbol(const char *Sym, EVT VT)
Definition: SelectionDAG.cpp:1846
llvm::SelectionDAG::isConstantValueOfAnyType
bool isConstantValueOfAnyType(SDValue N) const
Definition: SelectionDAG.h:2185
llvm::GraphTraits
Definition: GraphTraits.h:37
StringMap.h
InlinePriorityMode::Size
@ Size
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
llvm::SelectionDAG::getMDNode
SDValue getMDNode(const MDNode *MD)
Return an MDNodeSDNode which holds an MDNode.
Definition: SelectionDAG.cpp:2183
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394
llvm::SDDbgInfo::ByvalParmDbgEnd
DbgIterator ByvalParmDbgEnd()
Definition: SelectionDAG.h:202
llvm::SDDbgInfo::add
void add(SDDbgValue *V, bool isParameter)
Definition: SelectionDAG.cpp:1015
llvm::SelectionDAG::getUseInstrRefDebugInfo
bool getUseInstrRefDebugInfo() const
Definition: SelectionDAG.h:1841
llvm::SelectionDAG::DAGUpdateListener
Clients of various APIs that cause global effects on the DAG can optionally implement this interface.
Definition: SelectionDAG.h:301
llvm::SDDbgInfo::DbgEnd
DbgIterator DbgEnd()
Definition: SelectionDAG.h:200
MachineFunction.h
llvm::SDDbgInfo::DbgIterator
SmallVectorImpl< SDDbgValue * >::iterator DbgIterator
Definition: SelectionDAG.h:196
llvm::SelectionDAG::DAGNodeInsertedListener::Callback
std::function< void(SDNode *)> Callback
Definition: SelectionDAG.h:341
llvm::SelectionDAG::getSplatValue
SDValue getSplatValue(SDValue V, bool LegalTypes=false)
If V is a splat vector, return its scalar source operand by extracting that element from the source v...
Definition: SelectionDAG.cpp:2787
llvm::SelectionDAG::getStackArgumentTokenFactor
SDValue getStackArgumentTokenFactor(SDValue Chain)
Compute a TokenFactor to force all the incoming stack arguments to be loaded from the stack.
Definition: SelectionDAG.cpp:6654
llvm::MachineMemOperand::MONone
@ MONone
Definition: MachineMemOperand.h:132
llvm::SelectionDAG::getMaskedScatter
SDValue getMaskedScatter(SDVTList VTs, EVT MemVT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType, bool IsTruncating=false)
Definition: SelectionDAG.cpp:8847
llvm::SelectionDAG::getExtLoad
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Definition: SelectionDAG.cpp:7931
llvm::MVT::f32
@ f32
Definition: MachineValueType.h:57
llvm::SelectionDAG::makeEquivalentMemoryOrdering
SDValue makeEquivalentMemoryOrdering(SDValue OldChain, SDValue NewMemOpChain)
If an existing load has uses of its chain, create a token factor node with that chain and the new mem...
Definition: SelectionDAG.cpp:10660
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::SelectionDAG::getTarget
const TargetMachine & getTarget() const
Definition: SelectionDAG.h:467
llvm::SelectionDAG::DbgLabelEnd
SDDbgInfo::DbgLabelIterator DbgLabelEnd() const
Definition: SelectionDAG.h:1827
llvm::SelectionDAG::getFrameIndexDbgValue
SDDbgValue * getFrameIndexDbgValue(DIVariable *Var, DIExpression *Expr, unsigned FI, bool IsIndirect, const DebugLoc &DL, unsigned O)
Creates a FrameIndex SDDbgValue node.
Definition: SelectionDAG.cpp:9944
llvm::SelectionDAG::getIndexedMaskedStore
SDValue getIndexedMaskedStore(SDValue OrigStore, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8789
llvm::codeview::PublicSymFlags::Function
@ Function
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:172
llvm::SelectionDAG::getSetCC
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
Definition: SelectionDAG.h:1102
llvm::SelectionDAG::getMergeValues
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
Definition: SelectionDAG.cpp:7678
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
llvm::SelectionDAG::getTargetIndex
SDValue getTargetIndex(int Index, EVT VT, int64_t Offset=0, unsigned TargetFlags=0)
Definition: SelectionDAG.cpp:1801
llvm::EVT::getSimpleVT
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
Definition: ValueTypes.h:288
llvm::ISD::VSELECT
@ VSELECT
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
Definition: ISDOpcodes.h:722
llvm::SelectionDAG::getCondCode
SDValue getCondCode(ISD::CondCode Cond)
Definition: SelectionDAG.cpp:1873
llvm::SelectionDAG::areNonVolatileConsecutiveLoads
bool areNonVolatileConsecutiveLoads(LoadSDNode *LD, LoadSDNode *Base, unsigned Bytes, int Dist) const
Return true if loads are next to each other and can be merged.
Definition: SelectionDAG.cpp:11310