LLVM 24.0.0git
SelectionDAG.h
Go to the documentation of this file.
1//===- llvm/CodeGen/SelectionDAG.h - InstSelection DAG ----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the SelectionDAG class, and transitively defines the
10// SDNode class and subclasses.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_SELECTIONDAG_H
15#define LLVM_CODEGEN_SELECTIONDAG_H
16
17#include "llvm/ADT/ArrayRef.h"
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/DenseSet.h"
20#include "llvm/ADT/FoldingSet.h"
22#include "llvm/ADT/StringMap.h"
23#include "llvm/ADT/ilist.h"
24#include "llvm/ADT/iterator.h"
35#include "llvm/IR/DebugLoc.h"
36#include "llvm/IR/Metadata.h"
46#include <cassert>
47#include <cstdint>
48#include <functional>
49#include <map>
50#include <set>
51#include <string>
52#include <tuple>
53#include <utility>
54#include <vector>
55
56namespace llvm {
57
58class DIExpression;
59class DILabel;
60class DIVariable;
61class Function;
62class Pass;
63class Type;
64template <class GraphType> struct GraphTraits;
65template <typename T, unsigned int N> class SmallSetVector;
66template <typename T, typename Enable> struct FoldingSetTrait;
67class BatchAAResults;
68class BlockAddress;
70class Constant;
71class ConstantFP;
72class ConstantInt;
73class DataLayout;
74struct fltSemantics;
76class FunctionVarLocs;
77class GlobalValue;
78struct KnownBits;
79class LLVMContext;
83class MCSymbol;
86class SDDbgValue;
87class SDDbgOperand;
88class SDDbgLabel;
89class SelectionDAG;
92class TargetLowering;
93class TargetMachine;
95class Value;
96
97template <typename T> class GenericSSAContext;
99template <typename T> class GenericUniformityInfo;
101
103 friend struct FoldingSetTrait<SDVTListNode>;
104
105 /// A reference to an Interned FoldingSetNodeID for this node.
106 /// The Allocator in SelectionDAG holds the data.
107 /// SDVTList contains all types which are frequently accessed in SelectionDAG.
108 /// The size of this list is not expected to be big so it won't introduce
109 /// a memory penalty.
110 FoldingSetNodeIDRef FastID;
111 const EVT *VTs;
112 unsigned int NumVTs;
113 /// The hash value for SDVTList is fixed, so cache it to avoid
114 /// hash calculation.
115 unsigned HashValue;
116
117public:
118 SDVTListNode(const FoldingSetNodeIDRef ID, const EVT *VT, unsigned int Num) :
119 FastID(ID), VTs(VT), NumVTs(Num) {
120 HashValue = ID.ComputeHash();
121 }
122
124 SDVTList result = {VTs, NumVTs};
125 return result;
126 }
127};
128
129/// Specialize FoldingSetTrait for SDVTListNode
130/// to avoid computing temp FoldingSetNodeID and hash value.
131template<> struct FoldingSetTrait<SDVTListNode> : DefaultFoldingSetTrait<SDVTListNode> {
132 static void Profile(const SDVTListNode &X, FoldingSetNodeID& ID) {
133 ID = X.FastID;
134 }
135
136 static bool Equals(const SDVTListNode &X, const FoldingSetNodeID &ID,
137 unsigned IDHash, FoldingSetNodeID &TempID) {
138 if (X.HashValue != IDHash)
139 return false;
140 return ID == X.FastID;
141 }
142
143 static unsigned ComputeHash(const SDVTListNode &X, FoldingSetNodeID &TempID) {
144 return X.HashValue;
145 }
146};
147
148template <> struct ilist_alloc_traits<SDNode> {
149 static void deleteNode(SDNode *) {
150 llvm_unreachable("ilist_traits<SDNode> shouldn't see a deleteNode call!");
151 }
152};
153
154/// Keeps track of dbg_value information through SDISel. We do
155/// not build SDNodes for these so as not to perturb the generated code;
156/// instead the info is kept off to the side in this structure. Each SDNode may
157/// have one or more associated dbg_value entries. This information is kept in
158/// DbgValMap.
159/// Byval parameters are handled separately because they don't use alloca's,
160/// which busts the normal mechanism. There is good reason for handling all
161/// parameters separately: they may not have code generated for them, they
162/// should always go at the beginning of the function regardless of other code
163/// motion, and debug info for them is potentially useful even if the parameter
164/// is unused. Right now only byval parameters are handled separately.
166 BumpPtrAllocator Alloc;
168 SmallVector<SDDbgValue*, 32> ByvalParmDbgValues;
171 DbgValMapType DbgValMap;
172
173public:
174 SDDbgInfo() = default;
175 SDDbgInfo(const SDDbgInfo &) = delete;
176 SDDbgInfo &operator=(const SDDbgInfo &) = delete;
177
178 LLVM_ABI void add(SDDbgValue *V, bool isParameter);
179
180 void add(SDDbgLabel *L) { DbgLabels.push_back(L); }
181
182 /// Invalidate all DbgValues attached to the node and remove
183 /// it from the Node-to-DbgValues map.
184 LLVM_ABI void erase(const SDNode *Node);
185
186 void clear() {
187 DbgValMap.clear();
188 DbgValues.clear();
189 ByvalParmDbgValues.clear();
190 DbgLabels.clear();
191 Alloc.Reset();
192 }
193
194 BumpPtrAllocator &getAlloc() { return Alloc; }
195
196 bool empty() const {
197 return DbgValues.empty() && ByvalParmDbgValues.empty() && DbgLabels.empty();
198 }
199
201 auto I = DbgValMap.find(Node);
202 if (I != DbgValMap.end())
203 return I->second;
204 return ArrayRef<SDDbgValue*>();
205 }
206
209
210 DbgIterator DbgBegin() { return DbgValues.begin(); }
211 DbgIterator DbgEnd() { return DbgValues.end(); }
212 DbgIterator ByvalParmDbgBegin() { return ByvalParmDbgValues.begin(); }
213 DbgIterator ByvalParmDbgEnd() { return ByvalParmDbgValues.end(); }
214 DbgLabelIterator DbgLabelBegin() { return DbgLabels.begin(); }
215 DbgLabelIterator DbgLabelEnd() { return DbgLabels.end(); }
216};
217
218LLVM_ABI void checkForCycles(const SelectionDAG *DAG, bool force = false);
219
220/// This is used to represent a portion of an LLVM function in a low-level
221/// Data Dependence DAG representation suitable for instruction selection.
222/// This DAG is constructed as the first step of instruction selection in order
223/// to allow implementation of machine specific optimizations
224/// and code simplifications.
225///
226/// The representation used by the SelectionDAG is a target-independent
227/// representation, which has some similarities to the GCC RTL representation,
228/// but is significantly more simple, powerful, and is a graph form instead of a
229/// linear form.
230///
232 const TargetMachine &TM;
233 const SelectionDAGTargetInfo *TSI = nullptr;
234 const TargetLowering *TLI = nullptr;
235 const TargetLibraryInfo *LibInfo = nullptr;
236 const RTLIB::RuntimeLibcallsInfo *RuntimeLibcallInfo = nullptr;
237 const LibcallLoweringInfo *Libcalls = nullptr;
238
239 const FunctionVarLocs *FnVarLocs = nullptr;
240 MachineFunction *MF;
241 MachineFunctionAnalysisManager *MFAM = nullptr;
242 Pass *SDAGISelPass = nullptr;
243 LLVMContext *Context;
244 CodeGenOptLevel OptLevel;
245
246 UniformityInfo *UA = nullptr;
247 FunctionLoweringInfo * FLI = nullptr;
248
249 /// The function-level optimization remark emitter. Used to emit remarks
250 /// whenever manipulating the DAG.
252
253 ProfileSummaryInfo *PSI = nullptr;
254 BlockFrequencyInfo *BFI = nullptr;
255 MachineModuleInfo *MMI = nullptr;
256
257 /// Extended EVTs used for single value VTLists.
258 std::set<EVT, EVT::compareRawBits> EVTs;
259
260 /// List of non-single value types.
261 FoldingSet<SDVTListNode> VTListMap;
262
263 /// Pool allocation for misc. objects that are created once per SelectionDAG.
264 BumpPtrAllocator Allocator;
265
266 /// The starting token.
267 SDNode EntryNode;
268
269 /// The root of the entire DAG.
270 SDValue Root;
271
272 /// A linked list of nodes in the current DAG.
273 ilist<SDNode> AllNodes;
274
275 /// The AllocatorType for allocating SDNodes. We use
276 /// pool allocation with recycling.
277 using NodeAllocatorType = RecyclingAllocator<BumpPtrAllocator, SDNode,
278 sizeof(LargestSDNode),
279 alignof(MostAlignedSDNode)>;
280
281 /// Pool allocation for nodes.
282 NodeAllocatorType NodeAllocator;
283
284 /// This structure is used to memoize nodes, automatically performing
285 /// CSE with existing nodes when a duplicate is requested.
286 FoldingSet<SDNode> CSEMap;
287
288 /// Pool allocation for machine-opcode SDNode operands.
289 BumpPtrAllocator OperandAllocator;
290 ArrayRecycler<SDUse> OperandRecycler;
291
292 /// Tracks dbg_value and dbg_label information through SDISel.
293 SDDbgInfo *DbgInfo;
294
295 using CallSiteInfo = MachineFunction::CallSiteInfo;
296 using CalledGlobalInfo = MachineFunction::CalledGlobalInfo;
297
298 struct NodeExtraInfo {
299 CallSiteInfo CSInfo;
300 MDNode *HeapAllocSite = nullptr;
301 MDNode *PCSections = nullptr;
302 MDNode *MMRA = nullptr;
303 CalledGlobalInfo CalledGlobal{};
304 bool NoMerge = false;
305 };
306 /// Out-of-line extra information for SDNodes.
308
309 /// PersistentId counter to be used when inserting the next
310 /// SDNode to this SelectionDAG. We do not place that under
311 /// `#if LLVM_ENABLE_ABI_BREAKING_CHECKS` intentionally because
312 /// it adds unneeded complexity without noticeable
313 /// benefits (see discussion with @thakis in D120714).
314 uint16_t NextPersistentId = 0;
315
316public:
317 /// Clients of various APIs that cause global effects on
318 /// the DAG can optionally implement this interface. This allows the clients
319 /// to handle the various sorts of updates that happen.
320 ///
321 /// A DAGUpdateListener automatically registers itself with DAG when it is
322 /// constructed, and removes itself when destroyed in RAII fashion.
326
328 : Next(D.UpdateListeners), DAG(D) {
329 DAG.UpdateListeners = this;
330 }
331
333 assert(DAG.UpdateListeners == this &&
334 "DAGUpdateListeners must be destroyed in LIFO order");
335 DAG.UpdateListeners = Next;
336 }
337
338 /// The node N that was deleted and, if E is not null, an
339 /// equivalent node E that replaced it.
340 virtual void NodeDeleted(SDNode *N, SDNode *E);
341
342 /// The node N that was updated.
343 virtual void NodeUpdated(SDNode *N);
344
345 /// The node N that was inserted.
346 virtual void NodeInserted(SDNode *N);
347 };
348
350 std::function<void(SDNode *, SDNode *)> Callback;
351
355
356 void NodeDeleted(SDNode *N, SDNode *E) override { Callback(N, E); }
357
358 private:
359 virtual void anchor();
360 };
361
363 std::function<void(SDNode *)> Callback;
364
368
369 void NodeInserted(SDNode *N) override { Callback(N); }
370
371 private:
372 virtual void anchor();
373 };
374
375 /// Help to insert SDNodeFlags automatically in transforming. Use
376 /// RAII to save and resume flags in current scope.
378 SelectionDAG &DAG;
379 SDNodeFlags Flags;
380 FlagInserter *LastInserter;
381
382 public:
384 : DAG(SDAG), Flags(Flags),
385 LastInserter(SDAG.getFlagInserter()) {
386 SDAG.setFlagInserter(this);
387 }
390
391 FlagInserter(const FlagInserter &) = delete;
393 ~FlagInserter() { DAG.setFlagInserter(LastInserter); }
394
395 SDNodeFlags getFlags() const { return Flags; }
396 };
397
398 /// When true, additional steps are taken to
399 /// ensure that getConstant() and similar functions return DAG nodes that
400 /// have legal types. This is important after type legalization since
401 /// any illegally typed nodes generated after this point will not experience
402 /// type legalization.
404
405private:
406 /// DAGUpdateListener is a friend so it can manipulate the listener stack.
407 friend struct DAGUpdateListener;
408
409 /// Linked list of registered DAGUpdateListener instances.
410 /// This stack is maintained by DAGUpdateListener RAII.
411 DAGUpdateListener *UpdateListeners = nullptr;
412
413 /// Implementation of setSubgraphColor.
414 /// Return whether we had to truncate the search.
415 bool setSubgraphColorHelper(SDNode *N, const char *Color,
416 DenseSet<SDNode *> &visited,
417 int level, bool &printed);
418
419 template <typename SDNodeT, typename... ArgTypes>
420 SDNodeT *newSDNode(ArgTypes &&... Args) {
421 return new (NodeAllocator.template Allocate<SDNodeT>())
422 SDNodeT(std::forward<ArgTypes>(Args)...);
423 }
424
425 /// Build a synthetic SDNodeT with the given args and extract its subclass
426 /// data as an integer (e.g. for use in a folding set).
427 ///
428 /// The args to this function are the same as the args to SDNodeT's
429 /// constructor, except the second arg (assumed to be a const DebugLoc&) is
430 /// omitted.
431 template <typename SDNodeT, typename... ArgTypes>
432 static uint16_t getSyntheticNodeSubclassData(unsigned IROrder,
433 ArgTypes &&... Args) {
434 // The compiler can reduce this expression to a constant iff we pass an
435 // empty DebugLoc. Thankfully, the debug location doesn't have any bearing
436 // on the subclass data.
437 return SDNodeT(IROrder, DebugLoc(), std::forward<ArgTypes>(Args)...)
438 .getRawSubclassData();
439 }
440
441 template <typename SDNodeTy>
442 static uint16_t getSyntheticNodeSubclassData(unsigned Opc, unsigned Order,
443 SDVTList VTs, EVT MemoryVT,
444 MachineMemOperand *MMO) {
445 return SDNodeTy(Opc, Order, DebugLoc(), VTs, MemoryVT, MMO)
446 .getRawSubclassData();
447 }
448
449 template <typename SDNodeTy>
450 static uint16_t getSyntheticNodeSubclassData(
451 unsigned Opc, unsigned Order, SDVTList VTs, EVT MemoryVT,
452 PointerUnion<MachineMemOperand *, MachineMemOperand **> MemRefs) {
453 return SDNodeTy(Opc, Order, DebugLoc(), VTs, MemoryVT, MemRefs)
454 .getRawSubclassData();
455 }
456
457 void createOperands(SDNode *Node, ArrayRef<SDValue> Vals);
458
459 void removeOperands(SDNode *Node) {
460 if (!Node->OperandList)
461 return;
462 OperandRecycler.deallocate(
464 Node->OperandList);
465 Node->NumOperands = 0;
466 Node->OperandList = nullptr;
467 }
468 void CreateTopologicalOrder(std::vector<SDNode*>& Order);
469
470public:
471 // Maximum depth for recursive analysis such as computeKnownBits, etc.
472 static constexpr unsigned MaxRecursionDepth = 6;
473
474 // Returns the maximum steps for SDNode->hasPredecessor() like searches.
475 LLVM_ABI static unsigned getHasPredecessorMaxSteps();
476
478 SelectionDAG(const SelectionDAG &) = delete;
481
482 /// Prepare this SelectionDAG to process code in the given MachineFunction.
484 Pass *PassPtr, const TargetLibraryInfo *LibraryInfo,
485 const LibcallLoweringInfo *LibcallsInfo,
488 FunctionVarLocs const *FnVarLocs);
489
492 const TargetLibraryInfo *LibraryInfo,
493 const LibcallLoweringInfo *LibcallsInfo, UniformityInfo *UA,
495 MachineModuleInfo &MMI, FunctionVarLocs const *FnVarLocs) {
496 init(NewMF, NewORE, nullptr, LibraryInfo, LibcallsInfo, UA, PSIin, BFIin,
497 MMI, FnVarLocs);
498 MFAM = &AM;
499 }
500
502 FLI = FuncInfo;
503 }
504
505 /// Clear state and free memory necessary to make this
506 /// SelectionDAG ready to process a new block.
507 LLVM_ABI void clear();
508
509 MachineFunction &getMachineFunction() const { return *MF; }
510 const Pass *getPass() const { return SDAGISelPass; }
512
513 bool hasSwiftErrorArg() const;
514
515 CodeGenOptLevel getOptLevel() const { return OptLevel; }
516 const DataLayout &getDataLayout() const { return MF->getDataLayout(); }
517 const TargetMachine &getTarget() const { return TM; }
518 const TargetSubtargetInfo &getSubtarget() const { return MF->getSubtarget(); }
519 template <typename STC> const STC &getSubtarget() const {
520 return MF->getSubtarget<STC>();
521 }
522 const TargetLowering &getTargetLoweringInfo() const { return *TLI; }
523 const TargetLibraryInfo &getLibInfo() const { return *LibInfo; }
524
525 const LibcallLoweringInfo &getLibcalls() const { return *Libcalls; }
526
528 return *RuntimeLibcallInfo;
529 }
530
531 const SelectionDAGTargetInfo &getSelectionDAGInfo() const { return *TSI; }
532 const UniformityInfo *getUniformityInfo() const { return UA; }
533 /// Returns the result of the AssignmentTrackingAnalysis pass if it's
534 /// available, otherwise return nullptr.
535 const FunctionVarLocs *getFunctionVarLocs() const { return FnVarLocs; }
536 LLVMContext *getContext() const { return Context; }
537 OptimizationRemarkEmitter &getORE() const { return *ORE; }
538 ProfileSummaryInfo *getPSI() const { return PSI; }
539 BlockFrequencyInfo *getBFI() const { return BFI; }
540 MachineModuleInfo *getMMI() const { return MMI; }
541
542 FlagInserter *getFlagInserter() { return Inserter; }
543 void setFlagInserter(FlagInserter *FI) { Inserter = FI; }
544
545 /// Just dump dot graph to a user-provided path and title.
546 /// This doesn't open the dot viewer program and
547 /// helps visualization when outside debugging session.
548 /// FileName expects absolute path. If provided
549 /// without any path separators then the file
550 /// will be created in the current directory.
551 /// Error will be emitted if the path is insane.
552#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
553 LLVM_DUMP_METHOD void dumpDotGraph(const Twine &FileName, const Twine &Title);
554#endif
555
556 /// Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
557 LLVM_ABI void viewGraph(const std::string &Title);
558 LLVM_ABI void viewGraph();
559
560#if LLVM_ENABLE_ABI_BREAKING_CHECKS
561 std::map<const SDNode *, std::string> NodeGraphAttrs;
562#endif
563
564 /// Clear all previously defined node graph attributes.
565 /// Intended to be used from a debugging tool (eg. gdb).
567
568 /// Set graph attributes for a node. (eg. "color=red".)
569 LLVM_ABI void setGraphAttrs(const SDNode *N, const char *Attrs);
570
571 /// Get graph attributes for a node. (eg. "color=red".)
572 /// Used from getNodeAttributes.
573 LLVM_ABI std::string getGraphAttrs(const SDNode *N) const;
574
575 /// Convenience for setting node color attribute.
576 LLVM_ABI void setGraphColor(const SDNode *N, const char *Color);
577
578 /// Convenience for setting subgraph color attribute.
579 LLVM_ABI void setSubgraphColor(SDNode *N, const char *Color);
580
582
583 allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); }
584 allnodes_const_iterator allnodes_end() const { return AllNodes.end(); }
585
587
588 allnodes_iterator allnodes_begin() { return AllNodes.begin(); }
589 allnodes_iterator allnodes_end() { return AllNodes.end(); }
590
592 return AllNodes.size();
593 }
594
601
602 /// Return the root tag of the SelectionDAG.
603 const SDValue &getRoot() const { return Root; }
604
605 /// Return the token chain corresponding to the entry of the function.
607 return SDValue(const_cast<SDNode *>(&EntryNode), 0);
608 }
609
610 /// Set the current root tag of the SelectionDAG.
611 ///
613 assert((!N.getNode() || N.getValueType() == MVT::Other) &&
614 "DAG root value is not a chain!");
615 if (N.getNode())
616 checkForCycles(N.getNode(), this);
617 Root = N;
618 if (N.getNode())
619 checkForCycles(this);
620 return Root;
621 }
622
623#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
624 void VerifyDAGDivergence();
625#endif
626
627 /// This iterates over the nodes in the SelectionDAG, folding
628 /// certain types of nodes together, or eliminating superfluous nodes. The
629 /// Level argument controls whether Combine is allowed to produce nodes and
630 /// types that are illegal on the target.
631 LLVM_ABI void Combine(CombineLevel Level, BatchAAResults *BatchAA,
632 CodeGenOptLevel OptLevel);
633
634 /// This transforms the SelectionDAG into a SelectionDAG that
635 /// only uses types natively supported by the target.
636 /// Returns "true" if it made any changes.
637 ///
638 /// Note that this is an involved process that may invalidate pointers into
639 /// the graph.
640 LLVM_ABI bool LegalizeTypes();
641
642 /// This transforms the SelectionDAG into a SelectionDAG that is
643 /// compatible with the target instruction selector, as indicated by the
644 /// TargetLowering object.
645 ///
646 /// Note that this is an involved process that may invalidate pointers into
647 /// the graph.
648 LLVM_ABI void Legalize();
649
650 /// Transforms a SelectionDAG node and any operands to it into a node
651 /// that is compatible with the target instruction selector, as indicated by
652 /// the TargetLowering object.
653 ///
654 /// \returns true if \c N is a valid, legal node after calling this.
655 ///
656 /// This essentially runs a single recursive walk of the \c Legalize process
657 /// over the given node (and its operands). This can be used to incrementally
658 /// legalize the DAG. All of the nodes which are directly replaced,
659 /// potentially including N, are added to the output parameter \c
660 /// UpdatedNodes so that the delta to the DAG can be understood by the
661 /// caller.
662 ///
663 /// When this returns false, N has been legalized in a way that make the
664 /// pointer passed in no longer valid. It may have even been deleted from the
665 /// DAG, and so it shouldn't be used further. When this returns true, the
666 /// N passed in is a legal node, and can be immediately processed as such.
667 /// This may still have done some work on the DAG, and will still populate
668 /// UpdatedNodes with any new nodes replacing those originally in the DAG.
670 SmallSetVector<SDNode *, 16> &UpdatedNodes);
671
672 /// This transforms the SelectionDAG into a SelectionDAG
673 /// that only uses vector math operations supported by the target. This is
674 /// necessary as a separate step from Legalize because unrolling a vector
675 /// operation can introduce illegal types, which requires running
676 /// LegalizeTypes again.
677 ///
678 /// This returns true if it made any changes; in that case, LegalizeTypes
679 /// is called again before Legalize.
680 ///
681 /// Note that this is an involved process that may invalidate pointers into
682 /// the graph.
684
685 /// This method deletes all unreachable nodes in the SelectionDAG.
687
688 /// Remove the specified node from the system. This node must
689 /// have no referrers.
691
692 /// Return an SDVTList that represents the list of values specified.
695 LLVM_ABI SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3);
696 LLVM_ABI SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3, EVT VT4);
698
699 //===--------------------------------------------------------------------===//
700 // Node creation methods.
701
702 /// Create a ConstantSDNode wrapping a constant value.
703 /// If VT is a vector type, the constant is splatted into a BUILD_VECTOR.
704 ///
705 /// If only legal types can be produced, this does the necessary
706 /// transformations (e.g., if the vector element type is illegal).
707 /// @{
709 bool isTarget = false, bool isOpaque = false);
710 LLVM_ABI SDValue getConstant(const APInt &Val, const SDLoc &DL, EVT VT,
711 bool isTarget = false, bool isOpaque = false);
712
713 LLVM_ABI SDValue getSignedConstant(int64_t Val, const SDLoc &DL, EVT VT,
714 bool isTarget = false,
715 bool isOpaque = false);
716
718 bool IsTarget = false,
719 bool IsOpaque = false);
720
721 LLVM_ABI SDValue getConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT,
722 bool isTarget = false, bool isOpaque = false);
724 bool isTarget = false);
726 const SDLoc &DL);
728 const SDLoc &DL);
730 bool isTarget = false);
731
733 bool isOpaque = false) {
734 return getConstant(Val, DL, VT, true, isOpaque);
735 }
736 SDValue getTargetConstant(const APInt &Val, const SDLoc &DL, EVT VT,
737 bool isOpaque = false) {
738 return getConstant(Val, DL, VT, true, isOpaque);
739 }
741 bool isOpaque = false) {
742 return getConstant(Val, DL, VT, true, isOpaque);
743 }
744 SDValue getSignedTargetConstant(int64_t Val, const SDLoc &DL, EVT VT,
745 bool isOpaque = false) {
746 return getSignedConstant(Val, DL, VT, true, isOpaque);
747 }
748
749 /// Create a true or false constant of type \p VT using the target's
750 /// BooleanContent for type \p OpVT.
751 LLVM_ABI SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT);
752 /// @}
753
754 /// Create a ConstantFPSDNode wrapping a constant value.
755 /// If VT is a vector type, the constant is splatted into a BUILD_VECTOR.
756 ///
757 /// If only legal types can be produced, this does the necessary
758 /// transformations (e.g., if the vector element type is illegal).
759 /// The forms that take a double should only be used for simple constants
760 /// that can be exactly represented in VT. No checks are made.
761 /// @{
762 LLVM_ABI SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT,
763 bool isTarget = false);
764 LLVM_ABI SDValue getConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT,
765 bool isTarget = false);
766 LLVM_ABI SDValue getConstantFP(const ConstantFP &V, const SDLoc &DL, EVT VT,
767 bool isTarget = false);
768 SDValue getTargetConstantFP(double Val, const SDLoc &DL, EVT VT) {
769 return getConstantFP(Val, DL, VT, true);
770 }
771 SDValue getTargetConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT) {
772 return getConstantFP(Val, DL, VT, true);
773 }
775 return getConstantFP(Val, DL, VT, true);
776 }
777 /// @}
778
780 EVT VT, int64_t offset = 0,
781 bool isTargetGA = false,
782 unsigned TargetFlags = 0);
784 int64_t offset = 0, unsigned TargetFlags = 0) {
785 return getGlobalAddress(GV, DL, VT, offset, true, TargetFlags);
786 }
788 LLVM_ABI SDValue getFrameIndex(int FI, EVT VT, bool isTarget = false);
790 return getFrameIndex(FI, VT, true);
791 }
792 LLVM_ABI SDValue getJumpTable(int JTI, EVT VT, bool isTarget = false,
793 unsigned TargetFlags = 0);
794 SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags = 0) {
795 return getJumpTable(JTI, VT, true, TargetFlags);
796 }
798 const SDLoc &DL);
800 MaybeAlign Align = std::nullopt,
801 int Offs = 0, bool isT = false,
802 unsigned TargetFlags = 0);
804 MaybeAlign Align = std::nullopt, int Offset = 0,
805 unsigned TargetFlags = 0) {
806 return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
807 }
809 MaybeAlign Align = std::nullopt,
810 int Offs = 0, bool isT = false,
811 unsigned TargetFlags = 0);
813 MaybeAlign Align = std::nullopt, int Offset = 0,
814 unsigned TargetFlags = 0) {
815 return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
816 }
817 // When generating a branch to a BB, we don't in general know enough
818 // to provide debug info for the BB at that time, so keep this one around.
820 LLVM_ABI SDValue getExternalSymbol(const char *Sym, EVT VT);
821 LLVM_ABI SDValue getExternalSymbol(RTLIB::LibcallImpl LCImpl, EVT VT);
822 LLVM_ABI SDValue getTargetExternalSymbol(const char *Sym, EVT VT,
823 unsigned TargetFlags = 0);
824 LLVM_ABI SDValue getTargetExternalSymbol(RTLIB::LibcallImpl LCImpl, EVT VT,
825 unsigned TargetFlags = 0);
826
828
832 LLVM_ABI SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label);
833 LLVM_ABI SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root,
834 MCSymbol *Label);
836 int64_t Offset = 0, bool isTarget = false,
837 unsigned TargetFlags = 0);
839 int64_t Offset = 0, unsigned TargetFlags = 0) {
840 return getBlockAddress(BA, VT, Offset, true, TargetFlags);
841 }
842
844 SDValue N) {
845 return getNode(ISD::CopyToReg, dl, MVT::Other, Chain,
846 getRegister(Reg, N.getValueType()), N);
847 }
848
849 // This version of the getCopyToReg method takes an extra operand, which
850 // indicates that there is potentially an incoming glue value (if Glue is not
851 // null) and that there should be a glue result.
853 SDValue Glue) {
854 SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
855 SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Glue };
856 return getNode(ISD::CopyToReg, dl, VTs,
857 ArrayRef(Ops, Glue.getNode() ? 4 : 3));
858 }
859
860 // Similar to last getCopyToReg() except parameter Reg is a SDValue
862 SDValue Glue) {
863 SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
864 SDValue Ops[] = { Chain, Reg, N, Glue };
865 return getNode(ISD::CopyToReg, dl, VTs,
866 ArrayRef(Ops, Glue.getNode() ? 4 : 3));
867 }
868
870 SDVTList VTs = getVTList(VT, MVT::Other);
871 SDValue Ops[] = { Chain, getRegister(Reg, VT) };
872 return getNode(ISD::CopyFromReg, dl, VTs, Ops);
873 }
874
875 // This version of the getCopyFromReg method takes an extra operand, which
876 // indicates that there is potentially an incoming glue value (if Glue is not
877 // null) and that there should be a glue result.
879 SDValue Glue) {
880 SDVTList VTs = getVTList(VT, MVT::Other, MVT::Glue);
881 SDValue Ops[] = { Chain, getRegister(Reg, VT), Glue };
882 return getNode(ISD::CopyFromReg, dl, VTs,
883 ArrayRef(Ops, Glue.getNode() ? 3 : 2));
884 }
885
887
888 /// Return an ISD::VECTOR_SHUFFLE node. The number of elements in VT,
889 /// which must be a vector type, must match the number of mask elements
890 /// NumElts. An integer mask element equal to -1 is treated as undefined.
892 SDValue N2, ArrayRef<int> Mask);
893
894 /// Return an ISD::BUILD_VECTOR node. The number of elements in VT,
895 /// which must be a vector type, must match the number of operands in Ops.
896 /// The operands must have the same type as (or, for integers, a type wider
897 /// than) VT's element type.
899 // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
900 return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
901 }
902
903 /// Return an ISD::BUILD_VECTOR node. The number of elements in VT,
904 /// which must be a vector type, must match the number of operands in Ops.
905 /// The operands must have the same type as (or, for integers, a type wider
906 /// than) VT's element type.
908 // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
909 return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
910 }
911
912 /// Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all
913 /// elements. VT must be a vector type. Op's type must be the same as (or,
914 /// for integers, a type wider than) VT's element type.
916 // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
917 if (Op.isUndef()) {
918 assert((VT.getVectorElementType() == Op.getValueType() ||
919 (VT.isInteger() &&
920 VT.getVectorElementType().bitsLE(Op.getValueType()))) &&
921 "A splatted value must have a width equal or (for integers) "
922 "greater than the vector element type!");
923 return getNode(ISD::UNDEF, SDLoc(), VT);
924 }
925
927 return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
928 }
929
930 // Return a splat ISD::SPLAT_VECTOR node, consisting of Op splatted to all
931 // elements.
933 if (Op.isUndef()) {
934 assert((VT.getVectorElementType() == Op.getValueType() ||
935 (VT.isInteger() &&
936 VT.getVectorElementType().bitsLE(Op.getValueType()))) &&
937 "A splatted value must have a width equal or (for integers) "
938 "greater than the vector element type!");
939 return getNode(ISD::UNDEF, SDLoc(), VT);
940 }
941 return getNode(ISD::SPLAT_VECTOR, DL, VT, Op);
942 }
943
944 /// Returns a node representing a splat of one value into all lanes
945 /// of the provided vector type. This is a utility which returns
946 /// either a BUILD_VECTOR or SPLAT_VECTOR depending on the
947 /// scalability of the desired vector type.
949 assert(VT.isVector() && "Can't splat to non-vector type");
950 return VT.isScalableVector() ?
952 }
953
954 /// Returns a vector of type ResVT whose elements contain the linear sequence
955 /// <0, Step, Step * 2, Step * 3, ...>
957 const APInt &StepVal);
958
959 /// Returns a vector of type ResVT whose elements contain the linear sequence
960 /// <0, 1, 2, 3, ...>
961 LLVM_ABI SDValue getStepVector(const SDLoc &DL, EVT ResVT);
962
963 /// Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to
964 /// the shuffle node in input but with swapped operands.
965 ///
966 /// Example: shuffle A, B, <0,5,2,7> -> shuffle B, A, <4,1,6,3>
968
969 /// Extract element at \p Idx from \p Vec. See EXTRACT_VECTOR_ELT
970 /// description for result type handling.
972 unsigned Idx) {
973 return getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, Vec,
975 }
976
977 /// Insert \p Elt into \p Vec at offset \p Idx. See INSERT_VECTOR_ELT
978 /// description for element type handling.
980 unsigned Idx) {
981 return getNode(ISD::INSERT_VECTOR_ELT, DL, Vec.getValueType(), Vec, Elt,
983 }
984
985 /// Insert \p SubVec at the \p Idx element of \p Vec.
987 unsigned Idx) {
988 return getNode(ISD::INSERT_SUBVECTOR, DL, Vec.getValueType(), Vec, SubVec,
990 }
991
992 /// Return the \p VT typed sub-vector of \p Vec at \p Idx
994 unsigned Idx) {
995 return getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, Vec,
997 }
998
999 /// Convert Op, which must be of float type, to the
1000 /// float type VT, by either extending or rounding (by truncation).
1002
1003 /// Convert Op, which must be a STRICT operation of float type, to the
1004 /// float type VT, by either extending or rounding (by truncation).
1005 LLVM_ABI std::pair<SDValue, SDValue>
1007
1008 /// Convert *_EXTEND_VECTOR_INREG to *_EXTEND opcode.
1009 static unsigned getOpcode_EXTEND(unsigned Opcode) {
1010 switch (Opcode) {
1011 case ISD::ANY_EXTEND:
1013 return ISD::ANY_EXTEND;
1014 case ISD::ZERO_EXTEND:
1016 return ISD::ZERO_EXTEND;
1017 case ISD::SIGN_EXTEND:
1019 return ISD::SIGN_EXTEND;
1020 }
1021 llvm_unreachable("Unknown opcode");
1022 }
1023
1024 /// Convert *_EXTEND to *_EXTEND_VECTOR_INREG opcode.
1025 static unsigned getOpcode_EXTEND_VECTOR_INREG(unsigned Opcode) {
1026 switch (Opcode) {
1027 case ISD::ANY_EXTEND:
1030 case ISD::ZERO_EXTEND:
1033 case ISD::SIGN_EXTEND:
1036 }
1037 llvm_unreachable("Unknown opcode");
1038 }
1039
1040 /// Convert Op, which must be of integer type, to the
1041 /// integer type VT, by either any-extending or truncating it.
1043
1044 /// Convert Op, which must be of integer type, to the
1045 /// integer type VT, by either sign-extending or truncating it.
1047
1048 /// Convert Op, which must be of integer type, to the
1049 /// integer type VT, by either zero-extending or truncating it.
1051
1052 /// Convert Op, which must be of integer type, to the
1053 /// integer type VT, by either any/sign/zero-extending (depending on IsAny /
1054 /// IsSigned) or truncating it.
1056 EVT VT, unsigned Opcode) {
1057 switch(Opcode) {
1058 case ISD::ANY_EXTEND:
1059 return getAnyExtOrTrunc(Op, DL, VT);
1060 case ISD::ZERO_EXTEND:
1061 return getZExtOrTrunc(Op, DL, VT);
1062 case ISD::SIGN_EXTEND:
1063 return getSExtOrTrunc(Op, DL, VT);
1064 }
1065 llvm_unreachable("Unsupported opcode");
1066 }
1067
1068 /// Convert Op, which must be of integer type, to the
1069 /// integer type VT, by either sign/zero-extending (depending on IsSigned) or
1070 /// truncating it.
1071 SDValue getExtOrTrunc(bool IsSigned, SDValue Op, const SDLoc &DL, EVT VT) {
1072 return IsSigned ? getSExtOrTrunc(Op, DL, VT) : getZExtOrTrunc(Op, DL, VT);
1073 }
1074
1075 /// Convert Op, which must be of integer type, to the
1076 /// integer type VT, by first bitcasting (from potential vector) to
1077 /// corresponding scalar type then either any-extending or truncating it.
1079 EVT VT);
1080
1081 /// Convert Op, which must be of integer type, to the
1082 /// integer type VT, by first bitcasting (from potential vector) to
1083 /// corresponding scalar type then either sign-extending or truncating it.
1085
1086 /// Convert Op, which must be of integer type, to the
1087 /// integer type VT, by first bitcasting (from potential vector) to
1088 /// corresponding scalar type then either zero-extending or truncating it.
1090
1091 /// Return the expression required to zero extend the Op
1092 /// value assuming it was the smaller SrcTy value.
1094
1095 /// Convert Op, which must be of integer type, to the integer type VT, by
1096 /// either truncating it or performing either zero or sign extension as
1097 /// appropriate extension for the pointer's semantics.
1099
1100 /// Return the expression required to extend the Op as a pointer value
1101 /// assuming it was the smaller SrcTy value. This may be either a zero extend
1102 /// or a sign extend.
1104
1105 /// Convert Op, which must be of integer type, to the integer type VT,
1106 /// by using an extension appropriate for the target's
1107 /// BooleanContent for type OpVT or truncating it.
1109 EVT OpVT);
1110
1111 /// Create negative operation as (SUB 0, Val).
1112 LLVM_ABI SDValue getNegative(SDValue Val, const SDLoc &DL, EVT VT);
1113
1114 /// Create a bitwise NOT operation as (XOR Val, -1).
1115 LLVM_ABI SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT);
1116
1117 /// Create a logical NOT operation as (XOR Val, BooleanOne).
1118 LLVM_ABI SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT);
1119
1120 /// Returns sum of the base pointer and offset.
1121 /// Unlike getObjectPtrOffset this does not set NoUnsignedWrap and InBounds by
1122 /// default.
1125 const SDNodeFlags Flags = SDNodeFlags());
1128 const SDNodeFlags Flags = SDNodeFlags());
1129
1130 /// Create an add instruction with appropriate flags when used for
1131 /// addressing some offset of an object. i.e. if a load is split into multiple
1132 /// components, create an add nuw (or ptradd nuw inbounds) from the base
1133 /// pointer to the offset.
1138
1140 // The object itself can't wrap around the address space, so it shouldn't be
1141 // possible for the adds of the offsets to the split parts to overflow.
1142 return getMemBasePlusOffset(
1144 }
1145
1146 /// Return a new CALLSEQ_START node, that starts new call frame, in which
1147 /// InSize bytes are set up inside CALLSEQ_START..CALLSEQ_END sequence and
1148 /// OutSize specifies part of the frame set up prior to the sequence.
1150 const SDLoc &DL) {
1151 SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
1152 SDValue Ops[] = { Chain,
1153 getIntPtrConstant(InSize, DL, true),
1154 getIntPtrConstant(OutSize, DL, true) };
1155 return getNode(ISD::CALLSEQ_START, DL, VTs, Ops);
1156 }
1157
1158 /// Return a new CALLSEQ_END node, which always must have a
1159 /// glue result (to ensure it's not CSE'd).
1160 /// CALLSEQ_END does not have a useful SDLoc.
1162 SDValue InGlue, const SDLoc &DL) {
1163 SDVTList NodeTys = getVTList(MVT::Other, MVT::Glue);
1165 Ops.push_back(Chain);
1166 Ops.push_back(Op1);
1167 Ops.push_back(Op2);
1168 if (InGlue.getNode())
1169 Ops.push_back(InGlue);
1170 return getNode(ISD::CALLSEQ_END, DL, NodeTys, Ops);
1171 }
1172
1174 SDValue Glue, const SDLoc &DL) {
1175 return getCALLSEQ_END(
1176 Chain, getIntPtrConstant(Size1, DL, /*isTarget=*/true),
1177 getIntPtrConstant(Size2, DL, /*isTarget=*/true), Glue, DL);
1178 }
1179
1180 /// Return true if the result of this operation is always undefined.
1181 LLVM_ABI bool isUndef(unsigned Opcode, ArrayRef<SDValue> Ops);
1182
1183 /// Return an UNDEF node. UNDEF does not have a useful SDLoc.
1185 return getNode(ISD::UNDEF, SDLoc(), VT);
1186 }
1187
1188 /// Return a POISON node. POISON does not have a useful SDLoc.
1190
1191 /// Return a node that represents the runtime scaling 'MulImm * RuntimeVL'.
1192 LLVM_ABI SDValue getVScale(const SDLoc &DL, EVT VT, APInt MulImm);
1193
1195
1197
1198 /// Return a vector with the first 'Len' lanes set to true and remaining lanes
1199 /// set to false. The mask's ValueType is the same as when comparing vectors
1200 /// of type VT.
1202 ElementCount Len);
1203
1204 /// Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
1208
1209 /// Gets or creates the specified node.
1210 ///
1211 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1213 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1214 ArrayRef<SDValue> Ops, const SDNodeFlags Flags);
1215 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL,
1217 const SDNodeFlags Flags);
1218 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1219 ArrayRef<SDValue> Ops, const SDNodeFlags Flags);
1220
1221 // Use flags from current flag inserter.
1222 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1224 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL,
1226 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1228 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1229 SDValue Operand);
1230 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1231 SDValue N2);
1232 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1233 SDValue N2, SDValue N3);
1234
1235 // Specialize based on number of operands.
1236 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT);
1237 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1238 SDValue Operand, const SDNodeFlags Flags);
1239 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1240 SDValue N2, const SDNodeFlags Flags);
1241 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1242 SDValue N2, SDValue N3, const SDNodeFlags Flags);
1243 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1244 SDValue N2, SDValue N3, SDValue N4);
1245 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1246 SDValue N2, SDValue N3, SDValue N4,
1247 const SDNodeFlags Flags);
1248 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1249 SDValue N2, SDValue N3, SDValue N4, SDValue N5);
1250 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1251 SDValue N2, SDValue N3, SDValue N4, SDValue N5,
1252 const SDNodeFlags Flags);
1253
1254 // Specialize again based on number of operands for nodes with a VTList
1255 // rather than a single VT.
1256 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList);
1257 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1258 SDValue N);
1259 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1260 SDValue N1, SDValue N2);
1261 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1262 SDValue N1, SDValue N2, SDValue N3);
1263 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1264 SDValue N1, SDValue N2, SDValue N3, SDValue N4);
1265 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1266 SDValue N1, SDValue N2, SDValue N3, SDValue N4,
1267 SDValue N5);
1268
1269 /// Compute a TokenFactor to force all the incoming stack arguments to be
1270 /// loaded from the stack. This is used in tail call lowering to protect
1271 /// stack arguments from being clobbered.
1273
1274 /// Lower a memccpy operation into a target library call and return the
1275 /// resulting chain and call result as SelectionDAG SDValues.
1276 LLVM_ABI std::pair<SDValue, SDValue>
1277 getMemccpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
1278 SDValue C, SDValue Size, const CallInst *CI);
1279
1280 /// Lower a memcmp operation into a target library call and return the
1281 /// resulting chain and call result as SelectionDAG SDValues.
1282 LLVM_ABI std::pair<SDValue, SDValue> getMemcmp(SDValue Chain, const SDLoc &dl,
1283 SDValue Dst, SDValue Src,
1284 SDValue Size,
1285 const CallInst *CI);
1286
1287 /// Lower a strcmp operation into a target library call and return the
1288 /// resulting chain and call result as SelectionDAG SDValues.
1289 LLVM_ABI std::pair<SDValue, SDValue> getStrcmp(SDValue Chain, const SDLoc &dl,
1290 SDValue S0, SDValue S1,
1291 const CallInst *CI);
1292
1293 /// Lower a strcpy operation into a target library call and return the
1294 /// resulting chain and call result as SelectionDAG SDValues.
1295 LLVM_ABI std::pair<SDValue, SDValue> getStrcpy(SDValue Chain, const SDLoc &dl,
1296 SDValue Dst, SDValue Src,
1297 const CallInst *CI);
1298
1299 /// Lower a strlen operation into a target library call and return the
1300 /// resulting chain and call result as SelectionDAG SDValues.
1301 LLVM_ABI std::pair<SDValue, SDValue>
1302 getStrlen(SDValue Chain, const SDLoc &dl, SDValue Src, const CallInst *CI);
1303
1304 /// Lower a strstr operation into a target library call and return the
1305 /// resulting chain and call result as SelectionDAG SDValues.
1306 LLVM_ABI std::pair<SDValue, SDValue> getStrstr(SDValue Chain, const SDLoc &dl,
1307 SDValue S0, SDValue S1,
1308 const CallInst *CI);
1309
1310 /* \p CI if not null is the memset call being lowered.
1311 * \p OverrideTailCall is an optional parameter that can be used to override
1312 * the tail call optimization decision. */
1314 SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size,
1315 Align DstAlign, Align SrcAlign, bool isVol, bool AlwaysInline,
1316 const CallInst *CI, std::optional<bool> OverrideTailCall,
1317 MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo,
1318 const AAMDNodes &AAInfo = AAMDNodes(), BatchAAResults *BatchAA = nullptr);
1319
1320 /* \p CI if not null is the memset call being lowered.
1321 * \p OverrideTailCall is an optional parameter that can be used to override
1322 * the tail call optimization decision. */
1323 LLVM_ABI SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst,
1324 SDValue Src, SDValue Size, Align DstAlign,
1325 Align SrcAlign, bool isVol, const CallInst *CI,
1326 std::optional<bool> OverrideTailCall,
1327 MachinePointerInfo DstPtrInfo,
1328 MachinePointerInfo SrcPtrInfo,
1329 const AAMDNodes &AAInfo = AAMDNodes(),
1330 BatchAAResults *BatchAA = nullptr);
1331
1332 LLVM_ABI SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst,
1333 SDValue Src, SDValue Size, Align Alignment,
1334 bool isVol, bool AlwaysInline, const CallInst *CI,
1335 MachinePointerInfo DstPtrInfo,
1336 const AAMDNodes &AAInfo = AAMDNodes());
1337
1338 LLVM_ABI SDValue getAtomicMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst,
1339 SDValue Src, SDValue Size, Type *SizeTy,
1340 unsigned ElemSz, bool isTailCall,
1341 MachinePointerInfo DstPtrInfo,
1342 MachinePointerInfo SrcPtrInfo);
1343
1344 LLVM_ABI SDValue getAtomicMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst,
1345 SDValue Src, SDValue Size, Type *SizeTy,
1346 unsigned ElemSz, bool isTailCall,
1347 MachinePointerInfo DstPtrInfo,
1348 MachinePointerInfo SrcPtrInfo);
1349
1350 LLVM_ABI SDValue getAtomicMemset(SDValue Chain, const SDLoc &dl, SDValue Dst,
1351 SDValue Value, SDValue Size, Type *SizeTy,
1352 unsigned ElemSz, bool isTailCall,
1353 MachinePointerInfo DstPtrInfo);
1354
1355 /// Helper function to make it easier to build SetCC's if you just have an
1356 /// ISD::CondCode instead of an SDValue.
1358 ISD::CondCode Cond, SDValue Chain = SDValue(),
1359 bool IsSignaling = false, SDNodeFlags Flags = {}) {
1360 assert(LHS.getValueType().isVector() == RHS.getValueType().isVector() &&
1361 "Vector/scalar operand type mismatch for setcc");
1362 assert(LHS.getValueType().isVector() == VT.isVector() &&
1363 "Vector/scalar result type mismatch for setcc");
1365 "Cannot create a setCC of an invalid node.");
1366 if (Chain)
1367 return getNode(IsSignaling ? ISD::STRICT_FSETCCS : ISD::STRICT_FSETCC, DL,
1368 {VT, MVT::Other}, {Chain, LHS, RHS, getCondCode(Cond)},
1369 Flags);
1370 return getNode(ISD::SETCC, DL, VT, LHS, RHS, getCondCode(Cond), Flags);
1371 }
1372
1373 /// Helper function to make it easier to build Select's if you just have
1374 /// operands and don't want to check for vector.
1376 SDValue RHS, SDNodeFlags Flags = SDNodeFlags()) {
1377 assert(LHS.getValueType() == VT && RHS.getValueType() == VT &&
1378 "Cannot use select on differing types");
1379 auto Opcode = Cond.getValueType().isVector() ? ISD::VSELECT : ISD::SELECT;
1380 return getNode(Opcode, DL, VT, Cond, LHS, RHS, Flags);
1381 }
1382
1383 /// Helper function to make it easier to build SelectCC's if you just have an
1384 /// ISD::CondCode instead of an SDValue.
1386 SDValue False, ISD::CondCode Cond,
1387 SDNodeFlags Flags = SDNodeFlags()) {
1388 return getNode(ISD::SELECT_CC, DL, True.getValueType(), LHS, RHS, True,
1389 False, getCondCode(Cond), Flags);
1390 }
1391
1392 /// Try to simplify a select/vselect into 1 of its operands or a constant.
1394
1395 /// Try to simplify a shift into 1 of its operands or a constant.
1397
1398 /// Try to simplify a floating-point binary operation into 1 of its operands
1399 /// or a constant.
1400 LLVM_ABI SDValue simplifyFPBinop(unsigned Opcode, SDValue X, SDValue Y,
1401 SDNodeFlags Flags);
1402
1403 /// VAArg produces a result and token chain, and takes a pointer
1404 /// and a source value as input.
1405 LLVM_ABI SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1406 SDValue SV, unsigned Align);
1407
1408 /// Gets a node for an atomic cmpxchg op. There are two
1409 /// valid Opcodes. ISD::ATOMIC_CMO_SWAP produces the value loaded and a
1410 /// chain result. ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS produces the value loaded,
1411 /// a success flag (initially i1), and a chain.
1412 LLVM_ABI SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT,
1413 SDVTList VTs, SDValue Chain, SDValue Ptr,
1414 SDValue Cmp, SDValue Swp,
1415 MachineMemOperand *MMO);
1416
1417 /// Gets a node for an atomic op, produces result (if relevant)
1418 /// and chain and takes 2 operands.
1419 LLVM_ABI SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT,
1420 SDValue Chain, SDValue Ptr, SDValue Val,
1421 MachineMemOperand *MMO);
1422
1423 /// Gets a node for an atomic op, produces result and chain and takes N
1424 /// operands.
1425 LLVM_ABI SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT,
1427 MachineMemOperand *MMO,
1429
1431 EVT MemVT, EVT VT, SDValue Chain, SDValue Ptr,
1432 MachineMemOperand *MMO);
1433
1434 /// Creates a MemIntrinsicNode that may produce a
1435 /// result and takes a list of operands. Opcode may be INTRINSIC_VOID,
1436 /// INTRINSIC_W_CHAIN, or a target-specific memory-referencing opcode
1437 // (see `SelectionDAGTargetInfo::isTargetMemoryOpcode`).
1439 unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
1440 EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment,
1444 const AAMDNodes &AAInfo = AAMDNodes());
1445
1447 unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
1448 EVT MemVT, MachinePointerInfo PtrInfo,
1449 MaybeAlign Alignment = std::nullopt,
1453 const AAMDNodes &AAInfo = AAMDNodes()) {
1454 // Ensure that codegen never sees alignment 0
1455 return getMemIntrinsicNode(Opcode, dl, VTList, Ops, MemVT, PtrInfo,
1456 Alignment.value_or(getEVTAlign(MemVT)), Flags,
1457 Size, AAInfo);
1458 }
1459
1460 LLVM_ABI SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl,
1462 EVT MemVT, MachineMemOperand *MMO);
1463
1464 /// getMemIntrinsicNode - Creates a MemIntrinsicNode with multiple MMOs.
1465 LLVM_ABI SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl,
1467 EVT MemVT,
1469
1470 /// Creates a LifetimeSDNode that starts (`IsStart==true`) or ends
1471 /// (`IsStart==false`) the lifetime of the `FrameIndex`.
1472 LLVM_ABI SDValue getLifetimeNode(bool IsStart, const SDLoc &dl, SDValue Chain,
1473 int FrameIndex);
1474
1475 /// Creates a PseudoProbeSDNode with function GUID `Guid` and
1476 /// the index of the block `Index` it is probing, as well as the attributes
1477 /// `attr` of the probe.
1479 uint64_t Guid, uint64_t Index,
1480 uint32_t Attr);
1481
1482 /// Create a MERGE_VALUES node from the given operands.
1484
1485 /// Return poison values for each of \p ResultTypes, substituting \p Chain
1486 /// for any result of type MVT::Other, merged into a single MERGE_VALUES
1487 /// node. Used to salvage a chain when an operation cannot be lowered due
1488 /// to an error, and the program will be discarded.
1490 const SDLoc &dl);
1491
1492 /// Loads are not normal binary operators: their result type is not
1493 /// determined by their operands, and they produce a value AND a token chain.
1494 ///
1495 /// This function will set the MOLoad flag on MMOFlags, but you can set it if
1496 /// you want. The MOStore flag must not be set.
1498 getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1499 MachinePointerInfo PtrInfo, MaybeAlign Alignment = MaybeAlign(),
1501 const MMOMetadata &Metadata = MMOMetadata());
1502 LLVM_ABI SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1503 MachineMemOperand *MMO);
1505 getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain,
1506 SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT,
1507 MaybeAlign Alignment = MaybeAlign(),
1509 const MMOMetadata &Metadata = MMOMetadata());
1510 LLVM_ABI SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
1511 SDValue Chain, SDValue Ptr, EVT MemVT,
1512 MachineMemOperand *MMO);
1513 LLVM_ABI SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl,
1518 const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1519 MachinePointerInfo PtrInfo, EVT MemVT, Align Alignment,
1521 const MMOMetadata &Metadata = MMOMetadata());
1522 inline SDValue
1524 const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1525 MachinePointerInfo PtrInfo, EVT MemVT,
1526 MaybeAlign Alignment = MaybeAlign(),
1528 const MMOMetadata &Metadata = MMOMetadata()) {
1529 // Ensures that codegen never sees a None Alignment.
1530 return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, PtrInfo, MemVT,
1531 Alignment.value_or(getEVTAlign(MemVT)), MMOFlags, Metadata);
1532 }
1534 EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1535 SDValue Offset, EVT MemVT, MachineMemOperand *MMO);
1536
1537 /// Helper function to build ISD::STORE nodes.
1538 ///
1539 /// This function will set the MOStore flag on MMOFlags, but you can set it if
1540 /// you want. The MOLoad and MOInvariant flags must not be set.
1541
1543 getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1544 MachinePointerInfo PtrInfo, Align Alignment,
1546 const MMOMetadata &Metadata = MMOMetadata());
1547 inline SDValue
1548 getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1549 MachinePointerInfo PtrInfo, MaybeAlign Alignment = MaybeAlign(),
1551 const MMOMetadata &Metadata = MMOMetadata()) {
1552 return getStore(Chain, dl, Val, Ptr, PtrInfo,
1553 Alignment.value_or(getEVTAlign(Val.getValueType())),
1554 MMOFlags, Metadata);
1555 }
1556 LLVM_ABI SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1557 SDValue Ptr, MachineMemOperand *MMO);
1559 SDValue Ptr, SDValue Offset,
1560 MachineMemOperand *MMO);
1562 SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Offset,
1563 MachinePointerInfo PtrInfo, EVT SVT, Align Alignment,
1565 const MMOMetadata &Metadata = MMOMetadata());
1567 getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1568 MachinePointerInfo PtrInfo, EVT SVT, Align Alignment,
1570 const MMOMetadata &Metadata = MMOMetadata());
1571 LLVM_ABI SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1572 SDValue Ptr, SDValue Offset, EVT SVT,
1573 MachineMemOperand *MMO);
1574
1575 inline SDValue
1576 getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1577 MachinePointerInfo PtrInfo, EVT SVT,
1578 MaybeAlign Alignment = MaybeAlign(),
1580 const MMOMetadata &Metadata = MMOMetadata()) {
1581 return getTruncStore(Chain, dl, Val, Ptr, PtrInfo, SVT,
1582 Alignment.value_or(getEVTAlign(SVT)), MMOFlags,
1583 Metadata);
1584 }
1585 LLVM_ABI SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1586 SDValue Ptr, EVT SVT, MachineMemOperand *MMO);
1587 LLVM_ABI SDValue getIndexedStore(SDValue OrigStore, const SDLoc &dl,
1590 LLVM_ABI SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1591 SDValue Ptr, SDValue Offset, EVT SVT,
1593 bool IsTruncating = false);
1594
1596 EVT VT, const SDLoc &dl, SDValue Chain,
1597 SDValue Ptr, SDValue Offset, SDValue Mask,
1598 SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1599 Align Alignment, MachineMemOperand::Flags MMOFlags,
1600 const AAMDNodes &AAInfo,
1601 const MDNode *Ranges = nullptr,
1602 bool IsExpanding = false);
1603 inline SDValue
1605 const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1606 SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1607 MaybeAlign Alignment = MaybeAlign(),
1609 const AAMDNodes &AAInfo = AAMDNodes(),
1610 const MDNode *Ranges = nullptr, bool IsExpanding = false) {
1611 // Ensures that codegen never sees a None Alignment.
1612 return getLoadVP(AM, ExtType, VT, dl, Chain, Ptr, Offset, Mask, EVL,
1613 PtrInfo, MemVT, Alignment.value_or(getEVTAlign(MemVT)),
1614 MMOFlags, AAInfo, Ranges, IsExpanding);
1615 }
1617 EVT VT, const SDLoc &dl, SDValue Chain,
1618 SDValue Ptr, SDValue Offset, SDValue Mask,
1619 SDValue EVL, EVT MemVT, MachineMemOperand *MMO,
1620 bool IsExpanding = false);
1621 LLVM_ABI SDValue getLoadVP(EVT VT, const SDLoc &dl, SDValue Chain,
1622 SDValue Ptr, SDValue Mask, SDValue EVL,
1623 MachinePointerInfo PtrInfo, MaybeAlign Alignment,
1624 MachineMemOperand::Flags MMOFlags,
1625 const AAMDNodes &AAInfo,
1626 const MDNode *Ranges = nullptr,
1627 bool IsExpanding = false);
1628 LLVM_ABI SDValue getLoadVP(EVT VT, const SDLoc &dl, SDValue Chain,
1629 SDValue Ptr, SDValue Mask, SDValue EVL,
1630 MachineMemOperand *MMO, bool IsExpanding = false);
1632 ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain,
1633 SDValue Ptr, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo,
1634 EVT MemVT, MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags,
1635 const AAMDNodes &AAInfo, bool IsExpanding = false);
1637 EVT VT, SDValue Chain, SDValue Ptr,
1638 SDValue Mask, SDValue EVL, EVT MemVT,
1639 MachineMemOperand *MMO,
1640 bool IsExpanding = false);
1641 LLVM_ABI SDValue getIndexedLoadVP(SDValue OrigLoad, const SDLoc &dl,
1644 LLVM_ABI SDValue getStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val,
1645 SDValue Ptr, SDValue Offset, SDValue Mask,
1646 SDValue EVL, EVT MemVT, MachineMemOperand *MMO,
1647 ISD::MemIndexedMode AM, bool IsTruncating = false,
1648 bool IsCompressing = false);
1649 LLVM_ABI SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val,
1650 SDValue Ptr, SDValue Mask, SDValue EVL,
1651 MachinePointerInfo PtrInfo, EVT SVT,
1652 Align Alignment,
1653 MachineMemOperand::Flags MMOFlags,
1654 const AAMDNodes &AAInfo,
1655 bool IsCompressing = false);
1656 LLVM_ABI SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val,
1657 SDValue Ptr, SDValue Mask, SDValue EVL,
1658 EVT SVT, MachineMemOperand *MMO,
1659 bool IsCompressing = false);
1660 LLVM_ABI SDValue getIndexedStoreVP(SDValue OrigStore, const SDLoc &dl,
1663
1665 ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &DL,
1666 SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Stride, SDValue Mask,
1667 SDValue EVL, EVT MemVT, MachineMemOperand *MMO, bool IsExpanding = false);
1669 SDValue Ptr, SDValue Stride, SDValue Mask,
1670 SDValue EVL, MachineMemOperand *MMO,
1671 bool IsExpanding = false);
1673 const SDLoc &DL, EVT VT, SDValue Chain,
1674 SDValue Ptr, SDValue Stride,
1675 SDValue Mask, SDValue EVL, EVT MemVT,
1676 MachineMemOperand *MMO,
1677 bool IsExpanding = false);
1679 SDValue Val, SDValue Ptr, SDValue Offset,
1680 SDValue Stride, SDValue Mask, SDValue EVL,
1681 EVT MemVT, MachineMemOperand *MMO,
1683 bool IsTruncating = false,
1684 bool IsCompressing = false);
1686 SDValue Val, SDValue Ptr,
1687 SDValue Stride, SDValue Mask,
1688 SDValue EVL, EVT SVT,
1689 MachineMemOperand *MMO,
1690 bool IsCompressing = false);
1691
1692 LLVM_ABI SDValue getGatherVP(SDVTList VTs, EVT VT, const SDLoc &dl,
1694 ISD::MemIndexType IndexType);
1695 LLVM_ABI SDValue getScatterVP(SDVTList VTs, EVT VT, const SDLoc &dl,
1697 ISD::MemIndexType IndexType);
1698
1699 LLVM_ABI SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain,
1701 SDValue Src0, EVT MemVT,
1703 ISD::LoadExtType, bool IsExpanding = false);
1707 LLVM_ABI SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1709 EVT MemVT, MachineMemOperand *MMO,
1711 bool IsTruncating = false,
1712 bool IsCompressing = false);
1713 LLVM_ABI SDValue getIndexedMaskedStore(SDValue OrigStore, const SDLoc &dl,
1716 LLVM_ABI SDValue getMaskedGather(SDVTList VTs, EVT MemVT, const SDLoc &dl,
1718 MachineMemOperand *MMO,
1719 ISD::MemIndexType IndexType,
1720 ISD::LoadExtType ExtTy);
1721 LLVM_ABI SDValue getMaskedScatter(SDVTList VTs, EVT MemVT, const SDLoc &dl,
1723 MachineMemOperand *MMO,
1724 ISD::MemIndexType IndexType,
1725 bool IsTruncating = false);
1726 LLVM_ABI SDValue getMaskedHistogram(SDVTList VTs, EVT MemVT, const SDLoc &dl,
1728 MachineMemOperand *MMO,
1729 ISD::MemIndexType IndexType);
1730 LLVM_ABI SDValue getLoadFFVP(EVT VT, const SDLoc &DL, SDValue Chain,
1731 SDValue Ptr, SDValue Mask, SDValue EVL,
1732 MachineMemOperand *MMO);
1733
1734 LLVM_ABI SDValue getGetFPEnv(SDValue Chain, const SDLoc &dl, SDValue Ptr,
1735 EVT MemVT, MachineMemOperand *MMO);
1736 LLVM_ABI SDValue getSetFPEnv(SDValue Chain, const SDLoc &dl, SDValue Ptr,
1737 EVT MemVT, MachineMemOperand *MMO);
1738
1739 /// Construct a node to track a Value* through the backend.
1741
1742 /// Return an MDNodeSDNode which holds an MDNode.
1743 LLVM_ABI SDValue getMDNode(const MDNode *MD);
1744
1745 /// Return a bitcast using the SDLoc of the value operand, and casting to the
1746 /// provided type. Use getNode to set a custom SDLoc.
1748
1749 /// Return an AddrSpaceCastSDNode.
1750 LLVM_ABI SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr,
1751 unsigned SrcAS, unsigned DestAS);
1752
1753 /// Return a freeze using the SDLoc of the value operand.
1755
1756 /// Return a freeze of V if any of the demanded elts may be undef or poison.
1757 /// \p Kind can be used to selectively freeze poison and/or undef bits only.
1759 getFreeze(SDValue V, const APInt &DemandedElts,
1761
1762 /// Return an AssertAlignSDNode.
1764
1765 /// Swap N1 and N2 if Opcode is a commutative binary opcode
1766 /// and the canonical form expects the opposite order.
1767 LLVM_ABI void canonicalizeCommutativeBinop(unsigned Opcode, SDValue &N1,
1768 SDValue &N2) const;
1769
1770 /// Return the specified value casted to
1771 /// the target's desired shift amount type.
1773
1774 /// Expand the specified \c ISD::VAARG node as the Legalize pass would.
1776
1777 /// Expand the specified \c ISD::VACOPY node as the Legalize pass would.
1779
1780 /// Return a GlobalAddress of the function from the current module with
1781 /// name matching the given ExternalSymbol. Additionally can provide the
1782 /// matched function.
1783 /// Panic if the function doesn't exist.
1785 SDValue Op, Function **TargetFunction = nullptr);
1786
1787 /// *Mutate* the specified node in-place to have the
1788 /// specified operands. If the resultant node already exists in the DAG,
1789 /// this does not modify the specified node, instead it returns the node that
1790 /// already exists. If the resultant node does not exist in the DAG, the
1791 /// input node is returned. As a degenerate case, if you specify the same
1792 /// input operands as the node already has, the input node is returned.
1796 SDValue Op3);
1798 SDValue Op3, SDValue Op4);
1800 SDValue Op3, SDValue Op4, SDValue Op5);
1802
1803 /// Creates a new TokenFactor containing \p Vals. If \p Vals contains 64k
1804 /// values or more, move values into new TokenFactors in 64k-1 blocks, until
1805 /// the final TokenFactor has less than 64k operands.
1808
1809 /// *Mutate* the specified machine node's memory references to the provided
1810 /// list.
1813
1814 // Calculate divergence of node \p N based on its operands.
1816
1817 // Propagates the change in divergence to users
1819
1820 /// These are used for target selectors to *mutate* the
1821 /// specified node to have the specified return type, Target opcode, and
1822 /// operands. Note that target opcodes are stored as
1823 /// ~TargetOpcode in the node opcode field. The resultant node is returned.
1824 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT);
1825 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1826 SDValue Op1);
1827 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1828 SDValue Op1, SDValue Op2);
1829 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1830 SDValue Op1, SDValue Op2, SDValue Op3);
1831 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1833 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1834 EVT VT2);
1835 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1837 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1838 EVT VT2, EVT VT3, ArrayRef<SDValue> Ops);
1839 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1840 EVT VT2, SDValue Op1, SDValue Op2);
1841 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, SDVTList VTs,
1843
1844 /// This *mutates* the specified node to have the specified
1845 /// return type, opcode, and operands.
1846 LLVM_ABI SDNode *MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs,
1848
1849 /// Mutate the specified strict FP node to its non-strict equivalent,
1850 /// unlinking the node from its chain and dropping the metadata arguments.
1851 /// The node must be a strict FP node.
1853
1854 /// These are used for target selectors to create a new node
1855 /// with specified return type(s), MachineInstr opcode, and operands.
1856 ///
1857 /// Note that getMachineNode returns the resultant node. If there is already
1858 /// a node of the specified opcode and operands, it returns that node instead
1859 /// of the current one.
1860 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1861 EVT VT);
1862 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1863 EVT VT, SDValue Op1);
1864 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1865 EVT VT, SDValue Op1, SDValue Op2);
1866 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1867 EVT VT, SDValue Op1, SDValue Op2,
1868 SDValue Op3);
1869 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1871 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1872 EVT VT1, EVT VT2, SDValue Op1,
1873 SDValue Op2);
1874 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1875 EVT VT1, EVT VT2, SDValue Op1,
1876 SDValue Op2, SDValue Op3);
1877 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1878 EVT VT1, EVT VT2,
1880 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1881 EVT VT1, EVT VT2, EVT VT3, SDValue Op1,
1882 SDValue Op2);
1883 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1884 EVT VT1, EVT VT2, EVT VT3, SDValue Op1,
1885 SDValue Op2, SDValue Op3);
1886 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1887 EVT VT1, EVT VT2, EVT VT3,
1889 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1890 ArrayRef<EVT> ResultTys,
1892 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1894
1895 /// A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
1896 LLVM_ABI SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT,
1897 SDValue Operand);
1898
1899 /// A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
1900 LLVM_ABI SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT,
1901 SDValue Operand, SDValue Subreg);
1902
1903 /// Get the specified node if it's already available, or else return NULL.
1904 LLVM_ABI SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTList,
1906 const SDNodeFlags Flags,
1907 bool AllowCommute = false);
1908 LLVM_ABI SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTList,
1910 bool AllowCommute = false);
1911
1912 /// Check if a node exists without modifying its flags.
1913 LLVM_ABI bool doesNodeExist(unsigned Opcode, SDVTList VTList,
1915
1916 /// Creates a SDDbgValue node.
1918 SDNode *N, unsigned R, bool IsIndirect,
1919 const DebugLoc &DL, unsigned O);
1920
1921 /// Creates a constant SDDbgValue node.
1923 const Value *C, const DebugLoc &DL,
1924 unsigned O);
1925
1926 /// Creates a FrameIndex SDDbgValue node.
1928 DIExpression *Expr, unsigned FI,
1929 bool IsIndirect,
1930 const DebugLoc &DL, unsigned O);
1931
1932 /// Creates a FrameIndex SDDbgValue node.
1934 DIExpression *Expr, unsigned FI,
1935 ArrayRef<SDNode *> Dependencies,
1936 bool IsIndirect,
1937 const DebugLoc &DL, unsigned O);
1938
1939 /// Creates a VReg SDDbgValue node.
1941 Register VReg, bool IsIndirect,
1942 const DebugLoc &DL, unsigned O);
1943
1944 /// Creates a SDDbgValue node from a list of locations.
1947 ArrayRef<SDNode *> Dependencies,
1948 bool IsIndirect, const DebugLoc &DL,
1949 unsigned O, bool IsVariadic);
1950
1951 /// Creates a SDDbgLabel node.
1953 unsigned O);
1954
1955 /// Transfer debug values from one node to another, while optionally
1956 /// generating fragment expressions for split-up values. If \p InvalidateDbg
1957 /// is set, debug values are invalidated after they are transferred.
1959 unsigned OffsetInBits = 0,
1960 unsigned SizeInBits = 0,
1961 bool InvalidateDbg = true);
1962
1963 /// Remove the specified node from the system. If any of its
1964 /// operands then becomes dead, remove them as well. Inform UpdateListener
1965 /// for each node deleted.
1967
1968 /// This method deletes the unreachable nodes in the
1969 /// given list, and any nodes that become unreachable as a result.
1971
1972 /// Modify anything using 'From' to use 'To' instead.
1973 /// This can cause recursive merging of nodes in the DAG. Use the first
1974 /// version if 'From' is known to have a single result, use the second
1975 /// if you have two nodes with identical results (or if 'To' has a superset
1976 /// of the results of 'From'), use the third otherwise.
1977 ///
1978 /// These methods all take an optional UpdateListener, which (if not null) is
1979 /// informed about nodes that are deleted and modified due to recursive
1980 /// changes in the dag.
1981 ///
1982 /// These functions only replace all existing uses. It's possible that as
1983 /// these replacements are being performed, CSE may cause the From node
1984 /// to be given new uses. These new uses of From are left in place, and
1985 /// not automatically transferred to To.
1986 ///
1988 LLVM_ABI void ReplaceAllUsesWith(SDNode *From, SDNode *To);
1989 LLVM_ABI void ReplaceAllUsesWith(SDNode *From, const SDValue *To);
1990
1991 /// Replace any uses of From with To, leaving
1992 /// uses of other values produced by From.getNode() alone.
1994
1995 /// Like ReplaceAllUsesOfValueWith, but for multiple values at once.
1996 /// This correctly handles the case where
1997 /// there is an overlap between the From values and the To values.
1999 const SDValue *To, unsigned Num);
2000
2001 /// If an existing load has uses of its chain, create a token factor node with
2002 /// that chain and the new memory node's chain and update users of the old
2003 /// chain to the token factor. This ensures that the new memory node will have
2004 /// the same relative memory dependency position as the old load. Returns the
2005 /// new merged load chain.
2007 SDValue NewMemOpChain);
2008
2009 /// If an existing load has uses of its chain, create a token factor node with
2010 /// that chain and the new memory node's chain and update users of the old
2011 /// chain to the token factor. This ensures that the new memory node will have
2012 /// the same relative memory dependency position as the old load. Returns the
2013 /// new merged load chain.
2015 SDValue NewMemOp);
2016
2017 /// Get all the nodes in their topological order without modifying any states.
2019 SmallVectorImpl<const SDNode *> &SortedNodes) const;
2020
2021 /// Topological-sort the AllNodes list and a
2022 /// assign a unique node id for each node in the DAG based on their
2023 /// topological order. Returns the number of nodes.
2025
2026 /// Move node N in the AllNodes list to be immediately
2027 /// before the given iterator Position. This may be used to update the
2028 /// topological ordering when the list of nodes is modified.
2030 AllNodes.insert(Position, AllNodes.remove(N));
2031 }
2032
2033 /// Add a dbg_value SDNode. If SD is non-null that means the
2034 /// value is produced by SD.
2035 LLVM_ABI void AddDbgValue(SDDbgValue *DB, bool isParameter);
2036
2037 /// Add a dbg_label SDNode.
2039
2040 /// Get the debug values which reference the given SDNode.
2042 return DbgInfo->getSDDbgValues(SD);
2043 }
2044
2045public:
2046 /// Return true if there are any SDDbgValue nodes associated
2047 /// with this SelectionDAG.
2048 bool hasDebugValues() const { return !DbgInfo->empty(); }
2049
2050 SDDbgInfo::DbgIterator DbgBegin() const { return DbgInfo->DbgBegin(); }
2051 SDDbgInfo::DbgIterator DbgEnd() const { return DbgInfo->DbgEnd(); }
2052
2054 return DbgInfo->ByvalParmDbgBegin();
2055 }
2057 return DbgInfo->ByvalParmDbgEnd();
2058 }
2059
2061 return DbgInfo->DbgLabelBegin();
2062 }
2064 return DbgInfo->DbgLabelEnd();
2065 }
2066
2067 /// To be invoked on an SDNode that is slated to be erased. This
2068 /// function mirrors \c llvm::salvageDebugInfo.
2070
2071 /// Dump the textual format of this DAG. Nodes are not sorted.
2072 /// Note that we overload it instead of using default value so that it is
2073 /// convenient to be called from debuggers.
2074 LLVM_ABI void dump() const;
2075
2076 /// Dump the textual format of this DAG. Print nodes in sorted orders if \p
2077 /// Sorted is true.
2078 LLVM_ABI void dump(bool Sorted) const;
2079
2080 /// In most cases this function returns the ABI alignment for a given type,
2081 /// except for illegal vector types where the alignment exceeds that of the
2082 /// stack. In such cases we attempt to break the vector down to a legal type
2083 /// and return the ABI alignment for that instead.
2084 LLVM_ABI Align getReducedAlign(EVT VT, bool UseABI);
2085
2086 /// Create a stack temporary based on the size in bytes and the alignment
2088
2089 /// Create a stack temporary, suitable for holding the specified value type.
2090 /// If minAlign is specified, the slot size will have at least that alignment.
2091 LLVM_ABI SDValue CreateStackTemporary(EVT VT, unsigned minAlign = 1);
2092
2093 /// Create a stack temporary suitable for holding either of the specified
2094 /// value types.
2096
2097 LLVM_ABI SDValue FoldSymbolOffset(unsigned Opcode, EVT VT,
2098 const GlobalAddressSDNode *GA,
2099 const SDNode *N2);
2100
2101 LLVM_ABI SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL,
2103 SDNodeFlags Flags = SDNodeFlags());
2104
2105 /// Fold floating-point operations when all operands are constants and/or
2106 /// undefined.
2107 LLVM_ABI SDValue foldConstantFPMath(unsigned Opcode, const SDLoc &DL, EVT VT,
2109
2110 /// Fold BUILD_VECTOR of constants/undefs to the destination type
2111 /// BUILD_VECTOR of constants/undefs elements.
2113 const SDLoc &DL, EVT DstEltVT);
2114
2115 /// Constant fold a setcc to true or false.
2117 const SDLoc &dl, SDNodeFlags Flags = {});
2118
2119 /// Return true if the sign bit of Op is known to be zero.
2120 /// We use this predicate to simplify operations downstream.
2121 LLVM_ABI bool SignBitIsZero(SDValue Op, unsigned Depth = 0) const;
2122
2123 /// Return true if the sign bit of Op is known to be zero, for a
2124 /// floating-point value.
2125 LLVM_ABI bool SignBitIsZeroFP(SDValue Op, unsigned Depth = 0) const;
2126
2127 /// Return true if 'Op & Mask' is known to be zero. We
2128 /// use this predicate to simplify operations downstream. Op and Mask are
2129 /// known to be the same type.
2130 LLVM_ABI bool MaskedValueIsZero(SDValue Op, const APInt &Mask,
2131 unsigned Depth = 0) const;
2132
2133 /// Return true if 'Op & Mask' is known to be zero in DemandedElts. We
2134 /// use this predicate to simplify operations downstream. Op and Mask are
2135 /// known to be the same type.
2136 LLVM_ABI bool MaskedValueIsZero(SDValue Op, const APInt &Mask,
2137 const APInt &DemandedElts,
2138 unsigned Depth = 0) const;
2139
2140 /// Return true if 'Op' is known to be zero in DemandedElts. We
2141 /// use this predicate to simplify operations downstream.
2142 LLVM_ABI bool MaskedVectorIsZero(SDValue Op, const APInt &DemandedElts,
2143 unsigned Depth = 0) const;
2144
2145 /// Return true if '(Op & Mask) == Mask'.
2146 /// Op and Mask are known to be the same type.
2147 LLVM_ABI bool MaskedValueIsAllOnes(SDValue Op, const APInt &Mask,
2148 unsigned Depth = 0) const;
2149
2150 /// For each demanded element of a vector, see if it is known to be zero.
2152 const APInt &DemandedElts,
2153 unsigned Depth = 0) const;
2154
2155 /// Determine which bits of Op are known to be either zero or one and return
2156 /// them in Known. For vectors, the known bits are those that are shared by
2157 /// every vector element.
2158 /// Targets can implement the computeKnownBitsForTargetNode method in the
2159 /// TargetLowering class to allow target nodes to be understood.
2160 LLVM_ABI KnownBits computeKnownBits(SDValue Op, unsigned Depth = 0) const;
2161
2162 /// Determine which bits of Op are known to be either zero or one and return
2163 /// them in Known. The DemandedElts argument allows us to only collect the
2164 /// known bits that are shared by the requested vector elements.
2165 /// Targets can implement the computeKnownBitsForTargetNode method in the
2166 /// TargetLowering class to allow target nodes to be understood.
2167 LLVM_ABI KnownBits computeKnownBits(SDValue Op, const APInt &DemandedElts,
2168 unsigned Depth = 0) const;
2169
2170 /// Determine the possible constant range of an integer or vector of integers.
2171 LLVM_ABI ConstantRange computeConstantRange(SDValue Op, bool ForSigned,
2172 unsigned Depth = 0) const;
2173
2174 /// Determine the possible constant range of an integer or vector of integers.
2175 /// The DemandedElts argument allows us to only collect the known ranges that
2176 /// are shared by the requested vector elements.
2178 const APInt &DemandedElts,
2179 bool ForSigned,
2180 unsigned Depth = 0) const;
2181
2182 /// Combine constant ranges from computeConstantRange() and
2183 /// computeKnownBits().
2185 SDValue Op, bool ForSigned, unsigned Depth = 0) const;
2186
2187 /// Combine constant ranges from computeConstantRange() and
2188 /// computeKnownBits(). The DemandedElts argument allows us to only collect
2189 /// the known ranges that are shared by the requested vector elements.
2191 SDValue Op, const APInt &DemandedElts, bool ForSigned,
2192 unsigned Depth = 0) const;
2193
2194 /// Used to represent the possible overflow behavior of an operation.
2195 /// Never: the operation cannot overflow.
2196 /// Always: the operation will always overflow.
2197 /// Sometime: the operation may or may not overflow.
2203
2204 /// Determine if the result of the signed addition of 2 nodes can overflow.
2206 SDValue N1) const;
2207
2208 /// Determine if the result of the unsigned addition of 2 nodes can overflow.
2210 SDValue N1) const;
2211
2212 /// Determine if the result of the addition of 2 nodes can overflow.
2214 SDValue N1) const {
2215 return IsSigned ? computeOverflowForSignedAdd(N0, N1)
2217 }
2218
2219 /// Determine if the result of the addition of 2 nodes can never overflow.
2220 bool willNotOverflowAdd(bool IsSigned, SDValue N0, SDValue N1) const {
2221 return computeOverflowForAdd(IsSigned, N0, N1) == OFK_Never;
2222 }
2223
2224 /// Determine if the result of the signed sub of 2 nodes can overflow.
2226 SDValue N1) const;
2227
2228 /// Determine if the result of the unsigned sub of 2 nodes can overflow.
2230 SDValue N1) const;
2231
2232 /// Determine if the result of the sub of 2 nodes can overflow.
2234 SDValue N1) const {
2235 return IsSigned ? computeOverflowForSignedSub(N0, N1)
2237 }
2238
2239 /// Determine if the result of the sub of 2 nodes can never overflow.
2240 bool willNotOverflowSub(bool IsSigned, SDValue N0, SDValue N1) const {
2241 return computeOverflowForSub(IsSigned, N0, N1) == OFK_Never;
2242 }
2243
2244 /// Determine if the result of the signed mul of 2 nodes can overflow.
2246 SDValue N1) const;
2247
2248 /// Determine if the result of the unsigned mul of 2 nodes can overflow.
2250 SDValue N1) const;
2251
2252 /// Determine if the result of the mul of 2 nodes can overflow.
2254 SDValue N1) const {
2255 return IsSigned ? computeOverflowForSignedMul(N0, N1)
2257 }
2258
2259 /// Determine if the result of the mul of 2 nodes can never overflow.
2260 bool willNotOverflowMul(bool IsSigned, SDValue N0, SDValue N1) const {
2261 return computeOverflowForMul(IsSigned, N0, N1) == OFK_Never;
2262 }
2263
2264 /// Returns true if \p V is an identity element of Opc with Flags.
2265 /// When OperandNo is 0, it checks that V is a left identity. Otherwise, it
2266 /// checks that V is a right identity.
2267 LLVM_ABI bool isIdentityElement(unsigned Opc, SDNodeFlags Flags, SDValue V,
2268 unsigned OperandNo, unsigned Depth = 0) const;
2269
2270 /// Returns true if the demanded vector elements of \p V is an identity
2271 /// element of Opc with Flags. When OperandNo is 0, it checks that V is a left
2272 /// identity. Otherwise, it checks that V is a right identity.
2273 LLVM_ABI bool isIdentityElement(unsigned Opc, SDNodeFlags Flags, SDValue V,
2274 const APInt &DemandedElts, unsigned OperandNo,
2275 unsigned Depth = 0) const;
2276
2277 /// Test if the given value is known to have exactly one bit set. This differs
2278 /// from computeKnownBits in that it doesn't necessarily determine which bit
2279 /// is set. If 'OrZero' is set, then return true if the given value is either
2280 /// a power of two or zero.
2281 LLVM_ABI bool isKnownToBeAPowerOfTwo(SDValue Val, bool OrZero = false,
2282 unsigned Depth = 0) const;
2283
2284 /// Test if the given value is known to have exactly one bit set. This differs
2285 /// from computeKnownBits in that it doesn't necessarily determine which bit
2286 /// is set. The DemandedElts argument allows us to only collect the minimum
2287 /// sign bits of the requested vector elements. If 'OrZero' is set, then
2288 /// return true if the given value is either a power of two or zero.
2289 LLVM_ABI bool isKnownToBeAPowerOfTwo(SDValue Val, const APInt &DemandedElts,
2290 bool OrZero = false,
2291 unsigned Depth = 0) const;
2292
2293 /// Test if the given _fp_ value is known to be an integer power-of-2, either
2294 /// positive or negative.
2295 LLVM_ABI bool isKnownToBeAPowerOfTwoFP(SDValue Val, unsigned Depth = 0) const;
2296
2297 /// Return the number of times the sign bit of the register is replicated into
2298 /// the other bits. We know that at least 1 bit is always equal to the sign
2299 /// bit (itself), but other cases can give us information. For example,
2300 /// immediately after an "SRA X, 2", we know that the top 3 bits are all equal
2301 /// to each other, so we return 3. Targets can implement the
2302 /// ComputeNumSignBitsForTarget method in the TargetLowering class to allow
2303 /// target nodes to be understood.
2304 LLVM_ABI unsigned ComputeNumSignBits(SDValue Op, unsigned Depth = 0) const;
2305
2306 /// Return the number of times the sign bit of the register is replicated into
2307 /// the other bits. We know that at least 1 bit is always equal to the sign
2308 /// bit (itself), but other cases can give us information. For example,
2309 /// immediately after an "SRA X, 2", we know that the top 3 bits are all equal
2310 /// to each other, so we return 3. The DemandedElts argument allows
2311 /// us to only collect the minimum sign bits of the requested vector elements.
2312 /// Targets can implement the ComputeNumSignBitsForTarget method in the
2313 /// TargetLowering class to allow target nodes to be understood.
2314 LLVM_ABI unsigned ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
2315 unsigned Depth = 0) const;
2316
2317 /// Get the upper bound on bit size for this Value \p Op as a signed integer.
2318 /// i.e. x == sext(trunc(x to MaxSignedBits) to bitwidth(x)).
2319 /// Similar to the APInt::getSignificantBits function.
2320 /// Helper wrapper to ComputeNumSignBits.
2322 unsigned Depth = 0) const;
2323
2324 /// Get the upper bound on bit size for this Value \p Op as a signed integer.
2325 /// i.e. x == sext(trunc(x to MaxSignedBits) to bitwidth(x)).
2326 /// Similar to the APInt::getSignificantBits function.
2327 /// Helper wrapper to ComputeNumSignBits.
2329 const APInt &DemandedElts,
2330 unsigned Depth = 0) const;
2331
2332 /// Return true if this function can prove that \p Op is never poison
2333 /// and, \p Kind can be used to track poison and/or undef bits.
2336 unsigned Depth = 0) const;
2337
2338 /// Return true if this function can prove that \p Op is never poison
2339 /// and, \p Kind can be used to track poison and/or undef bits. The
2340 /// DemandedElts argument limits the check to the requested vector elements.
2342 SDValue Op, const APInt &DemandedElts,
2344 unsigned Depth = 0) const;
2345
2346 /// Return true if this function can prove that \p Op is never poison.
2351
2352 /// Return true if this function can prove that \p Op is never poison. The
2353 /// DemandedElts argument limits the check to the requested vector elements.
2354 bool isGuaranteedNotToBePoison(SDValue Op, const APInt &DemandedElts,
2355 unsigned Depth = 0) const {
2356 return isGuaranteedNotToBeUndefOrPoison(Op, DemandedElts,
2358 }
2359
2360 /// Return true if Op can create undef or poison from non-undef & non-poison
2361 /// operands. The DemandedElts argument limits the check to the requested
2362 /// vector elements.
2363 ///
2364 /// \p ConsiderFlags controls whether poison producing flags on the
2365 /// instruction are considered. This can be used to see if the instruction
2366 /// could still introduce undef or poison even without poison generating flags
2367 /// which might be on the instruction. (i.e. could the result of
2368 /// Op->dropPoisonGeneratingFlags() still create poison or undef)
2369 LLVM_ABI bool
2370 canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
2372 bool ConsiderFlags = true, unsigned Depth = 0) const;
2373
2374 /// Return true if Op can create undef or poison from non-undef & non-poison
2375 /// operands.
2376 ///
2377 /// \p ConsiderFlags controls whether poison producing flags on the
2378 /// instruction are considered. This can be used to see if the instruction
2379 /// could still introduce undef or poison even without poison generating flags
2380 /// which might be on the instruction. (i.e. could the result of
2381 /// Op->dropPoisonGeneratingFlags() still create poison or undef)
2382 LLVM_ABI bool
2385 bool ConsiderFlags = true, unsigned Depth = 0) const;
2386
2387 /// Return true if the specified operand is an ISD::OR or ISD::XOR node
2388 /// that can be treated as an ISD::ADD node.
2389 /// or(x,y) == add(x,y) iff haveNoCommonBitsSet(x,y)
2390 /// xor(x,y) == add(x,y) iff isMinSignedConstant(y) && !NoWrap
2391 /// If \p NoWrap is true, this will not match ISD::XOR.
2392 LLVM_ABI bool isADDLike(SDValue Op, bool NoWrap = false) const;
2393
2394 /// Return true if the specified operand is an ISD::ADD with a ConstantSDNode
2395 /// on the right-hand side, or if it is an ISD::OR with a ConstantSDNode that
2396 /// is guaranteed to have the same semantics as an ADD. This handles the
2397 /// equivalence:
2398 /// X|Cst == X+Cst iff X&Cst = 0.
2400
2401 /// Determine floating-point class information about \p Op. For vectors, the
2402 /// known FP classes are those shared by every demanded vector element.
2403 /// \p InterestedClasses is a hint for which FP classes we care about;
2404 /// the implementation may bail out early if it can determine that
2405 /// none of the interested classes are possible.
2407 FPClassTest InterestedClasses,
2408 unsigned Depth = 0) const;
2409
2410 /// Determine floating-point class information about \p Op. The
2411 /// DemandedElts argument allows us to only collect the known FP classes
2412 /// that are shared by the requested vector elements.
2413 /// \p InterestedClasses is a hint for which FP classes we care about.
2415 const APInt &DemandedElts,
2416 FPClassTest InterestedClasses,
2417 unsigned Depth = 0) const;
2418
2419 /// Test whether the given SDValue (or all elements of it, if it is a
2420 /// vector) is known to never be NaN in \p DemandedElts. If \p SNaN is true,
2421 /// returns if \p Op is known to never be a signaling NaN (it may still be a
2422 /// qNaN).
2423 LLVM_ABI bool isKnownNeverNaN(SDValue Op, const APInt &DemandedElts,
2424 bool SNaN = false, unsigned Depth = 0) const;
2425
2426 /// Test whether the given SDValue (or all elements of it, if it is a
2427 /// vector) is known to never be NaN. If \p SNaN is true, returns if \p Op is
2428 /// known to never be a signaling NaN (it may still be a qNaN).
2429 LLVM_ABI bool isKnownNeverNaN(SDValue Op, bool SNaN = false,
2430 unsigned Depth = 0) const;
2431
2432 /// \returns true if \p Op is known to never be a signaling NaN in \p
2433 /// DemandedElts.
2434 bool isKnownNeverSNaN(SDValue Op, const APInt &DemandedElts,
2435 unsigned Depth = 0) const {
2436 return isKnownNeverNaN(Op, DemandedElts, true, Depth);
2437 }
2438
2439 /// \returns true if \p Op is known to never be a signaling NaN.
2440 bool isKnownNeverSNaN(SDValue Op, unsigned Depth = 0) const {
2441 return isKnownNeverNaN(Op, true, Depth);
2442 }
2443
2444 /// Test whether the given floating point SDValue (or all elements of it, if
2445 /// it is a vector) is known to never be interpretable as zero in \p
2446 /// DemandedElts.
2447 LLVM_ABI bool isKnownNeverLogicalZero(SDValue Op, const APInt &DemandedElts,
2448 unsigned Depth = 0) const;
2449
2450 /// Test whether the given floating point SDValue (or all elements of it, if
2451 /// it is a vector) is known to never be interpretable as zero.
2452 LLVM_ABI bool isKnownNeverLogicalZero(SDValue Op, unsigned Depth = 0) const;
2453
2454 /// Test whether the given SDValue is known to contain non-zero value(s).
2455 LLVM_ABI bool isKnownNeverZero(SDValue Op, unsigned Depth = 0) const;
2456
2457 /// Test whether the given SDValue is known to contain non-zero value(s).
2458 /// The DemandedElts argument limits the check to the requested vector
2459 /// elements.
2460 LLVM_ABI bool isKnownNeverZero(SDValue Op, const APInt &DemandedElts,
2461 unsigned Depth = 0) const;
2462
2463 /// Test whether the given float value is known to be positive. +0.0, +inf and
2464 /// +nan are considered positive, -0.0, -inf and -nan are not.
2466
2467 /// Check if a use of a float value is insensitive to signed zeros.
2468 LLVM_ABI bool canIgnoreSignBitOfZero(const SDUse &Use) const;
2469
2470 /// Check if \p Op has no-signed-zeros, or all users (limited to checking two
2471 /// for compile-time performance) are insensitive to signed zeros.
2473
2474 /// Test whether two SDValues are known to compare equal. This
2475 /// is true if they are the same value, or if one is negative zero and the
2476 /// other positive zero.
2477 LLVM_ABI bool isEqualTo(SDValue A, SDValue B) const;
2478
2479 /// Return true if A and B have no common bits set. As an example, this can
2480 /// allow an 'add' to be transformed into an 'or'.
2482
2483 /// Test whether \p V has a splatted value for all the demanded elements.
2484 ///
2485 /// On success \p UndefElts will indicate the elements that have UNDEF
2486 /// values instead of the splat value, this is only guaranteed to be correct
2487 /// for \p DemandedElts.
2488 ///
2489 /// NOTE: The function will return true for a demanded splat of UNDEF values.
2490 LLVM_ABI bool isSplatValue(SDValue V, const APInt &DemandedElts,
2491 APInt &UndefElts, unsigned Depth = 0) const;
2492
2493 /// Test whether \p V has a splatted value.
2494 LLVM_ABI bool isSplatValue(SDValue V, bool AllowUndefs = false) const;
2495
2496 /// If V is a splatted value, return the source vector and its splat index.
2497 LLVM_ABI SDValue getSplatSourceVector(SDValue V, int &SplatIndex);
2498
2499 /// If V is a splat vector, return its scalar source operand by extracting
2500 /// that element from the source vector. If LegalTypes is true, this method
2501 /// may only return a legally-typed splat value. If it cannot legalize the
2502 /// splatted value it will return SDValue().
2503 LLVM_ABI SDValue getSplatValue(SDValue V, bool LegalTypes = false);
2504
2505 /// If a SHL/SRA/SRL node \p V has shift amounts that are all less than the
2506 /// element bit-width of the shift node, return the valid constant range.
2507 LLVM_ABI std::optional<ConstantRange>
2508 getValidShiftAmountRange(SDValue V, const APInt &DemandedElts,
2509 unsigned Depth) const;
2510
2511 /// If a SHL/SRA/SRL node \p V has a uniform shift amount
2512 /// that is less than the element bit-width of the shift node, return it.
2513 LLVM_ABI std::optional<unsigned>
2514 getValidShiftAmount(SDValue V, const APInt &DemandedElts,
2515 unsigned Depth = 0) const;
2516
2517 /// If a SHL/SRA/SRL node \p V has a uniform shift amount
2518 /// that is less than the element bit-width of the shift node, return it.
2519 LLVM_ABI std::optional<unsigned>
2520 getValidShiftAmount(SDValue V, unsigned Depth = 0) const;
2521
2522 /// If a SHL/SRA/SRL node \p V has shift amounts that are all less than the
2523 /// element bit-width of the shift node, return the minimum possible value.
2524 LLVM_ABI std::optional<unsigned>
2525 getValidMinimumShiftAmount(SDValue V, const APInt &DemandedElts,
2526 unsigned Depth = 0) const;
2527
2528 /// If a SHL/SRA/SRL node \p V has shift amounts that are all less than the
2529 /// element bit-width of the shift node, return the minimum possible value.
2530 LLVM_ABI std::optional<unsigned>
2531 getValidMinimumShiftAmount(SDValue V, unsigned Depth = 0) const;
2532
2533 /// If a SHL/SRA/SRL node \p V has shift amounts that are all less than the
2534 /// element bit-width of the shift node, return the maximum possible value.
2535 LLVM_ABI std::optional<unsigned>
2536 getValidMaximumShiftAmount(SDValue V, const APInt &DemandedElts,
2537 unsigned Depth = 0) const;
2538
2539 /// If a SHL/SRA/SRL node \p V has shift amounts that are all less than the
2540 /// element bit-width of the shift node, return the maximum possible value.
2541 LLVM_ABI std::optional<unsigned>
2542 getValidMaximumShiftAmount(SDValue V, unsigned Depth = 0) const;
2543
2544 /// Match a binop + shuffle pyramid that represents a horizontal reduction
2545 /// over the elements of a vector starting from the EXTRACT_VECTOR_ELT node /p
2546 /// Extract. The reduction must use one of the opcodes listed in /p
2547 /// CandidateBinOps and on success /p BinOp will contain the matching opcode.
2548 /// Returns the vector that is being reduced on, or SDValue() if a reduction
2549 /// was not matched. If \p AllowPartials is set then in the case of a
2550 /// reduction pattern that only matches the first few stages, the extracted
2551 /// subvector of the start of the reduction is returned.
2553 ArrayRef<ISD::NodeType> CandidateBinOps,
2554 bool AllowPartials = false);
2555
2556 /// Utility function used by legalize and lowering to
2557 /// "unroll" a vector operation by splitting out the scalars and operating
2558 /// on each element individually. If the ResNE is 0, fully unroll the vector
2559 /// op. If ResNE is less than the width of the vector op, unroll up to ResNE.
2560 /// If the ResNE is greater than the width of the vector op, unroll the
2561 /// vector op and fill the end of the resulting vector with UNDEFS.
2562 LLVM_ABI SDValue UnrollVectorOp(SDNode *N, unsigned ResNE = 0);
2563
2564 /// Like UnrollVectorOp(), but for the [US](ADD|SUB|MUL)O family of opcodes.
2565 /// This is a separate function because those opcodes have two results.
2566 LLVM_ABI std::pair<SDValue, SDValue>
2567 UnrollVectorOverflowOp(SDNode *N, unsigned ResNE = 0);
2568
2569 /// Return true if loads are next to each other and can be
2570 /// merged. Check that both are nonvolatile and if LD is loading
2571 /// 'Bytes' bytes from a location that is 'Dist' units away from the
2572 /// location that the 'Base' load is loading from.
2574 unsigned Bytes, int Dist) const;
2575
2576 /// Infer alignment of a load / store address. Return std::nullopt if it
2577 /// cannot be inferred.
2579
2580 /// Split the scalar node with EXTRACT_ELEMENT using the provided VTs and
2581 /// return the low/high part.
2582 LLVM_ABI std::pair<SDValue, SDValue> SplitScalar(const SDValue &N,
2583 const SDLoc &DL,
2584 const EVT &LoVT,
2585 const EVT &HiVT);
2586
2587 /// Compute the VTs needed for the low/hi parts of a type
2588 /// which is split (or expanded) into two not necessarily identical pieces.
2589 LLVM_ABI std::pair<EVT, EVT> GetSplitDestVTs(const EVT &VT) const;
2590
2591 /// Compute the VTs needed for the low/hi parts of a type, dependent on an
2592 /// enveloping VT that has been split into two identical pieces. Sets the
2593 /// HisIsEmpty flag when hi type has zero storage size.
2594 LLVM_ABI std::pair<EVT, EVT> GetDependentSplitDestVTs(const EVT &VT,
2595 const EVT &EnvVT,
2596 bool *HiIsEmpty) const;
2597
2598 /// Split the vector with EXTRACT_SUBVECTOR using the provided
2599 /// VTs and return the low/high part.
2600 LLVM_ABI std::pair<SDValue, SDValue> SplitVector(const SDValue &N,
2601 const SDLoc &DL,
2602 const EVT &LoVT,
2603 const EVT &HiVT);
2604
2605 /// Split the vector with EXTRACT_SUBVECTOR and return the low/high part.
2606 std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL) {
2607 EVT LoVT, HiVT;
2608 std::tie(LoVT, HiVT) = GetSplitDestVTs(N.getValueType());
2609 return SplitVector(N, DL, LoVT, HiVT);
2610 }
2611
2612 /// Split the explicit vector length parameter of a VP operation.
2613 LLVM_ABI std::pair<SDValue, SDValue> SplitEVL(SDValue N, EVT VecVT,
2614 const SDLoc &DL);
2615
2616 /// Split the node's operand with EXTRACT_SUBVECTOR and
2617 /// return the low/high part.
2618 std::pair<SDValue, SDValue> SplitVectorOperand(const SDNode *N, unsigned OpNo)
2619 {
2620 return SplitVector(N->getOperand(OpNo), SDLoc(N));
2621 }
2622
2623 /// Widen the vector up to the next power of two using INSERT_SUBVECTOR.
2624 LLVM_ABI SDValue WidenVector(const SDValue &N, const SDLoc &DL);
2625
2626 /// Append the extracted elements from Start to Count out of the vector Op in
2627 /// Args. If Count is 0, all of the elements will be extracted. The extracted
2628 /// elements will have type EVT if it is provided, and otherwise their type
2629 /// will be Op's element type.
2632 unsigned Start = 0, unsigned Count = 0,
2633 EVT EltVT = EVT());
2634
2635 /// Compute the default alignment value for the given type.
2636 LLVM_ABI Align getEVTAlign(EVT MemoryVT) const;
2637
2638 /// Test whether the given value is a constant int or similar node.
2639 LLVM_ABI bool
2641 bool AllowOpaques = true) const;
2642
2643 /// Test whether the given value is a constant FP or similar node.
2645
2646 /// \returns true if \p N is any kind of constant or build_vector of
2647 /// constants, int or float. If a vector, it may not necessarily be a splat.
2652
2653 /// Check if a value \op N is a constant using the target's BooleanContent for
2654 /// its type.
2655 LLVM_ABI std::optional<bool> isBoolConstant(SDValue N) const;
2656
2657 /// Set CallSiteInfo to be associated with Node.
2658 void addCallSiteInfo(const SDNode *Node, CallSiteInfo &&CallInfo) {
2659 SDEI[Node].CSInfo = std::move(CallInfo);
2660 }
2661 /// Return CallSiteInfo associated with Node, or a default if none exists.
2662 CallSiteInfo getCallSiteInfo(const SDNode *Node) {
2663 auto I = SDEI.find(Node);
2664 return I != SDEI.end() ? std::move(I->second).CSInfo : CallSiteInfo();
2665 }
2666 /// Set HeapAllocSite to be associated with Node.
2668 SDEI[Node].HeapAllocSite = MD;
2669 }
2670 /// Return HeapAllocSite associated with Node, or nullptr if none exists.
2672 auto I = SDEI.find(Node);
2673 return I != SDEI.end() ? I->second.HeapAllocSite : nullptr;
2674 }
2675 /// Set PCSections to be associated with Node.
2676 void addPCSections(const SDNode *Node, MDNode *MD) {
2677 SDEI[Node].PCSections = MD;
2678 }
2679 /// Set MMRAMetadata to be associated with Node.
2680 void addMMRAMetadata(const SDNode *Node, MDNode *MMRA) {
2681 SDEI[Node].MMRA = MMRA;
2682 }
2683 /// Return PCSections associated with Node, or nullptr if none exists.
2685 auto It = SDEI.find(Node);
2686 return It != SDEI.end() ? It->second.PCSections : nullptr;
2687 }
2688 /// Return the MMRA MDNode associated with Node, or nullptr if none
2689 /// exists.
2691 auto It = SDEI.find(Node);
2692 return It != SDEI.end() ? It->second.MMRA : nullptr;
2693 }
2694 /// Set CalledGlobal to be associated with Node.
2695 void addCalledGlobal(const SDNode *Node, const GlobalValue *GV,
2696 unsigned OpFlags) {
2697 SDEI[Node].CalledGlobal = {GV, OpFlags};
2698 }
2699 /// Return CalledGlobal associated with Node, or a nullopt if none exists.
2700 std::optional<CalledGlobalInfo> getCalledGlobal(const SDNode *Node) {
2701 auto I = SDEI.find(Node);
2702 return I != SDEI.end()
2703 ? std::make_optional(std::move(I->second).CalledGlobal)
2704 : std::nullopt;
2705 }
2706 /// Set NoMergeSiteInfo to be associated with Node if NoMerge is true.
2707 void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge) {
2708 if (NoMerge)
2709 SDEI[Node].NoMerge = NoMerge;
2710 }
2711 /// Return NoMerge info associated with Node.
2712 bool getNoMergeSiteInfo(const SDNode *Node) const {
2713 auto I = SDEI.find(Node);
2714 return I != SDEI.end() ? I->second.NoMerge : false;
2715 }
2716
2717 /// Copy extra info associated with one node to another.
2718 LLVM_ABI void copyExtraInfo(SDNode *From, SDNode *To);
2719
2720 /// Return the current function's default denormal handling kind for the given
2721 /// floating point type.
2723 return MF->getDenormalMode(VT.getFltSemantics());
2724 }
2725
2726 LLVM_ABI bool shouldOptForSize() const;
2727
2728 /// Get the (commutative) identity element for the given opcode, if it exists.
2729 LLVM_ABI SDValue getIdentityElement(unsigned Opcode, const SDLoc &DL, EVT VT,
2730 SDNodeFlags Flags);
2731
2732 /// Get an expression that implements a partial multiply-subtract reduction.
2733 /// In practice this means that parts of the expression are negated, e.g.
2734 ///
2735 /// partial_reduce_fmls acc, lhs, rhs
2736 /// <=> partial_reduce_fmla acc, lhs, -rhs
2737 ///
2738 /// partial_reduce_umls acc, lhs, rhs
2739 /// <=> -partial_reduce_umla -acc, lhs, rhs
2741 SDValue Acc, SDValue LHS, SDValue RHS);
2742
2743 /// Some opcodes may create immediate undefined behavior when used with some
2744 /// values (integer division-by-zero for example). Therefore, these operations
2745 /// are not generally safe to move around or change.
2746 bool isSafeToSpeculativelyExecute(unsigned Opcode) const {
2747 switch (Opcode) {
2748 case ISD::SDIV:
2749 case ISD::SREM:
2750 case ISD::SDIVREM:
2751 case ISD::UDIV:
2752 case ISD::UREM:
2753 case ISD::UDIVREM:
2754 return false;
2755 default:
2756 return true;
2757 }
2758 }
2759
2760 /// Check if the provided node is save to speculatively executed given its
2761 /// current arguments. So, while `udiv` the opcode is not safe to
2762 /// speculatively execute, a given `udiv` node may be if the denominator is
2763 /// known nonzero.
2765 switch (N->getOpcode()) {
2766 case ISD::UDIV:
2767 return isKnownNeverZero(N->getOperand(1));
2768 default:
2769 return isSafeToSpeculativelyExecute(N->getOpcode());
2770 }
2771 }
2772
2773 LLVM_ABI SDValue makeStateFunctionCall(unsigned LibFunc, SDValue Ptr,
2774 SDValue InChain, const SDLoc &DLoc);
2775
2776private:
2777#ifndef NDEBUG
2778 void verifyNode(SDNode *N) const;
2779#endif
2780 void InsertNode(SDNode *N);
2781 bool RemoveNodeFromCSEMaps(SDNode *N);
2782 void AddModifiedNodeToCSEMaps(SDNode *N);
2783 SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op, void *&InsertPos);
2784 SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op1, SDValue Op2,
2785 void *&InsertPos);
2786 SDNode *FindModifiedNodeSlot(SDNode *N, ArrayRef<SDValue> Ops,
2787 void *&InsertPos);
2788 SDNode *UpdateSDLocOnMergeSDNode(SDNode *N, const SDLoc &loc);
2789
2790 void DeleteNodeNotInCSEMaps(SDNode *N);
2791 void DeallocateNode(SDNode *N);
2792
2793 void allnodes_clear();
2794
2795 /// Look up the node specified by ID in CSEMap. If it exists, return it. If
2796 /// not, return the insertion token that will make insertion faster. This
2797 /// overload is for nodes other than Constant or ConstantFP, use the other one
2798 /// for those.
2799 SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos);
2800
2801 /// Look up the node specified by ID in CSEMap. If it exists, return it. If
2802 /// not, return the insertion token that will make insertion faster. Performs
2803 /// additional processing for constant nodes.
2804 SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, const SDLoc &DL,
2805 void *&InsertPos);
2806
2807 /// Maps to auto-CSE operations.
2808 std::vector<CondCodeSDNode*> CondCodeNodes;
2809
2810 std::vector<SDNode*> ValueTypeNodes;
2811 std::map<EVT, SDNode*, EVT::compareRawBits> ExtendedValueTypeNodes;
2812 StringMap<SDNode*> ExternalSymbols;
2813
2814 std::map<std::pair<std::string, unsigned>, SDNode *> TargetExternalSymbols;
2816
2817 FlagInserter *Inserter = nullptr;
2818};
2819
2820template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> {
2822
2824 return nodes_iterator(G->allnodes_begin());
2825 }
2826
2828 return nodes_iterator(G->allnodes_end());
2829 }
2830};
2831
2832} // end namespace llvm
2833
2834#endif // LLVM_CODEGEN_SELECTIONDAG_H
return SDValue()
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
unsigned uint64_t
constexpr LLT S1
AMDGPU Uniform Intrinsic Combine
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file defines the BumpPtrAllocator interface.
#define X(NUM, ENUM, NAME)
Definition ELF.h:856
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_ABI
Definition Compiler.h:215
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition Compiler.h:678
@ CallSiteInfo
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
This file defines a hash set that can be used to remove duplication of nodes in a graph.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define I(x, y, z)
Definition MD5.cpp:57
#define G(x, y, z)
Definition MD5.cpp:55
Register Reg
This file contains the declarations for metadata subclasses.
const SmallVectorImpl< MachineOperand > & Cond
This file defines the SmallVector class.
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static void removeOperands(MachineInstr &MI, unsigned i)
This file contains the UndefPoisonKind enum and helper functions.
Value * RHS
Value * LHS
Class for arbitrary precision integers.
Definition APInt.h:78
static Capacity get(size_t N)
Get the capacity of an array that can hold at least N elements.
Recycle small arrays allocated from a BumpPtrAllocator.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
This class is a wrapper over an AAResults, and it is intended to be used only when there are no IR ch...
The address of a basic block.
Definition Constants.h:1088
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
A "pseudo-class" with methods for operating on BUILD_VECTORs.
This class represents a function call, abstracting a target machine's calling convention.
ConstantFP - Floating Point Values [float, double].
Definition Constants.h:420
This is the shared class of boolean and integer constants.
Definition Constants.h:87
This is an important base class in LLVM.
Definition Constant.h:43
DWARF expression.
Base class for variables.
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
A debug info location.
Definition DebugLoc.h:126
Implements a dense probed hash-table based set.
Definition DenseSet.h:281
This class describes a reference to an interned FoldingSetNodeID, which can be a useful to store node...
Definition FoldingSet.h:175
This class is used to gather all the unique data bits of a node.
Definition FoldingSet.h:212
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Data structure describing the variable locations in a function.
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
Tracks which library functions to use for a particular subtarget or function.
This class is used to represent ISD::LOAD nodes.
static LocationSize precise(uint64_t Value)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
Metadata node.
Definition Metadata.h:1069
Abstract base class for all machine specific constantpool value subclasses.
A description of a memory reference used in the backend.
Flags
Flags values. These may be or'd together.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
This class contains meta information specific to a module.
An SDNode that represents everything that will be needed to construct a MachineInstr.
Root of the metadata hierarchy.
Definition Metadata.h:64
The optimization diagnostic interface.
Pass interface - Implemented by all 'passes'.
Definition Pass.h:99
Analysis providing profile information.
RecyclingAllocator - This class wraps an Allocator, adding the functionality of recycling deleted obj...
Wrapper class representing virtual and physical registers.
Definition Register.h:20
Keeps track of dbg_value information through SDISel.
BumpPtrAllocator & getAlloc()
DbgIterator ByvalParmDbgBegin()
DbgIterator DbgEnd()
SDDbgInfo & operator=(const SDDbgInfo &)=delete
SmallVectorImpl< SDDbgLabel * >::iterator DbgLabelIterator
SDDbgInfo()=default
LLVM_ABI void add(SDDbgValue *V, bool isParameter)
bool empty() const
DbgLabelIterator DbgLabelEnd()
DbgIterator ByvalParmDbgEnd()
SmallVectorImpl< SDDbgValue * >::iterator DbgIterator
SDDbgInfo(const SDDbgInfo &)=delete
DbgLabelIterator DbgLabelBegin()
void add(SDDbgLabel *L)
DbgIterator DbgBegin()
LLVM_ABI void erase(const SDNode *Node)
Invalidate all DbgValues attached to the node and remove it from the Node-to-DbgValues map.
ArrayRef< SDDbgValue * > getSDDbgValues(const SDNode *Node) const
Holds the information from a dbg_label node through SDISel.
Holds the information for a single machine location through SDISel; either an SDNode,...
Holds the information from a dbg_value node through SDISel.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
Represents a use of a SDNode.
SDVTListNode(const FoldingSetNodeIDRef ID, const EVT *VT, unsigned int Num)
SDVTList getSDVTList()
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
EVT getValueType() const
Return the ValueType of the referenced return value.
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
Help to insert SDNodeFlags automatically in transforming.
FlagInserter(SelectionDAG &SDAG, SDNodeFlags Flags)
FlagInserter(const FlagInserter &)=delete
FlagInserter(SelectionDAG &SDAG, SDNode *N)
FlagInserter & operator=(const FlagInserter &)=delete
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
LLVM_ABI SDValue getElementCount(const SDLoc &DL, EVT VT, ElementCount EC)
bool willNotOverflowAdd(bool IsSigned, SDValue N0, SDValue N1) const
Determine if the result of the addition of 2 nodes can never overflow.
static unsigned getOpcode_EXTEND_VECTOR_INREG(unsigned Opcode)
Convert *_EXTEND to *_EXTEND_VECTOR_INREG opcode.
LLVM_ABI Align getReducedAlign(EVT VT, bool UseABI)
In most cases this function returns the ABI alignment for a given type, except for illegal vector typ...
LLVM_ABI SDValue getShiftAmountOperand(EVT LHSTy, SDValue Op)
Return the specified value casted to the target's desired shift amount type.
LLVM_ABI std::pair< SDValue, SDValue > getMemccpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue C, SDValue Size, const CallInst *CI)
Lower a memccpy operation into a target library call and return the resulting chain and call result a...
LLVM_ABI bool isKnownNeverLogicalZero(SDValue Op, const APInt &DemandedElts, unsigned Depth=0) const
Test whether the given floating point SDValue (or all elements of it, if it is a vector) is known to ...
LLVM_ABI SDValue getExtLoadVP(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo, bool IsExpanding=false)
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned TargetFlags=0)
SDValue getExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT, unsigned Opcode)
Convert Op, which must be of integer type, to the integer type VT, by either any/sign/zero-extending ...
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, Register Reg, EVT VT, SDValue Glue)
SDValue getExtractVectorElt(const SDLoc &DL, EVT VT, SDValue Vec, unsigned Idx)
Extract element at Idx from Vec.
LLVM_ABI SDValue getSplatSourceVector(SDValue V, int &SplatIndex)
If V is a splatted value, return the source vector and its splat index.
LLVM_ABI SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root, MCSymbol *Label)
LLVM_ABI OverflowKind computeOverflowForUnsignedSub(SDValue N0, SDValue N1) const
Determine if the result of the unsigned sub of 2 nodes can overflow.
LLVM_ABI unsigned ComputeMaxSignificantBits(SDValue Op, unsigned Depth=0) const
Get the upper bound on bit size for this Value Op as a signed integer.
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
LLVM_ABI std::pair< SDValue, SDValue > getStrlen(SDValue Chain, const SDLoc &dl, SDValue Src, const CallInst *CI)
Lower a strlen operation into a target library call and return the resulting chain and call result as...
LLVM_ABI SDValue getMaskedGather(SDVTList VTs, EVT MemVT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType, ISD::LoadExtType ExtTy)
const RTLIB::RuntimeLibcallsInfo & getRuntimeLibcallInfo() const
bool isKnownNeverSNaN(SDValue Op, unsigned Depth=0) const
LLVM_ABI SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr, unsigned SrcAS, unsigned DestAS)
Return an AddrSpaceCastSDNode.
LLVM_ABI SDValue FoldSetCC(EVT VT, SDValue N1, SDValue N2, ISD::CondCode Cond, const SDLoc &dl, SDNodeFlags Flags={})
Constant fold a setcc to true or false.
bool isKnownNeverSNaN(SDValue Op, const APInt &DemandedElts, unsigned Depth=0) const
LLVM_ABI std::optional< bool > isBoolConstant(SDValue N) const
Check if a value \op N is a constant using the target's BooleanContent for its type.
LLVM_ABI SDValue getStackArgumentTokenFactor(SDValue Chain)
Compute a TokenFactor to force all the incoming stack arguments to be loaded from the stack.
const TargetSubtargetInfo & getSubtarget() const
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, Register Reg, SDValue N)
const Pass * getPass() const
LLVM_ABI ConstantRange computeConstantRange(SDValue Op, bool ForSigned, unsigned Depth=0) const
Determine the possible constant range of an integer or vector of integers.
LLVM_ABI SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
LLVM_ABI SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
OptimizationRemarkEmitter & getORE() const
BlockFrequencyInfo * getBFI() const
LLVM_ABI SDValue getShiftAmountConstant(uint64_t Val, EVT VT, const SDLoc &DL)
LLVM_ABI void updateDivergence(SDNode *N)
LLVM_ABI SDValue getSplatValue(SDValue V, bool LegalTypes=false)
If V is a splat vector, return its scalar source operand by extracting that element from the source v...
LLVM_ABI SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget=false, bool IsOpaque=false)
LLVM_ABI MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s),...
LLVM_ABI void ExtractVectorElements(SDValue Op, SmallVectorImpl< SDValue > &Args, unsigned Start=0, unsigned Count=0, EVT EltVT=EVT())
Append the extracted elements from Start to Count out of the vector Op in Args.
LLVM_ABI SDValue getAtomicMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Value, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo)
LLVM_ABI SDValue getAtomicLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT MemVT, EVT VT, SDValue Chain, SDValue Ptr, MachineMemOperand *MMO)
LLVM_ABI bool LegalizeVectors()
This transforms the SelectionDAG into a SelectionDAG that only uses vector math operations supported ...
LLVM_ABI SDNode * getNodeIfExists(unsigned Opcode, SDVTList VTList, ArrayRef< SDValue > Ops, const SDNodeFlags Flags, bool AllowCommute=false)
Get the specified node if it's already available, or else return NULL.
SDValue getTargetConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT)
LLVM_ABI SDValue getPseudoProbeNode(const SDLoc &Dl, SDValue Chain, uint64_t Guid, uint64_t Index, uint32_t Attr)
Creates a PseudoProbeSDNode with function GUID Guid and the index of the block Index it is probing,...
LLVM_ABI SDValue getFreeze(SDValue V)
Return a freeze using the SDLoc of the value operand.
LLVM_ABI SDNode * SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT)
These are used for target selectors to mutate the specified node to have the specified return type,...
LLVM_ABI void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE, Pass *PassPtr, const TargetLibraryInfo *LibraryInfo, const LibcallLoweringInfo *LibcallsInfo, UniformityInfo *UA, ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin, MachineModuleInfo &MMI, FunctionVarLocs const *FnVarLocs)
Prepare this SelectionDAG to process code in the given MachineFunction.
LLVM_ABI SelectionDAG(const TargetMachine &TM, CodeGenOptLevel)
LLVM_ABI SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVol, bool AlwaysInline, const CallInst *CI, MachinePointerInfo DstPtrInfo, const AAMDNodes &AAInfo=AAMDNodes())
LLVM_ABI SDValue getBitcastedSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by first bitcasting (from potentia...
LLVM_ABI SDValue getConstantPool(const Constant *C, EVT VT, MaybeAlign Align=std::nullopt, int Offs=0, bool isT=false, unsigned TargetFlags=0)
LLVM_ABI SDValue getStridedLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Stride, SDValue Mask, SDValue EVL, EVT MemVT, MachineMemOperand *MMO, bool IsExpanding=false)
SDDbgInfo::DbgIterator ByvalParmDbgEnd() const
LLVM_ABI SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDVTList VTs, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp, MachineMemOperand *MMO)
Gets a node for an atomic cmpxchg op.
MachineModuleInfo * getMMI() const
LLVM_ABI SDValue makeEquivalentMemoryOrdering(SDValue OldChain, SDValue NewMemOpChain)
If an existing load has uses of its chain, create a token factor node with that chain and the new mem...
LLVM_ABI bool isConstantIntBuildVectorOrConstantInt(SDValue N, bool AllowOpaques=true) const
Test whether the given value is a constant int or similar node.
LLVM_ABI void ReplaceAllUsesOfValuesWith(const SDValue *From, const SDValue *To, unsigned Num)
Like ReplaceAllUsesOfValueWith, but for multiple values at once.
LLVM_ABI SDValue getJumpTableDebugInfo(int JTI, SDValue Chain, const SDLoc &DL)
LLVM_ABI SDValue getSymbolFunctionGlobalAddress(SDValue Op, Function **TargetFunction=nullptr)
Return a GlobalAddress of the function from the current module with name matching the given ExternalS...
bool isSafeToSpeculativelyExecute(unsigned Opcode) const
Some opcodes may create immediate undefined behavior when used with some values (integer division-by-...
void addMMRAMetadata(const SDNode *Node, MDNode *MMRA)
Set MMRAMetadata to be associated with Node.
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
LLVM_ABI std::optional< unsigned > getValidMaximumShiftAmount(SDValue V, const APInt &DemandedElts, unsigned Depth=0) const
If a SHL/SRA/SRL node V has shift amounts that are all less than the element bit-width of the shift n...
OverflowKind computeOverflowForSub(bool IsSigned, SDValue N0, SDValue N1) const
Determine if the result of the sub of 2 nodes can overflow.
void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE, MachineFunctionAnalysisManager &AM, const TargetLibraryInfo *LibraryInfo, const LibcallLoweringInfo *LibcallsInfo, UniformityInfo *UA, ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin, MachineModuleInfo &MMI, FunctionVarLocs const *FnVarLocs)
LLVM_ABI SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
SDDbgInfo::DbgIterator ByvalParmDbgBegin() const
LLVM_ABI SDValue getVScale(const SDLoc &DL, EVT VT, APInt MulImm)
Return a node that represents the runtime scaling 'MulImm * RuntimeVL'.
void setFunctionLoweringInfo(FunctionLoweringInfo *FuncInfo)
LLVM_ABI SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
OverflowKind
Used to represent the possible overflow behavior of an operation.
static LLVM_ABI unsigned getHasPredecessorMaxSteps()
LLVM_ABI bool haveNoCommonBitsSet(SDValue A, SDValue B) const
Return true if A and B have no common bits set.
SDValue getExtractSubvector(const SDLoc &DL, EVT VT, SDValue Vec, unsigned Idx)
Return the VT typed sub-vector of Vec at Idx.
LLVM_ABI bool cannotBeOrderedNegativeFP(SDValue Op) const
Test whether the given float value is known to be positive.
LLVM_ABI SDValue getRegister(Register Reg, EVT VT)
LLVM_ABI bool calculateDivergence(SDNode *N)
LLVM_ABI std::pair< SDValue, SDValue > getStrcmp(SDValue Chain, const SDLoc &dl, SDValue S0, SDValue S1, const CallInst *CI)
Lower a strcmp operation into a target library call and return the resulting chain and call result as...
LLVM_ABI SDValue getGetFPEnv(SDValue Chain, const SDLoc &dl, SDValue Ptr, EVT MemVT, MachineMemOperand *MMO)
LLVM_ABI SDValue getAssertAlign(const SDLoc &DL, SDValue V, Align A)
Return an AssertAlignSDNode.
LLVM_ABI SDNode * mutateStrictFPToFP(SDNode *Node)
Mutate the specified strict FP node to its non-strict equivalent, unlinking the node from its chain a...
LLVM_ABI bool canIgnoreSignBitOfZero(const SDUse &Use) const
Check if a use of a float value is insensitive to signed zeros.
SDValue getGLOBAL_OFFSET_TABLE(EVT VT)
Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
LLVM_ABI bool SignBitIsZeroFP(SDValue Op, unsigned Depth=0) const
Return true if the sign bit of Op is known to be zero, for a floating-point value.
LLVM_ABI SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, LocationSize Size=LocationSize::precise(0), const AAMDNodes &AAInfo=AAMDNodes())
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
SDValue getInsertSubvector(const SDLoc &DL, SDValue Vec, SDValue SubVec, unsigned Idx)
Insert SubVec at the Idx element of Vec.
LLVM_ABI SDValue getBitcastedZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by first bitcasting (from potentia...
SelectionDAG(const SelectionDAG &)=delete
LLVM_ABI SDValue getStepVector(const SDLoc &DL, EVT ResVT, const APInt &StepVal)
Returns a vector of type ResVT whose elements contain the linear sequence <0, Step,...
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false, SDNodeFlags Flags={})
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
bool willNotOverflowSub(bool IsSigned, SDValue N0, SDValue N1) const
Determine if the result of the sub of 2 nodes can never overflow.
LLVM_ABI SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, MachineMemOperand *MMO)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands.
LLVM_ABI Align getEVTAlign(EVT MemoryVT) const
Compute the default alignment value for the given type.
void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge)
Set NoMergeSiteInfo to be associated with Node if NoMerge is true.
LLVM_ABI bool shouldOptForSize() const
std::pair< SDValue, SDValue > SplitVectorOperand(const SDNode *N, unsigned OpNo)
Split the node's operand with EXTRACT_SUBVECTOR and return the low/high part.
bool hasSwiftErrorArg() const
LLVM_ABI SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
const STC & getSubtarget() const
LLVM_ABI SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align DstAlign, Align SrcAlign, bool isVol, bool AlwaysInline, const CallInst *CI, std::optional< bool > OverrideTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo=AAMDNodes(), BatchAAResults *BatchAA=nullptr)
const TargetLowering & getTargetLoweringInfo() const
LLVM_ABI bool isEqualTo(SDValue A, SDValue B) const
Test whether two SDValues are known to compare equal.
std::optional< CalledGlobalInfo > getCalledGlobal(const SDNode *Node)
Return CalledGlobal associated with Node, or a nullopt if none exists.
static constexpr unsigned MaxRecursionDepth
LLVM_ABI SDValue getStridedStoreVP(SDValue Chain, const SDLoc &DL, SDValue Val, SDValue Ptr, SDValue Offset, SDValue Stride, SDValue Mask, SDValue EVL, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, bool IsTruncating=false, bool IsCompressing=false)
bool isGuaranteedNotToBePoison(SDValue Op, unsigned Depth=0) const
Return true if this function can prove that Op is never poison.
LLVM_ABI SDValue getIdentityElement(unsigned Opcode, const SDLoc &DL, EVT VT, SDNodeFlags Flags)
Get the (commutative) identity element for the given opcode, if it exists.
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
LLVM_ABI SDValue expandVACopy(SDNode *Node)
Expand the specified ISD::VACOPY node as the Legalize pass would.
LLVM_ABI SDValue getIndexedMaskedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
SelectionDAG & operator=(const SelectionDAG &)=delete
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, MaybeAlign Alignment=std::nullopt, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, LocationSize Size=LocationSize::precise(0), const AAMDNodes &AAInfo=AAMDNodes())
SDValue getTargetConstant(const APInt &Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
LLVM_ABI APInt computeVectorKnownZeroElements(SDValue Op, const APInt &DemandedElts, unsigned Depth=0) const
For each demanded element of a vector, see if it is known to be zero.
LLVM_ABI void AddDbgValue(SDDbgValue *DB, bool isParameter)
Add a dbg_value SDNode.
bool NewNodesMustHaveLegalTypes
When true, additional steps are taken to ensure that getConstant() and similar functions return DAG n...
LLVM_ABI std::pair< EVT, EVT > GetSplitDestVTs(const EVT &VT) const
Compute the VTs needed for the low/hi parts of a type which is split (or expanded) into two not neces...
MDNode * getHeapAllocSite(const SDNode *Node) const
Return HeapAllocSite associated with Node, or nullptr if none exists.
LLVM_ABI void salvageDebugInfo(SDNode &N)
To be invoked on an SDNode that is slated to be erased.
LLVM_ABI SDNode * MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs, ArrayRef< SDValue > Ops)
This mutates the specified node to have the specified return type, opcode, and operands.
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags=0)
MDNode * getMMRAMetadata(const SDNode *Node) const
Return the MMRA MDNode associated with Node, or nullptr if none exists.
SDValue getLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, bool IsExpanding=false)
LLVM_ABI std::pair< SDValue, SDValue > UnrollVectorOverflowOp(SDNode *N, unsigned ResNE=0)
Like UnrollVectorOp(), but for the [US](ADD|SUB|MUL)O family of opcodes.
allnodes_const_iterator allnodes_begin() const
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, SDValue InGlue, const SDLoc &DL)
Return a new CALLSEQ_END node, which always must have a glue result (to ensure it's not CSE'd).
LLVM_ABI SDValue getGatherVP(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
LLVM_ABI SDValue getBitcastedAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by first bitcasting (from potentia...
allnodes_const_iterator allnodes_end() const
LLVM_ABI bool isSplatValue(SDValue V, const APInt &DemandedElts, APInt &UndefElts, unsigned Depth=0) const
Test whether V has a splatted value for all the demanded elements.
LLVM_ABI void DeleteNode(SDNode *N)
Remove the specified node from the system.
LLVM_ABI SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
LLVM_ABI SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type.
LLVM_ABI SDDbgValue * getDbgValueList(DIVariable *Var, DIExpression *Expr, ArrayRef< SDDbgOperand > Locs, ArrayRef< SDNode * > Dependencies, bool IsIndirect, const DebugLoc &DL, unsigned O, bool IsVariadic)
Creates a SDDbgValue node from a list of locations.
LLVM_ABI std::pair< SDValue, SDValue > getStrcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, const CallInst *CI)
Lower a strcpy operation into a target library call and return the resulting chain and call result as...
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, Register Reg, EVT VT)
SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS, SDValue RHS, SDNodeFlags Flags=SDNodeFlags())
Helper function to make it easier to build Select's if you just have operands and don't want to check...
SDDbgInfo::DbgIterator DbgEnd() const
LLVM_ABI SDValue getNegative(SDValue Val, const SDLoc &DL, EVT VT)
Create negative operation as (SUB 0, Val).
LLVM_ABI std::optional< unsigned > getValidShiftAmount(SDValue V, const APInt &DemandedElts, unsigned Depth=0) const
If a SHL/SRA/SRL node V has a uniform shift amount that is less than the element bit-width of the shi...
LLVM_ABI void setNodeMemRefs(MachineSDNode *N, ArrayRef< MachineMemOperand * > NewMemRefs)
Mutate the specified machine node's memory references to the provided list.
LLVM_ABI SDValue simplifySelect(SDValue Cond, SDValue TVal, SDValue FVal)
Try to simplify a select/vselect into 1 of its operands or a constant.
CallSiteInfo getCallSiteInfo(const SDNode *Node)
Return CallSiteInfo associated with Node, or a default if none exists.
LLVM_ABI SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value.
LLVM_ABI bool isConstantFPBuildVectorOrConstantFP(SDValue N) const
Test whether the given value is a constant FP or similar node.
const DataLayout & getDataLayout() const
allnodes_iterator allnodes_begin()
LLVM_ABI SDValue getPartialReduceMLS(unsigned Opc, const SDLoc &DL, SDValue Acc, SDValue LHS, SDValue RHS)
Get an expression that implements a partial multiply-subtract reduction.
iterator_range< allnodes_const_iterator > allnodes() const
MDNode * getPCSections(const SDNode *Node) const
Return PCSections associated with Node, or nullptr if none exists.
ProfileSummaryInfo * getPSI() const
LLVM_ABI SDValue expandVAArg(SDNode *Node)
Expand the specified ISD::VAARG node as the Legalize pass would.
SDValue getTargetFrameIndex(int FI, EVT VT)
LLVM_ABI void Legalize()
This transforms the SelectionDAG into a SelectionDAG that is compatible with the target instruction s...
LLVM_ABI SDValue getTokenFactor(const SDLoc &DL, SmallVectorImpl< SDValue > &Vals)
Creates a new TokenFactor containing Vals.
LLVM_ABI void setGraphAttrs(const SDNode *N, const char *Attrs)
Set graph attributes for a node. (eg. "color=red".)
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, SDValue Reg, SDValue N, SDValue Glue)
LLVM_ABI SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
Helper function to build ISD::STORE nodes.
LLVM_ABI bool LegalizeOp(SDNode *N, SmallSetVector< SDNode *, 16 > &UpdatedNodes)
Transforms a SelectionDAG node and any operands to it into a node that is compatible with the target ...
LLVM_ABI bool doesNodeExist(unsigned Opcode, SDVTList VTList, ArrayRef< SDValue > Ops)
Check if a node exists without modifying its flags.
LLVM_ABI ConstantRange computeConstantRangeIncludingKnownBits(SDValue Op, bool ForSigned, unsigned Depth=0) const
Combine constant ranges from computeConstantRange() and computeKnownBits().
void addHeapAllocSite(const SDNode *Node, MDNode *MD)
Set HeapAllocSite to be associated with Node.
const SelectionDAGTargetInfo & getSelectionDAGInfo() const
LLVM_ABI bool areNonVolatileConsecutiveLoads(LoadSDNode *LD, LoadSDNode *Base, unsigned Bytes, int Dist) const
Return true if loads are next to each other and can be merged.
LLVM_ABI SDValue getMaskedHistogram(SDVTList VTs, EVT MemVT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
LLVM_ABI SDDbgLabel * getDbgLabel(DILabel *Label, const DebugLoc &DL, unsigned O)
Creates a SDDbgLabel node.
SDValue getTargetConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
LLVM_ABI SDValue getStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Offset, SDValue Mask, SDValue EVL, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, bool IsTruncating=false, bool IsCompressing=false)
std::pair< SDValue, SDValue > SplitVector(const SDValue &N, const SDLoc &DL)
Split the vector with EXTRACT_SUBVECTOR and return the low/high part.
LLVM_ABI OverflowKind computeOverflowForUnsignedMul(SDValue N0, SDValue N1) const
Determine if the result of the unsigned mul of 2 nodes can overflow.
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, Register Reg, SDValue N, SDValue Glue)
LLVM_ABI void copyExtraInfo(SDNode *From, SDNode *To)
Copy extra info associated with one node to another.
LLVM_ABI SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
LLVM_ABI void setGraphColor(const SDNode *N, const char *Color)
Convenience for setting node color attribute.
LLVM_ABI SDValue getMemBasePlusOffset(SDValue Base, TypeSize Offset, const SDLoc &DL, const SDNodeFlags Flags=SDNodeFlags())
Returns sum of the base pointer and offset.
LLVM_ABI SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, bool isTargetGA=false, unsigned TargetFlags=0)
bool willNotOverflowMul(bool IsSigned, SDValue N0, SDValue N1) const
Determine if the result of the mul of 2 nodes can never overflow.
SDValue getSignedTargetConstant(int64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
LLVM_ABI SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue SV, unsigned Align)
VAArg produces a result and token chain, and takes a pointer and a source value as input.
OverflowKind computeOverflowForMul(bool IsSigned, SDValue N0, SDValue N1) const
Determine if the result of the mul of 2 nodes can overflow.
LLVM_ABI SDValue getLoadFFVP(EVT VT, const SDLoc &DL, SDValue Chain, SDValue Ptr, SDValue Mask, SDValue EVL, MachineMemOperand *MMO)
LLVM_ABI SDValue getTypeSize(const SDLoc &DL, EVT VT, TypeSize TS)
LLVM_ABI SDValue getMDNode(const MDNode *MD)
Return an MDNodeSDNode which holds an MDNode.
LLVM_ABI void clear()
Clear state and free memory necessary to make this SelectionDAG ready to process a new block.
SDValue getCALLSEQ_END(SDValue Chain, uint64_t Size1, uint64_t Size2, SDValue Glue, const SDLoc &DL)
LLVM_ABI std::pair< SDValue, SDValue > getMemcmp(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, const CallInst *CI)
Lower a memcmp operation into a target library call and return the resulting chain and call result as...
LLVM_ABI void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
LLVM_ABI SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Offset, MachineMemOperand *MMO)
LLVM_ABI SDValue getCommutedVectorShuffle(const ShuffleVectorSDNode &SV)
Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to the shuffle node in input but with swa...
LLVM_ABI SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
LLVM_ABI std::pair< SDValue, SDValue > SplitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the vector with EXTRACT_SUBVECTOR using the provided VTs and return the low/high part.
LLVM_ABI SDValue makeStateFunctionCall(unsigned LibFunc, SDValue Ptr, SDValue InChain, const SDLoc &DLoc)
Helper used to make a call to a library function that has one argument of pointer type.
LLVM_ABI SDValue getSignedConstant(int64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
LLVM_ABI SDValue getIndexedLoadVP(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
LLVM_ABI SDValue getSrcValue(const Value *v)
Construct a node to track a Value* through the backend.
SDValue getSplatVector(EVT VT, const SDLoc &DL, SDValue Op)
LLVM_ABI SDValue getAtomicMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
LLVM_ABI OverflowKind computeOverflowForSignedMul(SDValue N0, SDValue N1) const
Determine if the result of the signed mul of 2 nodes can overflow.
LLVM_ABI MaybeAlign InferPtrAlign(SDValue Ptr) const
Infer alignment of a load / store address.
LLVM_ABI void dump() const
Dump the textual format of this DAG.
FlagInserter * getFlagInserter()
LLVM_ABI bool MaskedValueIsAllOnes(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if '(Op & Mask) == Mask'.
SDValue getCALLSEQ_START(SDValue Chain, uint64_t InSize, uint64_t OutSize, const SDLoc &DL)
Return a new CALLSEQ_START node, that starts new call frame, in which InSize bytes are set up inside ...
bool hasDebugValues() const
Return true if there are any SDDbgValue nodes associated with this SelectionDAG.
LLVM_ABI bool SignBitIsZero(SDValue Op, unsigned Depth=0) const
Return true if the sign bit of Op is known to be zero.
LLVM_ABI void RemoveDeadNodes()
This method deletes all unreachable nodes in the SelectionDAG.
LLVM_ABI void RemoveDeadNode(SDNode *N)
Remove the specified node from the system.
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDUse > Ops)
Return an ISD::BUILD_VECTOR node.
LLVM_ABI void AddDbgLabel(SDDbgLabel *DB)
Add a dbg_label SDNode.
bool isConstantValueOfAnyType(SDValue N) const
SDDbgInfo::DbgLabelIterator DbgLabelEnd() const
allnodes_iterator allnodes_end()
SDDbgInfo::DbgLabelIterator DbgLabelBegin() const
LLVM_ABI bool canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts, UndefPoisonKind Kind=UndefPoisonKind::UndefOrPoison, bool ConsiderFlags=true, unsigned Depth=0) const
Return true if Op can create undef or poison from non-undef & non-poison operands.
SDValue getInsertVectorElt(const SDLoc &DL, SDValue Vec, SDValue Elt, unsigned Idx)
Insert Elt into Vec at offset Idx.
LLVM_ABI SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand)
A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
LLVM_ABI SDValue getBasicBlock(MachineBasicBlock *MBB)
SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond, SDNodeFlags Flags=SDNodeFlags())
Helper function to make it easier to build SelectCC's if you just have an ISD::CondCode instead of an...
MachineFunctionAnalysisManager * getMFAM()
LLVM_ABI SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either sign-extending or trunca...
LLVM_ABI SDDbgValue * getVRegDbgValue(DIVariable *Var, DIExpression *Expr, Register VReg, bool IsIndirect, const DebugLoc &DL, unsigned O)
Creates a VReg SDDbgValue node.
LLVM_ABI SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
Loads are not normal binary operators: their result type is not determined by their operands,...
LLVM_ABI KnownFPClass computeKnownFPClass(SDValue Op, FPClassTest InterestedClasses, unsigned Depth=0) const
Determine floating-point class information about Op.
LLVM_ABI bool isIdentityElement(unsigned Opc, SDNodeFlags Flags, SDValue V, unsigned OperandNo, unsigned Depth=0) const
Returns true if V is an identity element of Opc with Flags.
LLVM_ABI SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label)
LLVM_ABI std::string getGraphAttrs(const SDNode *N) const
Get graph attributes for a node.
LLVM_ABI SDValue getIndexedStoreVP(SDValue OrigStore, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
LLVM_ABI bool isGuaranteedNotToBeUndefOrPoison(SDValue Op, UndefPoisonKind Kind=UndefPoisonKind::UndefOrPoison, unsigned Depth=0) const
Return true if this function can prove that Op is never poison and, Kind can be used to track poison ...
LLVM_ABI bool isKnownNeverZero(SDValue Op, unsigned Depth=0) const
Test whether the given SDValue is known to contain non-zero value(s).
LLVM_ABI SDValue getIndexedStore(SDValue OrigStore, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
LLVM_ABI SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops, SDNodeFlags Flags=SDNodeFlags())
LLVM_ABI std::optional< unsigned > getValidMinimumShiftAmount(SDValue V, const APInt &DemandedElts, unsigned Depth=0) const
If a SHL/SRA/SRL node V has shift amounts that are all less than the element bit-width of the shift n...
LLVM_ABI SDValue getSetFPEnv(SDValue Chain, const SDLoc &dl, SDValue Ptr, EVT MemVT, MachineMemOperand *MMO)
LLVM_ABI SDValue getBoolExtOrTrunc(SDValue Op, const SDLoc &SL, EVT VT, EVT OpVT)
Convert Op, which must be of integer type, to the integer type VT, by using an extension appropriate ...
LLVM_ABI SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Base, SDValue Offset, SDValue Mask, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, bool IsTruncating=false, bool IsCompressing=false)
LLVM_ABI SDValue getExternalSymbol(const char *Sym, EVT VT)
const TargetMachine & getTarget() const
bool getNoMergeSiteInfo(const SDNode *Node) const
Return NoMerge info associated with Node.
LLVM_ABI std::pair< SDValue, SDValue > getStrictFPExtendOrRound(SDValue Op, SDValue Chain, const SDLoc &DL, EVT VT)
Convert Op, which must be a STRICT operation of float type, to the float type VT, by either extending...
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, SDValue Offset)
LLVM_ABI std::pair< SDValue, SDValue > SplitEVL(SDValue N, EVT VecVT, const SDLoc &DL)
Split the explicit vector length parameter of a VP operation.
LLVM_ABI SDValue getPtrExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either truncating it or perform...
LLVM_ABI SDValue getMaskFromElementCount(const SDLoc &DL, EVT VT, ElementCount Len)
Return a vector with the first 'Len' lanes set to true and remaining lanes set to false.
SDDbgInfo::DbgIterator DbgBegin() const
LLVM_ABI SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either any-extending or truncat...
iterator_range< allnodes_iterator > allnodes()
OverflowKind computeOverflowForAdd(bool IsSigned, SDValue N0, SDValue N1) const
Determine if the result of the addition of 2 nodes can overflow.
LLVM_ABI SDValue getBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, bool isTarget=false, unsigned TargetFlags=0)
LLVM_ABI SDValue WidenVector(const SDValue &N, const SDLoc &DL)
Widen the vector up to the next power of two using INSERT_SUBVECTOR.
const LibcallLoweringInfo & getLibcalls() const
LLVM_ABI SDValue getLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT, Align Alignment, MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo, const MDNode *Ranges=nullptr, bool IsExpanding=false)
LLVM_ABI SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
LLVM_ABI SDDbgValue * getConstantDbgValue(DIVariable *Var, DIExpression *Expr, const Value *C, const DebugLoc &DL, unsigned O)
Creates a constant SDDbgValue node.
LLVM_ABI SDValue getScatterVP(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
LLVM_ABI SDValue getValueType(EVT)
SDValue getTargetConstantFP(double Val, const SDLoc &DL, EVT VT)
LLVM_ABI SDValue getLifetimeNode(bool IsStart, const SDLoc &dl, SDValue Chain, int FrameIndex)
Creates a LifetimeSDNode that starts (IsStart==true) or ends (IsStart==false) the lifetime of the Fra...
ArrayRef< SDDbgValue * > GetDbgValues(const SDNode *SD) const
Get the debug values which reference the given SDNode.
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
LLVM_ABI OverflowKind computeOverflowForSignedAdd(SDValue N0, SDValue N1) const
Determine if the result of the signed addition of 2 nodes can overflow.
LLVM_ABI SDValue getFPExtendOrRound(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of float type, to the float type VT, by either extending or rounding (by tr...
LLVM_ABI unsigned AssignTopologicalOrder()
Topological-sort the AllNodes list and a assign a unique node id for each node in the DAG based on th...
ilist< SDNode >::size_type allnodes_size() const
LLVM_ABI bool isKnownNeverNaN(SDValue Op, const APInt &DemandedElts, bool SNaN=false, unsigned Depth=0) const
Test whether the given SDValue (or all elements of it, if it is a vector) is known to never be NaN in...
LLVM_ABI SDValue FoldConstantBuildVector(BuildVectorSDNode *BV, const SDLoc &DL, EVT DstEltVT)
Fold BUILD_VECTOR of constants/undefs to the destination type BUILD_VECTOR of constants/undefs elemen...
ilist< SDNode >::const_iterator allnodes_const_iterator
LLVM_ABI SDValue getAtomicMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
LLVM_ABI SDValue getIndexedMaskedStore(SDValue OrigStore, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
LLVM_ABI SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo, bool IsCompressing=false)
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
const TargetLibraryInfo & getLibInfo() const
LLVM_ABI unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits.
void addCalledGlobal(const SDNode *Node, const GlobalValue *GV, unsigned OpFlags)
Set CalledGlobal to be associated with Node.
LLVM_ABI bool MaskedVectorIsZero(SDValue Op, const APInt &DemandedElts, unsigned Depth=0) const
Return true if 'Op' is known to be zero in DemandedElts.
LLVM_ABI SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT)
Create a true or false constant of type VT using the target's BooleanContent for type OpVT.
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned TargetFlags=0)
LLVM_ABI SDDbgValue * getFrameIndexDbgValue(DIVariable *Var, DIExpression *Expr, unsigned FI, bool IsIndirect, const DebugLoc &DL, unsigned O)
Creates a FrameIndex SDDbgValue node.
const UniformityInfo * getUniformityInfo() const
LLVM_ABI SDValue getExtStridedLoadVP(ISD::LoadExtType ExtType, const SDLoc &DL, EVT VT, SDValue Chain, SDValue Ptr, SDValue Stride, SDValue Mask, SDValue EVL, EVT MemVT, MachineMemOperand *MMO, bool IsExpanding=false)
CodeGenOptLevel getOptLevel() const
LLVM_ABI SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align DstAlign, Align SrcAlign, bool isVol, const CallInst *CI, std::optional< bool > OverrideTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo=AAMDNodes(), BatchAAResults *BatchAA=nullptr)
LLVM_ABI SDValue getJumpTable(int JTI, EVT VT, bool isTarget=false, unsigned TargetFlags=0)
LLVM_ABI bool isBaseWithConstantOffset(SDValue Op) const
Return true if the specified operand is an ISD::ADD with a ConstantSDNode on the right-hand side,...
LLVM_ABI SDValue getVectorIdxConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
LLVM_ABI void getTopologicallyOrderedNodes(SmallVectorImpl< const SDNode * > &SortedNodes) const
Get all the nodes in their topological order without modifying any states.
LLVM_ABI void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.getNode() alone.
MachineFunction & getMachineFunction() const
LLVM_ABI std::pair< SDValue, SDValue > getStrstr(SDValue Chain, const SDLoc &dl, SDValue S0, SDValue S1, const CallInst *CI)
Lower a strstr operation into a target library call and return the resulting chain and call result as...
LLVM_ABI SDValue getPtrExtendInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return the expression required to extend the Op as a pointer value assuming it was the smaller SrcTy ...
LLVM_ABI OverflowKind computeOverflowForUnsignedAdd(SDValue N0, SDValue N1) const
Determine if the result of the unsigned addition of 2 nodes can overflow.
SDValue getPOISON(EVT VT)
Return a POISON node. POISON does not have a useful SDLoc.
void setFlagInserter(FlagInserter *FI)
SDValue getSplatBuildVector(EVT VT, const SDLoc &DL, SDValue Op)
Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all elements.
bool isSafeToSpeculativelyExecuteNode(const SDNode *N) const
Check if the provided node is save to speculatively executed given its current arguments.
LLVM_ABI SDValue getErrorMergeValues(ArrayRef< EVT > ResultTypes, SDValue Chain, const SDLoc &dl)
Return poison values for each of ResultTypes, substituting Chain for any result of type MVT::Other,...
LLVM_ABI SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
LLVM_ABI SDValue getTruncStridedStoreVP(SDValue Chain, const SDLoc &DL, SDValue Val, SDValue Ptr, SDValue Stride, SDValue Mask, SDValue EVL, EVT SVT, MachineMemOperand *MMO, bool IsCompressing=false)
const FunctionVarLocs * getFunctionVarLocs() const
Returns the result of the AssignmentTrackingAnalysis pass if it's available, otherwise return nullptr...
LLVM_ABI void canonicalizeCommutativeBinop(unsigned Opcode, SDValue &N1, SDValue &N2) const
Swap N1 and N2 if Opcode is a commutative binary opcode and the canonical form expects the opposite o...
LLVM_ABI KnownBits computeKnownBits(SDValue Op, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
LLVM_ABI SDValue getRegisterMask(const uint32_t *RegMask)
LLVM_ABI SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either zero-extending or trunca...
LLVM_ABI SDValue getCondCode(ISD::CondCode Cond)
void addCallSiteInfo(const SDNode *Node, CallSiteInfo &&CallInfo)
Set CallSiteInfo to be associated with Node.
SDValue getExtOrTrunc(bool IsSigned, SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either sign/zero-extending (dep...
LLVM_ABI bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
LLVM_ABI bool isKnownToBeAPowerOfTwoFP(SDValue Val, unsigned Depth=0) const
Test if the given fp value is known to be an integer power-of-2, either positive or negative.
LLVM_ABI OverflowKind computeOverflowForSignedSub(SDValue N0, SDValue N1) const
Determine if the result of the signed sub of 2 nodes can overflow.
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, TypeSize Offset)
Create an add instruction with appropriate flags when used for addressing some offset of an object.
LLVMContext * getContext() const
LLVM_ABI SDValue simplifyFPBinop(unsigned Opcode, SDValue X, SDValue Y, SDNodeFlags Flags)
Try to simplify a floating-point binary operation into 1 of its operands or a constant.
const SDValue & setRoot(SDValue N)
Set the current root tag of the SelectionDAG.
void addPCSections(const SDNode *Node, MDNode *MD)
Set PCSections to be associated with Node.
LLVM_ABI bool isKnownToBeAPowerOfTwo(SDValue Val, bool OrZero=false, unsigned Depth=0) const
Test if the given value is known to have exactly one bit set.
bool isGuaranteedNotToBePoison(SDValue Op, const APInt &DemandedElts, unsigned Depth=0) const
Return true if this function can prove that Op is never poison.
SDValue getTargetConstantPool(MachineConstantPoolValue *C, EVT VT, MaybeAlign Align=std::nullopt, int Offset=0, unsigned TargetFlags=0)
LLVM_ABI SDValue getDeactivationSymbol(const GlobalValue *GV)
LLVM_ABI void clearGraphAttrs()
Clear all previously defined node graph attributes.
LLVM_ABI SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
LLVM_ABI SDValue getMCSymbol(MCSymbol *Sym, EVT VT)
LLVM_ABI bool isUndef(unsigned Opcode, ArrayRef< SDValue > Ops)
Return true if the result of this operation is always undefined.
LLVM_ABI SDValue CreateStackTemporary(TypeSize Bytes, Align Alignment)
Create a stack temporary based on the size in bytes and the alignment.
LLVM_ABI SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
LLVM_ABI std::pair< EVT, EVT > GetDependentSplitDestVTs(const EVT &VT, const EVT &EnvVT, bool *HiIsEmpty) const
Compute the VTs needed for the low/hi parts of a type, dependent on an enveloping VT that has been sp...
LLVM_ABI SDValue foldConstantFPMath(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops)
Fold floating-point operations when all operands are constants and/or undefined.
SDValue getTargetConstantPool(const Constant *C, EVT VT, MaybeAlign Align=std::nullopt, int Offset=0, unsigned TargetFlags=0)
LLVM_ABI std::optional< ConstantRange > getValidShiftAmountRange(SDValue V, const APInt &DemandedElts, unsigned Depth) const
If a SHL/SRA/SRL node V has shift amounts that are all less than the element bit-width of the shift n...
LLVM_ABI SDValue FoldSymbolOffset(unsigned Opcode, EVT VT, const GlobalAddressSDNode *GA, const SDNode *N2)
void RepositionNode(allnodes_iterator Position, SDNode *N)
Move node N in the AllNodes list to be immediately before the given iterator Position.
SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
LLVM_ABI SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
LLVM_ABI SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand, SDValue Subreg)
A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
LLVM_ABI SDDbgValue * getDbgValue(DIVariable *Var, DIExpression *Expr, SDNode *N, unsigned R, bool IsIndirect, const DebugLoc &DL, unsigned O)
Creates a SDDbgValue node.
LLVM_ABI void setSubgraphColor(SDNode *N, const char *Color)
Convenience for setting subgraph color attribute.
LLVM_ABI SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Base, SDValue Offset, SDValue Mask, SDValue Src0, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, ISD::LoadExtType, bool IsExpanding=false)
SDValue getTargetConstantFP(const ConstantFP &Val, const SDLoc &DL, EVT VT)
DenormalMode getDenormalMode(EVT VT) const
Return the current function's default denormal handling kind for the given floating point type.
SDValue getSplat(EVT VT, const SDLoc &DL, SDValue Op)
Returns a node representing a splat of one value into all lanes of the provided vector type.
LLVM_ABI std::pair< SDValue, SDValue > SplitScalar(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the scalar node with EXTRACT_ELEMENT using the provided VTs and return the low/high part.
static unsigned getOpcode_EXTEND(unsigned Opcode)
Convert *_EXTEND_VECTOR_INREG to *_EXTEND opcode.
LLVM_ABI SDValue matchBinOpReduction(SDNode *Extract, ISD::NodeType &BinOp, ArrayRef< ISD::NodeType > CandidateBinOps, bool AllowPartials=false)
Match a binop + shuffle pyramid that represents a horizontal reduction over the elements of a vector ...
LLVM_ABI bool isADDLike(SDValue Op, bool NoWrap=false) const
Return true if the specified operand is an ISD::OR or ISD::XOR node that can be treated as an ISD::AD...
LLVM_ABI SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
LLVM_DUMP_METHOD void dumpDotGraph(const Twine &FileName, const Twine &Title)
Just dump dot graph to a user-provided path and title.
LLVM_ABI SDValue simplifyShift(SDValue X, SDValue Y)
Try to simplify a shift into 1 of its operands or a constant.
LLVM_ABI void transferDbgValues(SDValue From, SDValue To, unsigned OffsetInBits=0, unsigned SizeInBits=0, bool InvalidateDbg=true)
Transfer debug values from one node to another, while optionally generating fragment expressions for ...
LLVM_ABI SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a logical NOT operation as (XOR Val, BooleanOne).
LLVM_ABI SDValue getMaskedScatter(SDVTList VTs, EVT MemVT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType, bool IsTruncating=false)
ilist< SDNode >::iterator allnodes_iterator
LLVM_ABI bool LegalizeTypes()
This transforms the SelectionDAG into a SelectionDAG that only uses types natively supported by the t...
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
A SetVector that performs no allocations if smaller than a certain size.
Definition SetVector.h:345
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
typename SuperClass::iterator iterator
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:128
Provides information about what library functions are available for the current target.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Primary interface to the complete machine description for the target machine.
TargetSubtargetInfo - Generic base class for all target subtargets.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
A Use represents the edge between a Value definition and its users.
Definition Use.h:35
LLVM Value Representation.
Definition Value.h:75
typename base_list_type::const_iterator const_iterator
Definition ilist.h:122
A range adaptor for a pair of iterators.
This file defines classes to implement an intrusive doubly linked list class (i.e.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
Definition ISDOpcodes.h:41
@ SETCC
SetCC operator - This evaluates to a true value iff the condition is true.
Definition ISDOpcodes.h:829
@ STRICT_FSETCC
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only.
Definition ISDOpcodes.h:513
@ POISON
POISON - A poison node.
Definition ISDOpcodes.h:236
@ INSERT_SUBVECTOR
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1.
Definition ISDOpcodes.h:602
@ ANY_EXTEND
ANY_EXTEND - Used for integer types. The high bits are undefined.
Definition ISDOpcodes.h:863
@ SIGN_EXTEND_VECTOR_INREG
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
Definition ISDOpcodes.h:920
@ SDIVREM
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
Definition ISDOpcodes.h:280
@ SIGN_EXTEND
Conversion operators.
Definition ISDOpcodes.h:854
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
Definition ISDOpcodes.h:806
@ UNDEF
UNDEF - An undefined node.
Definition ISDOpcodes.h:233
@ SPLAT_VECTOR
SPLAT_VECTOR(VAL) - Returns a vector with the scalar value VAL duplicated in all lanes.
Definition ISDOpcodes.h:674
@ CopyFromReg
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
Definition ISDOpcodes.h:230
@ EXTRACT_SUBVECTOR
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR.
Definition ISDOpcodes.h:616
@ EXTRACT_VECTOR_ELT
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
Definition ISDOpcodes.h:578
@ CopyToReg
CopyToReg - This node has three operands: a chain, a register number to set to this value,...
Definition ISDOpcodes.h:224
@ ZERO_EXTEND
ZERO_EXTEND - Used for integer types, zeroing the new bits.
Definition ISDOpcodes.h:860
@ SELECT_CC
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
Definition ISDOpcodes.h:821
@ ANY_EXTEND_VECTOR_INREG
ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register any-extension of the low la...
Definition ISDOpcodes.h:909
@ GLOBAL_OFFSET_TABLE
The address of the GOT.
Definition ISDOpcodes.h:103
@ VSELECT
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
Definition ISDOpcodes.h:815
@ INSERT_VECTOR_ELT
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL.
Definition ISDOpcodes.h:567
@ ZERO_EXTEND_VECTOR_INREG
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
Definition ISDOpcodes.h:931
@ CALLSEQ_START
CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of a call sequence,...
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
Definition ISDOpcodes.h:558
MemIndexType
MemIndexType enum - This enum defines how to interpret MGATHER/SCATTER's index parameter when calcula...
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
NodeAddr< NodeBase * > Node
Definition RDFGraph.h:381
This is an optimization pass for GlobalISel generic memory operations.
GenericUniformityInfo< SSAContext > UniformityInfo
@ Offset
Definition DWP.cpp:578
GenericSSAContext< Function > SSAContext
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
FoldingSetBase::Node FoldingSetNode
Definition FoldingSet.h:407
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
iplist< T, Options... > ilist
Definition ilist.h:344
LLVM_ABI void checkForCycles(const SelectionDAG *DAG, bool force=false)
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
AlignedCharArrayUnion< AtomicSDNode, TargetIndexSDNode, BlockAddressSDNode, GlobalAddressSDNode, PseudoProbeSDNode > LargestSDNode
A representation of the largest SDNode, for use in sizeof().
GlobalAddressSDNode MostAlignedSDNode
The SDNode class with the greatest alignment requirement.
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:149
CombineLevel
Definition DAGCombine.h:15
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
Definition InstrProf.h:145
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1917
UndefPoisonKind
Enumeration to track whether we are interested in Undef, Poison, or both.
Definition UndefPoison.h:20
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:390
FoldingSetImpl< T, Trait > FoldingSet
This template class is used to instantiate a specialized implementation of the folding set to the nod...
Definition FoldingSet.h:560
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:878
#define N
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition Metadata.h:763
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
This class provides default implementations for FoldingSetTrait implementations.
Definition FoldingSet.h:117
Represent subnormal handling kind for floating point instruction inputs and outputs.
Extended Value Type.
Definition ValueTypes.h:35
bool isVector() const
Return true if this is a vector value type.
Definition ValueTypes.h:176
bool isScalableVector() const
Return true if this is a vector type where the runtime length is machine dependent.
Definition ValueTypes.h:187
EVT getVectorElementType() const
Given a vector type, return the type of each element.
Definition ValueTypes.h:351
LLVM_ABI const fltSemantics & getFltSemantics() const
Returns an APFloat semantics tag appropriate for the value type.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
Definition ValueTypes.h:359
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
Definition ValueTypes.h:331
bool isInteger() const
Return true if this is an integer or a vector integer type.
Definition ValueTypes.h:160
static bool Equals(const SDVTListNode &X, const FoldingSetNodeID &ID, unsigned IDHash, FoldingSetNodeID &TempID)
static unsigned ComputeHash(const SDVTListNode &X, FoldingSetNodeID &TempID)
static void Profile(const SDVTListNode &X, FoldingSetNodeID &ID)
This trait class is used to define behavior of how to "profile" (in the FoldingSet parlance) an objec...
Definition FoldingSet.h:145
static nodes_iterator nodes_begin(SelectionDAG *G)
static nodes_iterator nodes_end(SelectionDAG *G)
pointer_iterator< SelectionDAG::allnodes_iterator > nodes_iterator
LLVM IR metadata carried by a MachineMemOperand.
This class contains a discriminated union of information about pointers in memory operands,...
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition Alignment.h:106
A simple container for information about the supported runtime calls.
These are IR-level optimization flags that may be propagated to SDNodes.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
DAGNodeDeletedListener(SelectionDAG &DAG, std::function< void(SDNode *, SDNode *)> Callback)
void NodeDeleted(SDNode *N, SDNode *E) override
The node N that was deleted and, if E is not null, an equivalent node E that replaced it.
std::function< void(SDNode *, SDNode *)> Callback
std::function< void(SDNode *)> Callback
void NodeInserted(SDNode *N) override
The node N that was inserted.
DAGNodeInsertedListener(SelectionDAG &DAG, std::function< void(SDNode *)> Callback)
Clients of various APIs that cause global effects on the DAG can optionally implement this interface.
static void deleteNode(SDNode *)
Use delete by default for iplist and ilist.
Definition ilist.h:41