LCOV - code coverage report
Current view: top level - include/llvm/CodeGen - SelectionDAG.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 159 171 93.0 %
Date: 2018-05-20 00:06:23 Functions: 87 93 93.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- llvm/CodeGen/SelectionDAG.h - InstSelection DAG ----------*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file declares the SelectionDAG class, and transitively defines the
      11             : // SDNode class and subclasses.
      12             : //
      13             : //===----------------------------------------------------------------------===//
      14             : 
      15             : #ifndef LLVM_CODEGEN_SELECTIONDAG_H
      16             : #define LLVM_CODEGEN_SELECTIONDAG_H
      17             : 
      18             : #include "llvm/ADT/APFloat.h"
      19             : #include "llvm/ADT/APInt.h"
      20             : #include "llvm/ADT/ArrayRef.h"
      21             : #include "llvm/ADT/DenseMap.h"
      22             : #include "llvm/ADT/DenseSet.h"
      23             : #include "llvm/ADT/FoldingSet.h"
      24             : #include "llvm/ADT/SetVector.h"
      25             : #include "llvm/ADT/SmallVector.h"
      26             : #include "llvm/ADT/StringMap.h"
      27             : #include "llvm/ADT/ilist.h"
      28             : #include "llvm/ADT/iterator.h"
      29             : #include "llvm/ADT/iterator_range.h"
      30             : #include "llvm/Analysis/AliasAnalysis.h"
      31             : #include "llvm/Analysis/DivergenceAnalysis.h"
      32             : #include "llvm/CodeGen/DAGCombine.h"
      33             : #include "llvm/CodeGen/FunctionLoweringInfo.h"
      34             : #include "llvm/CodeGen/ISDOpcodes.h"
      35             : #include "llvm/CodeGen/MachineFunction.h"
      36             : #include "llvm/CodeGen/MachineMemOperand.h"
      37             : #include "llvm/CodeGen/SelectionDAGNodes.h"
      38             : #include "llvm/CodeGen/ValueTypes.h"
      39             : #include "llvm/IR/DebugLoc.h"
      40             : #include "llvm/IR/Instructions.h"
      41             : #include "llvm/IR/Metadata.h"
      42             : #include "llvm/Support/Allocator.h"
      43             : #include "llvm/Support/ArrayRecycler.h"
      44             : #include "llvm/Support/AtomicOrdering.h"
      45             : #include "llvm/Support/Casting.h"
      46             : #include "llvm/Support/CodeGen.h"
      47             : #include "llvm/Support/ErrorHandling.h"
      48             : #include "llvm/Support/MachineValueType.h"
      49             : #include "llvm/Support/RecyclingAllocator.h"
      50             : #include <algorithm>
      51             : #include <cassert>
      52             : #include <cstdint>
      53             : #include <functional>
      54             : #include <map>
      55             : #include <string>
      56             : #include <tuple>
      57             : #include <utility>
      58             : #include <vector>
      59             : 
      60             : namespace llvm {
      61             : 
      62             : class BlockAddress;
      63             : class Constant;
      64             : class ConstantFP;
      65             : class ConstantInt;
      66             : class DataLayout;
      67             : struct fltSemantics;
      68             : class GlobalValue;
      69             : struct KnownBits;
      70             : class LLVMContext;
      71             : class MachineBasicBlock;
      72             : class MachineConstantPoolValue;
      73             : class MCSymbol;
      74             : class OptimizationRemarkEmitter;
      75             : class SDDbgValue;
      76             : class SDDbgLabel;
      77             : class SelectionDAG;
      78             : class SelectionDAGTargetInfo;
      79             : class TargetLibraryInfo;
      80             : class TargetLowering;
      81             : class TargetMachine;
      82             : class TargetSubtargetInfo;
      83             : class Value;
      84             : 
      85             : class SDVTListNode : public FoldingSetNode {
      86             :   friend struct FoldingSetTrait<SDVTListNode>;
      87             : 
      88             :   /// A reference to an Interned FoldingSetNodeID for this node.
      89             :   /// The Allocator in SelectionDAG holds the data.
      90             :   /// SDVTList contains all types which are frequently accessed in SelectionDAG.
      91             :   /// The size of this list is not expected to be big so it won't introduce
      92             :   /// a memory penalty.
      93             :   FoldingSetNodeIDRef FastID;
      94             :   const EVT *VTs;
      95             :   unsigned int NumVTs;
      96             :   /// The hash value for SDVTList is fixed, so cache it to avoid
      97             :   /// hash calculation.
      98             :   unsigned HashValue;
      99             : 
     100             : public:
     101      124041 :   SDVTListNode(const FoldingSetNodeIDRef ID, const EVT *VT, unsigned int Num) :
     102      124041 :       FastID(ID), VTs(VT), NumVTs(Num) {
     103      124041 :     HashValue = ID.ComputeHash();
     104             :   }
     105             : 
     106             :   SDVTList getSDVTList() {
     107             :     SDVTList result = {VTs, NumVTs};
     108             :     return result;
     109             :   }
     110             : };
     111             : 
     112             : /// Specialize FoldingSetTrait for SDVTListNode
     113             : /// to avoid computing temp FoldingSetNodeID and hash value.
     114             : template<> struct FoldingSetTrait<SDVTListNode> : DefaultFoldingSetTrait<SDVTListNode> {
     115           0 :   static void Profile(const SDVTListNode &X, FoldingSetNodeID& ID) {
     116           0 :     ID = X.FastID;
     117           0 :   }
     118             : 
     119             :   static bool Equals(const SDVTListNode &X, const FoldingSetNodeID &ID,
     120             :                      unsigned IDHash, FoldingSetNodeID &TempID) {
     121     5534864 :     if (X.HashValue != IDHash)
     122             :       return false;
     123     4999350 :     return ID == X.FastID;
     124             :   }
     125             : 
     126             :   static unsigned ComputeHash(const SDVTListNode &X, FoldingSetNodeID &TempID) {
     127             :     return X.HashValue;
     128             :   }
     129             : };
     130             : 
     131             : template <> struct ilist_alloc_traits<SDNode> {
     132             :   static void deleteNode(SDNode *) {
     133           0 :     llvm_unreachable("ilist_traits<SDNode> shouldn't see a deleteNode call!");
     134             :   }
     135             : };
     136             : 
     137             : /// Keeps track of dbg_value information through SDISel.  We do
     138             : /// not build SDNodes for these so as not to perturb the generated code;
     139             : /// instead the info is kept off to the side in this structure. Each SDNode may
     140             : /// have one or more associated dbg_value entries. This information is kept in
     141             : /// DbgValMap.
     142             : /// Byval parameters are handled separately because they don't use alloca's,
     143             : /// which busts the normal mechanism.  There is good reason for handling all
     144             : /// parameters separately:  they may not have code generated for them, they
     145             : /// should always go at the beginning of the function regardless of other code
     146             : /// motion, and debug info for them is potentially useful even if the parameter
     147             : /// is unused.  Right now only byval parameters are handled separately.
     148       47555 : class SDDbgInfo {
     149             :   BumpPtrAllocator Alloc;
     150             :   SmallVector<SDDbgValue*, 32> DbgValues;
     151             :   SmallVector<SDDbgValue*, 32> ByvalParmDbgValues;
     152             :   SmallVector<SDDbgLabel*, 4> DbgLabels;
     153             :   using DbgValMapType = DenseMap<const SDNode *, SmallVector<SDDbgValue *, 2>>;
     154             :   DbgValMapType DbgValMap;
     155             : 
     156             : public:
     157       47774 :   SDDbgInfo() = default;
     158             :   SDDbgInfo(const SDDbgInfo &) = delete;
     159             :   SDDbgInfo &operator=(const SDDbgInfo &) = delete;
     160             : 
     161       34784 :   void add(SDDbgValue *V, const SDNode *Node, bool isParameter) {
     162       34784 :     if (isParameter) {
     163           6 :       ByvalParmDbgValues.push_back(V);
     164       34778 :     } else     DbgValues.push_back(V);
     165       34784 :     if (Node)
     166       43048 :       DbgValMap[Node].push_back(V);
     167       34784 :   }
     168             : 
     169             :   void add(SDDbgLabel *L) {
     170           0 :     DbgLabels.push_back(L);
     171             :   }
     172             : 
     173             :   /// Invalidate all DbgValues attached to the node and remove
     174             :   /// it from the Node-to-DbgValues map.
     175             :   void erase(const SDNode *Node);
     176             : 
     177      347842 :   void clear() {
     178      347842 :     DbgValMap.clear();
     179             :     DbgValues.clear();
     180             :     ByvalParmDbgValues.clear();
     181             :     DbgLabels.clear();
     182      347842 :     Alloc.Reset();
     183      347842 :   }
     184             : 
     185       34784 :   BumpPtrAllocator &getAlloc() { return Alloc; }
     186             : 
     187             :   bool empty() const {
     188      347827 :     return DbgValues.empty() && ByvalParmDbgValues.empty() && DbgLabels.empty();
     189             :   }
     190             : 
     191        7343 :   ArrayRef<SDDbgValue*> getSDDbgValues(const SDNode *Node) {
     192        7343 :     DbgValMapType::iterator I = DbgValMap.find(Node);
     193        7343 :     if (I != DbgValMap.end())
     194        7343 :       return I->second;
     195           0 :     return ArrayRef<SDDbgValue*>();
     196             :   }
     197             : 
     198             :   using DbgIterator = SmallVectorImpl<SDDbgValue*>::iterator;
     199             :   using DbgLabelIterator = SmallVectorImpl<SDDbgLabel*>::iterator;
     200             : 
     201             :   DbgIterator DbgBegin() { return DbgValues.begin(); }
     202             :   DbgIterator DbgEnd()   { return DbgValues.end(); }
     203             :   DbgIterator ByvalParmDbgBegin() { return ByvalParmDbgValues.begin(); }
     204             :   DbgIterator ByvalParmDbgEnd()   { return ByvalParmDbgValues.end(); }
     205             :   DbgLabelIterator DbgLabelBegin() { return DbgLabels.begin(); }
     206             :   DbgLabelIterator DbgLabelEnd()   { return DbgLabels.end(); }
     207             : };
     208             : 
     209             : void checkForCycles(const SelectionDAG *DAG, bool force = false);
     210             : 
     211             : /// This is used to represent a portion of an LLVM function in a low-level
     212             : /// Data Dependence DAG representation suitable for instruction selection.
     213             : /// This DAG is constructed as the first step of instruction selection in order
     214             : /// to allow implementation of machine specific optimizations
     215             : /// and code simplifications.
     216             : ///
     217             : /// The representation used by the SelectionDAG is a target-independent
     218             : /// representation, which has some similarities to the GCC RTL representation,
     219             : /// but is significantly more simple, powerful, and is a graph form instead of a
     220             : /// linear form.
     221             : ///
     222             : class SelectionDAG {
     223             :   const TargetMachine &TM;
     224             :   const SelectionDAGTargetInfo *TSI = nullptr;
     225             :   const TargetLowering *TLI = nullptr;
     226             :   const TargetLibraryInfo *LibInfo = nullptr;
     227             :   MachineFunction *MF;
     228             :   Pass *SDAGISelPass = nullptr;
     229             :   LLVMContext *Context;
     230             :   CodeGenOpt::Level OptLevel;
     231             : 
     232             :   DivergenceAnalysis * DA = nullptr;
     233             :   FunctionLoweringInfo * FLI = nullptr;
     234             : 
     235             :   /// The function-level optimization remark emitter.  Used to emit remarks
     236             :   /// whenever manipulating the DAG.
     237             :   OptimizationRemarkEmitter *ORE;
     238             : 
     239             :   /// The starting token.
     240             :   SDNode EntryNode;
     241             : 
     242             :   /// The root of the entire DAG.
     243             :   SDValue Root;
     244             : 
     245             :   /// A linked list of nodes in the current DAG.
     246             :   ilist<SDNode> AllNodes;
     247             : 
     248             :   /// The AllocatorType for allocating SDNodes. We use
     249             :   /// pool allocation with recycling.
     250             :   using NodeAllocatorType = RecyclingAllocator<BumpPtrAllocator, SDNode,
     251             :                                                sizeof(LargestSDNode),
     252             :                                                alignof(MostAlignedSDNode)>;
     253             : 
     254             :   /// Pool allocation for nodes.
     255             :   NodeAllocatorType NodeAllocator;
     256             : 
     257             :   /// This structure is used to memoize nodes, automatically performing
     258             :   /// CSE with existing nodes when a duplicate is requested.
     259             :   FoldingSet<SDNode> CSEMap;
     260             : 
     261             :   /// Pool allocation for machine-opcode SDNode operands.
     262             :   BumpPtrAllocator OperandAllocator;
     263             :   ArrayRecycler<SDUse> OperandRecycler;
     264             : 
     265             :   /// Pool allocation for misc. objects that are created once per SelectionDAG.
     266             :   BumpPtrAllocator Allocator;
     267             : 
     268             :   /// Tracks dbg_value and dbg_label information through SDISel.
     269             :   SDDbgInfo *DbgInfo;
     270             : 
     271             :   uint16_t NextPersistentId = 0;
     272             : 
     273             : public:
     274             :   /// Clients of various APIs that cause global effects on
     275             :   /// the DAG can optionally implement this interface.  This allows the clients
     276             :   /// to handle the various sorts of updates that happen.
     277             :   ///
     278             :   /// A DAGUpdateListener automatically registers itself with DAG when it is
     279             :   /// constructed, and removes itself when destroyed in RAII fashion.
     280             :   struct DAGUpdateListener {
     281             :     DAGUpdateListener *const Next;
     282             :     SelectionDAG &DAG;
     283             : 
     284             :     explicit DAGUpdateListener(SelectionDAG &D)
     285    40068554 :       : Next(D.UpdateListeners), DAG(D) {
     286    40068554 :       DAG.UpdateListeners = this;
     287             :     }
     288             : 
     289           0 :     virtual ~DAGUpdateListener() {
     290             :       assert(DAG.UpdateListeners == this &&
     291             :              "DAGUpdateListeners must be destroyed in LIFO order");
     292    12587064 :       DAG.UpdateListeners = Next;
     293           0 :     }
     294             : 
     295             :     /// The node N that was deleted and, if E is not null, an
     296             :     /// equivalent node E that replaced it.
     297             :     virtual void NodeDeleted(SDNode *N, SDNode *E);
     298             : 
     299             :     /// The node N that was updated.
     300             :     virtual void NodeUpdated(SDNode *N);
     301             :   };
     302             : 
     303     3396991 :   struct DAGNodeDeletedListener : public DAGUpdateListener {
     304             :     std::function<void(SDNode *, SDNode *)> Callback;
     305             : 
     306             :     DAGNodeDeletedListener(SelectionDAG &DAG,
     307             :                            std::function<void(SDNode *, SDNode *)> Callback)
     308     3049088 :         : DAGUpdateListener(DAG), Callback(std::move(Callback)) {}
     309             : 
     310     3810298 :     void NodeDeleted(SDNode *N, SDNode *E) override { Callback(N, E); }
     311             :   };
     312             : 
     313             :   /// When true, additional steps are taken to
     314             :   /// ensure that getConstant() and similar functions return DAG nodes that
     315             :   /// have legal types. This is important after type legalization since
     316             :   /// any illegally typed nodes generated after this point will not experience
     317             :   /// type legalization.
     318             :   bool NewNodesMustHaveLegalTypes = false;
     319             : 
     320             : private:
     321             :   /// DAGUpdateListener is a friend so it can manipulate the listener stack.
     322             :   friend struct DAGUpdateListener;
     323             : 
     324             :   /// Linked list of registered DAGUpdateListener instances.
     325             :   /// This stack is maintained by DAGUpdateListener RAII.
     326             :   DAGUpdateListener *UpdateListeners = nullptr;
     327             : 
     328             :   /// Implementation of setSubgraphColor.
     329             :   /// Return whether we had to truncate the search.
     330             :   bool setSubgraphColorHelper(SDNode *N, const char *Color,
     331             :                               DenseSet<SDNode *> &visited,
     332             :                               int level, bool &printed);
     333             : 
     334             :   template <typename SDNodeT, typename... ArgTypes>
     335    19809703 :   SDNodeT *newSDNode(ArgTypes &&... Args) {
     336    19809703 :     return new (NodeAllocator.template Allocate<SDNodeT>())
     337    59217564 :         SDNodeT(std::forward<ArgTypes>(Args)...);
     338             :   }
     339             : 
     340             :   /// Build a synthetic SDNodeT with the given args and extract its subclass
     341             :   /// data as an integer (e.g. for use in a folding set).
     342             :   ///
     343             :   /// The args to this function are the same as the args to SDNodeT's
     344             :   /// constructor, except the second arg (assumed to be a const DebugLoc&) is
     345             :   /// omitted.
     346             :   template <typename SDNodeT, typename... ArgTypes>
     347     1921216 :   static uint16_t getSyntheticNodeSubclassData(unsigned IROrder,
     348             :                                                ArgTypes &&... Args) {
     349             :     // The compiler can reduce this expression to a constant iff we pass an
     350             :     // empty DebugLoc.  Thankfully, the debug location doesn't have any bearing
     351             :     // on the subclass data.
     352             :     return SDNodeT(IROrder, DebugLoc(), std::forward<ArgTypes>(Args)...)
     353     5763648 :         .getRawSubclassData();
     354             :   }
     355             : 
     356             :   template <typename SDNodeTy>
     357       14583 :   static uint16_t getSyntheticNodeSubclassData(unsigned Opc, unsigned Order,
     358             :                                                 SDVTList VTs, EVT MemoryVT,
     359             :                                                 MachineMemOperand *MMO) {
     360             :     return SDNodeTy(Opc, Order, DebugLoc(), VTs, MemoryVT, MMO)
     361       43749 :          .getRawSubclassData();
     362             :   }
     363             : 
     364             :   void createOperands(SDNode *Node, ArrayRef<SDValue> Vals);
     365             : 
     366    22576290 :   void removeOperands(SDNode *Node) {
     367    22576290 :     if (!Node->OperandList)
     368             :       return;
     369    29304130 :     OperandRecycler.deallocate(
     370    14652065 :         ArrayRecycler<SDUse>::Capacity::get(Node->NumOperands),
     371             :         Node->OperandList);
     372    14652065 :     Node->NumOperands = 0;
     373    14652065 :     Node->OperandList = nullptr;
     374             :   }
     375             :   void CreateTopologicalOrder(std::vector<SDNode*>& Order);
     376             : public:
     377             :   explicit SelectionDAG(const TargetMachine &TM, CodeGenOpt::Level);
     378             :   SelectionDAG(const SelectionDAG &) = delete;
     379             :   SelectionDAG &operator=(const SelectionDAG &) = delete;
     380             :   ~SelectionDAG();
     381             : 
     382             :   /// Prepare this SelectionDAG to process code in the given MachineFunction.
     383             :   void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE,
     384             :             Pass *PassPtr, const TargetLibraryInfo *LibraryInfo,
     385             :             DivergenceAnalysis * DA);
     386             : 
     387             :   void setFunctionLoweringInfo(FunctionLoweringInfo * FuncInfo) {
     388      215022 :     FLI = FuncInfo;
     389             :   }
     390             : 
     391             :   /// Clear state and free memory necessary to make this
     392             :   /// SelectionDAG ready to process a new block.
     393             :   void clear();
     394             : 
     395             :   MachineFunction &getMachineFunction() const { return *MF; }
     396             :   const Pass *getPass() const { return SDAGISelPass; }
     397             : 
     398    46881376 :   const DataLayout &getDataLayout() const { return MF->getDataLayout(); }
     399             :   const TargetMachine &getTarget() const { return TM; }
     400     2883883 :   const TargetSubtargetInfo &getSubtarget() const { return MF->getSubtarget(); }
     401             :   const TargetLowering &getTargetLoweringInfo() const { return *TLI; }
     402             :   const TargetLibraryInfo &getLibInfo() const { return *LibInfo; }
     403             :   const SelectionDAGTargetInfo &getSelectionDAGInfo() const { return *TSI; }
     404             :   LLVMContext *getContext() const {return Context; }
     405             :   OptimizationRemarkEmitter &getORE() const { return *ORE; }
     406             : 
     407             :   /// Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
     408             :   void viewGraph(const std::string &Title);
     409             :   void viewGraph();
     410             : 
     411             : #ifndef NDEBUG
     412             :   std::map<const SDNode *, std::string> NodeGraphAttrs;
     413             : #endif
     414             : 
     415             :   /// Clear all previously defined node graph attributes.
     416             :   /// Intended to be used from a debugging tool (eg. gdb).
     417             :   void clearGraphAttrs();
     418             : 
     419             :   /// Set graph attributes for a node. (eg. "color=red".)
     420             :   void setGraphAttrs(const SDNode *N, const char *Attrs);
     421             : 
     422             :   /// Get graph attributes for a node. (eg. "color=red".)
     423             :   /// Used from getNodeAttributes.
     424             :   const std::string getGraphAttrs(const SDNode *N) const;
     425             : 
     426             :   /// Convenience for setting node color attribute.
     427             :   void setGraphColor(const SDNode *N, const char *Color);
     428             : 
     429             :   /// Convenience for setting subgraph color attribute.
     430             :   void setSubgraphColor(SDNode *N, const char *Color);
     431             : 
     432             :   using allnodes_const_iterator = ilist<SDNode>::const_iterator;
     433             : 
     434             :   allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); }
     435             :   allnodes_const_iterator allnodes_end() const { return AllNodes.end(); }
     436             : 
     437             :   using allnodes_iterator = ilist<SDNode>::iterator;
     438             : 
     439             :   allnodes_iterator allnodes_begin() { return AllNodes.begin(); }
     440             :   allnodes_iterator allnodes_end() { return AllNodes.end(); }
     441             : 
     442             :   ilist<SDNode>::size_type allnodes_size() const {
     443             :     return AllNodes.size();
     444             :   }
     445             : 
     446             :   iterator_range<allnodes_iterator> allnodes() {
     447             :     return make_range(allnodes_begin(), allnodes_end());
     448             :   }
     449             :   iterator_range<allnodes_const_iterator> allnodes() const {
     450             :     return make_range(allnodes_begin(), allnodes_end());
     451             :   }
     452             : 
     453             :   /// Return the root tag of the SelectionDAG.
     454     3869888 :   const SDValue &getRoot() const { return Root; }
     455             : 
     456             :   /// Return the token chain corresponding to the entry of the function.
     457             :   SDValue getEntryNode() const {
     458     1776858 :     return SDValue(const_cast<SDNode *>(&EntryNode), 0);
     459             :   }
     460             : 
     461             :   /// Set the current root tag of the SelectionDAG.
     462             :   ///
     463     5751553 :   const SDValue &setRoot(SDValue N) {
     464             :     assert((!N.getNode() || N.getValueType() == MVT::Other) &&
     465             :            "DAG root value is not a chain!");
     466     5751553 :     if (N.getNode())
     467     5380424 :       checkForCycles(N.getNode(), this);
     468     5751553 :     Root = N;
     469     5751553 :     if (N.getNode())
     470     5380424 :       checkForCycles(this);
     471     5751553 :     return Root;
     472             :   }
     473             : 
     474             :   void VerifyDAGDiverence();
     475             : 
     476             :   /// This iterates over the nodes in the SelectionDAG, folding
     477             :   /// certain types of nodes together, or eliminating superfluous nodes.  The
     478             :   /// Level argument controls whether Combine is allowed to produce nodes and
     479             :   /// types that are illegal on the target.
     480             :   void Combine(CombineLevel Level, AliasAnalysis *AA,
     481             :                CodeGenOpt::Level OptLevel);
     482             : 
     483             :   /// This transforms the SelectionDAG into a SelectionDAG that
     484             :   /// only uses types natively supported by the target.
     485             :   /// Returns "true" if it made any changes.
     486             :   ///
     487             :   /// Note that this is an involved process that may invalidate pointers into
     488             :   /// the graph.
     489             :   bool LegalizeTypes();
     490             : 
     491             :   /// This transforms the SelectionDAG into a SelectionDAG that is
     492             :   /// compatible with the target instruction selector, as indicated by the
     493             :   /// TargetLowering object.
     494             :   ///
     495             :   /// Note that this is an involved process that may invalidate pointers into
     496             :   /// the graph.
     497             :   void Legalize();
     498             : 
     499             :   /// Transforms a SelectionDAG node and any operands to it into a node
     500             :   /// that is compatible with the target instruction selector, as indicated by
     501             :   /// the TargetLowering object.
     502             :   ///
     503             :   /// \returns true if \c N is a valid, legal node after calling this.
     504             :   ///
     505             :   /// This essentially runs a single recursive walk of the \c Legalize process
     506             :   /// over the given node (and its operands). This can be used to incrementally
     507             :   /// legalize the DAG. All of the nodes which are directly replaced,
     508             :   /// potentially including N, are added to the output parameter \c
     509             :   /// UpdatedNodes so that the delta to the DAG can be understood by the
     510             :   /// caller.
     511             :   ///
     512             :   /// When this returns false, N has been legalized in a way that make the
     513             :   /// pointer passed in no longer valid. It may have even been deleted from the
     514             :   /// DAG, and so it shouldn't be used further. When this returns true, the
     515             :   /// N passed in is a legal node, and can be immediately processed as such.
     516             :   /// This may still have done some work on the DAG, and will still populate
     517             :   /// UpdatedNodes with any new nodes replacing those originally in the DAG.
     518             :   bool LegalizeOp(SDNode *N, SmallSetVector<SDNode *, 16> &UpdatedNodes);
     519             : 
     520             :   /// This transforms the SelectionDAG into a SelectionDAG
     521             :   /// that only uses vector math operations supported by the target.  This is
     522             :   /// necessary as a separate step from Legalize because unrolling a vector
     523             :   /// operation can introduce illegal types, which requires running
     524             :   /// LegalizeTypes again.
     525             :   ///
     526             :   /// This returns true if it made any changes; in that case, LegalizeTypes
     527             :   /// is called again before Legalize.
     528             :   ///
     529             :   /// Note that this is an involved process that may invalidate pointers into
     530             :   /// the graph.
     531             :   bool LegalizeVectors();
     532             : 
     533             :   /// This method deletes all unreachable nodes in the SelectionDAG.
     534             :   void RemoveDeadNodes();
     535             : 
     536             :   /// Remove the specified node from the system.  This node must
     537             :   /// have no referrers.
     538             :   void DeleteNode(SDNode *N);
     539             : 
     540             :   /// Return an SDVTList that represents the list of values specified.
     541             :   SDVTList getVTList(EVT VT);
     542             :   SDVTList getVTList(EVT VT1, EVT VT2);
     543             :   SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3);
     544             :   SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3, EVT VT4);
     545             :   SDVTList getVTList(ArrayRef<EVT> VTs);
     546             : 
     547             :   //===--------------------------------------------------------------------===//
     548             :   // Node creation methods.
     549             : 
     550             :   /// Create a ConstantSDNode wrapping a constant value.
     551             :   /// If VT is a vector type, the constant is splatted into a BUILD_VECTOR.
     552             :   ///
     553             :   /// If only legal types can be produced, this does the necessary
     554             :   /// transformations (e.g., if the vector element type is illegal).
     555             :   /// @{
     556             :   SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT,
     557             :                       bool isTarget = false, bool isOpaque = false);
     558             :   SDValue getConstant(const APInt &Val, const SDLoc &DL, EVT VT,
     559             :                       bool isTarget = false, bool isOpaque = false);
     560             : 
     561       14000 :   SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget = false,
     562             :                              bool IsOpaque = false) {
     563       28000 :     return getConstant(APInt::getAllOnesValue(VT.getScalarSizeInBits()), DL,
     564       42000 :                        VT, IsTarget, IsOpaque);
     565             :   }
     566             : 
     567             :   SDValue getConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT,
     568             :                       bool isTarget = false, bool isOpaque = false);
     569             :   SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL,
     570             :                             bool isTarget = false);
     571             :   SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT,
     572             :                             bool isOpaque = false) {
     573     3660554 :     return getConstant(Val, DL, VT, true, isOpaque);
     574             :   }
     575             :   SDValue getTargetConstant(const APInt &Val, const SDLoc &DL, EVT VT,
     576             :                             bool isOpaque = false) {
     577      207622 :     return getConstant(Val, DL, VT, true, isOpaque);
     578             :   }
     579             :   SDValue getTargetConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT,
     580             :                             bool isOpaque = false) {
     581      248488 :     return getConstant(Val, DL, VT, true, isOpaque);
     582             :   }
     583             : 
     584             :   /// Create a true or false constant of type \p VT using the target's
     585             :   /// BooleanContent for type \p OpVT.
     586             :   SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT);
     587             :   /// @}
     588             : 
     589             :   /// Create a ConstantFPSDNode wrapping a constant value.
     590             :   /// If VT is a vector type, the constant is splatted into a BUILD_VECTOR.
     591             :   ///
     592             :   /// If only legal types can be produced, this does the necessary
     593             :   /// transformations (e.g., if the vector element type is illegal).
     594             :   /// The forms that take a double should only be used for simple constants
     595             :   /// that can be exactly represented in VT.  No checks are made.
     596             :   /// @{
     597             :   SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT,
     598             :                         bool isTarget = false);
     599             :   SDValue getConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT,
     600             :                         bool isTarget = false);
     601             :   SDValue getConstantFP(const ConstantFP &CF, const SDLoc &DL, EVT VT,
     602             :                         bool isTarget = false);
     603             :   SDValue getTargetConstantFP(double Val, const SDLoc &DL, EVT VT) {
     604             :     return getConstantFP(Val, DL, VT, true);
     605             :   }
     606             :   SDValue getTargetConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT) {
     607           6 :     return getConstantFP(Val, DL, VT, true);
     608             :   }
     609             :   SDValue getTargetConstantFP(const ConstantFP &Val, const SDLoc &DL, EVT VT) {
     610        1054 :     return getConstantFP(Val, DL, VT, true);
     611             :   }
     612             :   /// @}
     613             : 
     614             :   SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT,
     615             :                            int64_t offset = 0, bool isTargetGA = false,
     616             :                            unsigned char TargetFlags = 0);
     617             :   SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT,
     618             :                                  int64_t offset = 0,
     619             :                                  unsigned char TargetFlags = 0) {
     620     1083691 :     return getGlobalAddress(GV, DL, VT, offset, true, TargetFlags);
     621             :   }
     622             :   SDValue getFrameIndex(int FI, EVT VT, bool isTarget = false);
     623             :   SDValue getTargetFrameIndex(int FI, EVT VT) {
     624      188810 :     return getFrameIndex(FI, VT, true);
     625             :   }
     626             :   SDValue getJumpTable(int JTI, EVT VT, bool isTarget = false,
     627             :                        unsigned char TargetFlags = 0);
     628             :   SDValue getTargetJumpTable(int JTI, EVT VT, unsigned char TargetFlags = 0) {
     629         461 :     return getJumpTable(JTI, VT, true, TargetFlags);
     630             :   }
     631             :   SDValue getConstantPool(const Constant *C, EVT VT,
     632             :                           unsigned Align = 0, int Offs = 0, bool isT=false,
     633             :                           unsigned char TargetFlags = 0);
     634             :   SDValue getTargetConstantPool(const Constant *C, EVT VT,
     635             :                                 unsigned Align = 0, int Offset = 0,
     636             :                                 unsigned char TargetFlags = 0) {
     637       45611 :     return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
     638             :   }
     639             :   SDValue getConstantPool(MachineConstantPoolValue *C, EVT VT,
     640             :                           unsigned Align = 0, int Offs = 0, bool isT=false,
     641             :                           unsigned char TargetFlags = 0);
     642             :   SDValue getTargetConstantPool(MachineConstantPoolValue *C,
     643             :                                   EVT VT, unsigned Align = 0,
     644             :                                   int Offset = 0, unsigned char TargetFlags=0) {
     645         256 :     return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
     646             :   }
     647             :   SDValue getTargetIndex(int Index, EVT VT, int64_t Offset = 0,
     648             :                          unsigned char TargetFlags = 0);
     649             :   // When generating a branch to a BB, we don't in general know enough
     650             :   // to provide debug info for the BB at that time, so keep this one around.
     651             :   SDValue getBasicBlock(MachineBasicBlock *MBB);
     652             :   SDValue getBasicBlock(MachineBasicBlock *MBB, SDLoc dl);
     653             :   SDValue getExternalSymbol(const char *Sym, EVT VT);
     654             :   SDValue getExternalSymbol(const char *Sym, const SDLoc &dl, EVT VT);
     655             :   SDValue getTargetExternalSymbol(const char *Sym, EVT VT,
     656             :                                   unsigned char TargetFlags = 0);
     657             :   SDValue getMCSymbol(MCSymbol *Sym, EVT VT);
     658             : 
     659             :   SDValue getValueType(EVT);
     660             :   SDValue getRegister(unsigned Reg, EVT VT);
     661             :   SDValue getRegisterMask(const uint32_t *RegMask);
     662             :   SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label);
     663             :   SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root,
     664             :                        MCSymbol *Label);
     665             :   SDValue getBlockAddress(const BlockAddress *BA, EVT VT,
     666             :                           int64_t Offset = 0, bool isTarget = false,
     667             :                           unsigned char TargetFlags = 0);
     668             :   SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT,
     669             :                                 int64_t Offset = 0,
     670             :                                 unsigned char TargetFlags = 0) {
     671         142 :     return getBlockAddress(BA, VT, Offset, true, TargetFlags);
     672             :   }
     673             : 
     674      149362 :   SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg,
     675             :                        SDValue N) {
     676             :     return getNode(ISD::CopyToReg, dl, MVT::Other, Chain,
     677      448086 :                    getRegister(Reg, N.getValueType()), N);
     678             :   }
     679             : 
     680             :   // This version of the getCopyToReg method takes an extra operand, which
     681             :   // indicates that there is potentially an incoming glue value (if Glue is not
     682             :   // null) and that there should be a glue result.
     683      606543 :   SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N,
     684             :                        SDValue Glue) {
     685      606543 :     SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
     686     1213086 :     SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Glue };
     687             :     return getNode(ISD::CopyToReg, dl, VTs,
     688      606543 :                    makeArrayRef(Ops, Glue.getNode() ? 4 : 3));
     689             :   }
     690             : 
     691             :   // Similar to last getCopyToReg() except parameter Reg is a SDValue
     692        1932 :   SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, SDValue Reg, SDValue N,
     693             :                        SDValue Glue) {
     694        1932 :     SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
     695        1932 :     SDValue Ops[] = { Chain, Reg, N, Glue };
     696             :     return getNode(ISD::CopyToReg, dl, VTs,
     697        1932 :                    makeArrayRef(Ops, Glue.getNode() ? 4 : 3));
     698             :   }
     699             : 
     700      583778 :   SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT) {
     701      583778 :     SDVTList VTs = getVTList(VT, MVT::Other);
     702      583778 :     SDValue Ops[] = { Chain, getRegister(Reg, VT) };
     703      583778 :     return getNode(ISD::CopyFromReg, dl, VTs, Ops);
     704             :   }
     705             : 
     706             :   // This version of the getCopyFromReg method takes an extra operand, which
     707             :   // indicates that there is potentially an incoming glue value (if Glue is not
     708             :   // null) and that there should be a glue result.
     709       56308 :   SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT,
     710             :                          SDValue Glue) {
     711       56308 :     SDVTList VTs = getVTList(VT, MVT::Other, MVT::Glue);
     712       56308 :     SDValue Ops[] = { Chain, getRegister(Reg, VT), Glue };
     713             :     return getNode(ISD::CopyFromReg, dl, VTs,
     714       56308 :                    makeArrayRef(Ops, Glue.getNode() ? 3 : 2));
     715             :   }
     716             : 
     717             :   SDValue getCondCode(ISD::CondCode Cond);
     718             : 
     719             :   /// Return an ISD::VECTOR_SHUFFLE node. The number of elements in VT,
     720             :   /// which must be a vector type, must match the number of mask elements
     721             :   /// NumElts. An integer mask element equal to -1 is treated as undefined.
     722             :   SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2,
     723             :                            ArrayRef<int> Mask);
     724             : 
     725             :   /// Return an ISD::BUILD_VECTOR node. The number of elements in VT,
     726             :   /// which must be a vector type, must match the number of operands in Ops.
     727             :   /// The operands must have the same type as (or, for integers, a type wider
     728             :   /// than) VT's element type.
     729      283342 :   SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef<SDValue> Ops) {
     730             :     // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
     731      283342 :     return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
     732             :   }
     733             : 
     734             :   /// Return an ISD::BUILD_VECTOR node. The number of elements in VT,
     735             :   /// which must be a vector type, must match the number of operands in Ops.
     736             :   /// The operands must have the same type as (or, for integers, a type wider
     737             :   /// than) VT's element type.
     738             :   SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef<SDUse> Ops) {
     739             :     // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
     740        3864 :     return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
     741             :   }
     742             : 
     743             :   /// Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all
     744             :   /// elements. VT must be a vector type. Op's type must be the same as (or,
     745             :   /// for integers, a type wider than) VT's element type.
     746      149254 :   SDValue getSplatBuildVector(EVT VT, const SDLoc &DL, SDValue Op) {
     747             :     // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
     748      298508 :     if (Op.getOpcode() == ISD::UNDEF) {
     749             :       assert((VT.getVectorElementType() == Op.getValueType() ||
     750             :               (VT.isInteger() &&
     751             :                VT.getVectorElementType().bitsLE(Op.getValueType()))) &&
     752             :              "A splatted value must have a width equal or (for integers) "
     753             :              "greater than the vector element type!");
     754           0 :       return getNode(ISD::UNDEF, SDLoc(), VT);
     755             :     }
     756             : 
     757      149254 :     SmallVector<SDValue, 16> Ops(VT.getVectorNumElements(), Op);
     758      149254 :     return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
     759             :   }
     760             : 
     761             :   /// Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to
     762             :   /// the shuffle node in input but with swapped operands.
     763             :   ///
     764             :   /// Example: shuffle A, B, <0,5,2,7> -> shuffle B, A, <4,1,6,3>
     765             :   SDValue getCommutedVectorShuffle(const ShuffleVectorSDNode &SV);
     766             : 
     767             :   /// Convert Op, which must be of float type, to the
     768             :   /// float type VT, by either extending or rounding (by truncation).
     769             :   SDValue getFPExtendOrRound(SDValue Op, const SDLoc &DL, EVT VT);
     770             : 
     771             :   /// Convert Op, which must be of integer type, to the
     772             :   /// integer type VT, by either any-extending or truncating it.
     773             :   SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT);
     774             : 
     775             :   /// Convert Op, which must be of integer type, to the
     776             :   /// integer type VT, by either sign-extending or truncating it.
     777             :   SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT);
     778             : 
     779             :   /// Convert Op, which must be of integer type, to the
     780             :   /// integer type VT, by either zero-extending or truncating it.
     781             :   SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT);
     782             : 
     783             :   /// Return the expression required to zero extend the Op
     784             :   /// value assuming it was the smaller SrcTy value.
     785             :   SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT SrcTy);
     786             : 
     787             :   /// Return an operation which will any-extend the low lanes of the operand
     788             :   /// into the specified vector type. For example,
     789             :   /// this can convert a v16i8 into a v4i32 by any-extending the low four
     790             :   /// lanes of the operand from i8 to i32.
     791             :   SDValue getAnyExtendVectorInReg(SDValue Op, const SDLoc &DL, EVT VT);
     792             : 
     793             :   /// Return an operation which will sign extend the low lanes of the operand
     794             :   /// into the specified vector type. For example,
     795             :   /// this can convert a v16i8 into a v4i32 by sign extending the low four
     796             :   /// lanes of the operand from i8 to i32.
     797             :   SDValue getSignExtendVectorInReg(SDValue Op, const SDLoc &DL, EVT VT);
     798             : 
     799             :   /// Return an operation which will zero extend the low lanes of the operand
     800             :   /// into the specified vector type. For example,
     801             :   /// this can convert a v16i8 into a v4i32 by zero extending the low four
     802             :   /// lanes of the operand from i8 to i32.
     803             :   SDValue getZeroExtendVectorInReg(SDValue Op, const SDLoc &DL, EVT VT);
     804             : 
     805             :   /// Convert Op, which must be of integer type, to the integer type VT,
     806             :   /// by using an extension appropriate for the target's
     807             :   /// BooleanContent for type OpVT or truncating it.
     808             :   SDValue getBoolExtOrTrunc(SDValue Op, const SDLoc &SL, EVT VT, EVT OpVT);
     809             : 
     810             :   /// Create a bitwise NOT operation as (XOR Val, -1).
     811             :   SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT);
     812             : 
     813             :   /// Create a logical NOT operation as (XOR Val, BooleanOne).
     814             :   SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT);
     815             : 
     816             :   /// Create an add instruction with appropriate flags when used for
     817             :   /// addressing some offset of an object. i.e. if a load is split into multiple
     818             :   /// components, create an add nuw from the base pointer to the offset.
     819      104600 :   SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Op, int64_t Offset) {
     820      209200 :     EVT VT = Op.getValueType();
     821      104600 :     return getObjectPtrOffset(SL, Op, getConstant(Offset, SL, VT));
     822             :   }
     823             : 
     824      104771 :   SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Op, SDValue Offset) {
     825      209542 :     EVT VT = Op.getValueType();
     826             : 
     827             :     // The object itself can't wrap around the address space, so it shouldn't be
     828             :     // possible for the adds of the offsets to the split parts to overflow.
     829             :     SDNodeFlags Flags;
     830             :     Flags.setNoUnsignedWrap(true);
     831      104771 :     return getNode(ISD::ADD, SL, VT, Op, Offset, Flags);
     832             :   }
     833             : 
     834             :   /// Return a new CALLSEQ_START node, that starts new call frame, in which
     835             :   /// InSize bytes are set up inside CALLSEQ_START..CALLSEQ_END sequence and
     836             :   /// OutSize specifies part of the frame set up prior to the sequence.
     837      176022 :   SDValue getCALLSEQ_START(SDValue Chain, uint64_t InSize, uint64_t OutSize,
     838             :                            const SDLoc &DL) {
     839      176022 :     SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
     840             :     SDValue Ops[] = { Chain,
     841             :                       getIntPtrConstant(InSize, DL, true),
     842      176022 :                       getIntPtrConstant(OutSize, DL, true) };
     843      176022 :     return getNode(ISD::CALLSEQ_START, DL, VTs, Ops);
     844             :   }
     845             : 
     846             :   /// Return a new CALLSEQ_END node, which always must have a
     847             :   /// glue result (to ensure it's not CSE'd).
     848             :   /// CALLSEQ_END does not have a useful SDLoc.
     849      175970 :   SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2,
     850             :                          SDValue InGlue, const SDLoc &DL) {
     851      175970 :     SDVTList NodeTys = getVTList(MVT::Other, MVT::Glue);
     852             :     SmallVector<SDValue, 4> Ops;
     853      175970 :     Ops.push_back(Chain);
     854      175970 :     Ops.push_back(Op1);
     855      175970 :     Ops.push_back(Op2);
     856      175970 :     if (InGlue.getNode())
     857      175555 :       Ops.push_back(InGlue);
     858      351940 :     return getNode(ISD::CALLSEQ_END, DL, NodeTys, Ops);
     859             :   }
     860             : 
     861             :   /// Return true if the result of this operation is always undefined.
     862             :   bool isUndef(unsigned Opcode, ArrayRef<SDValue> Ops);
     863             : 
     864             :   /// Return an UNDEF node. UNDEF does not have a useful SDLoc.
     865     2320323 :   SDValue getUNDEF(EVT VT) {
     866     4640646 :     return getNode(ISD::UNDEF, SDLoc(), VT);
     867             :   }
     868             : 
     869             :   /// Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
     870          28 :   SDValue getGLOBAL_OFFSET_TABLE(EVT VT) {
     871          56 :     return getNode(ISD::GLOBAL_OFFSET_TABLE, SDLoc(), VT);
     872             :   }
     873             : 
     874             :   /// Gets or creates the specified node.
     875             :   ///
     876             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
     877             :                   ArrayRef<SDUse> Ops);
     878             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
     879             :                   ArrayRef<SDValue> Ops, const SDNodeFlags Flags = SDNodeFlags());
     880             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, ArrayRef<EVT> ResultTys,
     881             :                   ArrayRef<SDValue> Ops);
     882             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTs,
     883             :                   ArrayRef<SDValue> Ops);
     884             : 
     885             :   // Specialize based on number of operands.
     886             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT);
     887             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N,
     888             :                   const SDNodeFlags Flags = SDNodeFlags());
     889             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
     890             :                   SDValue N2, const SDNodeFlags Flags = SDNodeFlags());
     891             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
     892             :                   SDValue N2, SDValue N3);
     893             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
     894             :                   SDValue N2, SDValue N3, SDValue N4);
     895             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
     896             :                   SDValue N2, SDValue N3, SDValue N4, SDValue N5);
     897             : 
     898             :   // Specialize again based on number of operands for nodes with a VTList
     899             :   // rather than a single VT.
     900             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTs);
     901             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTs, SDValue N);
     902             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTs, SDValue N1,
     903             :                   SDValue N2);
     904             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTs, SDValue N1,
     905             :                   SDValue N2, SDValue N3);
     906             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTs, SDValue N1,
     907             :                   SDValue N2, SDValue N3, SDValue N4);
     908             :   SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTs, SDValue N1,
     909             :                   SDValue N2, SDValue N3, SDValue N4, SDValue N5);
     910             : 
     911             :   /// Compute a TokenFactor to force all the incoming stack arguments to be
     912             :   /// loaded from the stack. This is used in tail call lowering to protect
     913             :   /// stack arguments from being clobbered.
     914             :   SDValue getStackArgumentTokenFactor(SDValue Chain);
     915             : 
     916             :   SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
     917             :                     SDValue Size, unsigned Align, bool isVol, bool AlwaysInline,
     918             :                     bool isTailCall, MachinePointerInfo DstPtrInfo,
     919             :                     MachinePointerInfo SrcPtrInfo);
     920             : 
     921             :   SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
     922             :                      SDValue Size, unsigned Align, bool isVol, bool isTailCall,
     923             :                      MachinePointerInfo DstPtrInfo,
     924             :                      MachinePointerInfo SrcPtrInfo);
     925             : 
     926             :   SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
     927             :                     SDValue Size, unsigned Align, bool isVol, bool isTailCall,
     928             :                     MachinePointerInfo DstPtrInfo);
     929             : 
     930             :   SDValue getAtomicMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst,
     931             :                           unsigned DstAlign, SDValue Src, unsigned SrcAlign,
     932             :                           SDValue Size, Type *SizeTy, unsigned ElemSz,
     933             :                           bool isTailCall, MachinePointerInfo DstPtrInfo,
     934             :                           MachinePointerInfo SrcPtrInfo);
     935             : 
     936             :   SDValue getAtomicMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst,
     937             :                            unsigned DstAlign, SDValue Src, unsigned SrcAlign,
     938             :                            SDValue Size, Type *SizeTy, unsigned ElemSz,
     939             :                            bool isTailCall, MachinePointerInfo DstPtrInfo,
     940             :                            MachinePointerInfo SrcPtrInfo);
     941             : 
     942             :   SDValue getAtomicMemset(SDValue Chain, const SDLoc &dl, SDValue Dst,
     943             :                           unsigned DstAlign, SDValue Value, SDValue Size,
     944             :                           Type *SizeTy, unsigned ElemSz, bool isTailCall,
     945             :                           MachinePointerInfo DstPtrInfo);
     946             : 
     947             :   /// Helper function to make it easier to build SetCC's if you just
     948             :   /// have an ISD::CondCode instead of an SDValue.
     949             :   ///
     950      145274 :   SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS,
     951             :                    ISD::CondCode Cond) {
     952             :     assert(LHS.getValueType().isVector() == RHS.getValueType().isVector() &&
     953             :       "Cannot compare scalars to vectors");
     954             :     assert(LHS.getValueType().isVector() == VT.isVector() &&
     955             :       "Cannot compare scalars to vectors");
     956             :     assert(Cond != ISD::SETCC_INVALID &&
     957             :         "Cannot create a setCC of an invalid node.");
     958      145274 :     return getNode(ISD::SETCC, DL, VT, LHS, RHS, getCondCode(Cond));
     959             :   }
     960             : 
     961             :   /// Helper function to make it easier to build Select's if you just
     962             :   /// have operands and don't want to check for vector.
     963       37535 :   SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS,
     964             :                     SDValue RHS) {
     965             :     assert(LHS.getValueType() == RHS.getValueType() &&
     966             :            "Cannot use select on differing types");
     967             :     assert(VT.isVector() == LHS.getValueType().isVector() &&
     968             :            "Cannot mix vectors and scalars");
     969      112605 :     return getNode(Cond.getValueType().isVector() ? ISD::VSELECT : ISD::SELECT, DL, VT,
     970       75070 :                    Cond, LHS, RHS);
     971             :   }
     972             : 
     973             :   /// Helper function to make it easier to build SelectCC's if you
     974             :   /// just have an ISD::CondCode instead of an SDValue.
     975             :   ///
     976        5069 :   SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True,
     977             :                       SDValue False, ISD::CondCode Cond) {
     978             :     return getNode(ISD::SELECT_CC, DL, True.getValueType(),
     979       10138 :                    LHS, RHS, True, False, getCondCode(Cond));
     980             :   }
     981             : 
     982             :   /// VAArg produces a result and token chain, and takes a pointer
     983             :   /// and a source value as input.
     984             :   SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
     985             :                    SDValue SV, unsigned Align);
     986             : 
     987             :   /// Gets a node for an atomic cmpxchg op. There are two
     988             :   /// valid Opcodes. ISD::ATOMIC_CMO_SWAP produces the value loaded and a
     989             :   /// chain result. ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS produces the value loaded,
     990             :   /// a success flag (initially i1), and a chain.
     991             :   SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT,
     992             :                            SDVTList VTs, SDValue Chain, SDValue Ptr,
     993             :                            SDValue Cmp, SDValue Swp, MachinePointerInfo PtrInfo,
     994             :                            unsigned Alignment, AtomicOrdering SuccessOrdering,
     995             :                            AtomicOrdering FailureOrdering,
     996             :                            SyncScope::ID SSID);
     997             :   SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT,
     998             :                            SDVTList VTs, SDValue Chain, SDValue Ptr,
     999             :                            SDValue Cmp, SDValue Swp, MachineMemOperand *MMO);
    1000             : 
    1001             :   /// Gets a node for an atomic op, produces result (if relevant)
    1002             :   /// and chain and takes 2 operands.
    1003             :   SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain,
    1004             :                     SDValue Ptr, SDValue Val, const Value *PtrVal,
    1005             :                     unsigned Alignment, AtomicOrdering Ordering,
    1006             :                     SyncScope::ID SSID);
    1007             :   SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain,
    1008             :                     SDValue Ptr, SDValue Val, MachineMemOperand *MMO);
    1009             : 
    1010             :   /// Gets a node for an atomic op, produces result and chain and
    1011             :   /// takes 1 operand.
    1012             :   SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, EVT VT,
    1013             :                     SDValue Chain, SDValue Ptr, MachineMemOperand *MMO);
    1014             : 
    1015             :   /// Gets a node for an atomic op, produces result and chain and takes N
    1016             :   /// operands.
    1017             :   SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT,
    1018             :                     SDVTList VTList, ArrayRef<SDValue> Ops,
    1019             :                     MachineMemOperand *MMO);
    1020             : 
    1021             :   /// Creates a MemIntrinsicNode that may produce a
    1022             :   /// result and takes a list of operands. Opcode may be INTRINSIC_VOID,
    1023             :   /// INTRINSIC_W_CHAIN, or a target-specific opcode with a value not
    1024             :   /// less than FIRST_TARGET_MEMORY_OPCODE.
    1025             :   SDValue getMemIntrinsicNode(
    1026             :     unsigned Opcode, const SDLoc &dl, SDVTList VTList,
    1027             :     ArrayRef<SDValue> Ops, EVT MemVT,
    1028             :     MachinePointerInfo PtrInfo,
    1029             :     unsigned Align = 0,
    1030             :     MachineMemOperand::Flags Flags
    1031             :     = MachineMemOperand::MOLoad | MachineMemOperand::MOStore,
    1032             :     unsigned Size = 0);
    1033             : 
    1034             :   SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList,
    1035             :                               ArrayRef<SDValue> Ops, EVT MemVT,
    1036             :                               MachineMemOperand *MMO);
    1037             : 
    1038             :   /// Create a MERGE_VALUES node from the given operands.
    1039             :   SDValue getMergeValues(ArrayRef<SDValue> Ops, const SDLoc &dl);
    1040             : 
    1041             :   /// Loads are not normal binary operators: their result type is not
    1042             :   /// determined by their operands, and they produce a value AND a token chain.
    1043             :   ///
    1044             :   /// This function will set the MOLoad flag on MMOFlags, but you can set it if
    1045             :   /// you want.  The MOStore flag must not be set.
    1046             :   SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
    1047             :                   MachinePointerInfo PtrInfo, unsigned Alignment = 0,
    1048             :                   MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
    1049             :                   const AAMDNodes &AAInfo = AAMDNodes(),
    1050             :                   const MDNode *Ranges = nullptr);
    1051             :   SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
    1052             :                   MachineMemOperand *MMO);
    1053             :   SDValue
    1054             :   getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain,
    1055             :              SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT,
    1056             :              unsigned Alignment = 0,
    1057             :              MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
    1058             :              const AAMDNodes &AAInfo = AAMDNodes());
    1059             :   SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
    1060             :                      SDValue Chain, SDValue Ptr, EVT MemVT,
    1061             :                      MachineMemOperand *MMO);
    1062             :   SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base,
    1063             :                          SDValue Offset, ISD::MemIndexedMode AM);
    1064             :   SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT,
    1065             :                   const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
    1066             :                   MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment = 0,
    1067             :                   MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
    1068             :                   const AAMDNodes &AAInfo = AAMDNodes(),
    1069             :                   const MDNode *Ranges = nullptr);
    1070             :   SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT,
    1071             :                   const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
    1072             :                   EVT MemVT, MachineMemOperand *MMO);
    1073             : 
    1074             :   /// Helper function to build ISD::STORE nodes.
    1075             :   ///
    1076             :   /// This function will set the MOStore flag on MMOFlags, but you can set it if
    1077             :   /// you want.  The MOLoad and MOInvariant flags must not be set.
    1078             :   SDValue
    1079             :   getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
    1080             :            MachinePointerInfo PtrInfo, unsigned Alignment = 0,
    1081             :            MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
    1082             :            const AAMDNodes &AAInfo = AAMDNodes());
    1083             :   SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
    1084             :                    MachineMemOperand *MMO);
    1085             :   SDValue
    1086             :   getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
    1087             :                 MachinePointerInfo PtrInfo, EVT TVT, unsigned Alignment = 0,
    1088             :                 MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
    1089             :                 const AAMDNodes &AAInfo = AAMDNodes());
    1090             :   SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val,
    1091             :                         SDValue Ptr, EVT TVT, MachineMemOperand *MMO);
    1092             :   SDValue getIndexedStore(SDValue OrigStoe, const SDLoc &dl, SDValue Base,
    1093             :                           SDValue Offset, ISD::MemIndexedMode AM);
    1094             : 
    1095             :   /// Returns sum of the base pointer and offset.
    1096             :   SDValue getMemBasePlusOffset(SDValue Base, unsigned Offset, const SDLoc &DL);
    1097             : 
    1098             :   SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
    1099             :                         SDValue Mask, SDValue Src0, EVT MemVT,
    1100             :                         MachineMemOperand *MMO, ISD::LoadExtType,
    1101             :                         bool IsExpanding = false);
    1102             :   SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val,
    1103             :                          SDValue Ptr, SDValue Mask, EVT MemVT,
    1104             :                          MachineMemOperand *MMO, bool IsTruncating = false,
    1105             :                          bool IsCompressing = false);
    1106             :   SDValue getMaskedGather(SDVTList VTs, EVT VT, const SDLoc &dl,
    1107             :                           ArrayRef<SDValue> Ops, MachineMemOperand *MMO);
    1108             :   SDValue getMaskedScatter(SDVTList VTs, EVT VT, const SDLoc &dl,
    1109             :                            ArrayRef<SDValue> Ops, MachineMemOperand *MMO);
    1110             : 
    1111             :   /// Return (create a new or find existing) a target-specific node.
    1112             :   /// TargetMemSDNode should be derived class from MemSDNode.
    1113             :   template <class TargetMemSDNode>
    1114             :   SDValue getTargetMemSDNode(SDVTList VTs, ArrayRef<SDValue> Ops,
    1115             :                              const SDLoc &dl, EVT MemVT,
    1116             :                              MachineMemOperand *MMO);
    1117             : 
    1118             :   /// Construct a node to track a Value* through the backend.
    1119             :   SDValue getSrcValue(const Value *v);
    1120             : 
    1121             :   /// Return an MDNodeSDNode which holds an MDNode.
    1122             :   SDValue getMDNode(const MDNode *MD);
    1123             : 
    1124             :   /// Return a bitcast using the SDLoc of the value operand, and casting to the
    1125             :   /// provided type. Use getNode to set a custom SDLoc.
    1126             :   SDValue getBitcast(EVT VT, SDValue V);
    1127             : 
    1128             :   /// Return an AddrSpaceCastSDNode.
    1129             :   SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr, unsigned SrcAS,
    1130             :                            unsigned DestAS);
    1131             : 
    1132             :   /// Return the specified value casted to
    1133             :   /// the target's desired shift amount type.
    1134             :   SDValue getShiftAmountOperand(EVT LHSTy, SDValue Op);
    1135             : 
    1136             :   /// Expand the specified \c ISD::VAARG node as the Legalize pass would.
    1137             :   SDValue expandVAArg(SDNode *Node);
    1138             : 
    1139             :   /// Expand the specified \c ISD::VACOPY node as the Legalize pass would.
    1140             :   SDValue expandVACopy(SDNode *Node);
    1141             : 
    1142             :   /// *Mutate* the specified node in-place to have the
    1143             :   /// specified operands.  If the resultant node already exists in the DAG,
    1144             :   /// this does not modify the specified node, instead it returns the node that
    1145             :   /// already exists.  If the resultant node does not exist in the DAG, the
    1146             :   /// input node is returned.  As a degenerate case, if you specify the same
    1147             :   /// input operands as the node already has, the input node is returned.
    1148             :   SDNode *UpdateNodeOperands(SDNode *N, SDValue Op);
    1149             :   SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2);
    1150             :   SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2,
    1151             :                                SDValue Op3);
    1152             :   SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2,
    1153             :                                SDValue Op3, SDValue Op4);
    1154             :   SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2,
    1155             :                                SDValue Op3, SDValue Op4, SDValue Op5);
    1156             :   SDNode *UpdateNodeOperands(SDNode *N, ArrayRef<SDValue> Ops);
    1157             : 
    1158             :   // Propagates the change in divergence to users
    1159             :   void updateDivergence(SDNode * N);
    1160             : 
    1161             :   /// These are used for target selectors to *mutate* the
    1162             :   /// specified node to have the specified return type, Target opcode, and
    1163             :   /// operands.  Note that target opcodes are stored as
    1164             :   /// ~TargetOpcode in the node opcode field.  The resultant node is returned.
    1165             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT);
    1166             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT, SDValue Op1);
    1167             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT,
    1168             :                        SDValue Op1, SDValue Op2);
    1169             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT,
    1170             :                        SDValue Op1, SDValue Op2, SDValue Op3);
    1171             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT,
    1172             :                        ArrayRef<SDValue> Ops);
    1173             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1, EVT VT2);
    1174             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
    1175             :                        EVT VT2, ArrayRef<SDValue> Ops);
    1176             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
    1177             :                        EVT VT2, EVT VT3, ArrayRef<SDValue> Ops);
    1178             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
    1179             :                        EVT VT2, SDValue Op1);
    1180             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
    1181             :                        EVT VT2, SDValue Op1, SDValue Op2);
    1182             :   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs,
    1183             :                        ArrayRef<SDValue> Ops);
    1184             : 
    1185             :   /// This *mutates* the specified node to have the specified
    1186             :   /// return type, opcode, and operands.
    1187             :   SDNode *MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs,
    1188             :                       ArrayRef<SDValue> Ops);
    1189             : 
    1190             :   /// Mutate the specified strict FP node to its non-strict equivalent,
    1191             :   /// unlinking the node from its chain and dropping the metadata arguments.
    1192             :   /// The node must be a strict FP node.
    1193             :   SDNode *mutateStrictFPToFP(SDNode *Node);
    1194             : 
    1195             :   /// These are used for target selectors to create a new node
    1196             :   /// with specified return type(s), MachineInstr opcode, and operands.
    1197             :   ///
    1198             :   /// Note that getMachineNode returns the resultant node.  If there is already
    1199             :   /// a node of the specified opcode and operands, it returns that node instead
    1200             :   /// of the current one.
    1201             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT);
    1202             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
    1203             :                                 SDValue Op1);
    1204             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
    1205             :                                 SDValue Op1, SDValue Op2);
    1206             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
    1207             :                                 SDValue Op1, SDValue Op2, SDValue Op3);
    1208             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT,
    1209             :                                 ArrayRef<SDValue> Ops);
    1210             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
    1211             :                                 EVT VT2, SDValue Op1, SDValue Op2);
    1212             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
    1213             :                                 EVT VT2, SDValue Op1, SDValue Op2, SDValue Op3);
    1214             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
    1215             :                                 EVT VT2, ArrayRef<SDValue> Ops);
    1216             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
    1217             :                                 EVT VT2, EVT VT3, SDValue Op1, SDValue Op2);
    1218             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
    1219             :                                 EVT VT2, EVT VT3, SDValue Op1, SDValue Op2,
    1220             :                                 SDValue Op3);
    1221             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1,
    1222             :                                 EVT VT2, EVT VT3, ArrayRef<SDValue> Ops);
    1223             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
    1224             :                                 ArrayRef<EVT> ResultTys, ArrayRef<SDValue> Ops);
    1225             :   MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, SDVTList VTs,
    1226             :                                 ArrayRef<SDValue> Ops);
    1227             : 
    1228             :   /// A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
    1229             :   SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT,
    1230             :                                  SDValue Operand);
    1231             : 
    1232             :   /// A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
    1233             :   SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT,
    1234             :                                 SDValue Operand, SDValue Subreg);
    1235             : 
    1236             :   /// Get the specified node if it's already available, or else return NULL.
    1237             :   SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs, ArrayRef<SDValue> Ops,
    1238             :                           const SDNodeFlags Flags = SDNodeFlags());
    1239             : 
    1240             :   /// Creates a SDDbgValue node.
    1241             :   SDDbgValue *getDbgValue(DIVariable *Var, DIExpression *Expr, SDNode *N,
    1242             :                           unsigned R, bool IsIndirect, const DebugLoc &DL,
    1243             :                           unsigned O);
    1244             : 
    1245             :   /// Creates a constant SDDbgValue node.
    1246             :   SDDbgValue *getConstantDbgValue(DIVariable *Var, DIExpression *Expr,
    1247             :                                   const Value *C, const DebugLoc &DL,
    1248             :                                   unsigned O);
    1249             : 
    1250             :   /// Creates a FrameIndex SDDbgValue node.
    1251             :   SDDbgValue *getFrameIndexDbgValue(DIVariable *Var, DIExpression *Expr,
    1252             :                                     unsigned FI, const DebugLoc &DL,
    1253             :                                     unsigned O);
    1254             : 
    1255             :   /// Creates a VReg SDDbgValue node.
    1256             :   SDDbgValue *getVRegDbgValue(DIVariable *Var, DIExpression *Expr,
    1257             :                               unsigned VReg, bool IsIndirect,
    1258             :                               const DebugLoc &DL, unsigned O);
    1259             : 
    1260             :   /// Creates a SDDbgLabel node.
    1261             :   SDDbgLabel *getDbgLabel(DILabel *Label, const DebugLoc &DL, unsigned O);
    1262             : 
    1263             :   /// Transfer debug values from one node to another, while optionally
    1264             :   /// generating fragment expressions for split-up values. If \p InvalidateDbg
    1265             :   /// is set, debug values are invalidated after they are transferred.
    1266             :   void transferDbgValues(SDValue From, SDValue To, unsigned OffsetInBits = 0,
    1267             :                          unsigned SizeInBits = 0, bool InvalidateDbg = true);
    1268             : 
    1269             :   /// Remove the specified node from the system. If any of its
    1270             :   /// operands then becomes dead, remove them as well. Inform UpdateListener
    1271             :   /// for each node deleted.
    1272             :   void RemoveDeadNode(SDNode *N);
    1273             : 
    1274             :   /// This method deletes the unreachable nodes in the
    1275             :   /// given list, and any nodes that become unreachable as a result.
    1276             :   void RemoveDeadNodes(SmallVectorImpl<SDNode *> &DeadNodes);
    1277             : 
    1278             :   /// Modify anything using 'From' to use 'To' instead.
    1279             :   /// This can cause recursive merging of nodes in the DAG.  Use the first
    1280             :   /// version if 'From' is known to have a single result, use the second
    1281             :   /// if you have two nodes with identical results (or if 'To' has a superset
    1282             :   /// of the results of 'From'), use the third otherwise.
    1283             :   ///
    1284             :   /// These methods all take an optional UpdateListener, which (if not null) is
    1285             :   /// informed about nodes that are deleted and modified due to recursive
    1286             :   /// changes in the dag.
    1287             :   ///
    1288             :   /// These functions only replace all existing uses. It's possible that as
    1289             :   /// these replacements are being performed, CSE may cause the From node
    1290             :   /// to be given new uses. These new uses of From are left in place, and
    1291             :   /// not automatically transferred to To.
    1292             :   ///
    1293             :   void ReplaceAllUsesWith(SDValue From, SDValue Op);
    1294             :   void ReplaceAllUsesWith(SDNode *From, SDNode *To);
    1295             :   void ReplaceAllUsesWith(SDNode *From, const SDValue *To);
    1296             : 
    1297             :   /// Replace any uses of From with To, leaving
    1298             :   /// uses of other values produced by From.getNode() alone.
    1299             :   void ReplaceAllUsesOfValueWith(SDValue From, SDValue To);
    1300             : 
    1301             :   /// Like ReplaceAllUsesOfValueWith, but for multiple values at once.
    1302             :   /// This correctly handles the case where
    1303             :   /// there is an overlap between the From values and the To values.
    1304             :   void ReplaceAllUsesOfValuesWith(const SDValue *From, const SDValue *To,
    1305             :                                   unsigned Num);
    1306             : 
    1307             :   /// If an existing load has uses of its chain, create a token factor node with
    1308             :   /// that chain and the new memory node's chain and update users of the old
    1309             :   /// chain to the token factor. This ensures that the new memory node will have
    1310             :   /// the same relative memory dependency position as the old load. Returns the
    1311             :   /// new merged load chain.
    1312             :   SDValue makeEquivalentMemoryOrdering(LoadSDNode *Old, SDValue New);
    1313             : 
    1314             :   /// Topological-sort the AllNodes list and a
    1315             :   /// assign a unique node id for each node in the DAG based on their
    1316             :   /// topological order. Returns the number of nodes.
    1317             :   unsigned AssignTopologicalOrder();
    1318             : 
    1319             :   /// Move node N in the AllNodes list to be immediately
    1320             :   /// before the given iterator Position. This may be used to update the
    1321             :   /// topological ordering when the list of nodes is modified.
    1322             :   void RepositionNode(allnodes_iterator Position, SDNode *N) {
    1323             :     AllNodes.insert(Position, AllNodes.remove(N));
    1324             :   }
    1325             : 
    1326             :   /// Returns an APFloat semantics tag appropriate for the given type. If VT is
    1327             :   /// a vector type, the element semantics are returned.
    1328        5544 :   static const fltSemantics &EVTToAPFloatSemantics(EVT VT) {
    1329        5544 :     switch (VT.getScalarType().getSimpleVT().SimpleTy) {
    1330           0 :     default: llvm_unreachable("Unknown FP format");
    1331         153 :     case MVT::f16:     return APFloat::IEEEhalf();
    1332        2543 :     case MVT::f32:     return APFloat::IEEEsingle();
    1333        2703 :     case MVT::f64:     return APFloat::IEEEdouble();
    1334         113 :     case MVT::f80:     return APFloat::x87DoubleExtended();
    1335          30 :     case MVT::f128:    return APFloat::IEEEquad();
    1336           2 :     case MVT::ppcf128: return APFloat::PPCDoubleDouble();
    1337             :     }
    1338             :   }
    1339             : 
    1340             :   /// Add a dbg_value SDNode. If SD is non-null that means the
    1341             :   /// value is produced by SD.
    1342             :   void AddDbgValue(SDDbgValue *DB, SDNode *SD, bool isParameter);
    1343             : 
    1344             :   /// Add a dbg_label SDNode.
    1345             :   void AddDbgLabel(SDDbgLabel *DB);
    1346             : 
    1347             :   /// Get the debug values which reference the given SDNode.
    1348             :   ArrayRef<SDDbgValue*> GetDbgValues(const SDNode* SD) {
    1349        7343 :     return DbgInfo->getSDDbgValues(SD);
    1350             :   }
    1351             : 
    1352             : public:
    1353             :   /// Return true if there are any SDDbgValue nodes associated
    1354             :   /// with this SelectionDAG.
    1355      347827 :   bool hasDebugValues() const { return !DbgInfo->empty(); }
    1356             : 
    1357             :   SDDbgInfo::DbgIterator DbgBegin() { return DbgInfo->DbgBegin(); }
    1358             :   SDDbgInfo::DbgIterator DbgEnd()   { return DbgInfo->DbgEnd(); }
    1359             : 
    1360             :   SDDbgInfo::DbgIterator ByvalParmDbgBegin() {
    1361             :     return DbgInfo->ByvalParmDbgBegin();
    1362             :   }
    1363             : 
    1364             :   SDDbgInfo::DbgIterator ByvalParmDbgEnd()   {
    1365             :     return DbgInfo->ByvalParmDbgEnd();
    1366             :   }
    1367             : 
    1368             :   SDDbgInfo::DbgLabelIterator DbgLabelBegin() {
    1369             :     return DbgInfo->DbgLabelBegin();
    1370             :   }
    1371             :   SDDbgInfo::DbgLabelIterator DbgLabelEnd() {
    1372             :     return DbgInfo->DbgLabelEnd();
    1373             :   }
    1374             : 
    1375             :   /// To be invoked on an SDNode that is slated to be erased. This
    1376             :   /// function mirrors \c llvm::salvageDebugInfo.
    1377             :   void salvageDebugInfo(SDNode &N);
    1378             : 
    1379             :   void dump() const;
    1380             : 
    1381             :   /// Create a stack temporary, suitable for holding the specified value type.
    1382             :   /// If minAlign is specified, the slot size will have at least that alignment.
    1383             :   SDValue CreateStackTemporary(EVT VT, unsigned minAlign = 1);
    1384             : 
    1385             :   /// Create a stack temporary suitable for holding either of the specified
    1386             :   /// value types.
    1387             :   SDValue CreateStackTemporary(EVT VT1, EVT VT2);
    1388             : 
    1389             :   SDValue FoldSymbolOffset(unsigned Opcode, EVT VT,
    1390             :                            const GlobalAddressSDNode *GA,
    1391             :                            const SDNode *N2);
    1392             : 
    1393             :   SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT,
    1394             :                                  SDNode *Cst1, SDNode *Cst2);
    1395             : 
    1396             :   SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT,
    1397             :                                  const ConstantSDNode *Cst1,
    1398             :                                  const ConstantSDNode *Cst2);
    1399             : 
    1400             :   SDValue FoldConstantVectorArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT,
    1401             :                                        ArrayRef<SDValue> Ops,
    1402             :                                        const SDNodeFlags Flags = SDNodeFlags());
    1403             : 
    1404             :   /// Constant fold a setcc to true or false.
    1405             :   SDValue FoldSetCC(EVT VT, SDValue N1, SDValue N2, ISD::CondCode Cond,
    1406             :                     const SDLoc &dl);
    1407             : 
    1408             :   /// See if the specified operand can be simplified with the knowledge that only
    1409             :   /// the bits specified by Mask are used.  If so, return the simpler operand,
    1410             :   /// otherwise return a null SDValue.
    1411             :   ///
    1412             :   /// (This exists alongside SimplifyDemandedBits because GetDemandedBits can
    1413             :   /// simplify nodes with multiple uses more aggressively.)
    1414             :   SDValue GetDemandedBits(SDValue V, const APInt &Mask);
    1415             : 
    1416             :   /// Return true if the sign bit of Op is known to be zero.
    1417             :   /// We use this predicate to simplify operations downstream.
    1418             :   bool SignBitIsZero(SDValue Op, unsigned Depth = 0) const;
    1419             : 
    1420             :   /// Return true if 'Op & Mask' is known to be zero.  We
    1421             :   /// use this predicate to simplify operations downstream.  Op and Mask are
    1422             :   /// known to be the same type.
    1423             :   bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth = 0)
    1424             :     const;
    1425             : 
    1426             :   /// Determine which bits of Op are known to be either zero or one and return
    1427             :   /// them in Known. For vectors, the known bits are those that are shared by
    1428             :   /// every vector element.
    1429             :   /// Targets can implement the computeKnownBitsForTargetNode method in the
    1430             :   /// TargetLowering class to allow target nodes to be understood.
    1431             :   void computeKnownBits(SDValue Op, KnownBits &Known, unsigned Depth = 0) const;
    1432             : 
    1433             :   /// Determine which bits of Op are known to be either zero or one and return
    1434             :   /// them in Known. The DemandedElts argument allows us to only collect the
    1435             :   /// known bits that are shared by the requested vector elements.
    1436             :   /// Targets can implement the computeKnownBitsForTargetNode method in the
    1437             :   /// TargetLowering class to allow target nodes to be understood.
    1438             :   void computeKnownBits(SDValue Op, KnownBits &Known, const APInt &DemandedElts,
    1439             :                         unsigned Depth = 0) const;
    1440             : 
    1441             :   /// Used to represent the possible overflow behavior of an operation.
    1442             :   /// Never: the operation cannot overflow.
    1443             :   /// Always: the operation will always overflow.
    1444             :   /// Sometime: the operation may or may not overflow.
    1445             :   enum OverflowKind {
    1446             :     OFK_Never,
    1447             :     OFK_Sometime,
    1448             :     OFK_Always,
    1449             :   };
    1450             : 
    1451             :   /// Determine if the result of the addition of 2 node can overflow.
    1452             :   OverflowKind computeOverflowKind(SDValue N0, SDValue N1) const;
    1453             : 
    1454             :   /// Test if the given value is known to have exactly one bit set. This differs
    1455             :   /// from computeKnownBits in that it doesn't necessarily determine which bit
    1456             :   /// is set.
    1457             :   bool isKnownToBeAPowerOfTwo(SDValue Val) const;
    1458             : 
    1459             :   /// Return the number of times the sign bit of the register is replicated into
    1460             :   /// the other bits. We know that at least 1 bit is always equal to the sign
    1461             :   /// bit (itself), but other cases can give us information. For example,
    1462             :   /// immediately after an "SRA X, 2", we know that the top 3 bits are all equal
    1463             :   /// to each other, so we return 3. Targets can implement the
    1464             :   /// ComputeNumSignBitsForTarget method in the TargetLowering class to allow
    1465             :   /// target nodes to be understood.
    1466             :   unsigned ComputeNumSignBits(SDValue Op, unsigned Depth = 0) const;
    1467             : 
    1468             :   /// Return the number of times the sign bit of the register is replicated into
    1469             :   /// the other bits. We know that at least 1 bit is always equal to the sign
    1470             :   /// bit (itself), but other cases can give us information. For example,
    1471             :   /// immediately after an "SRA X, 2", we know that the top 3 bits are all equal
    1472             :   /// to each other, so we return 3. The DemandedElts argument allows
    1473             :   /// us to only collect the minimum sign bits of the requested vector elements.
    1474             :   /// Targets can implement the ComputeNumSignBitsForTarget method in the
    1475             :   /// TargetLowering class to allow target nodes to be understood.
    1476             :   unsigned ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
    1477             :                               unsigned Depth = 0) const;
    1478             : 
    1479             :   /// Return true if the specified operand is an ISD::ADD with a ConstantSDNode
    1480             :   /// on the right-hand side, or if it is an ISD::OR with a ConstantSDNode that
    1481             :   /// is guaranteed to have the same semantics as an ADD. This handles the
    1482             :   /// equivalence:
    1483             :   ///     X|Cst == X+Cst iff X&Cst = 0.
    1484             :   bool isBaseWithConstantOffset(SDValue Op) const;
    1485             : 
    1486             :   /// Test whether the given SDValue is known to never be NaN.
    1487             :   bool isKnownNeverNaN(SDValue Op) const;
    1488             : 
    1489             :   /// Test whether the given SDValue is known to never be positive or negative
    1490             :   /// zero.
    1491             :   bool isKnownNeverZero(SDValue Op) const;
    1492             : 
    1493             :   /// Test whether two SDValues are known to compare equal. This
    1494             :   /// is true if they are the same value, or if one is negative zero and the
    1495             :   /// other positive zero.
    1496             :   bool isEqualTo(SDValue A, SDValue B) const;
    1497             : 
    1498             :   /// Return true if A and B have no common bits set. As an example, this can
    1499             :   /// allow an 'add' to be transformed into an 'or'.
    1500             :   bool haveNoCommonBitsSet(SDValue A, SDValue B) const;
    1501             : 
    1502             :   /// Utility function used by legalize and lowering to
    1503             :   /// "unroll" a vector operation by splitting out the scalars and operating
    1504             :   /// on each element individually.  If the ResNE is 0, fully unroll the vector
    1505             :   /// op. If ResNE is less than the width of the vector op, unroll up to ResNE.
    1506             :   /// If the  ResNE is greater than the width of the vector op, unroll the
    1507             :   /// vector op and fill the end of the resulting vector with UNDEFS.
    1508             :   SDValue UnrollVectorOp(SDNode *N, unsigned ResNE = 0);
    1509             : 
    1510             :   /// Return true if loads are next to each other and can be
    1511             :   /// merged. Check that both are nonvolatile and if LD is loading
    1512             :   /// 'Bytes' bytes from a location that is 'Dist' units away from the
    1513             :   /// location that the 'Base' load is loading from.
    1514             :   bool areNonVolatileConsecutiveLoads(LoadSDNode *LD, LoadSDNode *Base,
    1515             :                                       unsigned Bytes, int Dist) const;
    1516             : 
    1517             :   /// Infer alignment of a load / store address. Return 0 if
    1518             :   /// it cannot be inferred.
    1519             :   unsigned InferPtrAlignment(SDValue Ptr) const;
    1520             : 
    1521             :   /// Compute the VTs needed for the low/hi parts of a type
    1522             :   /// which is split (or expanded) into two not necessarily identical pieces.
    1523             :   std::pair<EVT, EVT> GetSplitDestVTs(const EVT &VT) const;
    1524             : 
    1525             :   /// Split the vector with EXTRACT_SUBVECTOR using the provides
    1526             :   /// VTs and return the low/high part.
    1527             :   std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL,
    1528             :                                           const EVT &LoVT, const EVT &HiVT);
    1529             : 
    1530             :   /// Split the vector with EXTRACT_SUBVECTOR and return the low/high part.
    1531        5172 :   std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL) {
    1532        5172 :     EVT LoVT, HiVT;
    1533       15516 :     std::tie(LoVT, HiVT) = GetSplitDestVTs(N.getValueType());
    1534        5172 :     return SplitVector(N, DL, LoVT, HiVT);
    1535             :   }
    1536             : 
    1537             :   /// Split the node's operand with EXTRACT_SUBVECTOR and
    1538             :   /// return the low/high part.
    1539        4369 :   std::pair<SDValue, SDValue> SplitVectorOperand(const SDNode *N, unsigned OpNo)
    1540             :   {
    1541       13107 :     return SplitVector(N->getOperand(OpNo), SDLoc(N));
    1542             :   }
    1543             : 
    1544             :   /// Append the extracted elements from Start to Count out of the vector Op
    1545             :   /// in Args. If Count is 0, all of the elements will be extracted.
    1546             :   void ExtractVectorElements(SDValue Op, SmallVectorImpl<SDValue> &Args,
    1547             :                              unsigned Start = 0, unsigned Count = 0);
    1548             : 
    1549             :   /// Compute the default alignment value for the given type.
    1550             :   unsigned getEVTAlignment(EVT MemoryVT) const;
    1551             : 
    1552             :   /// Test whether the given value is a constant int or similar node.
    1553             :   SDNode *isConstantIntBuildVectorOrConstantInt(SDValue N);
    1554             : 
    1555             :   /// Test whether the given value is a constant FP or similar node.
    1556             :   SDNode *isConstantFPBuildVectorOrConstantFP(SDValue N);
    1557             : 
    1558             :   /// \returns true if \p N is any kind of constant or build_vector of
    1559             :   /// constants, int or float. If a vector, it may not necessarily be a splat.
    1560        8281 :   inline bool isConstantValueOfAnyType(SDValue N) {
    1561       14069 :     return isConstantIntBuildVectorOrConstantInt(N) ||
    1562       14069 :            isConstantFPBuildVectorOrConstantFP(N);
    1563             :   }
    1564             : 
    1565             : private:
    1566             :   void InsertNode(SDNode *N);
    1567             :   bool RemoveNodeFromCSEMaps(SDNode *N);
    1568             :   void AddModifiedNodeToCSEMaps(SDNode *N);
    1569             :   SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op, void *&InsertPos);
    1570             :   SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op1, SDValue Op2,
    1571             :                                void *&InsertPos);
    1572             :   SDNode *FindModifiedNodeSlot(SDNode *N, ArrayRef<SDValue> Ops,
    1573             :                                void *&InsertPos);
    1574             :   SDNode *UpdateSDLocOnMergeSDNode(SDNode *N, const SDLoc &loc);
    1575             : 
    1576             :   void DeleteNodeNotInCSEMaps(SDNode *N);
    1577             :   void DeallocateNode(SDNode *N);
    1578             : 
    1579             :   void allnodes_clear();
    1580             : 
    1581             :   /// Look up the node specified by ID in CSEMap.  If it exists, return it.  If
    1582             :   /// not, return the insertion token that will make insertion faster.  This
    1583             :   /// overload is for nodes other than Constant or ConstantFP, use the other one
    1584             :   /// for those.
    1585             :   SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos);
    1586             : 
    1587             :   /// Look up the node specified by ID in CSEMap.  If it exists, return it.  If
    1588             :   /// not, return the insertion token that will make insertion faster.  Performs
    1589             :   /// additional processing for constant nodes.
    1590             :   SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, const SDLoc &DL,
    1591             :                               void *&InsertPos);
    1592             : 
    1593             :   /// List of non-single value types.
    1594             :   FoldingSet<SDVTListNode> VTListMap;
    1595             : 
    1596             :   /// Maps to auto-CSE operations.
    1597             :   std::vector<CondCodeSDNode*> CondCodeNodes;
    1598             : 
    1599             :   std::vector<SDNode*> ValueTypeNodes;
    1600             :   std::map<EVT, SDNode*, EVT::compareRawBits> ExtendedValueTypeNodes;
    1601             :   StringMap<SDNode*> ExternalSymbols;
    1602             : 
    1603             :   std::map<std::pair<std::string, unsigned char>,SDNode*> TargetExternalSymbols;
    1604             :   DenseMap<MCSymbol *, SDNode *> MCSymbols;
    1605             : };
    1606             : 
    1607             : template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> {
    1608             :   using nodes_iterator = pointer_iterator<SelectionDAG::allnodes_iterator>;
    1609             : 
    1610             :   static nodes_iterator nodes_begin(SelectionDAG *G) {
    1611             :     return nodes_iterator(G->allnodes_begin());
    1612             :   }
    1613             : 
    1614             :   static nodes_iterator nodes_end(SelectionDAG *G) {
    1615             :     return nodes_iterator(G->allnodes_end());
    1616             :   }
    1617             : };
    1618             : 
    1619             : template <class TargetMemSDNode>
    1620         556 : SDValue SelectionDAG::getTargetMemSDNode(SDVTList VTs,
    1621             :                                          ArrayRef<SDValue> Ops,
    1622             :                                          const SDLoc &dl, EVT MemVT,
    1623             :                                          MachineMemOperand *MMO) {
    1624             :   /// Compose node ID and try to find an existing node.
    1625             :   FoldingSetNodeID ID;
    1626        2224 :   unsigned Opcode =
    1627             :     TargetMemSDNode(dl.getIROrder(), DebugLoc(), VTs, MemVT, MMO).getOpcode();
    1628         556 :   ID.AddInteger(Opcode);
    1629         556 :   ID.AddPointer(VTs.VTs);
    1630        6768 :   for (auto& Op : Ops) {
    1631        3106 :     ID.AddPointer(Op.getNode());
    1632        3106 :     ID.AddInteger(Op.getResNo());
    1633             :   }
    1634         556 :   ID.AddInteger(MemVT.getRawBits());
    1635         556 :   ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
    1636        1112 :   ID.AddInteger(getSyntheticNodeSubclassData<TargetMemSDNode>(
    1637             :     dl.getIROrder(), VTs, MemVT, MMO));
    1638             : 
    1639         556 :   void *IP = nullptr;
    1640         556 :   if (SDNode *E = FindNodeOrInsertPos(ID, dl, IP)) {
    1641           0 :     cast<TargetMemSDNode>(E)->refineAlignment(MMO);
    1642           0 :     return SDValue(E, 0);
    1643             :   }
    1644             : 
    1645             :   /// Existing node was not found. Create a new one.
    1646        1112 :   auto *N = newSDNode<TargetMemSDNode>(dl.getIROrder(), dl.getDebugLoc(), VTs,
    1647             :                                        MemVT, MMO);
    1648         556 :   createOperands(N, Ops);
    1649         556 :   CSEMap.InsertNode(N, IP);
    1650         556 :   InsertNode(N);
    1651         556 :   return SDValue(N, 0);
    1652             : }
    1653             : 
    1654             : } // end namespace llvm
    1655             : 
    1656             : #endif // LLVM_CODEGEN_SELECTIONDAG_H

Generated by: LCOV version 1.13