LLVM  15.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> 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 CallSiteDbgInfo {
276  CallSiteInfo CSInfo;
277  MDNode *HeapAllocSite = nullptr;
278  bool NoMerge = false;
279  };
280 
282 
283  /// PersistentId counter to be used when inserting the next
284  /// SDNode to this SelectionDAG. We do not place that under
285  /// `#if LLVM_ENABLE_ABI_BREAKING_CHECKS` intentionally because
286  /// it adds unneeded complexity without noticeable
287  /// benefits (see discussion with @thakis in D120714).
288  uint16_t NextPersistentId = 0;
289 
290  /// Are instruction referencing variable locations desired for this function?
291  bool UseInstrRefDebugInfo = false;
292 
293 public:
294  /// Clients of various APIs that cause global effects on
295  /// the DAG can optionally implement this interface. This allows the clients
296  /// to handle the various sorts of updates that happen.
297  ///
298  /// A DAGUpdateListener automatically registers itself with DAG when it is
299  /// constructed, and removes itself when destroyed in RAII fashion.
303 
305  : Next(D.UpdateListeners), DAG(D) {
306  DAG.UpdateListeners = this;
307  }
308 
309  virtual ~DAGUpdateListener() {
310  assert(DAG.UpdateListeners == this &&
311  "DAGUpdateListeners must be destroyed in LIFO order");
312  DAG.UpdateListeners = Next;
313  }
314 
315  /// The node N that was deleted and, if E is not null, an
316  /// equivalent node E that replaced it.
317  virtual void NodeDeleted(SDNode *N, SDNode *E);
318 
319  /// The node N that was updated.
320  virtual void NodeUpdated(SDNode *N);
321 
322  /// The node N that was inserted.
323  virtual void NodeInserted(SDNode *N);
324  };
325 
328 
330  std::function<void(SDNode *, SDNode *)> Callback)
332 
333  void NodeDeleted(SDNode *N, SDNode *E) override { Callback(N, E); }
334 
335  private:
336  virtual void anchor();
337  };
338 
339  /// Help to insert SDNodeFlags automatically in transforming. Use
340  /// RAII to save and resume flags in current scope.
341  class FlagInserter {
342  SelectionDAG &DAG;
343  SDNodeFlags Flags;
344  FlagInserter *LastInserter;
345 
346  public:
348  : DAG(SDAG), Flags(Flags),
349  LastInserter(SDAG.getFlagInserter()) {
350  SDAG.setFlagInserter(this);
351  }
353  : FlagInserter(SDAG, N->getFlags()) {}
354 
355  FlagInserter(const FlagInserter &) = delete;
356  FlagInserter &operator=(const FlagInserter &) = delete;
357  ~FlagInserter() { DAG.setFlagInserter(LastInserter); }
358 
359  SDNodeFlags getFlags() const { return Flags; }
360  };
361 
362  /// When true, additional steps are taken to
363  /// ensure that getConstant() and similar functions return DAG nodes that
364  /// have legal types. This is important after type legalization since
365  /// any illegally typed nodes generated after this point will not experience
366  /// type legalization.
368 
369 private:
370  /// DAGUpdateListener is a friend so it can manipulate the listener stack.
371  friend struct DAGUpdateListener;
372 
373  /// Linked list of registered DAGUpdateListener instances.
374  /// This stack is maintained by DAGUpdateListener RAII.
375  DAGUpdateListener *UpdateListeners = nullptr;
376 
377  /// Implementation of setSubgraphColor.
378  /// Return whether we had to truncate the search.
379  bool setSubgraphColorHelper(SDNode *N, const char *Color,
380  DenseSet<SDNode *> &visited,
381  int level, bool &printed);
382 
383  template <typename SDNodeT, typename... ArgTypes>
384  SDNodeT *newSDNode(ArgTypes &&... Args) {
385  return new (NodeAllocator.template Allocate<SDNodeT>())
386  SDNodeT(std::forward<ArgTypes>(Args)...);
387  }
388 
389  /// Build a synthetic SDNodeT with the given args and extract its subclass
390  /// data as an integer (e.g. for use in a folding set).
391  ///
392  /// The args to this function are the same as the args to SDNodeT's
393  /// constructor, except the second arg (assumed to be a const DebugLoc&) is
394  /// omitted.
395  template <typename SDNodeT, typename... ArgTypes>
396  static uint16_t getSyntheticNodeSubclassData(unsigned IROrder,
397  ArgTypes &&... Args) {
398  // The compiler can reduce this expression to a constant iff we pass an
399  // empty DebugLoc. Thankfully, the debug location doesn't have any bearing
400  // on the subclass data.
401  return SDNodeT(IROrder, DebugLoc(), std::forward<ArgTypes>(Args)...)
402  .getRawSubclassData();
403  }
404 
405  template <typename SDNodeTy>
406  static uint16_t getSyntheticNodeSubclassData(unsigned Opc, unsigned Order,
407  SDVTList VTs, EVT MemoryVT,
408  MachineMemOperand *MMO) {
409  return SDNodeTy(Opc, Order, DebugLoc(), VTs, MemoryVT, MMO)
410  .getRawSubclassData();
411  }
412 
413  void createOperands(SDNode *Node, ArrayRef<SDValue> Vals);
414 
415  void removeOperands(SDNode *Node) {
416  if (!Node->OperandList)
417  return;
418  OperandRecycler.deallocate(
420  Node->OperandList);
421  Node->NumOperands = 0;
422  Node->OperandList = nullptr;
423  }
424  void CreateTopologicalOrder(std::vector<SDNode*>& Order);
425 
426 public:
427  // Maximum depth for recursive analysis such as computeKnownBits, etc.
428  static constexpr unsigned MaxRecursionDepth = 6;
429 
431  SelectionDAG(const SelectionDAG &) = delete;
432  SelectionDAG &operator=(const SelectionDAG &) = delete;
433  ~SelectionDAG();
434 
435  /// Prepare this SelectionDAG to process code in the given MachineFunction.
436  void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE,
437  Pass *PassPtr, const TargetLibraryInfo *LibraryInfo,
438  LegacyDivergenceAnalysis * Divergence,
439  ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin);
440 
442  FLI = FuncInfo;
443  }
444 
445  /// Clear state and free memory necessary to make this
446  /// SelectionDAG ready to process a new block.
447  void clear();
448 
449  MachineFunction &getMachineFunction() const { return *MF; }
450  const Pass *getPass() const { return SDAGISelPass; }
451 
452  const DataLayout &getDataLayout() const { return MF->getDataLayout(); }
453  const TargetMachine &getTarget() const { return TM; }
454  const TargetSubtargetInfo &getSubtarget() const { return MF->getSubtarget(); }
455  template <typename STC> const STC &getSubtarget() const {
456  return MF->getSubtarget<STC>();
457  }
458  const TargetLowering &getTargetLoweringInfo() const { return *TLI; }
459  const TargetLibraryInfo &getLibInfo() const { return *LibInfo; }
460  const SelectionDAGTargetInfo &getSelectionDAGInfo() const { return *TSI; }
462  LLVMContext *getContext() const { return Context; }
463  OptimizationRemarkEmitter &getORE() const { return *ORE; }
464  ProfileSummaryInfo *getPSI() const { return PSI; }
465  BlockFrequencyInfo *getBFI() const { return BFI; }
466 
467  FlagInserter *getFlagInserter() { return Inserter; }
468  void setFlagInserter(FlagInserter *FI) { Inserter = FI; }
469 
470  /// Just dump dot graph to a user-provided path and title.
471  /// This doesn't open the dot viewer program and
472  /// helps visualization when outside debugging session.
473  /// FileName expects absolute path. If provided
474  /// without any path separators then the file
475  /// will be created in the current directory.
476  /// Error will be emitted if the path is insane.
477 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
478  LLVM_DUMP_METHOD void dumpDotGraph(const Twine &FileName, const Twine &Title);
479 #endif
480 
481  /// Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
482  void viewGraph(const std::string &Title);
483  void viewGraph();
484 
485 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
486  std::map<const SDNode *, std::string> NodeGraphAttrs;
487 #endif
488 
489  /// Clear all previously defined node graph attributes.
490  /// Intended to be used from a debugging tool (eg. gdb).
491  void clearGraphAttrs();
492 
493  /// Set graph attributes for a node. (eg. "color=red".)
494  void setGraphAttrs(const SDNode *N, const char *Attrs);
495 
496  /// Get graph attributes for a node. (eg. "color=red".)
497  /// Used from getNodeAttributes.
498  std::string getGraphAttrs(const SDNode *N) const;
499 
500  /// Convenience for setting node color attribute.
501  void setGraphColor(const SDNode *N, const char *Color);
502 
503  /// Convenience for setting subgraph color attribute.
504  void setSubgraphColor(SDNode *N, const char *Color);
505 
507 
508  allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); }
509  allnodes_const_iterator allnodes_end() const { return AllNodes.end(); }
510 
512 
513  allnodes_iterator allnodes_begin() { return AllNodes.begin(); }
514  allnodes_iterator allnodes_end() { return AllNodes.end(); }
515 
517  return AllNodes.size();
518  }
519 
522  }
525  }
526 
527  /// Return the root tag of the SelectionDAG.
528  const SDValue &getRoot() const { return Root; }
529 
530  /// Return the token chain corresponding to the entry of the function.
532  return SDValue(const_cast<SDNode *>(&EntryNode), 0);
533  }
534 
535  /// Set the current root tag of the SelectionDAG.
536  ///
538  assert((!N.getNode() || N.getValueType() == MVT::Other) &&
539  "DAG root value is not a chain!");
540  if (N.getNode())
541  checkForCycles(N.getNode(), this);
542  Root = N;
543  if (N.getNode())
544  checkForCycles(this);
545  return Root;
546  }
547 
548 #ifndef NDEBUG
549  void VerifyDAGDivergence();
550 #endif
551 
552  /// This iterates over the nodes in the SelectionDAG, folding
553  /// certain types of nodes together, or eliminating superfluous nodes. The
554  /// Level argument controls whether Combine is allowed to produce nodes and
555  /// types that are illegal on the target.
557  CodeGenOpt::Level OptLevel);
558 
559  /// This transforms the SelectionDAG into a SelectionDAG that
560  /// only uses types natively supported by the target.
561  /// Returns "true" if it made any changes.
562  ///
563  /// Note that this is an involved process that may invalidate pointers into
564  /// the graph.
565  bool LegalizeTypes();
566 
567  /// This transforms the SelectionDAG into a SelectionDAG that is
568  /// compatible with the target instruction selector, as indicated by the
569  /// TargetLowering object.
570  ///
571  /// Note that this is an involved process that may invalidate pointers into
572  /// the graph.
573  void Legalize();
574 
575  /// Transforms a SelectionDAG node and any operands to it into a node
576  /// that is compatible with the target instruction selector, as indicated by
577  /// the TargetLowering object.
578  ///
579  /// \returns true if \c N is a valid, legal node after calling this.
580  ///
581  /// This essentially runs a single recursive walk of the \c Legalize process
582  /// over the given node (and its operands). This can be used to incrementally
583  /// legalize the DAG. All of the nodes which are directly replaced,
584  /// potentially including N, are added to the output parameter \c
585  /// UpdatedNodes so that the delta to the DAG can be understood by the
586  /// caller.
587  ///
588  /// When this returns false, N has been legalized in a way that make the
589  /// pointer passed in no longer valid. It may have even been deleted from the
590  /// DAG, and so it shouldn't be used further. When this returns true, the
591  /// N passed in is a legal node, and can be immediately processed as such.
592  /// This may still have done some work on the DAG, and will still populate
593  /// UpdatedNodes with any new nodes replacing those originally in the DAG.
594  bool LegalizeOp(SDNode *N, SmallSetVector<SDNode *, 16> &UpdatedNodes);
595 
596  /// This transforms the SelectionDAG into a SelectionDAG
597  /// that only uses vector math operations supported by the target. This is
598  /// necessary as a separate step from Legalize because unrolling a vector
599  /// operation can introduce illegal types, which requires running
600  /// LegalizeTypes again.
601  ///
602  /// This returns true if it made any changes; in that case, LegalizeTypes
603  /// is called again before Legalize.
604  ///
605  /// Note that this is an involved process that may invalidate pointers into
606  /// the graph.
607  bool LegalizeVectors();
608 
609  /// This method deletes all unreachable nodes in the SelectionDAG.
610  void RemoveDeadNodes();
611 
612  /// Remove the specified node from the system. This node must
613  /// have no referrers.
614  void DeleteNode(SDNode *N);
615 
616  /// Return an SDVTList that represents the list of values specified.
617  SDVTList getVTList(EVT VT);
618  SDVTList getVTList(EVT VT1, EVT VT2);
619  SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3);
620  SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3, EVT VT4);
622 
623  //===--------------------------------------------------------------------===//
624  // Node creation methods.
625 
626  /// Create a ConstantSDNode wrapping a constant value.
627  /// If VT is a vector type, the constant is splatted into a BUILD_VECTOR.
628  ///
629  /// If only legal types can be produced, this does the necessary
630  /// transformations (e.g., if the vector element type is illegal).
631  /// @{
632  SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT,
633  bool isTarget = false, bool isOpaque = false);
634  SDValue getConstant(const APInt &Val, const SDLoc &DL, EVT VT,
635  bool isTarget = false, bool isOpaque = false);
636 
637  SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget = false,
638  bool IsOpaque = false) {
640  IsTarget, IsOpaque);
641  }
642 
643  SDValue getConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT,
644  bool isTarget = false, bool isOpaque = false);
646  bool isTarget = false);
648  bool LegalTypes = true);
650  bool isTarget = false);
651 
653  bool isOpaque = false) {
654  return getConstant(Val, DL, VT, true, isOpaque);
655  }
656  SDValue getTargetConstant(const APInt &Val, const SDLoc &DL, EVT VT,
657  bool isOpaque = false) {
658  return getConstant(Val, DL, VT, true, isOpaque);
659  }
661  bool isOpaque = false) {
662  return getConstant(Val, DL, VT, true, isOpaque);
663  }
664 
665  /// Create a true or false constant of type \p VT using the target's
666  /// BooleanContent for type \p OpVT.
667  SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT);
668  /// @}
669 
670  /// Create a ConstantFPSDNode wrapping a constant value.
671  /// If VT is a vector type, the constant is splatted into a BUILD_VECTOR.
672  ///
673  /// If only legal types can be produced, this does the necessary
674  /// transformations (e.g., if the vector element type is illegal).
675  /// The forms that take a double should only be used for simple constants
676  /// that can be exactly represented in VT. No checks are made.
677  /// @{
678  SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT,
679  bool isTarget = false);
680  SDValue getConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT,
681  bool isTarget = false);
682  SDValue getConstantFP(const ConstantFP &V, const SDLoc &DL, EVT VT,
683  bool isTarget = false);
684  SDValue getTargetConstantFP(double Val, const SDLoc &DL, EVT VT) {
685  return getConstantFP(Val, DL, VT, true);
686  }
687  SDValue getTargetConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT) {
688  return getConstantFP(Val, DL, VT, true);
689  }
690  SDValue getTargetConstantFP(const ConstantFP &Val, const SDLoc &DL, EVT VT) {
691  return getConstantFP(Val, DL, VT, true);
692  }
693  /// @}
694 
695  SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT,
696  int64_t offset = 0, bool isTargetGA = false,
697  unsigned TargetFlags = 0);
699  int64_t offset = 0, unsigned TargetFlags = 0) {
700  return getGlobalAddress(GV, DL, VT, offset, true, TargetFlags);
701  }
702  SDValue getFrameIndex(int FI, EVT VT, bool isTarget = false);
704  return getFrameIndex(FI, VT, true);
705  }
706  SDValue getJumpTable(int JTI, EVT VT, bool isTarget = false,
707  unsigned TargetFlags = 0);
708  SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags = 0) {
709  return getJumpTable(JTI, VT, true, TargetFlags);
710  }
712  int Offs = 0, bool isT = false,
713  unsigned TargetFlags = 0);
715  MaybeAlign Align = None, int Offset = 0,
716  unsigned TargetFlags = 0) {
717  return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
718  }
720  MaybeAlign Align = None, int Offs = 0,
721  bool isT = false, unsigned TargetFlags = 0);
723  MaybeAlign Align = None, int Offset = 0,
724  unsigned TargetFlags = 0) {
725  return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
726  }
727  SDValue getTargetIndex(int Index, EVT VT, int64_t Offset = 0,
728  unsigned TargetFlags = 0);
729  // When generating a branch to a BB, we don't in general know enough
730  // to provide debug info for the BB at that time, so keep this one around.
732  SDValue getExternalSymbol(const char *Sym, EVT VT);
733  SDValue getTargetExternalSymbol(const char *Sym, EVT VT,
734  unsigned TargetFlags = 0);
735  SDValue getMCSymbol(MCSymbol *Sym, EVT VT);
736 
738  SDValue getRegister(unsigned Reg, EVT VT);
739  SDValue getRegisterMask(const uint32_t *RegMask);
740  SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label);
741  SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root,
742  MCSymbol *Label);
743  SDValue getBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset = 0,
744  bool isTarget = false, unsigned TargetFlags = 0);
746  int64_t Offset = 0, unsigned TargetFlags = 0) {
747  return getBlockAddress(BA, VT, Offset, true, TargetFlags);
748  }
749 
750  SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg,
751  SDValue N) {
752  return getNode(ISD::CopyToReg, dl, MVT::Other, Chain,
753  getRegister(Reg, N.getValueType()), N);
754  }
755 
756  // This version of the getCopyToReg method takes an extra operand, which
757  // indicates that there is potentially an incoming glue value (if Glue is not
758  // null) and that there should be a glue result.
759  SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N,
760  SDValue Glue) {
762  SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Glue };
763  return getNode(ISD::CopyToReg, dl, VTs,
764  makeArrayRef(Ops, Glue.getNode() ? 4 : 3));
765  }
766 
767  // Similar to last getCopyToReg() except parameter Reg is a SDValue
769  SDValue Glue) {
771  SDValue Ops[] = { Chain, Reg, N, Glue };
772  return getNode(ISD::CopyToReg, dl, VTs,
773  makeArrayRef(Ops, Glue.getNode() ? 4 : 3));
774  }
775 
776  SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT) {
777  SDVTList VTs = getVTList(VT, MVT::Other);
778  SDValue Ops[] = { Chain, getRegister(Reg, VT) };
779  return getNode(ISD::CopyFromReg, dl, VTs, Ops);
780  }
781 
782  // This version of the getCopyFromReg method takes an extra operand, which
783  // indicates that there is potentially an incoming glue value (if Glue is not
784  // null) and that there should be a glue result.
785  SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT,
786  SDValue Glue) {
788  SDValue Ops[] = { Chain, getRegister(Reg, VT), Glue };
789  return getNode(ISD::CopyFromReg, dl, VTs,
790  makeArrayRef(Ops, Glue.getNode() ? 3 : 2));
791  }
792 
794 
795  /// Return an ISD::VECTOR_SHUFFLE node. The number of elements in VT,
796  /// which must be a vector type, must match the number of mask elements
797  /// NumElts. An integer mask element equal to -1 is treated as undefined.
798  SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2,
800 
801  /// Return an ISD::BUILD_VECTOR node. The number of elements in VT,
802  /// which must be a vector type, must match the number of operands in Ops.
803  /// The operands must have the same type as (or, for integers, a type wider
804  /// than) VT's element type.
806  // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
807  return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
808  }
809 
810  /// Return an ISD::BUILD_VECTOR node. The number of elements in VT,
811  /// which must be a vector type, must match the number of operands in Ops.
812  /// The operands must have the same type as (or, for integers, a type wider
813  /// than) VT's element type.
815  // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
816  return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
817  }
818 
819  /// Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all
820  /// elements. VT must be a vector type. Op's type must be the same as (or,
821  /// for integers, a type wider than) VT's element type.
823  // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
824  if (Op.getOpcode() == ISD::UNDEF) {
825  assert((VT.getVectorElementType() == Op.getValueType() ||
826  (VT.isInteger() &&
827  VT.getVectorElementType().bitsLE(Op.getValueType()))) &&
828  "A splatted value must have a width equal or (for integers) "
829  "greater than the vector element type!");
830  return getNode(ISD::UNDEF, SDLoc(), VT);
831  }
832 
834  return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
835  }
836 
837  // Return a splat ISD::SPLAT_VECTOR node, consisting of Op splatted to all
838  // elements.
840  if (Op.getOpcode() == ISD::UNDEF) {
841  assert((VT.getVectorElementType() == Op.getValueType() ||
842  (VT.isInteger() &&
843  VT.getVectorElementType().bitsLE(Op.getValueType()))) &&
844  "A splatted value must have a width equal or (for integers) "
845  "greater than the vector element type!");
846  return getNode(ISD::UNDEF, SDLoc(), VT);
847  }
848  return getNode(ISD::SPLAT_VECTOR, DL, VT, Op);
849  }
850 
851  /// Returns a vector of type ResVT whose elements contain the linear sequence
852  /// <0, Step, Step * 2, Step * 3, ...>
853  SDValue getStepVector(const SDLoc &DL, EVT ResVT, APInt StepVal);
854 
855  /// Returns a vector of type ResVT whose elements contain the linear sequence
856  /// <0, 1, 2, 3, ...>
857  SDValue getStepVector(const SDLoc &DL, EVT ResVT);
858 
859  /// Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to
860  /// the shuffle node in input but with swapped operands.
861  ///
862  /// Example: shuffle A, B, <0,5,2,7> -> shuffle B, A, <4,1,6,3>
864 
865  /// Convert Op, which must be of float type, to the
866  /// float type VT, by either extending or rounding (by truncation).
868 
869  /// Convert Op, which must be a STRICT operation of float type, to the
870  /// float type VT, by either extending or rounding (by truncation).
871  std::pair<SDValue, SDValue>
872  getStrictFPExtendOrRound(SDValue Op, SDValue Chain, const SDLoc &DL, EVT VT);
873 
874  /// Convert Op, which must be of integer type, to the
875  /// integer type VT, by either any-extending or truncating it.
877 
878  /// Convert Op, which must be of integer type, to the
879  /// integer type VT, by either sign-extending or truncating it.
880  SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT);
881 
882  /// Convert Op, which must be of integer type, to the
883  /// integer type VT, by either zero-extending or truncating it.
884  SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT);
885 
886  /// Return the expression required to zero extend the Op
887  /// value assuming it was the smaller SrcTy value.
889 
890  /// Convert Op, which must be of integer type, to the integer type VT, by
891  /// either truncating it or performing either zero or sign extension as
892  /// appropriate extension for the pointer's semantics.
894 
895  /// Return the expression required to extend the Op as a pointer value
896  /// assuming it was the smaller SrcTy value. This may be either a zero extend
897  /// or a sign extend.
899 
900  /// Convert Op, which must be of integer type, to the integer type VT,
901  /// by using an extension appropriate for the target's
902  /// BooleanContent for type OpVT or truncating it.
903  SDValue getBoolExtOrTrunc(SDValue Op, const SDLoc &SL, EVT VT, EVT OpVT);
904 
905  /// Create a bitwise NOT operation as (XOR Val, -1).
906  SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT);
907 
908  /// Create a logical NOT operation as (XOR Val, BooleanOne).
909  SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT);
910 
911  /// Create a vector-predicated logical NOT operation as (VP_XOR Val,
912  /// BooleanOne, Mask, EVL).
914  SDValue EVL, EVT VT);
915 
916  /// Returns sum of the base pointer and offset.
917  /// Unlike getObjectPtrOffset this does not set NoUnsignedWrap by default.
919  const SDNodeFlags Flags = SDNodeFlags());
921  const SDNodeFlags Flags = SDNodeFlags());
922 
923  /// Create an add instruction with appropriate flags when used for
924  /// addressing some offset of an object. i.e. if a load is split into multiple
925  /// components, create an add nuw from the base pointer to the offset.
927  SDNodeFlags Flags;
928  Flags.setNoUnsignedWrap(true);
929  return getMemBasePlusOffset(Ptr, Offset, SL, Flags);
930  }
931 
933  // The object itself can't wrap around the address space, so it shouldn't be
934  // possible for the adds of the offsets to the split parts to overflow.
935  SDNodeFlags Flags;
936  Flags.setNoUnsignedWrap(true);
937  return getMemBasePlusOffset(Ptr, Offset, SL, Flags);
938  }
939 
940  /// Return a new CALLSEQ_START node, that starts new call frame, in which
941  /// InSize bytes are set up inside CALLSEQ_START..CALLSEQ_END sequence and
942  /// OutSize specifies part of the frame set up prior to the sequence.
944  const SDLoc &DL) {
946  SDValue Ops[] = { Chain,
947  getIntPtrConstant(InSize, DL, true),
948  getIntPtrConstant(OutSize, DL, true) };
949  return getNode(ISD::CALLSEQ_START, DL, VTs, Ops);
950  }
951 
952  /// Return a new CALLSEQ_END node, which always must have a
953  /// glue result (to ensure it's not CSE'd).
954  /// CALLSEQ_END does not have a useful SDLoc.
956  SDValue InGlue, const SDLoc &DL) {
959  Ops.push_back(Chain);
960  Ops.push_back(Op1);
961  Ops.push_back(Op2);
962  if (InGlue.getNode())
963  Ops.push_back(InGlue);
964  return getNode(ISD::CALLSEQ_END, DL, NodeTys, Ops);
965  }
966 
967  /// Return true if the result of this operation is always undefined.
968  bool isUndef(unsigned Opcode, ArrayRef<SDValue> Ops);
969 
970  /// Return an UNDEF node. UNDEF does not have a useful SDLoc.
972  return getNode(ISD::UNDEF, SDLoc(), VT);
973  }
974 
975  /// Return a node that represents the runtime scaling 'MulImm * RuntimeVL'.
976  SDValue getVScale(const SDLoc &DL, EVT VT, APInt MulImm) {
977  assert(MulImm.getMinSignedBits() <= VT.getSizeInBits() &&
978  "Immediate does not fit VT");
979  return getNode(ISD::VSCALE, DL, VT,
980  getConstant(MulImm.sextOrTrunc(VT.getSizeInBits()), DL, VT));
981  }
982 
983  /// Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
985  return getNode(ISD::GLOBAL_OFFSET_TABLE, SDLoc(), VT);
986  }
987 
988  /// Gets or creates the specified node.
989  ///
990  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
991  ArrayRef<SDUse> Ops);
992  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
993  ArrayRef<SDValue> Ops, const SDNodeFlags Flags);
994  SDValue getNode(unsigned Opcode, const SDLoc &DL, ArrayRef<EVT> ResultTys,
995  ArrayRef<SDValue> Ops);
996  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
997  ArrayRef<SDValue> Ops, const SDNodeFlags Flags);
998 
999  // Use flags from current flag inserter.
1000  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1001  ArrayRef<SDValue> Ops);
1002  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1003  ArrayRef<SDValue> Ops);
1004  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue Operand);
1005  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1006  SDValue N2);
1007  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1008  SDValue N2, SDValue N3);
1009 
1010  // Specialize based on number of operands.
1011  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT);
1012  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue Operand,
1013  const SDNodeFlags Flags);
1014  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1015  SDValue N2, const SDNodeFlags Flags);
1016  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1017  SDValue N2, SDValue N3, const SDNodeFlags Flags);
1018  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1019  SDValue N2, SDValue N3, SDValue N4);
1020  SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1021  SDValue N2, SDValue N3, SDValue N4, SDValue N5);
1022 
1023  // Specialize again based on number of operands for nodes with a VTList
1024  // rather than a single VT.
1025  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList);
1026  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N);
1027  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1,
1028  SDValue N2);
1029  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1,
1030  SDValue N2, SDValue N3);
1031  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1,
1032  SDValue N2, SDValue N3, SDValue N4);
1033  SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1,
1034  SDValue N2, SDValue N3, SDValue N4, SDValue N5);
1035 
1036  /// Compute a TokenFactor to force all the incoming stack arguments to be
1037  /// loaded from the stack. This is used in tail call lowering to protect
1038  /// stack arguments from being clobbered.
1040 
1041  SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
1042  SDValue Size, Align Alignment, bool isVol,
1043  bool AlwaysInline, bool isTailCall,
1044  MachinePointerInfo DstPtrInfo,
1045  MachinePointerInfo SrcPtrInfo,
1046  const AAMDNodes &AAInfo = AAMDNodes());
1047 
1048  SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
1049  SDValue Size, Align Alignment, bool isVol, bool isTailCall,
1050  MachinePointerInfo DstPtrInfo,
1051  MachinePointerInfo SrcPtrInfo,
1052  const AAMDNodes &AAInfo = AAMDNodes());
1053 
1054  SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
1055  SDValue Size, Align Alignment, bool isVol, bool isTailCall,
1056  MachinePointerInfo DstPtrInfo,
1057  const AAMDNodes &AAInfo = AAMDNodes());
1058 
1059  SDValue getAtomicMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst,
1060  unsigned DstAlign, SDValue Src, unsigned SrcAlign,
1061  SDValue Size, Type *SizeTy, unsigned ElemSz,
1062  bool isTailCall, MachinePointerInfo DstPtrInfo,
1063  MachinePointerInfo SrcPtrInfo);
1064 
1065  SDValue getAtomicMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst,
1066  unsigned DstAlign, SDValue Src, unsigned SrcAlign,
1067  SDValue Size, Type *SizeTy, unsigned ElemSz,
1068  bool isTailCall, MachinePointerInfo DstPtrInfo,
1069  MachinePointerInfo SrcPtrInfo);
1070 
1071  SDValue getAtomicMemset(SDValue Chain, const SDLoc &dl, SDValue Dst,
1072  unsigned DstAlign, SDValue Value, SDValue Size,
1073  Type *SizeTy, unsigned ElemSz, bool isTailCall,
1074  MachinePointerInfo DstPtrInfo);
1075 
1076  /// Helper function to make it easier to build SetCC's if you just have an
1077  /// ISD::CondCode instead of an SDValue.
1079  ISD::CondCode Cond, SDValue Chain = SDValue(),
1080  bool IsSignaling = false) {
1081  assert(LHS.getValueType().isVector() == RHS.getValueType().isVector() &&
1082  "Cannot compare scalars to vectors");
1083  assert(LHS.getValueType().isVector() == VT.isVector() &&
1084  "Cannot compare scalars to vectors");
1086  "Cannot create a setCC of an invalid node.");
1087  if (Chain)
1088  return getNode(IsSignaling ? ISD::STRICT_FSETCCS : ISD::STRICT_FSETCC, DL,
1089  {VT, MVT::Other}, {Chain, LHS, RHS, getCondCode(Cond)});
1090  return getNode(ISD::SETCC, DL, VT, LHS, RHS, getCondCode(Cond));
1091  }
1092 
1093  /// Helper function to make it easier to build VP_SETCCs if you just have an
1094  /// ISD::CondCode instead of an SDValue.
1097  assert(LHS.getValueType().isVector() && RHS.getValueType().isVector() &&
1098  "Cannot compare scalars");
1100  "Cannot create a setCC of an invalid node.");
1101  return getNode(ISD::VP_SETCC, DL, VT, LHS, RHS, getCondCode(Cond), Mask,
1102  EVL);
1103  }
1104 
1105  /// Helper function to make it easier to build Select's if you just have
1106  /// operands and don't want to check for vector.
1108  SDValue RHS) {
1109  assert(LHS.getValueType() == VT && RHS.getValueType() == VT &&
1110  "Cannot use select on differing types");
1111  auto Opcode = Cond.getValueType().isVector() ? ISD::VSELECT : ISD::SELECT;
1112  return getNode(Opcode, DL, VT, Cond, LHS, RHS);
1113  }
1114 
1115  /// Helper function to make it easier to build SelectCC's if you just have an
1116  /// ISD::CondCode instead of an SDValue.
1118  SDValue False, ISD::CondCode Cond) {
1119  return getNode(ISD::SELECT_CC, DL, True.getValueType(), LHS, RHS, True,
1120  False, getCondCode(Cond));
1121  }
1122 
1123  /// Try to simplify a select/vselect into 1 of its operands or a constant.
1125 
1126  /// Try to simplify a shift into 1 of its operands or a constant.
1128 
1129  /// Try to simplify a floating-point binary operation into 1 of its operands
1130  /// or a constant.
1131  SDValue simplifyFPBinop(unsigned Opcode, SDValue X, SDValue Y,
1132  SDNodeFlags Flags);
1133 
1134  /// VAArg produces a result and token chain, and takes a pointer
1135  /// and a source value as input.
1136  SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1137  SDValue SV, unsigned Align);
1138 
1139  /// Gets a node for an atomic cmpxchg op. There are two
1140  /// valid Opcodes. ISD::ATOMIC_CMO_SWAP produces the value loaded and a
1141  /// chain result. ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS produces the value loaded,
1142  /// a success flag (initially i1), and a chain.
1143  SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT,
1144  SDVTList VTs, SDValue Chain, SDValue Ptr,
1145  SDValue Cmp, SDValue Swp, MachineMemOperand *MMO);
1146 
1147  /// Gets a node for an atomic op, produces result (if relevant)
1148  /// and chain and takes 2 operands.
1149  SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain,
1150  SDValue Ptr, SDValue Val, MachineMemOperand *MMO);
1151 
1152  /// Gets a node for an atomic op, produces result and chain and
1153  /// takes 1 operand.
1154  SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, EVT VT,
1155  SDValue Chain, SDValue Ptr, MachineMemOperand *MMO);
1156 
1157  /// Gets a node for an atomic op, produces result and chain and takes N
1158  /// operands.
1159  SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT,
1160  SDVTList VTList, ArrayRef<SDValue> Ops,
1161  MachineMemOperand *MMO);
1162 
1163  /// Creates a MemIntrinsicNode that may produce a
1164  /// result and takes a list of operands. Opcode may be INTRINSIC_VOID,
1165  /// INTRINSIC_W_CHAIN, or a target-specific opcode with a value not
1166  /// less than FIRST_TARGET_MEMORY_OPCODE.
1168  unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
1169  EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment,
1172  uint64_t Size = 0, const AAMDNodes &AAInfo = AAMDNodes());
1173 
1175  unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
1176  EVT MemVT, MachinePointerInfo PtrInfo, MaybeAlign Alignment = None,
1179  uint64_t Size = 0, const AAMDNodes &AAInfo = AAMDNodes()) {
1180  // Ensure that codegen never sees alignment 0
1181  return getMemIntrinsicNode(Opcode, dl, VTList, Ops, MemVT, PtrInfo,
1182  Alignment.getValueOr(getEVTAlign(MemVT)), Flags,
1183  Size, AAInfo);
1184  }
1185 
1186  SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList,
1187  ArrayRef<SDValue> Ops, EVT MemVT,
1188  MachineMemOperand *MMO);
1189 
1190  /// Creates a LifetimeSDNode that starts (`IsStart==true`) or ends
1191  /// (`IsStart==false`) the lifetime of the portion of `FrameIndex` between
1192  /// offsets `Offset` and `Offset + Size`.
1193  SDValue getLifetimeNode(bool IsStart, const SDLoc &dl, SDValue Chain,
1194  int FrameIndex, int64_t Size, int64_t Offset = -1);
1195 
1196  /// Creates a PseudoProbeSDNode with function GUID `Guid` and
1197  /// the index of the block `Index` it is probing, as well as the attributes
1198  /// `attr` of the probe.
1199  SDValue getPseudoProbeNode(const SDLoc &Dl, SDValue Chain, uint64_t Guid,
1200  uint64_t Index, uint32_t Attr);
1201 
1202  /// Create a MERGE_VALUES node from the given operands.
1204 
1205  /// Loads are not normal binary operators: their result type is not
1206  /// determined by their operands, and they produce a value AND a token chain.
1207  ///
1208  /// This function will set the MOLoad flag on MMOFlags, but you can set it if
1209  /// you want. The MOStore flag must not be set.
1210  SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1211  MachinePointerInfo PtrInfo,
1212  MaybeAlign Alignment = MaybeAlign(),
1214  const AAMDNodes &AAInfo = AAMDNodes(),
1215  const MDNode *Ranges = nullptr);
1216  /// FIXME: Remove once transition to Align is over.
1217  inline SDValue
1218  getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1219  MachinePointerInfo PtrInfo, unsigned Alignment,
1221  const AAMDNodes &AAInfo = AAMDNodes(),
1222  const MDNode *Ranges = nullptr) {
1223  return getLoad(VT, dl, Chain, Ptr, PtrInfo, MaybeAlign(Alignment), MMOFlags,
1224  AAInfo, Ranges);
1225  }
1226  SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1227  MachineMemOperand *MMO);
1228  SDValue
1229  getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain,
1230  SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT,
1231  MaybeAlign Alignment = MaybeAlign(),
1233  const AAMDNodes &AAInfo = AAMDNodes());
1234  /// FIXME: Remove once transition to Align is over.
1235  inline SDValue
1236  getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain,
1237  SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT,
1238  unsigned Alignment,
1240  const AAMDNodes &AAInfo = AAMDNodes()) {
1241  return getExtLoad(ExtType, dl, VT, Chain, Ptr, PtrInfo, MemVT,
1242  MaybeAlign(Alignment), MMOFlags, AAInfo);
1243  }
1244  SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
1245  SDValue Chain, SDValue Ptr, EVT MemVT,
1246  MachineMemOperand *MMO);
1247  SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base,
1250  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1251  MachinePointerInfo PtrInfo, EVT MemVT, Align Alignment,
1253  const AAMDNodes &AAInfo = AAMDNodes(),
1254  const MDNode *Ranges = nullptr);
1256  ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl,
1257  SDValue Chain, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo,
1258  EVT MemVT, MaybeAlign Alignment = MaybeAlign(),
1260  const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr) {
1261  // Ensures that codegen never sees a None Alignment.
1262  return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, PtrInfo, MemVT,
1263  Alignment.getValueOr(getEVTAlign(MemVT)), MMOFlags, AAInfo,
1264  Ranges);
1265  }
1266  /// FIXME: Remove once transition to Align is over.
1267  inline SDValue
1269  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1270  MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment,
1272  const AAMDNodes &AAInfo = AAMDNodes(),
1273  const MDNode *Ranges = nullptr) {
1274  return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, PtrInfo, MemVT,
1275  MaybeAlign(Alignment), MMOFlags, AAInfo, Ranges);
1276  }
1278  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1279  EVT MemVT, MachineMemOperand *MMO);
1280 
1281  /// Helper function to build ISD::STORE nodes.
1282  ///
1283  /// This function will set the MOStore flag on MMOFlags, but you can set it if
1284  /// you want. The MOLoad and MOInvariant flags must not be set.
1285 
1286  SDValue
1287  getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1288  MachinePointerInfo PtrInfo, Align Alignment,
1290  const AAMDNodes &AAInfo = AAMDNodes());
1291  inline SDValue
1292  getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1293  MachinePointerInfo PtrInfo, MaybeAlign Alignment = MaybeAlign(),
1295  const AAMDNodes &AAInfo = AAMDNodes()) {
1296  return getStore(Chain, dl, Val, Ptr, PtrInfo,
1297  Alignment.getValueOr(getEVTAlign(Val.getValueType())),
1298  MMOFlags, AAInfo);
1299  }
1300  /// FIXME: Remove once transition to Align is over.
1301  inline SDValue
1302  getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1303  MachinePointerInfo PtrInfo, unsigned Alignment,
1305  const AAMDNodes &AAInfo = AAMDNodes()) {
1306  return getStore(Chain, dl, Val, Ptr, PtrInfo, MaybeAlign(Alignment),
1307  MMOFlags, AAInfo);
1308  }
1309  SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1310  MachineMemOperand *MMO);
1311  SDValue
1312  getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1313  MachinePointerInfo PtrInfo, EVT SVT, Align Alignment,
1315  const AAMDNodes &AAInfo = AAMDNodes());
1316  inline SDValue
1317  getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1318  MachinePointerInfo PtrInfo, EVT SVT,
1319  MaybeAlign Alignment = MaybeAlign(),
1321  const AAMDNodes &AAInfo = AAMDNodes()) {
1322  return getTruncStore(Chain, dl, Val, Ptr, PtrInfo, SVT,
1323  Alignment.getValueOr(getEVTAlign(SVT)), MMOFlags,
1324  AAInfo);
1325  }
1326  /// FIXME: Remove once transition to Align is over.
1327  inline SDValue
1328  getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1329  MachinePointerInfo PtrInfo, EVT SVT, unsigned Alignment,
1331  const AAMDNodes &AAInfo = AAMDNodes()) {
1332  return getTruncStore(Chain, dl, Val, Ptr, PtrInfo, SVT,
1333  MaybeAlign(Alignment), MMOFlags, AAInfo);
1334  }
1335  SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1336  SDValue Ptr, EVT SVT, MachineMemOperand *MMO);
1337  SDValue getIndexedStore(SDValue OrigStore, const SDLoc &dl, SDValue Base,
1339 
1341  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1342  SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo,
1343  EVT MemVT, Align Alignment,
1344  MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo,
1345  const MDNode *Ranges = nullptr, bool IsExpanding = false);
1346  inline SDValue
1348  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1349  SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1350  MaybeAlign Alignment = MaybeAlign(),
1352  const AAMDNodes &AAInfo = AAMDNodes(),
1353  const MDNode *Ranges = nullptr, bool IsExpanding = false) {
1354  // Ensures that codegen never sees a None Alignment.
1355  return getLoadVP(AM, ExtType, VT, dl, Chain, Ptr, Offset, Mask, EVL,
1356  PtrInfo, MemVT, Alignment.getValueOr(getEVTAlign(MemVT)),
1357  MMOFlags, AAInfo, Ranges, IsExpanding);
1358  }
1360  const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1361  SDValue Mask, SDValue EVL, EVT MemVT,
1362  MachineMemOperand *MMO, bool IsExpanding = false);
1363  SDValue getLoadVP(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1364  SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo,
1365  MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags,
1366  const AAMDNodes &AAInfo, const MDNode *Ranges = nullptr,
1367  bool IsExpanding = false);
1368  SDValue getLoadVP(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1370  bool IsExpanding = false);
1371  SDValue getExtLoadVP(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
1372  SDValue Chain, SDValue Ptr, SDValue Mask, SDValue EVL,
1373  MachinePointerInfo PtrInfo, EVT MemVT,
1374  MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags,
1375  const AAMDNodes &AAInfo, bool IsExpanding = false);
1376  SDValue getExtLoadVP(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
1377  SDValue Chain, SDValue Ptr, SDValue Mask, SDValue EVL,
1378  EVT MemVT, MachineMemOperand *MMO,
1379  bool IsExpanding = false);
1380  SDValue getIndexedLoadVP(SDValue OrigLoad, const SDLoc &dl, SDValue Base,
1382  SDValue getStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1383  SDValue Offset, SDValue Mask, SDValue EVL, EVT MemVT,
1385  bool IsTruncating = false, bool IsCompressing = false);
1386  SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val,
1387  SDValue Ptr, SDValue Mask, SDValue EVL,
1388  MachinePointerInfo PtrInfo, EVT SVT, Align Alignment,
1389  MachineMemOperand::Flags MMOFlags,
1390  const AAMDNodes &AAInfo, bool IsCompressing = false);
1391  SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val,
1392  SDValue Ptr, SDValue Mask, SDValue EVL, EVT SVT,
1393  MachineMemOperand *MMO, bool IsCompressing = false);
1394  SDValue getIndexedStoreVP(SDValue OrigStore, const SDLoc &dl, SDValue Base,
1396 
1398  EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr,
1399  SDValue Offset, SDValue Stride, SDValue Mask,
1400  SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1401  Align Alignment, MachineMemOperand::Flags MMOFlags,
1402  const AAMDNodes &AAInfo,
1403  const MDNode *Ranges = nullptr,
1404  bool IsExpanding = false);
1406  ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &DL,
1407  SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Stride, SDValue Mask,
1408  SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1409  MaybeAlign Alignment = MaybeAlign(),
1411  const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr,
1412  bool IsExpanding = false) {
1413  // Ensures that codegen never sees a None Alignment.
1414  return getStridedLoadVP(AM, ExtType, VT, DL, Chain, Ptr, Offset, Stride,
1415  Mask, EVL, PtrInfo, MemVT,
1416  Alignment.getValueOr(getEVTAlign(MemVT)), MMOFlags,
1417  AAInfo, Ranges, IsExpanding);
1418  }
1420  EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr,
1421  SDValue Offset, SDValue Stride, SDValue Mask,
1422  SDValue EVL, EVT MemVT, MachineMemOperand *MMO,
1423  bool IsExpanding = false);
1424  SDValue getStridedLoadVP(EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr,
1425  SDValue Stride, SDValue Mask, SDValue EVL,
1426  MachinePointerInfo PtrInfo, MaybeAlign Alignment,
1427  MachineMemOperand::Flags MMOFlags,
1428  const AAMDNodes &AAInfo,
1429  const MDNode *Ranges = nullptr,
1430  bool IsExpanding = false);
1431  SDValue getStridedLoadVP(EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr,
1432  SDValue Stride, SDValue Mask, SDValue EVL,
1433  MachineMemOperand *MMO, bool IsExpanding = false);
1434  SDValue
1435  getExtStridedLoadVP(ISD::LoadExtType ExtType, const SDLoc &DL, EVT VT,
1436  SDValue Chain, SDValue Ptr, SDValue Stride, SDValue Mask,
1437  SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1438  MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags,
1439  const AAMDNodes &AAInfo, bool IsExpanding = false);
1441  SDValue Chain, SDValue Ptr, SDValue Stride,
1442  SDValue Mask, SDValue EVL, EVT MemVT,
1443  MachineMemOperand *MMO, bool IsExpanding = false);
1444  SDValue getIndexedStridedLoadVP(SDValue OrigLoad, const SDLoc &DL,
1446  ISD::MemIndexedMode AM);
1447  SDValue getStridedStoreVP(SDValue Chain, const SDLoc &DL, SDValue Val,
1448  SDValue Ptr, SDValue Offset, SDValue Stride,
1449  SDValue Mask, SDValue EVL, EVT MemVT,
1451  bool IsTruncating = false,
1452  bool IsCompressing = false);
1454  SDValue Ptr, SDValue Stride, SDValue Mask,
1455  SDValue EVL, MachinePointerInfo PtrInfo,
1456  EVT SVT, Align Alignment,
1457  MachineMemOperand::Flags MMOFlags,
1458  const AAMDNodes &AAInfo,
1459  bool IsCompressing = false);
1461  SDValue Ptr, SDValue Stride, SDValue Mask,
1462  SDValue EVL, EVT SVT, MachineMemOperand *MMO,
1463  bool IsCompressing = false);
1464  SDValue getIndexedStridedStoreVP(SDValue OrigStore, const SDLoc &DL,
1466  ISD::MemIndexedMode AM);
1467 
1468  SDValue getGatherVP(SDVTList VTs, EVT VT, const SDLoc &dl,
1470  ISD::MemIndexType IndexType);
1471  SDValue getScatterVP(SDVTList VTs, EVT VT, const SDLoc &dl,
1473  ISD::MemIndexType IndexType);
1474 
1475  SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Base,
1476  SDValue Offset, SDValue Mask, SDValue Src0, EVT MemVT,
1478  ISD::LoadExtType, bool IsExpanding = false);
1479  SDValue getIndexedMaskedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base,
1481  SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1484  bool IsTruncating = false, bool IsCompressing = false);
1485  SDValue getIndexedMaskedStore(SDValue OrigStore, const SDLoc &dl,
1487  ISD::MemIndexedMode AM);
1488  SDValue getMaskedGather(SDVTList VTs, EVT MemVT, const SDLoc &dl,
1490  ISD::MemIndexType IndexType, ISD::LoadExtType ExtTy);
1491  SDValue getMaskedScatter(SDVTList VTs, EVT MemVT, const SDLoc &dl,
1493  ISD::MemIndexType IndexType,
1494  bool IsTruncating = false);
1495 
1496  /// Construct a node to track a Value* through the backend.
1497  SDValue getSrcValue(const Value *v);
1498 
1499  /// Return an MDNodeSDNode which holds an MDNode.
1500  SDValue getMDNode(const MDNode *MD);
1501 
1502  /// Return a bitcast using the SDLoc of the value operand, and casting to the
1503  /// provided type. Use getNode to set a custom SDLoc.
1504  SDValue getBitcast(EVT VT, SDValue V);
1505 
1506  /// Return an AddrSpaceCastSDNode.
1507  SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr, unsigned SrcAS,
1508  unsigned DestAS);
1509 
1510  /// Return a freeze using the SDLoc of the value operand.
1512 
1513  /// Return an AssertAlignSDNode.
1515 
1516  /// Swap N1 and N2 if Opcode is a commutative binary opcode
1517  /// and the canonical form expects the opposite order.
1518  void canonicalizeCommutativeBinop(unsigned Opcode, SDValue &N1,
1519  SDValue &N2) const;
1520 
1521  /// Return the specified value casted to
1522  /// the target's desired shift amount type.
1524 
1525  /// Expand the specified \c ISD::VAARG node as the Legalize pass would.
1527 
1528  /// Expand the specified \c ISD::VACOPY node as the Legalize pass would.
1530 
1531  /// Returs an GlobalAddress of the function from the current module with
1532  /// name matching the given ExternalSymbol. Additionally can provide the
1533  /// matched function.
1534  /// Panics the function doesn't exists.
1536  Function **TargetFunction = nullptr);
1537 
1538  /// *Mutate* the specified node in-place to have the
1539  /// specified operands. If the resultant node already exists in the DAG,
1540  /// this does not modify the specified node, instead it returns the node that
1541  /// already exists. If the resultant node does not exist in the DAG, the
1542  /// input node is returned. As a degenerate case, if you specify the same
1543  /// input operands as the node already has, the input node is returned.
1547  SDValue Op3);
1549  SDValue Op3, SDValue Op4);
1551  SDValue Op3, SDValue Op4, SDValue Op5);
1553 
1554  /// Creates a new TokenFactor containing \p Vals. If \p Vals contains 64k
1555  /// values or more, move values into new TokenFactors in 64k-1 blocks, until
1556  /// the final TokenFactor has less than 64k operands.
1558 
1559  /// *Mutate* the specified machine node's memory references to the provided
1560  /// list.
1562  ArrayRef<MachineMemOperand *> NewMemRefs);
1563 
1564  // Calculate divergence of node \p N based on its operands.
1565  bool calculateDivergence(SDNode *N);
1566 
1567  // Propagates the change in divergence to users
1568  void updateDivergence(SDNode * N);
1569 
1570  /// These are used for target selectors to *mutate* the
1571  /// specified node to have the specified return type, Target opcode, and
1572  /// operands. Note that target opcodes are stored as
1573  /// ~TargetOpcode in the node opcode field. The resultant node is returned.
1574  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT);
1575  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT, SDValue Op1);
1576  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1577  SDValue Op1, SDValue Op2);
1578  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1579  SDValue Op1, SDValue Op2, SDValue Op3);
1580  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1581  ArrayRef<SDValue> Ops);
1582  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1, EVT VT2);
1583  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1584  EVT VT2, ArrayRef<SDValue> Ops);
1585  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1586  EVT VT2, EVT VT3, ArrayRef<SDValue> Ops);
1587  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1588  EVT VT2, SDValue Op1, SDValue Op2);
1589  SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, SDVTList VTs,
1590  ArrayRef<SDValue> Ops);
1591 
1592  /// This *mutates* the specified node to have the specified
1593  /// return type, opcode, and operands.
1594  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs,
1595  ArrayRef<SDValue> Ops);
1596 
1597  /// Mutate the specified strict FP node to its non-strict equivalent,
1598  /// unlinking the node from its chain and dropping the metadata arguments.
1599  /// The node must be a strict FP node.
1601 
1602  /// These are used for target selectors to create a new node
1603  /// with specified return type(s), MachineInstr opcode, and operands.
1604  ///
1605  /// Note that getMachineNode returns the resultant node. If there is already
1606  /// a node of the specified opcode and operands, it returns that node instead
1607  /// of the current one.
1608  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT);
1609  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
1610  SDValue Op1);
1611  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
1612  SDValue Op1, SDValue Op2);
1613  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
1614  SDValue Op1, SDValue Op2, SDValue Op3);
1615  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
1616  ArrayRef<SDValue> Ops);
1617  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1618  EVT VT2, SDValue Op1, SDValue Op2);
1619  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1620  EVT VT2, SDValue Op1, SDValue Op2, SDValue Op3);
1621  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1622  EVT VT2, ArrayRef<SDValue> Ops);
1623  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1624  EVT VT2, EVT VT3, SDValue Op1, SDValue Op2);
1625  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1626  EVT VT2, EVT VT3, SDValue Op1, SDValue Op2,
1627  SDValue Op3);
1628  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
1629  EVT VT2, EVT VT3, ArrayRef<SDValue> Ops);
1630  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1631  ArrayRef<EVT> ResultTys, ArrayRef<SDValue> Ops);
1632  MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, SDVTList VTs,
1633  ArrayRef<SDValue> Ops);
1634 
1635  /// A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
1636  SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT,
1637  SDValue Operand);
1638 
1639  /// A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
1640  SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT,
1641  SDValue Operand, SDValue Subreg);
1642 
1643  /// Get the specified node if it's already available, or else return NULL.
1644  SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTList,
1645  ArrayRef<SDValue> Ops, const SDNodeFlags Flags);
1646  SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTList,
1647  ArrayRef<SDValue> Ops);
1648 
1649  /// Check if a node exists without modifying its flags.
1650  bool doesNodeExist(unsigned Opcode, SDVTList VTList, ArrayRef<SDValue> Ops);
1651 
1652  /// Creates a SDDbgValue node.
1654  unsigned R, bool IsIndirect, const DebugLoc &DL,
1655  unsigned O);
1656 
1657  /// Creates a constant SDDbgValue node.
1659  const Value *C, const DebugLoc &DL,
1660  unsigned O);
1661 
1662  /// Creates a FrameIndex SDDbgValue node.
1664  unsigned FI, bool IsIndirect,
1665  const DebugLoc &DL, unsigned O);
1666 
1667  /// Creates a FrameIndex SDDbgValue node.
1669  unsigned FI,
1670  ArrayRef<SDNode *> Dependencies,
1671  bool IsIndirect, const DebugLoc &DL,
1672  unsigned O);
1673 
1674  /// Creates a VReg SDDbgValue node.
1676  unsigned VReg, bool IsIndirect,
1677  const DebugLoc &DL, unsigned O);
1678 
1679  /// Creates a SDDbgValue node from a list of locations.
1682  ArrayRef<SDNode *> Dependencies, bool IsIndirect,
1683  const DebugLoc &DL, unsigned O, bool IsVariadic);
1684 
1685  /// Creates a SDDbgLabel node.
1686  SDDbgLabel *getDbgLabel(DILabel *Label, const DebugLoc &DL, unsigned O);
1687 
1688  /// Transfer debug values from one node to another, while optionally
1689  /// generating fragment expressions for split-up values. If \p InvalidateDbg
1690  /// is set, debug values are invalidated after they are transferred.
1691  void transferDbgValues(SDValue From, SDValue To, unsigned OffsetInBits = 0,
1692  unsigned SizeInBits = 0, bool InvalidateDbg = true);
1693 
1694  /// Remove the specified node from the system. If any of its
1695  /// operands then becomes dead, remove them as well. Inform UpdateListener
1696  /// for each node deleted.
1697  void RemoveDeadNode(SDNode *N);
1698 
1699  /// This method deletes the unreachable nodes in the
1700  /// given list, and any nodes that become unreachable as a result.
1701  void RemoveDeadNodes(SmallVectorImpl<SDNode *> &DeadNodes);
1702 
1703  /// Modify anything using 'From' to use 'To' instead.
1704  /// This can cause recursive merging of nodes in the DAG. Use the first
1705  /// version if 'From' is known to have a single result, use the second
1706  /// if you have two nodes with identical results (or if 'To' has a superset
1707  /// of the results of 'From'), use the third otherwise.
1708  ///
1709  /// These methods all take an optional UpdateListener, which (if not null) is
1710  /// informed about nodes that are deleted and modified due to recursive
1711  /// changes in the dag.
1712  ///
1713  /// These functions only replace all existing uses. It's possible that as
1714  /// these replacements are being performed, CSE may cause the From node
1715  /// to be given new uses. These new uses of From are left in place, and
1716  /// not automatically transferred to To.
1717  ///
1719  void ReplaceAllUsesWith(SDNode *From, SDNode *To);
1720  void ReplaceAllUsesWith(SDNode *From, const SDValue *To);
1721 
1722  /// Replace any uses of From with To, leaving
1723  /// uses of other values produced by From.getNode() alone.
1725 
1726  /// Like ReplaceAllUsesOfValueWith, but for multiple values at once.
1727  /// This correctly handles the case where
1728  /// there is an overlap between the From values and the To values.
1729  void ReplaceAllUsesOfValuesWith(const SDValue *From, const SDValue *To,
1730  unsigned Num);
1731 
1732  /// If an existing load has uses of its chain, create a token factor node with
1733  /// that chain and the new memory node's chain and update users of the old
1734  /// chain to the token factor. This ensures that the new memory node will have
1735  /// the same relative memory dependency position as the old load. Returns the
1736  /// new merged load chain.
1737  SDValue makeEquivalentMemoryOrdering(SDValue OldChain, SDValue NewMemOpChain);
1738 
1739  /// If an existing load has uses of its chain, create a token factor node with
1740  /// that chain and the new memory node's chain and update users of the old
1741  /// chain to the token factor. This ensures that the new memory node will have
1742  /// the same relative memory dependency position as the old load. Returns the
1743  /// new merged load chain.
1745 
1746  /// Topological-sort the AllNodes list and a
1747  /// assign a unique node id for each node in the DAG based on their
1748  /// topological order. Returns the number of nodes.
1749  unsigned AssignTopologicalOrder();
1750 
1751  /// Move node N in the AllNodes list to be immediately
1752  /// before the given iterator Position. This may be used to update the
1753  /// topological ordering when the list of nodes is modified.
1755  AllNodes.insert(Position, AllNodes.remove(N));
1756  }
1757 
1758  /// Returns an APFloat semantics tag appropriate for the given type. If VT is
1759  /// a vector type, the element semantics are returned.
1761  switch (VT.getScalarType().getSimpleVT().SimpleTy) {
1762  default: llvm_unreachable("Unknown FP format");
1763  case MVT::f16: return APFloat::IEEEhalf();
1764  case MVT::bf16: return APFloat::BFloat();
1765  case MVT::f32: return APFloat::IEEEsingle();
1766  case MVT::f64: return APFloat::IEEEdouble();
1767  case MVT::f80: return APFloat::x87DoubleExtended();
1768  case MVT::f128: return APFloat::IEEEquad();
1769  case MVT::ppcf128: return APFloat::PPCDoubleDouble();
1770  }
1771  }
1772 
1773  /// Add a dbg_value SDNode. If SD is non-null that means the
1774  /// value is produced by SD.
1775  void AddDbgValue(SDDbgValue *DB, bool isParameter);
1776 
1777  /// Add a dbg_label SDNode.
1778  void AddDbgLabel(SDDbgLabel *DB);
1779 
1780  /// Get the debug values which reference the given SDNode.
1782  return DbgInfo->getSDDbgValues(SD);
1783  }
1784 
1785 public:
1786  /// Return true if there are any SDDbgValue nodes associated
1787  /// with this SelectionDAG.
1788  bool hasDebugValues() const { return !DbgInfo->empty(); }
1789 
1790  SDDbgInfo::DbgIterator DbgBegin() const { return DbgInfo->DbgBegin(); }
1791  SDDbgInfo::DbgIterator DbgEnd() const { return DbgInfo->DbgEnd(); }
1792 
1794  return DbgInfo->ByvalParmDbgBegin();
1795  }
1797  return DbgInfo->ByvalParmDbgEnd();
1798  }
1799 
1801  return DbgInfo->DbgLabelBegin();
1802  }
1804  return DbgInfo->DbgLabelEnd();
1805  }
1806 
1807  /// To be invoked on an SDNode that is slated to be erased. This
1808  /// function mirrors \c llvm::salvageDebugInfo.
1809  void salvageDebugInfo(SDNode &N);
1810 
1811  /// Signal whether instruction referencing variable locations are desired for
1812  /// this function's debug-info.
1814  UseInstrRefDebugInfo = Flag;
1815  }
1816 
1818  return UseInstrRefDebugInfo;
1819  }
1820 
1821  void dump() const;
1822 
1823  /// In most cases this function returns the ABI alignment for a given type,
1824  /// except for illegal vector types where the alignment exceeds that of the
1825  /// stack. In such cases we attempt to break the vector down to a legal type
1826  /// and return the ABI alignment for that instead.
1827  Align getReducedAlign(EVT VT, bool UseABI);
1828 
1829  /// Create a stack temporary based on the size in bytes and the alignment
1830  SDValue CreateStackTemporary(TypeSize Bytes, Align Alignment);
1831 
1832  /// Create a stack temporary, suitable for holding the specified value type.
1833  /// If minAlign is specified, the slot size will have at least that alignment.
1834  SDValue CreateStackTemporary(EVT VT, unsigned minAlign = 1);
1835 
1836  /// Create a stack temporary suitable for holding either of the specified
1837  /// value types.
1838  SDValue CreateStackTemporary(EVT VT1, EVT VT2);
1839 
1840  SDValue FoldSymbolOffset(unsigned Opcode, EVT VT,
1841  const GlobalAddressSDNode *GA,
1842  const SDNode *N2);
1843 
1844  SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT,
1845  ArrayRef<SDValue> Ops);
1846 
1847  /// Fold floating-point operations with 2 operands when both operands are
1848  /// constants and/or undefined.
1849  SDValue foldConstantFPMath(unsigned Opcode, const SDLoc &DL, EVT VT,
1850  SDValue N1, SDValue N2);
1851 
1852  /// Constant fold a setcc to true or false.
1854  const SDLoc &dl);
1855 
1856  /// See if the specified operand can be simplified with the knowledge that
1857  /// only the bits specified by DemandedBits are used. If so, return the
1858  /// simpler operand, otherwise return a null SDValue.
1859  ///
1860  /// (This exists alongside SimplifyDemandedBits because GetDemandedBits can
1861  /// simplify nodes with multiple uses more aggressively.)
1863 
1864  /// See if the specified operand can be simplified with the knowledge that
1865  /// only the bits specified by DemandedBits are used in the elements specified
1866  /// by DemandedElts. If so, return the simpler operand, otherwise return a
1867  /// null SDValue.
1868  ///
1869  /// (This exists alongside SimplifyDemandedBits because GetDemandedBits can
1870  /// simplify nodes with multiple uses more aggressively.)
1872  const APInt &DemandedElts);
1873 
1874  /// Return true if the sign bit of Op is known to be zero.
1875  /// We use this predicate to simplify operations downstream.
1876  bool SignBitIsZero(SDValue Op, unsigned Depth = 0) const;
1877 
1878  /// Return true if 'Op & Mask' is known to be zero. We
1879  /// use this predicate to simplify operations downstream. Op and Mask are
1880  /// known to be the same type.
1881  bool MaskedValueIsZero(SDValue Op, const APInt &Mask,
1882  unsigned Depth = 0) const;
1883 
1884  /// Return true if 'Op & Mask' is known to be zero in DemandedElts. 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  const APInt &DemandedElts, unsigned Depth = 0) const;
1889 
1890  /// Return true if '(Op & Mask) == Mask'.
1891  /// Op and Mask are known to be the same type.
1892  bool MaskedValueIsAllOnes(SDValue Op, const APInt &Mask,
1893  unsigned Depth = 0) const;
1894 
1895  /// Determine which bits of Op are known to be either zero or one and return
1896  /// them in Known. For vectors, the known bits are those that are shared by
1897  /// every vector element.
1898  /// Targets can implement the computeKnownBitsForTargetNode method in the
1899  /// TargetLowering class to allow target nodes to be understood.
1900  KnownBits computeKnownBits(SDValue Op, unsigned Depth = 0) const;
1901 
1902  /// Determine which bits of Op are known to be either zero or one and return
1903  /// them in Known. The DemandedElts argument allows us to only collect the
1904  /// known bits that are shared by the requested vector elements.
1905  /// Targets can implement the computeKnownBitsForTargetNode method in the
1906  /// TargetLowering class to allow target nodes to be understood.
1907  KnownBits computeKnownBits(SDValue Op, const APInt &DemandedElts,
1908  unsigned Depth = 0) const;
1909 
1910  /// Used to represent the possible overflow behavior of an operation.
1911  /// Never: the operation cannot overflow.
1912  /// Always: the operation will always overflow.
1913  /// Sometime: the operation may or may not overflow.
1918  };
1919 
1920  /// Determine if the result of the addition of 2 node can overflow.
1922 
1923  /// Test if the given value is known to have exactly one bit set. This differs
1924  /// from computeKnownBits in that it doesn't necessarily determine which bit
1925  /// is set.
1926  bool isKnownToBeAPowerOfTwo(SDValue Val) const;
1927 
1928  /// Return the number of times the sign bit of the register is replicated into
1929  /// the other bits. We know that at least 1 bit is always equal to the sign
1930  /// bit (itself), but other cases can give us information. For example,
1931  /// immediately after an "SRA X, 2", we know that the top 3 bits are all equal
1932  /// to each other, so we return 3. Targets can implement the
1933  /// ComputeNumSignBitsForTarget method in the TargetLowering class to allow
1934  /// target nodes to be understood.
1935  unsigned ComputeNumSignBits(SDValue Op, unsigned Depth = 0) const;
1936 
1937  /// Return the number of times the sign bit of the register is replicated into
1938  /// the other bits. We know that at least 1 bit is always equal to the sign
1939  /// bit (itself), but other cases can give us information. For example,
1940  /// immediately after an "SRA X, 2", we know that the top 3 bits are all equal
1941  /// to each other, so we return 3. The DemandedElts argument allows
1942  /// us to only collect the minimum sign bits of the requested vector elements.
1943  /// Targets can implement the ComputeNumSignBitsForTarget method in the
1944  /// TargetLowering class to allow target nodes to be understood.
1945  unsigned ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
1946  unsigned Depth = 0) const;
1947 
1948  /// Get the upper bound on bit size for this Value \p Op as a signed integer.
1949  /// i.e. x == sext(trunc(x to MaxSignedBits) to bitwidth(x)).
1950  /// Similar to the APInt::getSignificantBits function.
1951  /// Helper wrapper to ComputeNumSignBits.
1952  unsigned ComputeMaxSignificantBits(SDValue Op, unsigned Depth = 0) const;
1953 
1954  /// Get the upper bound on bit size for this Value \p Op as a signed integer.
1955  /// i.e. x == sext(trunc(x to MaxSignedBits) to bitwidth(x)).
1956  /// Similar to the APInt::getSignificantBits function.
1957  /// Helper wrapper to ComputeNumSignBits.
1958  unsigned ComputeMaxSignificantBits(SDValue Op, const APInt &DemandedElts,
1959  unsigned Depth = 0) const;
1960 
1961  /// Return true if this function can prove that \p Op is never poison
1962  /// and, if \p PoisonOnly is false, does not have undef bits.
1963  bool isGuaranteedNotToBeUndefOrPoison(SDValue Op, bool PoisonOnly = false,
1964  unsigned Depth = 0) const;
1965 
1966  /// Return true if this function can prove that \p Op is never poison
1967  /// and, if \p PoisonOnly is false, does not have undef bits. The DemandedElts
1968  /// argument limits the check to the requested vector elements.
1969  bool isGuaranteedNotToBeUndefOrPoison(SDValue Op, const APInt &DemandedElts,
1970  bool PoisonOnly = false,
1971  unsigned Depth = 0) const;
1972 
1973  /// Return true if this function can prove that \p Op is never poison.
1974  bool isGuaranteedNotToBePoison(SDValue Op, unsigned Depth = 0) const {
1975  return isGuaranteedNotToBeUndefOrPoison(Op, /*PoisonOnly*/ true, Depth);
1976  }
1977 
1978  /// Return true if this function can prove that \p Op is never poison. The
1979  /// DemandedElts argument limits the check to the requested vector elements.
1980  bool isGuaranteedNotToBePoison(SDValue Op, const APInt &DemandedElts,
1981  unsigned Depth = 0) const {
1982  return isGuaranteedNotToBeUndefOrPoison(Op, DemandedElts,
1983  /*PoisonOnly*/ true, Depth);
1984  }
1985 
1986  /// Return true if the specified operand is an ISD::ADD with a ConstantSDNode
1987  /// on the right-hand side, or if it is an ISD::OR with a ConstantSDNode that
1988  /// is guaranteed to have the same semantics as an ADD. This handles the
1989  /// equivalence:
1990  /// X|Cst == X+Cst iff X&Cst = 0.
1991  bool isBaseWithConstantOffset(SDValue Op) const;
1992 
1993  /// Test whether the given SDValue is known to never be NaN. If \p SNaN is
1994  /// true, returns if \p Op is known to never be a signaling NaN (it may still
1995  /// be a qNaN).
1996  bool isKnownNeverNaN(SDValue Op, bool SNaN = false, unsigned Depth = 0) const;
1997 
1998  /// \returns true if \p Op is known to never be a signaling NaN.
1999  bool isKnownNeverSNaN(SDValue Op, unsigned Depth = 0) const {
2000  return isKnownNeverNaN(Op, true, Depth);
2001  }
2002 
2003  /// Test whether the given floating point SDValue is known to never be
2004  /// positive or negative zero.
2005  bool isKnownNeverZeroFloat(SDValue Op) const;
2006 
2007  /// Test whether the given SDValue is known to contain non-zero value(s).
2008  bool isKnownNeverZero(SDValue Op) const;
2009 
2010  /// Test whether two SDValues are known to compare equal. This
2011  /// is true if they are the same value, or if one is negative zero and the
2012  /// other positive zero.
2013  bool isEqualTo(SDValue A, SDValue B) const;
2014 
2015  /// Return true if A and B have no common bits set. As an example, this can
2016  /// allow an 'add' to be transformed into an 'or'.
2017  bool haveNoCommonBitsSet(SDValue A, SDValue B) const;
2018 
2019  /// Test whether \p V has a splatted value for all the demanded elements.
2020  ///
2021  /// On success \p UndefElts will indicate the elements that have UNDEF
2022  /// values instead of the splat value, this is only guaranteed to be correct
2023  /// for \p DemandedElts.
2024  ///
2025  /// NOTE: The function will return true for a demanded splat of UNDEF values.
2026  bool isSplatValue(SDValue V, const APInt &DemandedElts, APInt &UndefElts,
2027  unsigned Depth = 0) const;
2028 
2029  /// Test whether \p V has a splatted value.
2030  bool isSplatValue(SDValue V, bool AllowUndefs = false) const;
2031 
2032  /// If V is a splatted value, return the source vector and its splat index.
2033  SDValue getSplatSourceVector(SDValue V, int &SplatIndex);
2034 
2035  /// If V is a splat vector, return its scalar source operand by extracting
2036  /// that element from the source vector. If LegalTypes is true, this method
2037  /// may only return a legally-typed splat value. If it cannot legalize the
2038  /// splatted value it will return SDValue().
2039  SDValue getSplatValue(SDValue V, bool LegalTypes = false);
2040 
2041  /// If a SHL/SRA/SRL node \p V has a constant or splat constant shift amount
2042  /// that is less than the element bit-width of the shift node, return it.
2044  const APInt &DemandedElts) const;
2045 
2046  /// If a SHL/SRA/SRL node \p V has constant shift amounts that are all less
2047  /// than the element bit-width of the shift node, return the minimum value.
2048  const APInt *
2050  const APInt &DemandedElts) const;
2051 
2052  /// If a SHL/SRA/SRL node \p V has constant shift amounts that are all less
2053  /// than the element bit-width of the shift node, return the maximum value.
2054  const APInt *
2056  const APInt &DemandedElts) const;
2057 
2058  /// Match a binop + shuffle pyramid that represents a horizontal reduction
2059  /// over the elements of a vector starting from the EXTRACT_VECTOR_ELT node /p
2060  /// Extract. The reduction must use one of the opcodes listed in /p
2061  /// CandidateBinOps and on success /p BinOp will contain the matching opcode.
2062  /// Returns the vector that is being reduced on, or SDValue() if a reduction
2063  /// was not matched. If \p AllowPartials is set then in the case of a
2064  /// reduction pattern that only matches the first few stages, the extracted
2065  /// subvector of the start of the reduction is returned.
2067  ArrayRef<ISD::NodeType> CandidateBinOps,
2068  bool AllowPartials = false);
2069 
2070  /// Utility function used by legalize and lowering to
2071  /// "unroll" a vector operation by splitting out the scalars and operating
2072  /// on each element individually. If the ResNE is 0, fully unroll the vector
2073  /// op. If ResNE is less than the width of the vector op, unroll up to ResNE.
2074  /// If the ResNE is greater than the width of the vector op, unroll the
2075  /// vector op and fill the end of the resulting vector with UNDEFS.
2076  SDValue UnrollVectorOp(SDNode *N, unsigned ResNE = 0);
2077 
2078  /// Like UnrollVectorOp(), but for the [US](ADD|SUB|MUL)O family of opcodes.
2079  /// This is a separate function because those opcodes have two results.
2080  std::pair<SDValue, SDValue> UnrollVectorOverflowOp(SDNode *N,
2081  unsigned ResNE = 0);
2082 
2083  /// Return true if loads are next to each other and can be
2084  /// merged. Check that both are nonvolatile and if LD is loading
2085  /// 'Bytes' bytes from a location that is 'Dist' units away from the
2086  /// location that the 'Base' load is loading from.
2088  unsigned Bytes, int Dist) const;
2089 
2090  /// Infer alignment of a load / store address. Return None if it cannot be
2091  /// inferred.
2092  MaybeAlign InferPtrAlign(SDValue Ptr) const;
2093 
2094  /// Compute the VTs needed for the low/hi parts of a type
2095  /// which is split (or expanded) into two not necessarily identical pieces.
2096  std::pair<EVT, EVT> GetSplitDestVTs(const EVT &VT) const;
2097 
2098  /// Compute the VTs needed for the low/hi parts of a type, dependent on an
2099  /// enveloping VT that has been split into two identical pieces. Sets the
2100  /// HisIsEmpty flag when hi type has zero storage size.
2101  std::pair<EVT, EVT> GetDependentSplitDestVTs(const EVT &VT, const EVT &EnvVT,
2102  bool *HiIsEmpty) const;
2103 
2104  /// Split the vector with EXTRACT_SUBVECTOR using the provides
2105  /// VTs and return the low/high part.
2106  std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL,
2107  const EVT &LoVT, const EVT &HiVT);
2108 
2109  /// Split the vector with EXTRACT_SUBVECTOR and return the low/high part.
2110  std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL) {
2111  EVT LoVT, HiVT;
2112  std::tie(LoVT, HiVT) = GetSplitDestVTs(N.getValueType());
2113  return SplitVector(N, DL, LoVT, HiVT);
2114  }
2115 
2116  /// Split the explicit vector length parameter of a VP operation.
2117  std::pair<SDValue, SDValue> SplitEVL(SDValue N, EVT VecVT, const SDLoc &DL);
2118 
2119  /// Split the node's operand with EXTRACT_SUBVECTOR and
2120  /// return the low/high part.
2121  std::pair<SDValue, SDValue> SplitVectorOperand(const SDNode *N, unsigned OpNo)
2122  {
2123  return SplitVector(N->getOperand(OpNo), SDLoc(N));
2124  }
2125 
2126  /// Widen the vector up to the next power of two using INSERT_SUBVECTOR.
2127  SDValue WidenVector(const SDValue &N, const SDLoc &DL);
2128 
2129  /// Append the extracted elements from Start to Count out of the vector Op in
2130  /// Args. If Count is 0, all of the elements will be extracted. The extracted
2131  /// elements will have type EVT if it is provided, and otherwise their type
2132  /// will be Op's element type.
2134  unsigned Start = 0, unsigned Count = 0,
2135  EVT EltVT = EVT());
2136 
2137  /// Compute the default alignment value for the given type.
2138  Align getEVTAlign(EVT MemoryVT) const;
2139  /// Compute the default alignment value for the given type.
2140  /// FIXME: Remove once transition to Align is over.
2141  inline unsigned getEVTAlignment(EVT MemoryVT) const {
2142  return getEVTAlign(MemoryVT).value();
2143  }
2144 
2145  /// Test whether the given value is a constant int or similar node.
2147 
2148  /// Test whether the given value is a constant FP or similar node.
2150 
2151  /// \returns true if \p N is any kind of constant or build_vector of
2152  /// constants, int or float. If a vector, it may not necessarily be a splat.
2153  inline bool isConstantValueOfAnyType(SDValue N) const {
2156  }
2157 
2158  /// Set CallSiteInfo to be associated with Node.
2160  SDCallSiteDbgInfo[Node].CSInfo = std::move(CallInfo);
2161  }
2162  /// Return CallSiteInfo associated with Node, or a default if none exists.
2164  auto I = SDCallSiteDbgInfo.find(Node);
2165  return I != SDCallSiteDbgInfo.end() ? std::move(I->second).CSInfo
2166  : CallSiteInfo();
2167  }
2168  /// Set HeapAllocSite to be associated with Node.
2169  void addHeapAllocSite(const SDNode *Node, MDNode *MD) {
2170  SDCallSiteDbgInfo[Node].HeapAllocSite = MD;
2171  }
2172  /// Return HeapAllocSite associated with Node, or nullptr if none exists.
2174  auto I = SDCallSiteDbgInfo.find(Node);
2175  return I != SDCallSiteDbgInfo.end() ? I->second.HeapAllocSite : nullptr;
2176  }
2177  /// Set NoMergeSiteInfo to be associated with Node if NoMerge is true.
2178  void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge) {
2179  if (NoMerge)
2180  SDCallSiteDbgInfo[Node].NoMerge = NoMerge;
2181  }
2182  /// Return NoMerge info associated with Node.
2183  bool getNoMergeSiteInfo(const SDNode *Node) const {
2184  auto I = SDCallSiteDbgInfo.find(Node);
2185  return I != SDCallSiteDbgInfo.end() ? I->second.NoMerge : false;
2186  }
2187 
2188  /// Return the current function's default denormal handling kind for the given
2189  /// floating point type.
2191  return MF->getDenormalMode(EVTToAPFloatSemantics(VT));
2192  }
2193 
2194  bool shouldOptForSize() const;
2195 
2196  /// Get the (commutative) neutral element for the given opcode, if it exists.
2197  SDValue getNeutralElement(unsigned Opcode, const SDLoc &DL, EVT VT,
2198  SDNodeFlags Flags);
2199 
2200 private:
2201  void InsertNode(SDNode *N);
2202  bool RemoveNodeFromCSEMaps(SDNode *N);
2203  void AddModifiedNodeToCSEMaps(SDNode *N);
2204  SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op, void *&InsertPos);
2205  SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op1, SDValue Op2,
2206  void *&InsertPos);
2207  SDNode *FindModifiedNodeSlot(SDNode *N, ArrayRef<SDValue> Ops,
2208  void *&InsertPos);
2209  SDNode *UpdateSDLocOnMergeSDNode(SDNode *N, const SDLoc &loc);
2210 
2211  void DeleteNodeNotInCSEMaps(SDNode *N);
2212  void DeallocateNode(SDNode *N);
2213 
2214  void allnodes_clear();
2215 
2216  /// Look up the node specified by ID in CSEMap. If it exists, return it. If
2217  /// not, return the insertion token that will make insertion faster. This
2218  /// overload is for nodes other than Constant or ConstantFP, use the other one
2219  /// for those.
2220  SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos);
2221 
2222  /// Look up the node specified by ID in CSEMap. If it exists, return it. If
2223  /// not, return the insertion token that will make insertion faster. Performs
2224  /// additional processing for constant nodes.
2225  SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, const SDLoc &DL,
2226  void *&InsertPos);
2227 
2228  /// List of non-single value types.
2229  FoldingSet<SDVTListNode> VTListMap;
2230 
2231  /// Maps to auto-CSE operations.
2232  std::vector<CondCodeSDNode*> CondCodeNodes;
2233 
2234  std::vector<SDNode*> ValueTypeNodes;
2235  std::map<EVT, SDNode*, EVT::compareRawBits> ExtendedValueTypeNodes;
2236  StringMap<SDNode*> ExternalSymbols;
2237 
2238  std::map<std::pair<std::string, unsigned>, SDNode *> TargetExternalSymbols;
2240 
2241  FlagInserter *Inserter = nullptr;
2242 };
2243 
2244 template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> {
2246 
2248  return nodes_iterator(G->allnodes_begin());
2249  }
2250 
2252  return nodes_iterator(G->allnodes_end());
2253  }
2254 };
2255 
2256 } // end namespace llvm
2257 
2258 #endif // LLVM_CODEGEN_SELECTIONDAG_H
removeOperands
static void removeOperands(MachineInstr &MI, unsigned i)
Definition: ThumbRegisterInfo.cpp:338
llvm::Check::Size
@ Size
Definition: FileCheck.h:77
llvm::SelectionDAG::expandVACopy
SDValue expandVACopy(SDNode *Node)
Expand the specified ISD::VACOPY node as the Legalize pass would.
Definition: SelectionDAG.cpp:2240
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:984
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:9682
llvm::SelectionDAG::getTargetConstantFP
SDValue getTargetConstantFP(const ConstantFP &Val, const SDLoc &DL, EVT VT)
Definition: SelectionDAG.h:690
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:9744
llvm::SelectionDAG::getTargetConstantPool
SDValue getTargetConstantPool(MachineConstantPoolValue *C, EVT VT, MaybeAlign Align=None, int Offset=0, unsigned TargetFlags=0)
Definition: SelectionDAG.h:722
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:1292
llvm::SelectionDAG::GetDbgValues
ArrayRef< SDDbgValue * > GetDbgValues(const SDNode *SD) const
Get the debug values which reference the given SDNode.
Definition: SelectionDAG.h:1781
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:943
llvm::ISD::MemIndexedMode
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
Definition: ISDOpcodes.h:1353
llvm::SelectionDAG::GetDemandedBits
SDValue GetDemandedBits(SDValue V, const APInt &DemandedBits)
See if the specified operand can be simplified with the knowledge that only the bits specified by Dem...
Definition: SelectionDAG.cpp:2466
llvm::SelectionDAG::getEVTAlignment
unsigned getEVTAlignment(EVT MemoryVT) const
Compute the default alignment value for the given type.
Definition: SelectionDAG.h:2141
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:494
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
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:10304
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:2865
Pass
print lazy value Lazy Value Info Printer Pass
Definition: LazyValueInfo.cpp:1978
llvm::SelectionDAG::getSelectionDAGInfo
const SelectionDAGTargetInfo & getSelectionDAGInfo() const
Definition: SelectionDAG.h:460
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::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:1980
llvm::SDLoc
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Definition: SelectionDAGNodes.h:1090
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:4652
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:11132
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:2520
llvm::SelectionDAG::getSplatVector
SDValue getSplatVector(EVT VT, const SDLoc &DL, SDValue Op)
Definition: SelectionDAG.h:839
llvm::SelectionDAG::addNoMergeSiteInfo
void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge)
Set NoMergeSiteInfo to be associated with Node if NoMerge is true.
Definition: SelectionDAG.h:2178
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:750
llvm::MVT::ppcf128
@ ppcf128
Definition: MachineValueType.h:59
llvm::SDValue::getNode
SDNode * getNode() const
get the SDNode which holds the desired result
Definition: SelectionDAGNodes.h:151
llvm::SelectionDAG::VerifyDAGDivergence
void VerifyDAGDivergence()
Definition: SelectionDAG.cpp:10224
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:509
llvm::SDDbgInfo
Keeps track of dbg_value information through SDISel.
Definition: SelectionDAG.h:154
llvm::SelectionDAG::getValueType
SDValue getValueType(EVT)
Definition: SelectionDAG.cpp:1798
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:1471
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:1236
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:1405
llvm::SelectionDAG::FlagInserter
Help to insert SDNodeFlags automatically in transforming.
Definition: SelectionDAG.h:341
llvm::SelectionDAG::getTargetConstantFP
SDValue getTargetConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT)
Definition: SelectionDAG.h:687
llvm::SelectionDAG::getFrameIndex
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
Definition: SelectionDAG.cpp:1679
llvm::SelectionDAG::getIndexedStoreVP
SDValue getIndexedStoreVP(SDValue OrigStore, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8127
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:1185
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:1239
llvm::SelectionDAG::allnodes_begin
allnodes_iterator allnodes_begin()
Definition: SelectionDAG.h:513
llvm::SelectionDAG::getVTList
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
Definition: SelectionDAG.cpp:9055
llvm::MachineSDNode
An SDNode that represents everything that will be needed to construct a MachineInstr.
Definition: SelectionDAGNodes.h:2867
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:2318
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:2552
ErrorHandling.h
llvm::SelectionDAG::allnodes_begin
allnodes_const_iterator allnodes_begin() const
Definition: SelectionDAG.h:508
llvm::SelectionDAG::getRoot
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
Definition: SelectionDAG.h:528
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:468
llvm::SelectionDAG::getVectorIdxConstant
SDValue getVectorIdxConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
Definition: SelectionDAG.cpp:1584
Allocator.h
llvm::ISD::MemIndexType
MemIndexType
MemIndexType enum - This enum defines how to interpret MGATHER/SCATTER's index parameter when calcula...
Definition: ISDOpcodes.h:1366
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())
Definition: SelectionDAG.cpp:7193
llvm::SDNode
Represents one node in the SelectionDAG.
Definition: SelectionDAGNodes.h:454
llvm::SelectionDAG::hasDebugValues
bool hasDebugValues() const
Return true if there are any SDDbgValue nodes associated with this SelectionDAG.
Definition: SelectionDAG.h:1788
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:1428
llvm::SelectionDAG::ReplaceAllUsesWith
void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
Definition: SelectionDAG.cpp:9927
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:2314
llvm::SelectionDAG::EVTToAPFloatSemantics
static const fltSemantics & EVTToAPFloatSemantics(EVT VT)
Returns an APFloat semantics tag appropriate for the given type.
Definition: SelectionDAG.h:1760
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:2749
llvm::MVT::Glue
@ Glue
Definition: MachineValueType.h:262
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:6591
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:1255
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:768
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:1388
llvm::MachineMemOperand
A description of a memory reference used in the backend.
Definition: MachineMemOperand.h:126
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:10428
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:7756
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:1406
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:11209
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:2836
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:4511
llvm::LargestSDNode
AlignedCharArrayUnion< AtomicSDNode, TargetIndexSDNode, BlockAddressSDNode, GlobalAddressSDNode, PseudoProbeSDNode > LargestSDNode
A representation of the largest SDNode, for use in sizeof().
Definition: SelectionDAGNodes.h:3007
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:1064
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:822
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:8685
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:1341
llvm::BumpPtrAllocator
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition: Allocator.h:372
llvm::SelectionDAG::getCopyToReg
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N, SDValue Glue)
Definition: SelectionDAG.h:759
llvm::SelectionDAG::doesNodeExist
bool doesNodeExist(unsigned Opcode, SDVTList VTList, ArrayRef< SDValue > Ops)
Check if a node exists without modifying its flags.
Definition: SelectionDAG.cpp:9655
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:9639
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:79
llvm::SelectionDAG::getEHLabel
SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label)
Definition: SelectionDAG.cpp:2090
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:2051
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:1328
llvm::SelectionDAG::RemoveDeadNodes
void RemoveDeadNodes()
This method deletes all unreachable nodes in the SelectionDAG.
Definition: SelectionDAG.cpp:900
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2548
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:1373
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:11556
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:1348
llvm::SelectionDAG::~SelectionDAG
~SelectionDAG()
Definition: SelectionDAG.cpp:1257
llvm::SelectionDAG::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
Definition: SelectionDAG.h:454
llvm::SelectionDAG::clear
void clear()
Clear state and free memory necessary to make this SelectionDAG ready to process a new block.
Definition: SelectionDAG.cpp:1319
llvm::SelectionDAG::getDbgLabel
SDDbgLabel * getDbgLabel(DILabel *Label, const DebugLoc &DL, unsigned O)
Creates a SDDbgLabel node.
Definition: SelectionDAG.cpp:9890
llvm::SelectionDAG::DAGUpdateListener::DAGUpdateListener
DAGUpdateListener(SelectionDAG &D)
Definition: SelectionDAG.h:304
llvm::ISD::CALLSEQ_END
@ CALLSEQ_END
Definition: ISDOpcodes.h:1065
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:7875
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:10238
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:462
size_t
llvm::SelectionDAG::DbgBegin
SDDbgInfo::DbgIterator DbgBegin() const
Definition: SelectionDAG.h:1790
llvm::SelectionDAG::isKnownNeverSNaN
bool isKnownNeverSNaN(SDValue Op, unsigned Depth=0) const
Definition: SelectionDAG.h:1999
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:240
llvm::ShuffleVectorSDNode
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
Definition: SelectionDAGNodes.h:1506
llvm::SelectionDAG::getRegister
SDValue getRegister(unsigned Reg, EVT VT)
Definition: SelectionDAG.cpp:2061
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:357
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:9721
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:5695
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:1384
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:976
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:8273
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:7706
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:9670
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:329
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:8543
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:4446
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:8532
llvm::SelectionDAG::getTargetFrameIndex
SDValue getTargetFrameIndex(int FI, EVT VT)
Definition: SelectionDAG.h:703
llvm::SelectionDAG::DAGUpdateListener::DAG
SelectionDAG & DAG
Definition: SelectionDAG.h:302
llvm::SDValue::getValueType
EVT getValueType() const
Return the ValueType of the referenced return value.
Definition: SelectionDAGNodes.h:1125
llvm::SelectionDAG::isKnownToBeAPowerOfTwo
bool isKnownToBeAPowerOfTwo(SDValue Val) const
Test if the given value is known to have exactly one bit set.
Definition: SelectionDAG.cpp:3804
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:10819
llvm::SelectionDAG::DAGUpdateListener::~DAGUpdateListener
virtual ~DAGUpdateListener()
Definition: SelectionDAG.h:309
llvm::SelectionDAG::getTargetConstant
SDValue getTargetConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
Definition: SelectionDAG.h:660
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:9145
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:8453
llvm::SelectionDAG::getAtomicMemset
SDValue getAtomicMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, unsigned DstAlign, SDValue Value, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo)
Definition: SelectionDAG.cpp:7356
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:1379
llvm::AAResults
Definition: AliasAnalysis.h:511
llvm::SelectionDAG::getTargetBlockAddress
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned TargetFlags=0)
Definition: SelectionDAG.h:745
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:8021
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:7808
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:926
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:8784
llvm::SelectionDAG::getUNDEF
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
Definition: SelectionDAG.h:971
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:352
llvm::SelectionDAG::getTargetLoweringInfo
const TargetLowering & getTargetLoweringInfo() const
Definition: SelectionDAG.h:458
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:2134
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:302
llvm::MVT::f64
@ f64
Definition: MachineValueType.h:56
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:1449
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:3395
llvm::SelectionDAG::isUndef
bool isUndef(unsigned Opcode, ArrayRef< SDValue > Ops)
Return true if the result of this operation is always undefined.
Definition: SelectionDAG.cpp:5457
llvm::SelectionDAG::allnodes
iterator_range< allnodes_const_iterator > allnodes() const
Definition: SelectionDAG.h:523
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:2528
llvm::SelectionDAG::getFlagInserter
FlagInserter * getFlagInserter()
Definition: SelectionDAG.h:467
llvm::SelectionDAG::FlagInserter::getFlags
SDNodeFlags getFlags() const
Definition: SelectionDAG.h:359
llvm::SelectionDAG::getDivergenceAnalysis
const LegacyDivergenceAnalysis * getDivergenceAnalysis() const
Definition: SelectionDAG.h:461
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:5038
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:8739
llvm::SelectionDAG::InferPtrAlign
MaybeAlign InferPtrAlign(SDValue Ptr) const
Infer alignment of a load / store address.
Definition: SelectionDAG.cpp:11081
llvm::MVT::SimpleTy
SimpleValueType SimpleTy
Definition: MachineValueType.h:321
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:2192
DAGCombine.h
llvm::SelectionDAG::getIndexedStridedStoreVP
SDValue getIndexedStridedStoreVP(SDValue OrigStore, const SDLoc &DL, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8378
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::M68kBeads::DA
@ DA
Definition: M68kBaseInfo.h:59
llvm::SelectionDAG::DbgLabelBegin
SDDbgInfo::DbgLabelIterator DbgLabelBegin() const
Definition: SelectionDAG.h:1800
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:109
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:537
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:8055
llvm::SelectionDAG::FlagInserter::FlagInserter
FlagInserter(SelectionDAG &SDAG, SDNodeFlags Flags)
Definition: SelectionDAG.h:347
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:8410
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:1174
llvm::SDVTListNode
Definition: SelectionDAG.h:91
llvm::SelectionDAG::DAGNodeDeletedListener
Definition: SelectionDAG.h:326
llvm::SelectionDAG::getAddrSpaceCast
SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr, unsigned SrcAS, unsigned DestAS)
Return an AddrSpaceCastSDNode.
Definition: SelectionDAG.cpp:2171
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:1095
APFloat.h
llvm::SelectionDAG::isEqualTo
bool isEqualTo(SDValue A, SDValue B) const
Test whether two SDValues are known to compare equal.
Definition: SelectionDAG.cpp:4674
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:7481
llvm::LegacyDivergenceAnalysis
Definition: LegacyDivergenceAnalysis.h:31
llvm::SelectionDAG::dump
void dump() const
Definition: SelectionDAGDumper.cpp:919
DebugLoc.h
llvm::ISD::SETCC_INVALID
@ SETCC_INVALID
Definition: ISDOpcodes.h:1432
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:2121
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:4433
llvm::SelectionDAG::getAssertAlign
SDValue getAssertAlign(const SDLoc &DL, SDValue V, Align A)
Return an AssertAlignSDNode.
Definition: SelectionDAG.cpp:5768
StringMap.h
llvm::SelectionDAG::getIndexedLoadVP
SDValue getIndexedLoadVP(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8005
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:8309
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:4523
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:1222
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:8157
llvm::SelectionDAG::getObjectPtrOffset
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, SDValue Offset)
Definition: SelectionDAG.h:932
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:5804
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:698
llvm::SelectionDAG::expandVAArg
SDValue expandVAArg(SDNode *Node)
Expand the specified ISD::VAARG node as the Legalize pass would.
Definition: SelectionDAG.cpp:2206
llvm::ProfileSummaryInfo
Analysis providing profile information.
Definition: ProfileSummaryInfo.h:39
llvm::SelectionDAG::SelectionDAG
SelectionDAG(const TargetMachine &TM, CodeGenOpt::Level)
Definition: SelectionDAG.cpp:1231
llvm::MVT::f80
@ f80
Definition: MachineValueType.h:57
llvm::GraphTraits< SDNode * >
Definition: SelectionDAGNodes.h:2985
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:2821
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:465
llvm::checkForCycles
void checkForCycles(const SelectionDAG *DAG, bool force=false)
Definition: SelectionDAG.cpp:11706
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:640
llvm::pointer_iterator
Definition: iterator.h:344
llvm::SelectionDAG::ByvalParmDbgBegin
SDDbgInfo::DbgIterator ByvalParmDbgBegin() const
Definition: SelectionDAG.h:1793
llvm::SelectionDAG::OFK_Sometime
@ OFK_Sometime
Definition: SelectionDAG.h:1916
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:4641
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:239
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:954
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:1268
llvm::SelectionDAG::addCallSiteInfo
void addCallSiteInfo(const SDNode *Node, CallSiteInfoImpl &&CallInfo)
Set CallSiteInfo to be associated with Node.
Definition: SelectionDAG.h:2159
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:11162
llvm::EVT::getSizeInBits
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
Definition: ValueTypes.h:340
llvm::FoldingSetTrait
FoldingSetTrait - This trait class is used to define behavior of how to "profile" (in the FoldingSet ...
Definition: FoldingSet.h:259
llvm::DenseMapBase::clear
void clear()
Definition: DenseMap.h:112
Index
uint32_t Index
Definition: ELFObjHandler.cpp:82
llvm::SelectionDAG::MaxRecursionDepth
static constexpr unsigned MaxRecursionDepth
Definition: SelectionDAG.h:428
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:7539
llvm::GraphTraits< SelectionDAG * >::nodes_begin
static nodes_iterator nodes_begin(SelectionDAG *G)
Definition: SelectionDAG.h:2247
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::SelectionDAG::getLibInfo
const TargetLibraryInfo & getLibInfo() const
Definition: SelectionDAG.h:459
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:996
llvm::SelectionDAG::getIntPtrConstant
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
Definition: SelectionDAG.cpp:1572
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:8592
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:9445
llvm::MachinePointerInfo
This class contains a discriminated union of information about pointers in memory operands,...
Definition: MachineMemOperand.h:38
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
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:1713
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:776
llvm::DenseMap< const SDNode *, SmallVector< SDDbgValue *, 2 > >
llvm::DemandedBits
Definition: DemandedBits.h:40
llvm::SelectionDAG::shouldOptForSize
bool shouldOptForSize() const
Definition: SelectionDAG.cpp:1264
llvm::SelectionDAG::getLogicalNOT
SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a logical NOT operation as (XOR Val, BooleanOne).
Definition: SelectionDAG.cpp:1423
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:7904
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:8790
llvm::SelectionDAG::getNOT
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
Definition: SelectionDAG.cpp:1419
llvm::SelectionDAG::updateDivergence
void updateDivergence(SDNode *N)
Definition: SelectionDAG.cpp:10192
llvm::SelectionDAG::allnodes
iterator_range< allnodes_iterator > allnodes()
Definition: SelectionDAG.h:520
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:7569
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:1347
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:1367
ArrayRef.h
llvm::SelectionDAG::OFK_Always
@ OFK_Always
Definition: SelectionDAG.h:1917
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:1361
llvm::SelectionDAG::getPSI
ProfileSummaryInfo * getPSI() const
Definition: SelectionDAG.h:464
llvm::SelectionDAG::getSubtarget
const STC & getSubtarget() const
Definition: SelectionDAG.h:455
llvm::SelectionDAG::getIndexedStridedLoadVP
SDValue getIndexedStridedLoadVP(SDValue OrigLoad, const SDLoc &DL, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8256
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:9392
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:8235
llvm::SelectionDAG::getAllOnesConstant
SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget=false, bool IsOpaque=false)
Definition: SelectionDAG.h:637
llvm::SelectionDAG::NewNodesMustHaveLegalTypes
bool NewNodesMustHaveLegalTypes
When true, additional steps are taken to ensure that getConstant() and similar functions return DAG n...
Definition: SelectionDAG.h:367
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:152
llvm::MachineMemOperand::Flags
Flags
Flags values. These may be or'd together.
Definition: MachineMemOperand.h:129
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:1878
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:8497
llvm::MachineFunction::CallSiteInfoImpl
SmallVectorImpl< ArgRegPair > CallSiteInfoImpl
Definition: MachineFunction.h:424
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:7431
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:1665
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:1117
llvm::ISD::CondCode
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
Definition: ISDOpcodes.h:1404
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:2163
llvm::SelectionDAG::getCopyFromReg
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT, SDValue Glue)
Definition: SelectionDAG.h:785
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:9493
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:2164
llvm::MachineFunction::CallSiteInfo
SmallVector< ArgRegPair, 1 > CallSiteInfo
Vector of call argument and its forwarding register.
Definition: MachineFunction.h:423
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:1974
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:9261
llvm::MDNode
Metadata node.
Definition: Metadata.h:937
llvm::SelectionDAG::haveNoCommonBitsSet
bool haveNoCommonBitsSet(SDValue A, SDValue B) const
Return true if A and B have no common bits set.
Definition: SelectionDAG.cpp:4729
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:2282
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:9285
llvm::MVT::bf16
@ bf16
Definition: MachineValueType.h:53
llvm::SelectionDAG::getTokenFactor
SDValue getTokenFactor(const SDLoc &DL, SmallVectorImpl< SDValue > &Vals)
Creates a new TokenFactor containing Vals.
Definition: SelectionDAG.cpp:11612
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:1646
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::MachineFunction
Definition: MachineFunction.h:241
llvm::SelectionDAG::getORE
OptimizationRemarkEmitter & getORE() const
Definition: SelectionDAG.h:463
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:955
llvm::ISD::VSCALE
@ VSCALE
VSCALE(IMM) - Returns the runtime scaling factor used to calculate the number of elements within a sc...
Definition: ISDOpcodes.h:1240
llvm::SelectionDAG::allnodes_size
ilist< SDNode >::size_type allnodes_size() const
Definition: SelectionDAG.h:516
llvm::SDDbgInfo::DbgLabelEnd
DbgLabelIterator DbgLabelEnd()
Definition: SelectionDAG.h:204
llvm::BlockAddress
The address of a basic block.
Definition: Constants.h:848
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:714
llvm::FoldingSet
FoldingSet - This template class is used to instantiate a specialized implementation of the folding s...
Definition: FoldingSet.h:519
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:2110
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:9732
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::getAtomicMemcpy
SDValue getAtomicMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, unsigned DstAlign, SDValue Src, unsigned SrcAlign, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
Definition: SelectionDAG.cpp:7152
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:1107
llvm::SelectionDAG::getTargetConstant
SDValue getTargetConstant(const APInt &Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
Definition: SelectionDAG.h:656
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:9621
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:135
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:1218
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:2114
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:10081
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:11201
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:1813
uint32_t
llvm::SelectionDAG::setFunctionLoweringInfo
void setFunctionLoweringInfo(FunctionLoweringInfo *FuncInfo)
Definition: SelectionDAG.h:441
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:2169
llvm::FoldingSetNodeID
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:317
llvm::ISD::UNDEF
@ UNDEF
UNDEF - An undefined node.
Definition: ISDOpcodes.h:211
llvm::PICLevel::Level
Level
Definition: CodeGen.h:33
Node
Definition: ItaniumDemangle.h:155
llvm::DIVariable
Base class for variables.
Definition: DebugInfoMetadata.h:2482
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:2198
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
llvm::SelectionDAG::getBasicBlock
SDValue getBasicBlock(MachineBasicBlock *MBB)
Definition: SelectionDAG.cpp:1784
llvm::SDVTList
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
Definition: SelectionDAGNodes.h:78
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:2254
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:5087
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:11625
llvm::SelectionDAG::getBuildVector
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
Definition: SelectionDAG.h:805
llvm::SelectionDAG::DAGUpdateListener::Next
DAGUpdateListener *const Next
Definition: SelectionDAG.h:301
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:1628
llvm::MachineMemOperand::MOLoad
@ MOLoad
The memory access reads data.
Definition: MachineMemOperand.h:133
llvm::GraphTraits< SelectionDAG * >::nodes_end
static nodes_iterator nodes_end(SelectionDAG *G)
Definition: SelectionDAG.h:2251
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:708
llvm::ArrayRecycler
Recycle small arrays allocated from a BumpPtrAllocator.
Definition: ArrayRecycler.h:28
llvm::SelectionDAG::OFK_Never
@ OFK_Never
Definition: SelectionDAG.h:1915
llvm::ISD::FrameIndex
@ FrameIndex
Definition: ISDOpcodes.h:80
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
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:2190
llvm::SelectionDAG::isConstantFPBuildVectorOrConstantFP
SDNode * isConstantFPBuildVectorOrConstantFP(SDValue N) const
Test whether the given value is a constant FP or similar node.
Definition: SelectionDAG.cpp:11575
llvm::SelectionDAG::ByvalParmDbgEnd
SDDbgInfo::DbgIterator ByvalParmDbgEnd() const
Definition: SelectionDAG.h:1796
llvm::SelectionDAG::FoldSymbolOffset
SDValue FoldSymbolOffset(unsigned Opcode, EVT VT, const GlobalAddressSDNode *GA, const SDNode *N2)
Definition: SelectionDAG.cpp:5437
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:83
llvm::SelectionDAG::salvageDebugInfo
void salvageDebugInfo(SDNode &N)
To be invoked on an SDNode that is slated to be erased.
Definition: SelectionDAG.cpp:9826
llvm::SelectionDAG::DAGNodeDeletedListener::Callback
std::function< void(SDNode *, SDNode *)> Callback
Definition: SelectionDAG.h:327
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:2897
llvm::GlobalAddressSDNode
Definition: SelectionDAGNodes.h:1734
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:11183
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:10935
uint16_t
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:344
llvm::ilist_iterator
Iterator for intrusive lists based on ilist_node.
Definition: ilist_iterator.h:57
llvm::Align::value
uint64_t value() const
This is a hole in the type system and should not be abused.
Definition: Alignment.h:85
llvm::SelectionDAG::getEntryNode
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
Definition: SelectionDAG.h:531
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:452
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:230
llvm::TypeSize
Definition: TypeSize.h:421
llvm::SelectionDAG::getHeapAllocSite
MDNode * getHeapAllocSite(const SDNode *Node) const
Return HeapAllocSite associated with Node, or nullptr if none exists.
Definition: SelectionDAG.h:2173
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:24672
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:9611
llvm::SelectionDAG::AddDbgValue
void AddDbgValue(SDDbgValue *DB, bool isParameter)
Add a dbg_value SDNode.
Definition: SelectionDAG.cpp:10390
llvm::SelectionDAG::OverflowKind
OverflowKind
Used to represent the possible overflow behavior of an operation.
Definition: SelectionDAG.h:1914
llvm::SelectionDAG::calculateDivergence
bool calculateDivergence(SDNode *N)
Definition: SelectionDAG.cpp:10177
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:1829
llvm::SelectionDAG::getMCSymbol
SDValue getMCSymbol(MCSymbol *Sym, EVT VT)
Definition: SelectionDAG.cpp:1820
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:2183
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:8715
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:137
llvm::SelectionDAG::LegalizeVectors
bool LegalizeVectors()
This transforms the SelectionDAG into a SelectionDAG that only uses vector math operations supported ...
Definition: LegalizeVectorOps.cpp:1629
RecyclingAllocator.h
llvm::SDNodeFlags
These are IR-level optimization flags that may be propagated to SDNodes.
Definition: SelectionDAGNodes.h:370
llvm::SmallVectorImpl::clear
void clear()
Definition: SmallVector.h:591
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:1754
llvm::SelectionDAG::FoldConstantArithmetic
SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops)
Definition: SelectionDAG.cpp:5482
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:1302
llvm::MachineMemOperand::MOStore
@ MOStore
The memory access writes data.
Definition: MachineMemOperand.h:135
llvm::SelectionDAG::DbgEnd
SDDbgInfo::DbgIterator DbgEnd() const
Definition: SelectionDAG.h:1791
llvm::FoldingSetNodeIDRef
FoldingSetNodeIDRef - This class describes a reference to an interned FoldingSetNodeID,...
Definition: FoldingSet.h:287
llvm::SelectionDAG::getBuildVector
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDUse > Ops)
Return an ISD::BUILD_VECTOR node.
Definition: SelectionDAG.h:814
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:1577
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:3773
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:1434
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:7983
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:11117
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:58
SmallVector.h
llvm::SelectionDAG::getAtomicMemmove
SDValue getAtomicMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, unsigned DstAlign, SDValue Src, unsigned SrcAlign, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
Definition: SelectionDAG.cpp:7255
ArrayRecycler.h
llvm::SelectionDAG::getIndexedLoad
SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:7742
llvm::SelectionDAG::MaskedValueIsAllOnes
bool MaskedValueIsAllOnes(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if '(Op & Mask) == Mask'.
Definition: SelectionDAG.cpp:2543
llvm::MVT::f16
@ f16
Definition: MachineValueType.h:54
llvm::SmallVectorImpl::iterator
typename SuperClass::iterator iterator
Definition: SmallVector.h:558
llvm::SDNodeFlags::setNoUnsignedWrap
void setNoUnsignedWrap(bool b)
Definition: SelectionDAGNodes.h:410
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:684
llvm::SelectionDAG::AddDbgLabel
void AddDbgLabel(SDDbgLabel *DB)
Add a dbg_label SDNode.
Definition: SelectionDAG.cpp:10400
llvm::SelectionDAG::allnodes_end
allnodes_iterator allnodes_end()
Definition: SelectionDAG.h:514
llvm::SelectionDAG::getRegisterMask
SDValue getRegisterMask(const uint32_t *RegMask)
Definition: SelectionDAG.cpp:2076
llvm::SelectionDAG::getMemset
SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVol, bool isTailCall, MachinePointerInfo DstPtrInfo, const AAMDNodes &AAInfo=AAMDNodes())
Definition: SelectionDAG.cpp:7296
llvm::SelectionDAG::getLabelNode
SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root, MCSymbol *Label)
Definition: SelectionDAG.cpp:2095
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:1412
llvm::MachineFunction::getDataLayout
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
Definition: MachineFunction.cpp:287
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:1857
llvm::SelectionDAG::getPass
const Pass * getPass() const
Definition: SelectionDAG.h:450
llvm::SelectionDAG::getJumpTable
SDValue getJumpTable(int JTI, EVT VT, bool isTarget=false, unsigned TargetFlags=0)
Definition: SelectionDAG.cpp:1694
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:7419
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:333
llvm::SelectionDAG::getTargetConstant
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
Definition: SelectionDAG.h:652
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:965
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:1317
llvm::SelectionDAG::getMachineFunction
MachineFunction & getMachineFunction() const
Definition: SelectionDAG.h:449
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:3851
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:11003
llvm::DILabel
Label.
Definition: DebugInfoMetadata.h:3138
llvm::SelectionDAG::getExternalSymbol
SDValue getExternalSymbol(const char *Sym, EVT VT)
Definition: SelectionDAG.cpp:1812
llvm::SelectionDAG::isConstantValueOfAnyType
bool isConstantValueOfAnyType(SDValue N) const
Definition: SelectionDAG.h:2153
llvm::GraphTraits
Definition: GraphTraits.h:37
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:2149
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:985
llvm::SelectionDAG::getUseInstrRefDebugInfo
bool getUseInstrRefDebugInfo() const
Definition: SelectionDAG.h:1817
llvm::SelectionDAG::DAGUpdateListener
Clients of various APIs that cause global effects on the DAG can optionally implement this interface.
Definition: SelectionDAG.h:300
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())
Definition: SelectionDAG.cpp:7078
llvm::SDDbgInfo::DbgEnd
DbgIterator DbgEnd()
Definition: SelectionDAG.h:200
MachineFunction.h
llvm::SDDbgInfo::DbgIterator
SmallVectorImpl< SDDbgValue * >::iterator DbgIterator
Definition: SelectionDAG.h:196
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:2802
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:6486
llvm::MachineMemOperand::MONone
@ MONone
Definition: MachineMemOperand.h:131
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:8639
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:7723
llvm::MVT::f32
@ f32
Definition: MachineValueType.h:55
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:10402
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::SelectionDAG::getTarget
const TargetMachine & getTarget() const
Definition: SelectionDAG.h:453
llvm::SelectionDAG::DbgLabelEnd
SDDbgInfo::DbgLabelIterator DbgLabelEnd() const
Definition: SelectionDAG.h:1803
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:9695
llvm::SelectionDAG::getIndexedMaskedStore
SDValue getIndexedMaskedStore(SDValue OrigStore, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
Definition: SelectionDAG.cpp:8581
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:1078
llvm::SelectionDAG::getMergeValues
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
Definition: SelectionDAG.cpp:7470
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:1767
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:1839
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:11053