LLVM 23.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"
45#include <cassert>
46#include <cstdint>
47#include <functional>
48#include <map>
49#include <set>
50#include <string>
51#include <tuple>
52#include <utility>
53#include <vector>
54
55namespace llvm {
56
57class DIExpression;
58class DILabel;
59class DIVariable;
60class Function;
61class Pass;
62class Type;
63template <class GraphType> struct GraphTraits;
64template <typename T, unsigned int N> class SmallSetVector;
65template <typename T, typename Enable> struct FoldingSetTrait;
66class BatchAAResults;
67class BlockAddress;
69class Constant;
70class ConstantFP;
71class ConstantInt;
72class DataLayout;
73struct fltSemantics;
75class FunctionVarLocs;
76class GlobalValue;
77struct KnownBits;
78class LLVMContext;
82class MCSymbol;
85class SDDbgValue;
86class SDDbgOperand;
87class SDDbgLabel;
88class SelectionDAG;
91class TargetLowering;
92class TargetMachine;
94class Value;
95
96template <typename T> class GenericSSAContext;
98template <typename T> class GenericUniformityInfo;
100
102 friend struct FoldingSetTrait<SDVTListNode>;
103
104 /// A reference to an Interned FoldingSetNodeID for this node.
105 /// The Allocator in SelectionDAG holds the data.
106 /// SDVTList contains all types which are frequently accessed in SelectionDAG.
107 /// The size of this list is not expected to be big so it won't introduce
108 /// a memory penalty.
109 FoldingSetNodeIDRef FastID;
110 const EVT *VTs;
111 unsigned int NumVTs;
112 /// The hash value for SDVTList is fixed, so cache it to avoid
113 /// hash calculation.
114 unsigned HashValue;
115
116public:
117 SDVTListNode(const FoldingSetNodeIDRef ID, const EVT *VT, unsigned int Num) :
118 FastID(ID), VTs(VT), NumVTs(Num) {
119 HashValue = ID.ComputeHash();
120 }
121
123 SDVTList result = {VTs, NumVTs};
124 return result;
125 }
126};
127
128/// Specialize FoldingSetTrait for SDVTListNode
129/// to avoid computing temp FoldingSetNodeID and hash value.
130template<> struct FoldingSetTrait<SDVTListNode> : DefaultFoldingSetTrait<SDVTListNode> {
131 static void Profile(const SDVTListNode &X, FoldingSetNodeID& ID) {
132 ID = X.FastID;
133 }
134
135 static bool Equals(const SDVTListNode &X, const FoldingSetNodeID &ID,
136 unsigned IDHash, FoldingSetNodeID &TempID) {
137 if (X.HashValue != IDHash)
138 return false;
139 return ID == X.FastID;
140 }
141
142 static unsigned ComputeHash(const SDVTListNode &X, FoldingSetNodeID &TempID) {
143 return X.HashValue;
144 }
145};
146
147template <> struct ilist_alloc_traits<SDNode> {
148 static void deleteNode(SDNode *) {
149 llvm_unreachable("ilist_traits<SDNode> shouldn't see a deleteNode call!");
150 }
151};
152
153/// Keeps track of dbg_value information through SDISel. We do
154/// not build SDNodes for these so as not to perturb the generated code;
155/// instead the info is kept off to the side in this structure. Each SDNode may
156/// have one or more associated dbg_value entries. This information is kept in
157/// DbgValMap.
158/// Byval parameters are handled separately because they don't use alloca's,
159/// which busts the normal mechanism. There is good reason for handling all
160/// parameters separately: they may not have code generated for them, they
161/// should always go at the beginning of the function regardless of other code
162/// motion, and debug info for them is potentially useful even if the parameter
163/// is unused. Right now only byval parameters are handled separately.
165 BumpPtrAllocator Alloc;
167 SmallVector<SDDbgValue*, 32> ByvalParmDbgValues;
170 DbgValMapType DbgValMap;
171
172public:
173 SDDbgInfo() = default;
174 SDDbgInfo(const SDDbgInfo &) = delete;
175 SDDbgInfo &operator=(const SDDbgInfo &) = delete;
176
177 LLVM_ABI void add(SDDbgValue *V, bool isParameter);
178
179 void add(SDDbgLabel *L) { DbgLabels.push_back(L); }
180
181 /// Invalidate all DbgValues attached to the node and remove
182 /// it from the Node-to-DbgValues map.
183 LLVM_ABI void erase(const SDNode *Node);
184
185 void clear() {
186 DbgValMap.clear();
187 DbgValues.clear();
188 ByvalParmDbgValues.clear();
189 DbgLabels.clear();
190 Alloc.Reset();
191 }
192
193 BumpPtrAllocator &getAlloc() { return Alloc; }
194
195 bool empty() const {
196 return DbgValues.empty() && ByvalParmDbgValues.empty() && DbgLabels.empty();
197 }
198
200 auto I = DbgValMap.find(Node);
201 if (I != DbgValMap.end())
202 return I->second;
203 return ArrayRef<SDDbgValue*>();
204 }
205
208
209 DbgIterator DbgBegin() { return DbgValues.begin(); }
210 DbgIterator DbgEnd() { return DbgValues.end(); }
211 DbgIterator ByvalParmDbgBegin() { return ByvalParmDbgValues.begin(); }
212 DbgIterator ByvalParmDbgEnd() { return ByvalParmDbgValues.end(); }
213 DbgLabelIterator DbgLabelBegin() { return DbgLabels.begin(); }
214 DbgLabelIterator DbgLabelEnd() { return DbgLabels.end(); }
215};
216
217LLVM_ABI void checkForCycles(const SelectionDAG *DAG, bool force = false);
218
219/// This is used to represent a portion of an LLVM function in a low-level
220/// Data Dependence DAG representation suitable for instruction selection.
221/// This DAG is constructed as the first step of instruction selection in order
222/// to allow implementation of machine specific optimizations
223/// and code simplifications.
224///
225/// The representation used by the SelectionDAG is a target-independent
226/// representation, which has some similarities to the GCC RTL representation,
227/// but is significantly more simple, powerful, and is a graph form instead of a
228/// linear form.
229///
231 const TargetMachine &TM;
232 const SelectionDAGTargetInfo *TSI = nullptr;
233 const TargetLowering *TLI = nullptr;
234 const TargetLibraryInfo *LibInfo = nullptr;
235 const RTLIB::RuntimeLibcallsInfo *RuntimeLibcallInfo = nullptr;
236 const LibcallLoweringInfo *Libcalls = nullptr;
237
238 const FunctionVarLocs *FnVarLocs = nullptr;
239 MachineFunction *MF;
240 MachineFunctionAnalysisManager *MFAM = nullptr;
241 Pass *SDAGISelPass = nullptr;
242 LLVMContext *Context;
243 CodeGenOptLevel OptLevel;
244
245 UniformityInfo *UA = nullptr;
246 FunctionLoweringInfo * FLI = nullptr;
247
248 /// The function-level optimization remark emitter. Used to emit remarks
249 /// whenever manipulating the DAG.
251
252 ProfileSummaryInfo *PSI = nullptr;
253 BlockFrequencyInfo *BFI = nullptr;
254 MachineModuleInfo *MMI = nullptr;
255
256 /// Extended EVTs used for single value VTLists.
257 std::set<EVT, EVT::compareRawBits> EVTs;
258
259 /// List of non-single value types.
260 FoldingSet<SDVTListNode> VTListMap;
261
262 /// Pool allocation for misc. objects that are created once per SelectionDAG.
263 BumpPtrAllocator Allocator;
264
265 /// The starting token.
266 SDNode EntryNode;
267
268 /// The root of the entire DAG.
269 SDValue Root;
270
271 /// A linked list of nodes in the current DAG.
272 ilist<SDNode> AllNodes;
273
274 /// The AllocatorType for allocating SDNodes. We use
275 /// pool allocation with recycling.
276 using NodeAllocatorType = RecyclingAllocator<BumpPtrAllocator, SDNode,
277 sizeof(LargestSDNode),
278 alignof(MostAlignedSDNode)>;
279
280 /// Pool allocation for nodes.
281 NodeAllocatorType NodeAllocator;
282
283 /// This structure is used to memoize nodes, automatically performing
284 /// CSE with existing nodes when a duplicate is requested.
285 FoldingSet<SDNode> CSEMap;
286
287 /// Pool allocation for machine-opcode SDNode operands.
288 BumpPtrAllocator OperandAllocator;
289 ArrayRecycler<SDUse> OperandRecycler;
290
291 /// Tracks dbg_value and dbg_label information through SDISel.
292 SDDbgInfo *DbgInfo;
293
294 using CallSiteInfo = MachineFunction::CallSiteInfo;
295 using CalledGlobalInfo = MachineFunction::CalledGlobalInfo;
296
297 struct NodeExtraInfo {
298 CallSiteInfo CSInfo;
299 MDNode *HeapAllocSite = nullptr;
300 MDNode *PCSections = nullptr;
301 MDNode *MMRA = nullptr;
302 CalledGlobalInfo CalledGlobal{};
303 bool NoMerge = false;
304 };
305 /// Out-of-line extra information for SDNodes.
307
308 /// PersistentId counter to be used when inserting the next
309 /// SDNode to this SelectionDAG. We do not place that under
310 /// `#if LLVM_ENABLE_ABI_BREAKING_CHECKS` intentionally because
311 /// it adds unneeded complexity without noticeable
312 /// benefits (see discussion with @thakis in D120714).
313 uint16_t NextPersistentId = 0;
314
315public:
316 /// Clients of various APIs that cause global effects on
317 /// the DAG can optionally implement this interface. This allows the clients
318 /// to handle the various sorts of updates that happen.
319 ///
320 /// A DAGUpdateListener automatically registers itself with DAG when it is
321 /// constructed, and removes itself when destroyed in RAII fashion.
325
327 : Next(D.UpdateListeners), DAG(D) {
328 DAG.UpdateListeners = this;
329 }
330
332 assert(DAG.UpdateListeners == this &&
333 "DAGUpdateListeners must be destroyed in LIFO order");
334 DAG.UpdateListeners = Next;
335 }
336
337 /// The node N that was deleted and, if E is not null, an
338 /// equivalent node E that replaced it.
339 virtual void NodeDeleted(SDNode *N, SDNode *E);
340
341 /// The node N that was updated.
342 virtual void NodeUpdated(SDNode *N);
343
344 /// The node N that was inserted.
345 virtual void NodeInserted(SDNode *N);
346 };
347
349 std::function<void(SDNode *, SDNode *)> Callback;
350
354
355 void NodeDeleted(SDNode *N, SDNode *E) override { Callback(N, E); }
356
357 private:
358 virtual void anchor();
359 };
360
362 std::function<void(SDNode *)> Callback;
363
367
368 void NodeInserted(SDNode *N) override { Callback(N); }
369
370 private:
371 virtual void anchor();
372 };
373
374 /// Help to insert SDNodeFlags automatically in transforming. Use
375 /// RAII to save and resume flags in current scope.
377 SelectionDAG &DAG;
378 SDNodeFlags Flags;
379 FlagInserter *LastInserter;
380
381 public:
383 : DAG(SDAG), Flags(Flags),
384 LastInserter(SDAG.getFlagInserter()) {
385 SDAG.setFlagInserter(this);
386 }
389
390 FlagInserter(const FlagInserter &) = delete;
392 ~FlagInserter() { DAG.setFlagInserter(LastInserter); }
393
394 SDNodeFlags getFlags() const { return Flags; }
395 };
396
397 /// When true, additional steps are taken to
398 /// ensure that getConstant() and similar functions return DAG nodes that
399 /// have legal types. This is important after type legalization since
400 /// any illegally typed nodes generated after this point will not experience
401 /// type legalization.
403
404private:
405 /// DAGUpdateListener is a friend so it can manipulate the listener stack.
406 friend struct DAGUpdateListener;
407
408 /// Linked list of registered DAGUpdateListener instances.
409 /// This stack is maintained by DAGUpdateListener RAII.
410 DAGUpdateListener *UpdateListeners = nullptr;
411
412 /// Implementation of setSubgraphColor.
413 /// Return whether we had to truncate the search.
414 bool setSubgraphColorHelper(SDNode *N, const char *Color,
415 DenseSet<SDNode *> &visited,
416 int level, bool &printed);
417
418 template <typename SDNodeT, typename... ArgTypes>
419 SDNodeT *newSDNode(ArgTypes &&... Args) {
420 return new (NodeAllocator.template Allocate<SDNodeT>())
421 SDNodeT(std::forward<ArgTypes>(Args)...);
422 }
423
424 /// Build a synthetic SDNodeT with the given args and extract its subclass
425 /// data as an integer (e.g. for use in a folding set).
426 ///
427 /// The args to this function are the same as the args to SDNodeT's
428 /// constructor, except the second arg (assumed to be a const DebugLoc&) is
429 /// omitted.
430 template <typename SDNodeT, typename... ArgTypes>
431 static uint16_t getSyntheticNodeSubclassData(unsigned IROrder,
432 ArgTypes &&... Args) {
433 // The compiler can reduce this expression to a constant iff we pass an
434 // empty DebugLoc. Thankfully, the debug location doesn't have any bearing
435 // on the subclass data.
436 return SDNodeT(IROrder, DebugLoc(), std::forward<ArgTypes>(Args)...)
437 .getRawSubclassData();
438 }
439
440 template <typename SDNodeTy>
441 static uint16_t getSyntheticNodeSubclassData(unsigned Opc, unsigned Order,
442 SDVTList VTs, EVT MemoryVT,
443 MachineMemOperand *MMO) {
444 return SDNodeTy(Opc, Order, DebugLoc(), VTs, MemoryVT, MMO)
445 .getRawSubclassData();
446 }
447
448 template <typename SDNodeTy>
449 static uint16_t getSyntheticNodeSubclassData(
450 unsigned Opc, unsigned Order, SDVTList VTs, EVT MemoryVT,
451 PointerUnion<MachineMemOperand *, MachineMemOperand **> MemRefs) {
452 return SDNodeTy(Opc, Order, DebugLoc(), VTs, MemoryVT, MemRefs)
453 .getRawSubclassData();
454 }
455
456 void createOperands(SDNode *Node, ArrayRef<SDValue> Vals);
457
458 void removeOperands(SDNode *Node) {
459 if (!Node->OperandList)
460 return;
461 OperandRecycler.deallocate(
463 Node->OperandList);
464 Node->NumOperands = 0;
465 Node->OperandList = nullptr;
466 }
467 void CreateTopologicalOrder(std::vector<SDNode*>& Order);
468
469public:
470 // Maximum depth for recursive analysis such as computeKnownBits, etc.
471 static constexpr unsigned MaxRecursionDepth = 6;
472
473 // Returns the maximum steps for SDNode->hasPredecessor() like searches.
474 LLVM_ABI static unsigned getHasPredecessorMaxSteps();
475
477 SelectionDAG(const SelectionDAG &) = delete;
480
481 /// Prepare this SelectionDAG to process code in the given MachineFunction.
483 Pass *PassPtr, const TargetLibraryInfo *LibraryInfo,
484 const LibcallLoweringInfo *LibcallsInfo,
487 FunctionVarLocs const *FnVarLocs);
488
491 const TargetLibraryInfo *LibraryInfo,
492 const LibcallLoweringInfo *LibcallsInfo, UniformityInfo *UA,
494 MachineModuleInfo &MMI, FunctionVarLocs const *FnVarLocs) {
495 init(NewMF, NewORE, nullptr, LibraryInfo, LibcallsInfo, UA, PSIin, BFIin,
496 MMI, FnVarLocs);
497 MFAM = &AM;
498 }
499
501 FLI = FuncInfo;
502 }
503
504 /// Clear state and free memory necessary to make this
505 /// SelectionDAG ready to process a new block.
506 LLVM_ABI void clear();
507
508 MachineFunction &getMachineFunction() const { return *MF; }
509 const Pass *getPass() const { return SDAGISelPass; }
511
512 CodeGenOptLevel getOptLevel() const { return OptLevel; }
513 const DataLayout &getDataLayout() const { return MF->getDataLayout(); }
514 const TargetMachine &getTarget() const { return TM; }
515 const TargetSubtargetInfo &getSubtarget() const { return MF->getSubtarget(); }
516 template <typename STC> const STC &getSubtarget() const {
517 return MF->getSubtarget<STC>();
518 }
519 const TargetLowering &getTargetLoweringInfo() const { return *TLI; }
520 const TargetLibraryInfo &getLibInfo() const { return *LibInfo; }
521
522 const LibcallLoweringInfo &getLibcalls() const { return *Libcalls; }
523
525 return *RuntimeLibcallInfo;
526 }
527
528 const SelectionDAGTargetInfo &getSelectionDAGInfo() const { return *TSI; }
529 const UniformityInfo *getUniformityInfo() const { return UA; }
530 /// Returns the result of the AssignmentTrackingAnalysis pass if it's
531 /// available, otherwise return nullptr.
532 const FunctionVarLocs *getFunctionVarLocs() const { return FnVarLocs; }
533 LLVMContext *getContext() const { return Context; }
534 OptimizationRemarkEmitter &getORE() const { return *ORE; }
535 ProfileSummaryInfo *getPSI() const { return PSI; }
536 BlockFrequencyInfo *getBFI() const { return BFI; }
537 MachineModuleInfo *getMMI() const { return MMI; }
538
539 FlagInserter *getFlagInserter() { return Inserter; }
540 void setFlagInserter(FlagInserter *FI) { Inserter = FI; }
541
542 /// Just dump dot graph to a user-provided path and title.
543 /// This doesn't open the dot viewer program and
544 /// helps visualization when outside debugging session.
545 /// FileName expects absolute path. If provided
546 /// without any path separators then the file
547 /// will be created in the current directory.
548 /// Error will be emitted if the path is insane.
549#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
550 LLVM_DUMP_METHOD void dumpDotGraph(const Twine &FileName, const Twine &Title);
551#endif
552
553 /// Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
554 LLVM_ABI void viewGraph(const std::string &Title);
555 LLVM_ABI void viewGraph();
556
557#if LLVM_ENABLE_ABI_BREAKING_CHECKS
558 std::map<const SDNode *, std::string> NodeGraphAttrs;
559#endif
560
561 /// Clear all previously defined node graph attributes.
562 /// Intended to be used from a debugging tool (eg. gdb).
564
565 /// Set graph attributes for a node. (eg. "color=red".)
566 LLVM_ABI void setGraphAttrs(const SDNode *N, const char *Attrs);
567
568 /// Get graph attributes for a node. (eg. "color=red".)
569 /// Used from getNodeAttributes.
570 LLVM_ABI std::string getGraphAttrs(const SDNode *N) const;
571
572 /// Convenience for setting node color attribute.
573 LLVM_ABI void setGraphColor(const SDNode *N, const char *Color);
574
575 /// Convenience for setting subgraph color attribute.
576 LLVM_ABI void setSubgraphColor(SDNode *N, const char *Color);
577
579
580 allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); }
581 allnodes_const_iterator allnodes_end() const { return AllNodes.end(); }
582
584
585 allnodes_iterator allnodes_begin() { return AllNodes.begin(); }
586 allnodes_iterator allnodes_end() { return AllNodes.end(); }
587
589 return AllNodes.size();
590 }
591
598
599 /// Return the root tag of the SelectionDAG.
600 const SDValue &getRoot() const { return Root; }
601
602 /// Return the token chain corresponding to the entry of the function.
604 return SDValue(const_cast<SDNode *>(&EntryNode), 0);
605 }
606
607 /// Set the current root tag of the SelectionDAG.
608 ///
610 assert((!N.getNode() || N.getValueType() == MVT::Other) &&
611 "DAG root value is not a chain!");
612 if (N.getNode())
613 checkForCycles(N.getNode(), this);
614 Root = N;
615 if (N.getNode())
616 checkForCycles(this);
617 return Root;
618 }
619
620#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
621 void VerifyDAGDivergence();
622#endif
623
624 /// This iterates over the nodes in the SelectionDAG, folding
625 /// certain types of nodes together, or eliminating superfluous nodes. The
626 /// Level argument controls whether Combine is allowed to produce nodes and
627 /// types that are illegal on the target.
628 LLVM_ABI void Combine(CombineLevel Level, BatchAAResults *BatchAA,
629 CodeGenOptLevel OptLevel);
630
631 /// This transforms the SelectionDAG into a SelectionDAG that
632 /// only uses types natively supported by the target.
633 /// Returns "true" if it made any changes.
634 ///
635 /// Note that this is an involved process that may invalidate pointers into
636 /// the graph.
637 LLVM_ABI bool LegalizeTypes();
638
639 /// This transforms the SelectionDAG into a SelectionDAG that is
640 /// compatible with the target instruction selector, as indicated by the
641 /// TargetLowering object.
642 ///
643 /// Note that this is an involved process that may invalidate pointers into
644 /// the graph.
645 LLVM_ABI void Legalize();
646
647 /// Transforms a SelectionDAG node and any operands to it into a node
648 /// that is compatible with the target instruction selector, as indicated by
649 /// the TargetLowering object.
650 ///
651 /// \returns true if \c N is a valid, legal node after calling this.
652 ///
653 /// This essentially runs a single recursive walk of the \c Legalize process
654 /// over the given node (and its operands). This can be used to incrementally
655 /// legalize the DAG. All of the nodes which are directly replaced,
656 /// potentially including N, are added to the output parameter \c
657 /// UpdatedNodes so that the delta to the DAG can be understood by the
658 /// caller.
659 ///
660 /// When this returns false, N has been legalized in a way that make the
661 /// pointer passed in no longer valid. It may have even been deleted from the
662 /// DAG, and so it shouldn't be used further. When this returns true, the
663 /// N passed in is a legal node, and can be immediately processed as such.
664 /// This may still have done some work on the DAG, and will still populate
665 /// UpdatedNodes with any new nodes replacing those originally in the DAG.
667 SmallSetVector<SDNode *, 16> &UpdatedNodes);
668
669 /// This transforms the SelectionDAG into a SelectionDAG
670 /// that only uses vector math operations supported by the target. This is
671 /// necessary as a separate step from Legalize because unrolling a vector
672 /// operation can introduce illegal types, which requires running
673 /// LegalizeTypes again.
674 ///
675 /// This returns true if it made any changes; in that case, LegalizeTypes
676 /// is called again before Legalize.
677 ///
678 /// Note that this is an involved process that may invalidate pointers into
679 /// the graph.
681
682 /// This method deletes all unreachable nodes in the SelectionDAG.
684
685 /// Remove the specified node from the system. This node must
686 /// have no referrers.
688
689 /// Return an SDVTList that represents the list of values specified.
692 LLVM_ABI SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3);
693 LLVM_ABI SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3, EVT VT4);
695
696 //===--------------------------------------------------------------------===//
697 // Node creation methods.
698
699 /// Create a ConstantSDNode wrapping a constant value.
700 /// If VT is a vector type, the constant is splatted into a BUILD_VECTOR.
701 ///
702 /// If only legal types can be produced, this does the necessary
703 /// transformations (e.g., if the vector element type is illegal).
704 /// @{
706 bool isTarget = false, bool isOpaque = false);
707 LLVM_ABI SDValue getConstant(const APInt &Val, const SDLoc &DL, EVT VT,
708 bool isTarget = false, bool isOpaque = false);
709
710 LLVM_ABI SDValue getSignedConstant(int64_t Val, const SDLoc &DL, EVT VT,
711 bool isTarget = false,
712 bool isOpaque = false);
713
715 bool IsTarget = false,
716 bool IsOpaque = false);
717
718 LLVM_ABI SDValue getConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT,
719 bool isTarget = false, bool isOpaque = false);
721 bool isTarget = false);
723 const SDLoc &DL);
725 const SDLoc &DL);
727 bool isTarget = false);
728
730 bool isOpaque = false) {
731 return getConstant(Val, DL, VT, true, isOpaque);
732 }
733 SDValue getTargetConstant(const APInt &Val, const SDLoc &DL, EVT VT,
734 bool isOpaque = false) {
735 return getConstant(Val, DL, VT, true, isOpaque);
736 }
738 bool isOpaque = false) {
739 return getConstant(Val, DL, VT, true, isOpaque);
740 }
741 SDValue getSignedTargetConstant(int64_t Val, const SDLoc &DL, EVT VT,
742 bool isOpaque = false) {
743 return getSignedConstant(Val, DL, VT, true, isOpaque);
744 }
745
746 /// Create a true or false constant of type \p VT using the target's
747 /// BooleanContent for type \p OpVT.
748 LLVM_ABI SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT);
749 /// @}
750
751 /// Create a ConstantFPSDNode wrapping a constant value.
752 /// If VT is a vector type, the constant is splatted into a BUILD_VECTOR.
753 ///
754 /// If only legal types can be produced, this does the necessary
755 /// transformations (e.g., if the vector element type is illegal).
756 /// The forms that take a double should only be used for simple constants
757 /// that can be exactly represented in VT. No checks are made.
758 /// @{
759 LLVM_ABI SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT,
760 bool isTarget = false);
761 LLVM_ABI SDValue getConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT,
762 bool isTarget = false);
763 LLVM_ABI SDValue getConstantFP(const ConstantFP &V, const SDLoc &DL, EVT VT,
764 bool isTarget = false);
765 SDValue getTargetConstantFP(double Val, const SDLoc &DL, EVT VT) {
766 return getConstantFP(Val, DL, VT, true);
767 }
768 SDValue getTargetConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT) {
769 return getConstantFP(Val, DL, VT, true);
770 }
772 return getConstantFP(Val, DL, VT, true);
773 }
774 /// @}
775
777 EVT VT, int64_t offset = 0,
778 bool isTargetGA = false,
779 unsigned TargetFlags = 0);
781 int64_t offset = 0, unsigned TargetFlags = 0) {
782 return getGlobalAddress(GV, DL, VT, offset, true, TargetFlags);
783 }
785 LLVM_ABI SDValue getFrameIndex(int FI, EVT VT, bool isTarget = false);
787 return getFrameIndex(FI, VT, true);
788 }
789 LLVM_ABI SDValue getJumpTable(int JTI, EVT VT, bool isTarget = false,
790 unsigned TargetFlags = 0);
791 SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags = 0) {
792 return getJumpTable(JTI, VT, true, TargetFlags);
793 }
795 const SDLoc &DL);
797 MaybeAlign Align = std::nullopt,
798 int Offs = 0, bool isT = false,
799 unsigned TargetFlags = 0);
801 MaybeAlign Align = std::nullopt, int Offset = 0,
802 unsigned TargetFlags = 0) {
803 return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
804 }
806 MaybeAlign Align = std::nullopt,
807 int Offs = 0, bool isT = false,
808 unsigned TargetFlags = 0);
810 MaybeAlign Align = std::nullopt, int Offset = 0,
811 unsigned TargetFlags = 0) {
812 return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
813 }
814 // When generating a branch to a BB, we don't in general know enough
815 // to provide debug info for the BB at that time, so keep this one around.
817 LLVM_ABI SDValue getExternalSymbol(const char *Sym, EVT VT);
818 LLVM_ABI SDValue getExternalSymbol(RTLIB::LibcallImpl LCImpl, EVT VT);
819 LLVM_ABI SDValue getTargetExternalSymbol(const char *Sym, EVT VT,
820 unsigned TargetFlags = 0);
821 LLVM_ABI SDValue getTargetExternalSymbol(RTLIB::LibcallImpl LCImpl, EVT VT,
822 unsigned TargetFlags = 0);
823
825
829 LLVM_ABI SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label);
830 LLVM_ABI SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root,
831 MCSymbol *Label);
833 int64_t Offset = 0, bool isTarget = false,
834 unsigned TargetFlags = 0);
836 int64_t Offset = 0, unsigned TargetFlags = 0) {
837 return getBlockAddress(BA, VT, Offset, true, TargetFlags);
838 }
839
841 SDValue N) {
842 return getNode(ISD::CopyToReg, dl, MVT::Other, Chain,
843 getRegister(Reg, N.getValueType()), N);
844 }
845
846 // This version of the getCopyToReg method takes an extra operand, which
847 // indicates that there is potentially an incoming glue value (if Glue is not
848 // null) and that there should be a glue result.
850 SDValue Glue) {
851 SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
852 SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Glue };
853 return getNode(ISD::CopyToReg, dl, VTs,
854 ArrayRef(Ops, Glue.getNode() ? 4 : 3));
855 }
856
857 // Similar to last getCopyToReg() except parameter Reg is a SDValue
859 SDValue Glue) {
860 SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
861 SDValue Ops[] = { Chain, Reg, N, Glue };
862 return getNode(ISD::CopyToReg, dl, VTs,
863 ArrayRef(Ops, Glue.getNode() ? 4 : 3));
864 }
865
867 SDVTList VTs = getVTList(VT, MVT::Other);
868 SDValue Ops[] = { Chain, getRegister(Reg, VT) };
869 return getNode(ISD::CopyFromReg, dl, VTs, Ops);
870 }
871
872 // This version of the getCopyFromReg method takes an extra operand, which
873 // indicates that there is potentially an incoming glue value (if Glue is not
874 // null) and that there should be a glue result.
876 SDValue Glue) {
877 SDVTList VTs = getVTList(VT, MVT::Other, MVT::Glue);
878 SDValue Ops[] = { Chain, getRegister(Reg, VT), Glue };
879 return getNode(ISD::CopyFromReg, dl, VTs,
880 ArrayRef(Ops, Glue.getNode() ? 3 : 2));
881 }
882
884
885 /// Return an ISD::VECTOR_SHUFFLE node. The number of elements in VT,
886 /// which must be a vector type, must match the number of mask elements
887 /// NumElts. An integer mask element equal to -1 is treated as undefined.
889 SDValue N2, ArrayRef<int> Mask);
890
891 /// Return an ISD::BUILD_VECTOR node. The number of elements in VT,
892 /// which must be a vector type, must match the number of operands in Ops.
893 /// The operands must have the same type as (or, for integers, a type wider
894 /// than) VT's element type.
896 // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
897 return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
898 }
899
900 /// Return an ISD::BUILD_VECTOR node. The number of elements in VT,
901 /// which must be a vector type, must match the number of operands in Ops.
902 /// The operands must have the same type as (or, for integers, a type wider
903 /// than) VT's element type.
905 // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
906 return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
907 }
908
909 /// Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all
910 /// elements. VT must be a vector type. Op's type must be the same as (or,
911 /// for integers, a type wider than) VT's element type.
913 // VerifySDNode (via InsertNode) checks BUILD_VECTOR later.
914 if (Op.isUndef()) {
915 assert((VT.getVectorElementType() == Op.getValueType() ||
916 (VT.isInteger() &&
917 VT.getVectorElementType().bitsLE(Op.getValueType()))) &&
918 "A splatted value must have a width equal or (for integers) "
919 "greater than the vector element type!");
920 return getNode(ISD::UNDEF, SDLoc(), VT);
921 }
922
924 return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
925 }
926
927 // Return a splat ISD::SPLAT_VECTOR node, consisting of Op splatted to all
928 // elements.
930 if (Op.isUndef()) {
931 assert((VT.getVectorElementType() == Op.getValueType() ||
932 (VT.isInteger() &&
933 VT.getVectorElementType().bitsLE(Op.getValueType()))) &&
934 "A splatted value must have a width equal or (for integers) "
935 "greater than the vector element type!");
936 return getNode(ISD::UNDEF, SDLoc(), VT);
937 }
938 return getNode(ISD::SPLAT_VECTOR, DL, VT, Op);
939 }
940
941 /// Returns a node representing a splat of one value into all lanes
942 /// of the provided vector type. This is a utility which returns
943 /// either a BUILD_VECTOR or SPLAT_VECTOR depending on the
944 /// scalability of the desired vector type.
946 assert(VT.isVector() && "Can't splat to non-vector type");
947 return VT.isScalableVector() ?
949 }
950
951 /// Returns a vector of type ResVT whose elements contain the linear sequence
952 /// <0, Step, Step * 2, Step * 3, ...>
954 const APInt &StepVal);
955
956 /// Returns a vector of type ResVT whose elements contain the linear sequence
957 /// <0, 1, 2, 3, ...>
958 LLVM_ABI SDValue getStepVector(const SDLoc &DL, EVT ResVT);
959
960 /// Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to
961 /// the shuffle node in input but with swapped operands.
962 ///
963 /// Example: shuffle A, B, <0,5,2,7> -> shuffle B, A, <4,1,6,3>
965
966 /// Extract element at \p Idx from \p Vec. See EXTRACT_VECTOR_ELT
967 /// description for result type handling.
969 unsigned Idx) {
970 return getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, Vec,
972 }
973
974 /// Insert \p Elt into \p Vec at offset \p Idx. See INSERT_VECTOR_ELT
975 /// description for element type handling.
977 unsigned Idx) {
978 return getNode(ISD::INSERT_VECTOR_ELT, DL, Vec.getValueType(), Vec, Elt,
980 }
981
982 /// Insert \p SubVec at the \p Idx element of \p Vec.
984 unsigned Idx) {
985 return getNode(ISD::INSERT_SUBVECTOR, DL, Vec.getValueType(), Vec, SubVec,
987 }
988
989 /// Return the \p VT typed sub-vector of \p Vec at \p Idx
991 unsigned Idx) {
992 return getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, Vec,
994 }
995
996 /// Convert Op, which must be of float type, to the
997 /// float type VT, by either extending or rounding (by truncation).
999
1000 /// Convert Op, which must be a STRICT operation of float type, to the
1001 /// float type VT, by either extending or rounding (by truncation).
1002 LLVM_ABI std::pair<SDValue, SDValue>
1004
1005 /// Convert *_EXTEND_VECTOR_INREG to *_EXTEND opcode.
1006 static unsigned getOpcode_EXTEND(unsigned Opcode) {
1007 switch (Opcode) {
1008 case ISD::ANY_EXTEND:
1010 return ISD::ANY_EXTEND;
1011 case ISD::ZERO_EXTEND:
1013 return ISD::ZERO_EXTEND;
1014 case ISD::SIGN_EXTEND:
1016 return ISD::SIGN_EXTEND;
1017 }
1018 llvm_unreachable("Unknown opcode");
1019 }
1020
1021 /// Convert *_EXTEND to *_EXTEND_VECTOR_INREG opcode.
1022 static unsigned getOpcode_EXTEND_VECTOR_INREG(unsigned Opcode) {
1023 switch (Opcode) {
1024 case ISD::ANY_EXTEND:
1027 case ISD::ZERO_EXTEND:
1030 case ISD::SIGN_EXTEND:
1033 }
1034 llvm_unreachable("Unknown opcode");
1035 }
1036
1037 /// Convert Op, which must be of integer type, to the
1038 /// integer type VT, by either any-extending or truncating it.
1040
1041 /// Convert Op, which must be of integer type, to the
1042 /// integer type VT, by either sign-extending or truncating it.
1044
1045 /// Convert Op, which must be of integer type, to the
1046 /// integer type VT, by either zero-extending or truncating it.
1048
1049 /// Convert Op, which must be of integer type, to the
1050 /// integer type VT, by either any/sign/zero-extending (depending on IsAny /
1051 /// IsSigned) or truncating it.
1053 EVT VT, unsigned Opcode) {
1054 switch(Opcode) {
1055 case ISD::ANY_EXTEND:
1056 return getAnyExtOrTrunc(Op, DL, VT);
1057 case ISD::ZERO_EXTEND:
1058 return getZExtOrTrunc(Op, DL, VT);
1059 case ISD::SIGN_EXTEND:
1060 return getSExtOrTrunc(Op, DL, VT);
1061 }
1062 llvm_unreachable("Unsupported opcode");
1063 }
1064
1065 /// Convert Op, which must be of integer type, to the
1066 /// integer type VT, by either sign/zero-extending (depending on IsSigned) or
1067 /// truncating it.
1068 SDValue getExtOrTrunc(bool IsSigned, SDValue Op, const SDLoc &DL, EVT VT) {
1069 return IsSigned ? getSExtOrTrunc(Op, DL, VT) : getZExtOrTrunc(Op, DL, VT);
1070 }
1071
1072 /// Convert Op, which must be of integer type, to the
1073 /// integer type VT, by first bitcasting (from potential vector) to
1074 /// corresponding scalar type then either any-extending or truncating it.
1076 EVT VT);
1077
1078 /// Convert Op, which must be of integer type, to the
1079 /// integer type VT, by first bitcasting (from potential vector) to
1080 /// corresponding scalar type then either sign-extending or truncating it.
1082
1083 /// Convert Op, which must be of integer type, to the
1084 /// integer type VT, by first bitcasting (from potential vector) to
1085 /// corresponding scalar type then either zero-extending or truncating it.
1087
1088 /// Return the expression required to zero extend the Op
1089 /// value assuming it was the smaller SrcTy value.
1091
1092 /// Return the expression required to zero extend the Op
1093 /// value assuming it was the smaller SrcTy value.
1095 const SDLoc &DL, EVT VT);
1096
1097 /// Convert Op, which must be of integer type, to the integer type VT, by
1098 /// either truncating it or performing either zero or sign extension as
1099 /// appropriate extension for the pointer's semantics.
1101
1102 /// Return the expression required to extend the Op as a pointer value
1103 /// assuming it was the smaller SrcTy value. This may be either a zero extend
1104 /// or a sign extend.
1106
1107 /// Convert Op, which must be of integer type, to the integer type VT,
1108 /// by using an extension appropriate for the target's
1109 /// BooleanContent for type OpVT or truncating it.
1111 EVT OpVT);
1112
1113 /// Create negative operation as (SUB 0, Val).
1114 LLVM_ABI SDValue getNegative(SDValue Val, const SDLoc &DL, EVT VT);
1115
1116 /// Create a bitwise NOT operation as (XOR Val, -1).
1117 LLVM_ABI SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT);
1118
1119 /// Create a logical NOT operation as (XOR Val, BooleanOne).
1120 LLVM_ABI SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT);
1121
1122 /// Create a vector-predicated logical NOT operation as (VP_XOR Val,
1123 /// BooleanOne, Mask, EVL).
1125 SDValue EVL, EVT VT);
1126
1127 /// Convert a vector-predicated Op, which must be an integer vector, to the
1128 /// vector-type VT, by performing either vector-predicated zext or truncating
1129 /// it. The Op will be returned as-is if Op and VT are vectors containing
1130 /// integer with same width.
1132 SDValue Mask, SDValue EVL);
1133
1134 /// Convert a vector-predicated Op, which must be of integer type, to the
1135 /// vector-type integer type VT, by either truncating it or performing either
1136 /// vector-predicated zero or sign extension as appropriate extension for the
1137 /// pointer's semantics. This function just redirects to getVPZExtOrTrunc
1138 /// right now.
1140 SDValue Mask, SDValue EVL);
1141
1142 /// Returns sum of the base pointer and offset.
1143 /// Unlike getObjectPtrOffset this does not set NoUnsignedWrap and InBounds by
1144 /// default.
1147 const SDNodeFlags Flags = SDNodeFlags());
1150 const SDNodeFlags Flags = SDNodeFlags());
1151
1152 /// Create an add instruction with appropriate flags when used for
1153 /// addressing some offset of an object. i.e. if a load is split into multiple
1154 /// components, create an add nuw (or ptradd nuw inbounds) from the base
1155 /// pointer to the offset.
1160
1162 // The object itself can't wrap around the address space, so it shouldn't be
1163 // possible for the adds of the offsets to the split parts to overflow.
1164 return getMemBasePlusOffset(
1166 }
1167
1168 /// Return a new CALLSEQ_START node, that starts new call frame, in which
1169 /// InSize bytes are set up inside CALLSEQ_START..CALLSEQ_END sequence and
1170 /// OutSize specifies part of the frame set up prior to the sequence.
1172 const SDLoc &DL) {
1173 SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
1174 SDValue Ops[] = { Chain,
1175 getIntPtrConstant(InSize, DL, true),
1176 getIntPtrConstant(OutSize, DL, true) };
1177 return getNode(ISD::CALLSEQ_START, DL, VTs, Ops);
1178 }
1179
1180 /// Return a new CALLSEQ_END node, which always must have a
1181 /// glue result (to ensure it's not CSE'd).
1182 /// CALLSEQ_END does not have a useful SDLoc.
1184 SDValue InGlue, const SDLoc &DL) {
1185 SDVTList NodeTys = getVTList(MVT::Other, MVT::Glue);
1187 Ops.push_back(Chain);
1188 Ops.push_back(Op1);
1189 Ops.push_back(Op2);
1190 if (InGlue.getNode())
1191 Ops.push_back(InGlue);
1192 return getNode(ISD::CALLSEQ_END, DL, NodeTys, Ops);
1193 }
1194
1196 SDValue Glue, const SDLoc &DL) {
1197 return getCALLSEQ_END(
1198 Chain, getIntPtrConstant(Size1, DL, /*isTarget=*/true),
1199 getIntPtrConstant(Size2, DL, /*isTarget=*/true), Glue, DL);
1200 }
1201
1202 /// Return true if the result of this operation is always undefined.
1203 LLVM_ABI bool isUndef(unsigned Opcode, ArrayRef<SDValue> Ops);
1204
1205 /// Return an UNDEF node. UNDEF does not have a useful SDLoc.
1207 return getNode(ISD::UNDEF, SDLoc(), VT);
1208 }
1209
1210 /// Return a POISON node. POISON does not have a useful SDLoc.
1212
1213 /// Return a node that represents the runtime scaling 'MulImm * RuntimeVL'.
1214 LLVM_ABI SDValue getVScale(const SDLoc &DL, EVT VT, APInt MulImm);
1215
1217
1219
1220 /// Return a vector with the first 'Len' lanes set to true and remaining lanes
1221 /// set to false. The mask's ValueType is the same as when comparing vectors
1222 /// of type VT.
1224 ElementCount Len);
1225
1226 /// Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
1230
1231 /// Gets or creates the specified node.
1232 ///
1233 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1235 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1236 ArrayRef<SDValue> Ops, const SDNodeFlags Flags);
1237 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL,
1239 const SDNodeFlags Flags);
1240 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1241 ArrayRef<SDValue> Ops, const SDNodeFlags Flags);
1242
1243 // Use flags from current flag inserter.
1244 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1246 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL,
1248 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1250 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1251 SDValue Operand);
1252 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1253 SDValue N2);
1254 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1255 SDValue N2, SDValue N3);
1256
1257 // Specialize based on number of operands.
1258 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT);
1259 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
1260 SDValue Operand, const SDNodeFlags Flags);
1261 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1262 SDValue N2, const SDNodeFlags Flags);
1263 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1264 SDValue N2, SDValue N3, const SDNodeFlags Flags);
1265 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1266 SDValue N2, SDValue N3, SDValue N4);
1267 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1268 SDValue N2, SDValue N3, SDValue N4,
1269 const SDNodeFlags Flags);
1270 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1271 SDValue N2, SDValue N3, SDValue N4, SDValue N5);
1272 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1,
1273 SDValue N2, SDValue N3, SDValue N4, SDValue N5,
1274 const SDNodeFlags Flags);
1275
1276 // Specialize again based on number of operands for nodes with a VTList
1277 // rather than a single VT.
1278 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList);
1279 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1280 SDValue N);
1281 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1282 SDValue N1, SDValue N2);
1283 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1284 SDValue N1, SDValue N2, SDValue N3);
1285 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1286 SDValue N1, SDValue N2, SDValue N3, SDValue N4);
1287 LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
1288 SDValue N1, SDValue N2, SDValue N3, SDValue N4,
1289 SDValue N5);
1290
1291 /// Compute a TokenFactor to force all the incoming stack arguments to be
1292 /// loaded from the stack. This is used in tail call lowering to protect
1293 /// stack arguments from being clobbered.
1295
1296 /// Lower a memccpy operation into a target library call and return the
1297 /// resulting chain and call result as SelectionDAG SDValues.
1298 LLVM_ABI std::pair<SDValue, SDValue>
1299 getMemccpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src,
1300 SDValue C, SDValue Size, const CallInst *CI);
1301
1302 /// Lower a memcmp operation into a target library call and return the
1303 /// resulting chain and call result as SelectionDAG SDValues.
1304 LLVM_ABI std::pair<SDValue, SDValue> getMemcmp(SDValue Chain, const SDLoc &dl,
1305 SDValue Dst, SDValue Src,
1306 SDValue Size,
1307 const CallInst *CI);
1308
1309 /// Lower a strcmp operation into a target library call and return the
1310 /// resulting chain and call result as SelectionDAG SDValues.
1311 LLVM_ABI std::pair<SDValue, SDValue> getStrcmp(SDValue Chain, const SDLoc &dl,
1312 SDValue S0, SDValue S1,
1313 const CallInst *CI);
1314
1315 /// Lower a strcpy operation into a target library call and return the
1316 /// resulting chain and call result as SelectionDAG SDValues.
1317 LLVM_ABI std::pair<SDValue, SDValue> getStrcpy(SDValue Chain, const SDLoc &dl,
1318 SDValue Dst, SDValue Src,
1319 const CallInst *CI);
1320
1321 /// Lower a strlen operation into a target library call and return the
1322 /// resulting chain and call result as SelectionDAG SDValues.
1323 LLVM_ABI std::pair<SDValue, SDValue>
1324 getStrlen(SDValue Chain, const SDLoc &dl, SDValue Src, const CallInst *CI);
1325
1326 /// Lower a strstr operation into a target library call and return the
1327 /// resulting chain and call result as SelectionDAG SDValues.
1328 LLVM_ABI std::pair<SDValue, SDValue> getStrstr(SDValue Chain, const SDLoc &dl,
1329 SDValue S0, SDValue S1,
1330 const CallInst *CI);
1331
1332 /* \p CI if not null is the memset call being lowered.
1333 * \p OverrideTailCall is an optional parameter that can be used to override
1334 * the tail call optimization decision. */
1335 LLVM_ABI SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst,
1336 SDValue Src, SDValue Size, Align Alignment,
1337 bool isVol, bool AlwaysInline, const CallInst *CI,
1338 std::optional<bool> OverrideTailCall,
1339 MachinePointerInfo DstPtrInfo,
1340 MachinePointerInfo SrcPtrInfo,
1341 const AAMDNodes &AAInfo = AAMDNodes(),
1342 BatchAAResults *BatchAA = nullptr);
1343
1344 /* \p CI if not null is the memset call being lowered.
1345 * \p OverrideTailCall is an optional parameter that can be used to override
1346 * the tail call optimization decision. */
1347 LLVM_ABI SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst,
1348 SDValue Src, SDValue Size, Align Alignment,
1349 bool isVol, const CallInst *CI,
1350 std::optional<bool> OverrideTailCall,
1351 MachinePointerInfo DstPtrInfo,
1352 MachinePointerInfo SrcPtrInfo,
1353 const AAMDNodes &AAInfo = AAMDNodes(),
1354 BatchAAResults *BatchAA = nullptr);
1355
1356 LLVM_ABI SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst,
1357 SDValue Src, SDValue Size, Align Alignment,
1358 bool isVol, bool AlwaysInline, const CallInst *CI,
1359 MachinePointerInfo DstPtrInfo,
1360 const AAMDNodes &AAInfo = AAMDNodes());
1361
1362 LLVM_ABI SDValue getAtomicMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst,
1363 SDValue Src, SDValue Size, Type *SizeTy,
1364 unsigned ElemSz, bool isTailCall,
1365 MachinePointerInfo DstPtrInfo,
1366 MachinePointerInfo SrcPtrInfo);
1367
1368 LLVM_ABI SDValue getAtomicMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst,
1369 SDValue Src, SDValue Size, Type *SizeTy,
1370 unsigned ElemSz, bool isTailCall,
1371 MachinePointerInfo DstPtrInfo,
1372 MachinePointerInfo SrcPtrInfo);
1373
1374 LLVM_ABI SDValue getAtomicMemset(SDValue Chain, const SDLoc &dl, SDValue Dst,
1375 SDValue Value, SDValue Size, Type *SizeTy,
1376 unsigned ElemSz, bool isTailCall,
1377 MachinePointerInfo DstPtrInfo);
1378
1379 /// Helper function to make it easier to build SetCC's if you just have an
1380 /// ISD::CondCode instead of an SDValue.
1382 ISD::CondCode Cond, SDValue Chain = SDValue(),
1383 bool IsSignaling = false, SDNodeFlags Flags = {}) {
1384 assert(LHS.getValueType().isVector() == RHS.getValueType().isVector() &&
1385 "Vector/scalar operand type mismatch for setcc");
1386 assert(LHS.getValueType().isVector() == VT.isVector() &&
1387 "Vector/scalar result type mismatch for setcc");
1389 "Cannot create a setCC of an invalid node.");
1390 if (Chain)
1391 return getNode(IsSignaling ? ISD::STRICT_FSETCCS : ISD::STRICT_FSETCC, DL,
1392 {VT, MVT::Other}, {Chain, LHS, RHS, getCondCode(Cond)},
1393 Flags);
1394 return getNode(ISD::SETCC, DL, VT, LHS, RHS, getCondCode(Cond), Flags);
1395 }
1396
1397 /// Helper function to make it easier to build VP_SETCCs if you just have an
1398 /// ISD::CondCode instead of an SDValue.
1400 ISD::CondCode Cond, SDValue Mask, SDValue EVL) {
1401 assert(LHS.getValueType().isVector() && RHS.getValueType().isVector() &&
1402 "Cannot compare scalars");
1404 "Cannot create a setCC of an invalid node.");
1405 return getNode(ISD::VP_SETCC, DL, VT, LHS, RHS, getCondCode(Cond), Mask,
1406 EVL);
1407 }
1408
1409 /// Helper function to make it easier to build Select's if you just have
1410 /// operands and don't want to check for vector.
1412 SDValue RHS, SDNodeFlags Flags = SDNodeFlags()) {
1413 assert(LHS.getValueType() == VT && RHS.getValueType() == VT &&
1414 "Cannot use select on differing types");
1415 auto Opcode = Cond.getValueType().isVector() ? ISD::VSELECT : ISD::SELECT;
1416 return getNode(Opcode, DL, VT, Cond, LHS, RHS, Flags);
1417 }
1418
1419 /// Helper function to make it easier to build SelectCC's if you just have an
1420 /// ISD::CondCode instead of an SDValue.
1422 SDValue False, ISD::CondCode Cond,
1423 SDNodeFlags Flags = SDNodeFlags()) {
1424 return getNode(ISD::SELECT_CC, DL, True.getValueType(), LHS, RHS, True,
1425 False, getCondCode(Cond), Flags);
1426 }
1427
1428 /// Try to simplify a select/vselect into 1 of its operands or a constant.
1430
1431 /// Try to simplify a shift into 1 of its operands or a constant.
1433
1434 /// Try to simplify a floating-point binary operation into 1 of its operands
1435 /// or a constant.
1436 LLVM_ABI SDValue simplifyFPBinop(unsigned Opcode, SDValue X, SDValue Y,
1437 SDNodeFlags Flags);
1438
1439 /// VAArg produces a result and token chain, and takes a pointer
1440 /// and a source value as input.
1441 LLVM_ABI SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1442 SDValue SV, unsigned Align);
1443
1444 /// Gets a node for an atomic cmpxchg op. There are two
1445 /// valid Opcodes. ISD::ATOMIC_CMO_SWAP produces the value loaded and a
1446 /// chain result. ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS produces the value loaded,
1447 /// a success flag (initially i1), and a chain.
1448 LLVM_ABI SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT,
1449 SDVTList VTs, SDValue Chain, SDValue Ptr,
1450 SDValue Cmp, SDValue Swp,
1451 MachineMemOperand *MMO);
1452
1453 /// Gets a node for an atomic op, produces result (if relevant)
1454 /// and chain and takes 2 operands.
1455 LLVM_ABI SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT,
1456 SDValue Chain, SDValue Ptr, SDValue Val,
1457 MachineMemOperand *MMO);
1458
1459 /// Gets a node for an atomic op, produces result and chain and takes N
1460 /// operands.
1461 LLVM_ABI SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT,
1463 MachineMemOperand *MMO,
1465
1467 EVT MemVT, EVT VT, SDValue Chain, SDValue Ptr,
1468 MachineMemOperand *MMO);
1469
1470 /// Creates a MemIntrinsicNode that may produce a
1471 /// result and takes a list of operands. Opcode may be INTRINSIC_VOID,
1472 /// INTRINSIC_W_CHAIN, or a target-specific memory-referencing opcode
1473 // (see `SelectionDAGTargetInfo::isTargetMemoryOpcode`).
1475 unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
1476 EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment,
1480 const AAMDNodes &AAInfo = AAMDNodes());
1481
1483 unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
1484 EVT MemVT, MachinePointerInfo PtrInfo,
1485 MaybeAlign Alignment = std::nullopt,
1489 const AAMDNodes &AAInfo = AAMDNodes()) {
1490 // Ensure that codegen never sees alignment 0
1491 return getMemIntrinsicNode(Opcode, dl, VTList, Ops, MemVT, PtrInfo,
1492 Alignment.value_or(getEVTAlign(MemVT)), Flags,
1493 Size, AAInfo);
1494 }
1495
1496 LLVM_ABI SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl,
1498 EVT MemVT, MachineMemOperand *MMO);
1499
1500 /// getMemIntrinsicNode - Creates a MemIntrinsicNode with multiple MMOs.
1501 LLVM_ABI SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl,
1503 EVT MemVT,
1505
1506 /// Creates a LifetimeSDNode that starts (`IsStart==true`) or ends
1507 /// (`IsStart==false`) the lifetime of the `FrameIndex`.
1508 LLVM_ABI SDValue getLifetimeNode(bool IsStart, const SDLoc &dl, SDValue Chain,
1509 int FrameIndex);
1510
1511 /// Creates a PseudoProbeSDNode with function GUID `Guid` and
1512 /// the index of the block `Index` it is probing, as well as the attributes
1513 /// `attr` of the probe.
1515 uint64_t Guid, uint64_t Index,
1516 uint32_t Attr);
1517
1518 /// Create a MERGE_VALUES node from the given operands.
1520
1521 /// Loads are not normal binary operators: their result type is not
1522 /// determined by their operands, and they produce a value AND a token chain.
1523 ///
1524 /// This function will set the MOLoad flag on MMOFlags, but you can set it if
1525 /// you want. The MOStore flag must not be set.
1527 EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1528 MachinePointerInfo PtrInfo, MaybeAlign Alignment = MaybeAlign(),
1530 const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr);
1531 LLVM_ABI SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1532 MachineMemOperand *MMO);
1534 getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain,
1535 SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT,
1536 MaybeAlign Alignment = MaybeAlign(),
1538 const AAMDNodes &AAInfo = AAMDNodes());
1539 LLVM_ABI SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
1540 SDValue Chain, SDValue Ptr, EVT MemVT,
1541 MachineMemOperand *MMO);
1542 LLVM_ABI SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl,
1546 ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl,
1547 SDValue Chain, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo,
1548 EVT MemVT, Align Alignment,
1550 const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr);
1552 ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl,
1553 SDValue Chain, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo,
1554 EVT MemVT, MaybeAlign Alignment = MaybeAlign(),
1556 const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr) {
1557 // Ensures that codegen never sees a None Alignment.
1558 return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, PtrInfo, MemVT,
1559 Alignment.value_or(getEVTAlign(MemVT)), MMOFlags, AAInfo,
1560 Ranges);
1561 }
1563 EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
1564 SDValue Offset, EVT MemVT, MachineMemOperand *MMO);
1565
1566 /// Helper function to build ISD::STORE nodes.
1567 ///
1568 /// This function will set the MOStore flag on MMOFlags, but you can set it if
1569 /// you want. The MOLoad and MOInvariant flags must not be set.
1570
1572 getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1573 MachinePointerInfo PtrInfo, Align Alignment,
1575 const AAMDNodes &AAInfo = AAMDNodes());
1576 inline SDValue
1577 getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1578 MachinePointerInfo PtrInfo, MaybeAlign Alignment = MaybeAlign(),
1580 const AAMDNodes &AAInfo = AAMDNodes()) {
1581 return getStore(Chain, dl, Val, Ptr, PtrInfo,
1582 Alignment.value_or(getEVTAlign(Val.getValueType())),
1583 MMOFlags, AAInfo);
1584 }
1585 LLVM_ABI SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1586 SDValue Ptr, MachineMemOperand *MMO);
1588 getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1589 MachinePointerInfo PtrInfo, EVT SVT, Align Alignment,
1591 const AAMDNodes &AAInfo = AAMDNodes());
1592 inline SDValue
1593 getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
1594 MachinePointerInfo PtrInfo, EVT SVT,
1595 MaybeAlign Alignment = MaybeAlign(),
1597 const AAMDNodes &AAInfo = AAMDNodes()) {
1598 return getTruncStore(Chain, dl, Val, Ptr, PtrInfo, SVT,
1599 Alignment.value_or(getEVTAlign(SVT)), MMOFlags,
1600 AAInfo);
1601 }
1602 LLVM_ABI SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1603 SDValue Ptr, EVT SVT, MachineMemOperand *MMO);
1604 LLVM_ABI SDValue getIndexedStore(SDValue OrigStore, const SDLoc &dl,
1607 LLVM_ABI SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1608 SDValue Ptr, SDValue Offset, EVT SVT,
1610 bool IsTruncating = false);
1611
1613 EVT VT, const SDLoc &dl, SDValue Chain,
1614 SDValue Ptr, SDValue Offset, SDValue Mask,
1615 SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1616 Align Alignment, MachineMemOperand::Flags MMOFlags,
1617 const AAMDNodes &AAInfo,
1618 const MDNode *Ranges = nullptr,
1619 bool IsExpanding = false);
1620 inline SDValue
1622 const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
1623 SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT,
1624 MaybeAlign Alignment = MaybeAlign(),
1626 const AAMDNodes &AAInfo = AAMDNodes(),
1627 const MDNode *Ranges = nullptr, bool IsExpanding = false) {
1628 // Ensures that codegen never sees a None Alignment.
1629 return getLoadVP(AM, ExtType, VT, dl, Chain, Ptr, Offset, Mask, EVL,
1630 PtrInfo, MemVT, Alignment.value_or(getEVTAlign(MemVT)),
1631 MMOFlags, AAInfo, Ranges, IsExpanding);
1632 }
1634 EVT VT, const SDLoc &dl, SDValue Chain,
1635 SDValue Ptr, SDValue Offset, SDValue Mask,
1636 SDValue EVL, EVT MemVT, MachineMemOperand *MMO,
1637 bool IsExpanding = false);
1638 LLVM_ABI SDValue getLoadVP(EVT VT, const SDLoc &dl, SDValue Chain,
1639 SDValue Ptr, SDValue Mask, SDValue EVL,
1640 MachinePointerInfo PtrInfo, MaybeAlign Alignment,
1641 MachineMemOperand::Flags MMOFlags,
1642 const AAMDNodes &AAInfo,
1643 const MDNode *Ranges = nullptr,
1644 bool IsExpanding = false);
1645 LLVM_ABI SDValue getLoadVP(EVT VT, const SDLoc &dl, SDValue Chain,
1646 SDValue Ptr, SDValue Mask, SDValue EVL,
1647 MachineMemOperand *MMO, bool IsExpanding = false);
1649 ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain,
1650 SDValue Ptr, SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo,
1651 EVT MemVT, MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags,
1652 const AAMDNodes &AAInfo, bool IsExpanding = false);
1654 EVT VT, SDValue Chain, SDValue Ptr,
1655 SDValue Mask, SDValue EVL, EVT MemVT,
1656 MachineMemOperand *MMO,
1657 bool IsExpanding = false);
1658 LLVM_ABI SDValue getIndexedLoadVP(SDValue OrigLoad, const SDLoc &dl,
1661 LLVM_ABI SDValue getStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val,
1662 SDValue Ptr, SDValue Offset, SDValue Mask,
1663 SDValue EVL, EVT MemVT, MachineMemOperand *MMO,
1664 ISD::MemIndexedMode AM, bool IsTruncating = false,
1665 bool IsCompressing = false);
1666 LLVM_ABI SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val,
1667 SDValue Ptr, SDValue Mask, SDValue EVL,
1668 MachinePointerInfo PtrInfo, EVT SVT,
1669 Align Alignment,
1670 MachineMemOperand::Flags MMOFlags,
1671 const AAMDNodes &AAInfo,
1672 bool IsCompressing = false);
1673 LLVM_ABI SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val,
1674 SDValue Ptr, SDValue Mask, SDValue EVL,
1675 EVT SVT, MachineMemOperand *MMO,
1676 bool IsCompressing = false);
1677 LLVM_ABI SDValue getIndexedStoreVP(SDValue OrigStore, const SDLoc &dl,
1680
1682 ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &DL,
1683 SDValue Chain, SDValue Ptr, SDValue Offset, SDValue Stride, SDValue Mask,
1684 SDValue EVL, EVT MemVT, MachineMemOperand *MMO, bool IsExpanding = false);
1686 SDValue Ptr, SDValue Stride, SDValue Mask,
1687 SDValue EVL, MachineMemOperand *MMO,
1688 bool IsExpanding = false);
1690 const SDLoc &DL, EVT VT, SDValue Chain,
1691 SDValue Ptr, SDValue Stride,
1692 SDValue Mask, SDValue EVL, EVT MemVT,
1693 MachineMemOperand *MMO,
1694 bool IsExpanding = false);
1696 SDValue Val, SDValue Ptr, SDValue Offset,
1697 SDValue Stride, SDValue Mask, SDValue EVL,
1698 EVT MemVT, MachineMemOperand *MMO,
1700 bool IsTruncating = false,
1701 bool IsCompressing = false);
1703 SDValue Val, SDValue Ptr,
1704 SDValue Stride, SDValue Mask,
1705 SDValue EVL, EVT SVT,
1706 MachineMemOperand *MMO,
1707 bool IsCompressing = false);
1708
1709 LLVM_ABI SDValue getGatherVP(SDVTList VTs, EVT VT, const SDLoc &dl,
1711 ISD::MemIndexType IndexType);
1712 LLVM_ABI SDValue getScatterVP(SDVTList VTs, EVT VT, const SDLoc &dl,
1714 ISD::MemIndexType IndexType);
1715
1716 LLVM_ABI SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain,
1718 SDValue Src0, EVT MemVT,
1720 ISD::LoadExtType, bool IsExpanding = false);
1724 LLVM_ABI SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val,
1726 EVT MemVT, MachineMemOperand *MMO,
1728 bool IsTruncating = false,
1729 bool IsCompressing = false);
1730 LLVM_ABI SDValue getIndexedMaskedStore(SDValue OrigStore, const SDLoc &dl,
1733 LLVM_ABI SDValue getMaskedGather(SDVTList VTs, EVT MemVT, const SDLoc &dl,
1735 MachineMemOperand *MMO,
1736 ISD::MemIndexType IndexType,
1737 ISD::LoadExtType ExtTy);
1738 LLVM_ABI SDValue getMaskedScatter(SDVTList VTs, EVT MemVT, const SDLoc &dl,
1740 MachineMemOperand *MMO,
1741 ISD::MemIndexType IndexType,
1742 bool IsTruncating = false);
1743 LLVM_ABI SDValue getMaskedHistogram(SDVTList VTs, EVT MemVT, const SDLoc &dl,
1745 MachineMemOperand *MMO,
1746 ISD::MemIndexType IndexType);
1747 LLVM_ABI SDValue getLoadFFVP(EVT VT, const SDLoc &DL, SDValue Chain,
1748 SDValue Ptr, SDValue Mask, SDValue EVL,
1749 MachineMemOperand *MMO);
1750
1751 LLVM_ABI SDValue getGetFPEnv(SDValue Chain, const SDLoc &dl, SDValue Ptr,
1752 EVT MemVT, MachineMemOperand *MMO);
1753 LLVM_ABI SDValue getSetFPEnv(SDValue Chain, const SDLoc &dl, SDValue Ptr,
1754 EVT MemVT, MachineMemOperand *MMO);
1755
1756 /// Construct a node to track a Value* through the backend.
1758
1759 /// Return an MDNodeSDNode which holds an MDNode.
1760 LLVM_ABI SDValue getMDNode(const MDNode *MD);
1761
1762 /// Return a bitcast using the SDLoc of the value operand, and casting to the
1763 /// provided type. Use getNode to set a custom SDLoc.
1765
1766 /// Return an AddrSpaceCastSDNode.
1767 LLVM_ABI SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr,
1768 unsigned SrcAS, unsigned DestAS);
1769
1770 /// Return a freeze using the SDLoc of the value operand.
1772
1773 /// Return a freeze of V if any of the demanded elts may be undef or poison.
1774 /// If \p PoisonOnly is true, then only check for poison elements.
1775 LLVM_ABI SDValue getFreeze(SDValue V, const APInt &DemandedElts,
1776 bool PoisonOnly = false);
1777
1778 /// Return an AssertAlignSDNode.
1780
1781 /// Swap N1 and N2 if Opcode is a commutative binary opcode
1782 /// and the canonical form expects the opposite order.
1783 LLVM_ABI void canonicalizeCommutativeBinop(unsigned Opcode, SDValue &N1,
1784 SDValue &N2) const;
1785
1786 /// Return the specified value casted to
1787 /// the target's desired shift amount type.
1789
1790 /// Expand the specified \c ISD::VAARG node as the Legalize pass would.
1792
1793 /// Expand the specified \c ISD::VACOPY node as the Legalize pass would.
1795
1796 /// Return a GlobalAddress of the function from the current module with
1797 /// name matching the given ExternalSymbol. Additionally can provide the
1798 /// matched function.
1799 /// Panic if the function doesn't exist.
1801 SDValue Op, Function **TargetFunction = nullptr);
1802
1803 /// *Mutate* the specified node in-place to have the
1804 /// specified operands. If the resultant node already exists in the DAG,
1805 /// this does not modify the specified node, instead it returns the node that
1806 /// already exists. If the resultant node does not exist in the DAG, the
1807 /// input node is returned. As a degenerate case, if you specify the same
1808 /// input operands as the node already has, the input node is returned.
1812 SDValue Op3);
1814 SDValue Op3, SDValue Op4);
1816 SDValue Op3, SDValue Op4, SDValue Op5);
1818
1819 /// Creates a new TokenFactor containing \p Vals. If \p Vals contains 64k
1820 /// values or more, move values into new TokenFactors in 64k-1 blocks, until
1821 /// the final TokenFactor has less than 64k operands.
1824
1825 /// *Mutate* the specified machine node's memory references to the provided
1826 /// list.
1829
1830 // Calculate divergence of node \p N based on its operands.
1832
1833 // Propagates the change in divergence to users
1835
1836 /// These are used for target selectors to *mutate* the
1837 /// specified node to have the specified return type, Target opcode, and
1838 /// operands. Note that target opcodes are stored as
1839 /// ~TargetOpcode in the node opcode field. The resultant node is returned.
1840 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT);
1841 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1842 SDValue Op1);
1843 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1844 SDValue Op1, SDValue Op2);
1845 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1846 SDValue Op1, SDValue Op2, SDValue Op3);
1847 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT,
1849 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1850 EVT VT2);
1851 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1853 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1854 EVT VT2, EVT VT3, ArrayRef<SDValue> Ops);
1855 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
1856 EVT VT2, SDValue Op1, SDValue Op2);
1857 LLVM_ABI SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, SDVTList VTs,
1859
1860 /// This *mutates* the specified node to have the specified
1861 /// return type, opcode, and operands.
1862 LLVM_ABI SDNode *MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs,
1864
1865 /// Mutate the specified strict FP node to its non-strict equivalent,
1866 /// unlinking the node from its chain and dropping the metadata arguments.
1867 /// The node must be a strict FP node.
1869
1870 /// These are used for target selectors to create a new node
1871 /// with specified return type(s), MachineInstr opcode, and operands.
1872 ///
1873 /// Note that getMachineNode returns the resultant node. If there is already
1874 /// a node of the specified opcode and operands, it returns that node instead
1875 /// of the current one.
1876 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1877 EVT VT);
1878 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1879 EVT VT, SDValue Op1);
1880 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1881 EVT VT, SDValue Op1, SDValue Op2);
1882 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1883 EVT VT, SDValue Op1, SDValue Op2,
1884 SDValue Op3);
1885 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1887 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1888 EVT VT1, EVT VT2, SDValue Op1,
1889 SDValue Op2);
1890 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1891 EVT VT1, EVT VT2, SDValue Op1,
1892 SDValue Op2, SDValue Op3);
1893 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1894 EVT VT1, EVT VT2,
1896 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1897 EVT VT1, EVT VT2, EVT VT3, SDValue Op1,
1898 SDValue Op2);
1899 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1900 EVT VT1, EVT VT2, EVT VT3, SDValue Op1,
1901 SDValue Op2, SDValue Op3);
1902 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1903 EVT VT1, EVT VT2, EVT VT3,
1905 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1906 ArrayRef<EVT> ResultTys,
1908 LLVM_ABI MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl,
1910
1911 /// A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
1912 LLVM_ABI SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT,
1913 SDValue Operand);
1914
1915 /// A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
1916 LLVM_ABI SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT,
1917 SDValue Operand, SDValue Subreg);
1918
1919 /// Get the specified node if it's already available, or else return NULL.
1920 LLVM_ABI SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTList,
1922 const SDNodeFlags Flags,
1923 bool AllowCommute = false);
1924 LLVM_ABI SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTList,
1926 bool AllowCommute = false);
1927
1928 /// Check if a node exists without modifying its flags.
1929 LLVM_ABI bool doesNodeExist(unsigned Opcode, SDVTList VTList,
1931
1932 /// Creates a SDDbgValue node.
1934 SDNode *N, unsigned R, bool IsIndirect,
1935 const DebugLoc &DL, unsigned O);
1936
1937 /// Creates a constant SDDbgValue node.
1939 const Value *C, const DebugLoc &DL,
1940 unsigned O);
1941
1942 /// Creates a FrameIndex SDDbgValue node.
1944 DIExpression *Expr, unsigned FI,
1945 bool IsIndirect,
1946 const DebugLoc &DL, unsigned O);
1947
1948 /// Creates a FrameIndex SDDbgValue node.
1950 DIExpression *Expr, unsigned FI,
1951 ArrayRef<SDNode *> Dependencies,
1952 bool IsIndirect,
1953 const DebugLoc &DL, unsigned O);
1954
1955 /// Creates a VReg SDDbgValue node.
1957 Register VReg, bool IsIndirect,
1958 const DebugLoc &DL, unsigned O);
1959
1960 /// Creates a SDDbgValue node from a list of locations.
1963 ArrayRef<SDNode *> Dependencies,
1964 bool IsIndirect, const DebugLoc &DL,
1965 unsigned O, bool IsVariadic);
1966
1967 /// Creates a SDDbgLabel node.
1969 unsigned O);
1970
1971 /// Transfer debug values from one node to another, while optionally
1972 /// generating fragment expressions for split-up values. If \p InvalidateDbg
1973 /// is set, debug values are invalidated after they are transferred.
1975 unsigned OffsetInBits = 0,
1976 unsigned SizeInBits = 0,
1977 bool InvalidateDbg = true);
1978
1979 /// Remove the specified node from the system. If any of its
1980 /// operands then becomes dead, remove them as well. Inform UpdateListener
1981 /// for each node deleted.
1983
1984 /// This method deletes the unreachable nodes in the
1985 /// given list, and any nodes that become unreachable as a result.
1987
1988 /// Modify anything using 'From' to use 'To' instead.
1989 /// This can cause recursive merging of nodes in the DAG. Use the first
1990 /// version if 'From' is known to have a single result, use the second
1991 /// if you have two nodes with identical results (or if 'To' has a superset
1992 /// of the results of 'From'), use the third otherwise.
1993 ///
1994 /// These methods all take an optional UpdateListener, which (if not null) is
1995 /// informed about nodes that are deleted and modified due to recursive
1996 /// changes in the dag.
1997 ///
1998 /// These functions only replace all existing uses. It's possible that as
1999 /// these replacements are being performed, CSE may cause the From node
2000 /// to be given new uses. These new uses of From are left in place, and
2001 /// not automatically transferred to To.
2002 ///
2004 LLVM_ABI void ReplaceAllUsesWith(SDNode *From, SDNode *To);
2005 LLVM_ABI void ReplaceAllUsesWith(SDNode *From, const SDValue *To);
2006
2007 /// Replace any uses of From with To, leaving
2008 /// uses of other values produced by From.getNode() alone.
2010
2011 /// Like ReplaceAllUsesOfValueWith, but for multiple values at once.
2012 /// This correctly handles the case where
2013 /// there is an overlap between the From values and the To values.
2015 const SDValue *To, unsigned Num);
2016
2017 /// If an existing load has uses of its chain, create a token factor node with
2018 /// that chain and the new memory node's chain and update users of the old
2019 /// chain to the token factor. This ensures that the new memory node will have
2020 /// the same relative memory dependency position as the old load. Returns the
2021 /// new merged load chain.
2023 SDValue NewMemOpChain);
2024
2025 /// If an existing load has uses of its chain, create a token factor node with
2026 /// that chain and the new memory node's chain and update users of the old
2027 /// chain to the token factor. This ensures that the new memory node will have
2028 /// the same relative memory dependency position as the old load. Returns the
2029 /// new merged load chain.
2031 SDValue NewMemOp);
2032
2033 /// Get all the nodes in their topological order without modifying any states.
2035 SmallVectorImpl<const SDNode *> &SortedNodes) const;
2036
2037 /// Topological-sort the AllNodes list and a
2038 /// assign a unique node id for each node in the DAG based on their
2039 /// topological order. Returns the number of nodes.
2041
2042 /// Move node N in the AllNodes list to be immediately
2043 /// before the given iterator Position. This may be used to update the
2044 /// topological ordering when the list of nodes is modified.
2046 AllNodes.insert(Position, AllNodes.remove(N));
2047 }
2048
2049 /// Add a dbg_value SDNode. If SD is non-null that means the
2050 /// value is produced by SD.
2051 LLVM_ABI void AddDbgValue(SDDbgValue *DB, bool isParameter);
2052
2053 /// Add a dbg_label SDNode.
2055
2056 /// Get the debug values which reference the given SDNode.
2058 return DbgInfo->getSDDbgValues(SD);
2059 }
2060
2061public:
2062 /// Return true if there are any SDDbgValue nodes associated
2063 /// with this SelectionDAG.
2064 bool hasDebugValues() const { return !DbgInfo->empty(); }
2065
2066 SDDbgInfo::DbgIterator DbgBegin() const { return DbgInfo->DbgBegin(); }
2067 SDDbgInfo::DbgIterator DbgEnd() const { return DbgInfo->DbgEnd(); }
2068
2070 return DbgInfo->ByvalParmDbgBegin();
2071 }
2073 return DbgInfo->ByvalParmDbgEnd();
2074 }
2075
2077 return DbgInfo->DbgLabelBegin();
2078 }
2080 return DbgInfo->DbgLabelEnd();
2081 }
2082
2083 /// To be invoked on an SDNode that is slated to be erased. This
2084 /// function mirrors \c llvm::salvageDebugInfo.
2086
2087 /// Dump the textual format of this DAG. Nodes are not sorted.
2088 /// Note that we overload it instead of using default value so that it is
2089 /// convenient to be called from debuggers.
2090 LLVM_ABI void dump() const;
2091
2092 /// Dump the textual format of this DAG. Print nodes in sorted orders if \p
2093 /// Sorted is true.
2094 LLVM_ABI void dump(bool Sorted) const;
2095
2096 /// In most cases this function returns the ABI alignment for a given type,
2097 /// except for illegal vector types where the alignment exceeds that of the
2098 /// stack. In such cases we attempt to break the vector down to a legal type
2099 /// and return the ABI alignment for that instead.
2100 LLVM_ABI Align getReducedAlign(EVT VT, bool UseABI);
2101
2102 /// Create a stack temporary based on the size in bytes and the alignment
2104
2105 /// Create a stack temporary, suitable for holding the specified value type.
2106 /// If minAlign is specified, the slot size will have at least that alignment.
2107 LLVM_ABI SDValue CreateStackTemporary(EVT VT, unsigned minAlign = 1);
2108
2109 /// Create a stack temporary suitable for holding either of the specified
2110 /// value types.
2112
2113 LLVM_ABI SDValue FoldSymbolOffset(unsigned Opcode, EVT VT,
2114 const GlobalAddressSDNode *GA,
2115 const SDNode *N2);
2116
2117 LLVM_ABI SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL,
2119 SDNodeFlags Flags = SDNodeFlags());
2120
2121 /// Fold floating-point operations when all operands are constants and/or
2122 /// undefined.
2123 LLVM_ABI SDValue foldConstantFPMath(unsigned Opcode, const SDLoc &DL, EVT VT,
2125
2126 /// Fold BUILD_VECTOR of constants/undefs to the destination type
2127 /// BUILD_VECTOR of constants/undefs elements.
2129 const SDLoc &DL, EVT DstEltVT);
2130
2131 /// Constant fold a setcc to true or false.
2133 const SDLoc &dl, SDNodeFlags Flags = {});
2134
2135 /// Return true if the sign bit of Op is known to be zero.
2136 /// We use this predicate to simplify operations downstream.
2137 LLVM_ABI bool SignBitIsZero(SDValue Op, unsigned Depth = 0) const;
2138
2139 /// Return true if the sign bit of Op is known to be zero, for a
2140 /// floating-point value.
2141 LLVM_ABI bool SignBitIsZeroFP(SDValue Op, unsigned Depth = 0) const;
2142
2143 /// Return true if 'Op & Mask' is known to be zero. We
2144 /// use this predicate to simplify operations downstream. Op and Mask are
2145 /// known to be the same type.
2146 LLVM_ABI bool MaskedValueIsZero(SDValue Op, const APInt &Mask,
2147 unsigned Depth = 0) const;
2148
2149 /// Return true if 'Op & Mask' is known to be zero in DemandedElts. We
2150 /// use this predicate to simplify operations downstream. Op and Mask are
2151 /// known to be the same type.
2152 LLVM_ABI bool MaskedValueIsZero(SDValue Op, const APInt &Mask,
2153 const APInt &DemandedElts,
2154 unsigned Depth = 0) const;
2155
2156 /// Return true if 'Op' is known to be zero in DemandedElts. We
2157 /// use this predicate to simplify operations downstream.
2158 LLVM_ABI bool MaskedVectorIsZero(SDValue Op, const APInt &DemandedElts,
2159 unsigned Depth = 0) const;
2160
2161 /// Return true if '(Op & Mask) == Mask'.
2162 /// Op and Mask are known to be the same type.
2163 LLVM_ABI bool MaskedValueIsAllOnes(SDValue Op, const APInt &Mask,
2164 unsigned Depth = 0) const;
2165
2166 /// For each demanded element of a vector, see if it is known to be zero.
2168 const APInt &DemandedElts,
2169 unsigned Depth = 0) const;
2170
2171 /// Determine which bits of Op are known to be either zero or one and return
2172 /// them in Known. For vectors, the known bits are those that are shared by
2173 /// every vector element.
2174 /// Targets can implement the computeKnownBitsForTargetNode method in the
2175 /// TargetLowering class to allow target nodes to be understood.
2176 LLVM_ABI KnownBits computeKnownBits(SDValue Op, unsigned Depth = 0) const;
2177
2178 /// Determine which bits of Op are known to be either zero or one and return
2179 /// them in Known. The DemandedElts argument allows us to only collect the
2180 /// known bits that are shared by the requested vector elements.
2181 /// Targets can implement the computeKnownBitsForTargetNode method in the
2182 /// TargetLowering class to allow target nodes to be understood.
2183 LLVM_ABI KnownBits computeKnownBits(SDValue Op, const APInt &DemandedElts,
2184 unsigned Depth = 0) const;
2185
2186 /// Determine the possible constant range of an integer or vector of integers.
2187 LLVM_ABI ConstantRange computeConstantRange(SDValue Op, bool ForSigned,
2188 unsigned Depth = 0) const;
2189
2190 /// Determine the possible constant range of an integer or vector of integers.
2191 /// The DemandedElts argument allows us to only collect the known ranges that
2192 /// are shared by the requested vector elements.
2194 const APInt &DemandedElts,
2195 bool ForSigned,
2196 unsigned Depth = 0) const;
2197
2198 /// Combine constant ranges from computeConstantRange() and
2199 /// computeKnownBits().
2201 SDValue Op, bool ForSigned, unsigned Depth = 0) const;
2202
2203 /// Combine constant ranges from computeConstantRange() and
2204 /// computeKnownBits(). The DemandedElts argument allows us to only collect
2205 /// the known ranges that are shared by the requested vector elements.
2207 SDValue Op, const APInt &DemandedElts, bool ForSigned,
2208 unsigned Depth = 0) const;
2209
2210 /// Used to represent the possible overflow behavior of an operation.
2211 /// Never: the operation cannot overflow.
2212 /// Always: the operation will always overflow.
2213 /// Sometime: the operation may or may not overflow.
2219
2220 /// Determine if the result of the signed addition of 2 nodes can overflow.
2222 SDValue N1) const;
2223
2224 /// Determine if the result of the unsigned addition of 2 nodes can overflow.
2226 SDValue N1) const;
2227
2228 /// Determine if the result of the addition of 2 nodes can overflow.
2230 SDValue N1) const {
2231 return IsSigned ? computeOverflowForSignedAdd(N0, N1)
2233 }
2234
2235 /// Determine if the result of the addition of 2 nodes can never overflow.
2236 bool willNotOverflowAdd(bool IsSigned, SDValue N0, SDValue N1) const {
2237 return computeOverflowForAdd(IsSigned, N0, N1) == OFK_Never;
2238 }
2239
2240 /// Determine if the result of the signed sub of 2 nodes can overflow.
2242 SDValue N1) const;
2243
2244 /// Determine if the result of the unsigned sub of 2 nodes can overflow.
2246 SDValue N1) const;
2247
2248 /// Determine if the result of the sub of 2 nodes can overflow.
2250 SDValue N1) const {
2251 return IsSigned ? computeOverflowForSignedSub(N0, N1)
2253 }
2254
2255 /// Determine if the result of the sub of 2 nodes can never overflow.
2256 bool willNotOverflowSub(bool IsSigned, SDValue N0, SDValue N1) const {
2257 return computeOverflowForSub(IsSigned, N0, N1) == OFK_Never;
2258 }
2259
2260 /// Determine if the result of the signed mul of 2 nodes can overflow.
2262 SDValue N1) const;
2263
2264 /// Determine if the result of the unsigned mul of 2 nodes can overflow.
2266 SDValue N1) const;
2267
2268 /// Determine if the result of the mul of 2 nodes can overflow.
2270 SDValue N1) const {
2271 return IsSigned ? computeOverflowForSignedMul(N0, N1)
2273 }
2274
2275 /// Determine if the result of the mul of 2 nodes can never overflow.
2276 bool willNotOverflowMul(bool IsSigned, SDValue N0, SDValue N1) const {
2277 return computeOverflowForMul(IsSigned, N0, N1) == OFK_Never;
2278 }
2279
2280 /// Test if the given value is known to have exactly one bit set. This differs
2281 /// from computeKnownBits in that it doesn't necessarily determine which bit
2282 /// is set. If 'OrZero' is set, then return true if the given value is either
2283 /// a power of two or zero.
2284 LLVM_ABI bool isKnownToBeAPowerOfTwo(SDValue Val, bool OrZero = false,
2285 unsigned Depth = 0) const;
2286
2287 /// Test if the given value is known to have exactly one bit set. This differs
2288 /// from computeKnownBits in that it doesn't necessarily determine which bit
2289 /// is set. The DemandedElts argument allows us to only collect the minimum
2290 /// sign bits of the requested vector elements. If 'OrZero' is set, then
2291 /// return true if the given value is either a power of two or zero.
2292 LLVM_ABI bool isKnownToBeAPowerOfTwo(SDValue Val, const APInt &DemandedElts,
2293 bool OrZero = false,
2294 unsigned Depth = 0) const;
2295
2296 /// Test if the given _fp_ value is known to be an integer power-of-2, either
2297 /// positive or negative.
2298 LLVM_ABI bool isKnownToBeAPowerOfTwoFP(SDValue Val, unsigned Depth = 0) const;
2299
2300 /// Return the number of times the sign bit of the register is replicated into
2301 /// the other bits. We know that at least 1 bit is always equal to the sign
2302 /// bit (itself), but other cases can give us information. For example,
2303 /// immediately after an "SRA X, 2", we know that the top 3 bits are all equal
2304 /// to each other, so we return 3. Targets can implement the
2305 /// ComputeNumSignBitsForTarget method in the TargetLowering class to allow
2306 /// target nodes to be understood.
2307 LLVM_ABI unsigned ComputeNumSignBits(SDValue Op, unsigned Depth = 0) const;
2308
2309 /// Return the number of times the sign bit of the register is replicated into
2310 /// the other bits. We know that at least 1 bit is always equal to the sign
2311 /// bit (itself), but other cases can give us information. For example,
2312 /// immediately after an "SRA X, 2", we know that the top 3 bits are all equal
2313 /// to each other, so we return 3. The DemandedElts argument allows
2314 /// us to only collect the minimum sign bits of the requested vector elements.
2315 /// Targets can implement the ComputeNumSignBitsForTarget method in the
2316 /// TargetLowering class to allow target nodes to be understood.
2317 LLVM_ABI unsigned ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
2318 unsigned Depth = 0) const;
2319
2320 /// Get the upper bound on bit size for this Value \p Op as a signed integer.
2321 /// i.e. x == sext(trunc(x to MaxSignedBits) to bitwidth(x)).
2322 /// Similar to the APInt::getSignificantBits function.
2323 /// Helper wrapper to ComputeNumSignBits.
2325 unsigned Depth = 0) const;
2326
2327 /// Get the upper bound on bit size for this Value \p Op as a signed integer.
2328 /// i.e. x == sext(trunc(x to MaxSignedBits) to bitwidth(x)).
2329 /// Similar to the APInt::getSignificantBits function.
2330 /// Helper wrapper to ComputeNumSignBits.
2332 const APInt &DemandedElts,
2333 unsigned Depth = 0) const;
2334
2335 /// Return true if this function can prove that \p Op is never poison
2336 /// and, if \p PoisonOnly is false, does not have undef bits.
2338 bool PoisonOnly = false,
2339 unsigned Depth = 0) const;
2340
2341 /// Return true if this function can prove that \p Op is never poison
2342 /// and, if \p PoisonOnly is false, does not have undef bits. The DemandedElts
2343 /// argument limits the check to the requested vector elements.
2345 const APInt &DemandedElts,
2346 bool PoisonOnly = false,
2347 unsigned Depth = 0) const;
2348
2349 /// Return true if this function can prove that \p Op is never poison.
2350 bool isGuaranteedNotToBePoison(SDValue Op, unsigned Depth = 0) const {
2351 return isGuaranteedNotToBeUndefOrPoison(Op, /*PoisonOnly*/ true, Depth);
2352 }
2353
2354 /// Return true if this function can prove that \p Op is never poison. The
2355 /// DemandedElts argument limits the check to the requested vector elements.
2356 bool isGuaranteedNotToBePoison(SDValue Op, const APInt &DemandedElts,
2357 unsigned Depth = 0) const {
2358 return isGuaranteedNotToBeUndefOrPoison(Op, DemandedElts,
2359 /*PoisonOnly*/ true, Depth);
2360 }
2361
2362 /// Return true if Op can create undef or poison from non-undef & non-poison
2363 /// operands. The DemandedElts argument limits the check to the requested
2364 /// vector elements.
2365 ///
2366 /// \p ConsiderFlags controls whether poison producing flags on the
2367 /// instruction are considered. This can be used to see if the instruction
2368 /// could still introduce undef or poison even without poison generating flags
2369 /// which might be on the instruction. (i.e. could the result of
2370 /// Op->dropPoisonGeneratingFlags() still create poison or undef)
2371 LLVM_ABI bool canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
2372 bool PoisonOnly = false,
2373 bool ConsiderFlags = true,
2374 unsigned Depth = 0) const;
2375
2376 /// Return true if Op can create undef or poison from non-undef & non-poison
2377 /// operands.
2378 ///
2379 /// \p ConsiderFlags controls whether poison producing flags on the
2380 /// instruction are considered. This can be used to see if the instruction
2381 /// could still introduce undef or poison even without poison generating flags
2382 /// which might be on the instruction. (i.e. could the result of
2383 /// Op->dropPoisonGeneratingFlags() still create poison or undef)
2385 bool ConsiderFlags = true,
2386 unsigned Depth = 0) const;
2387
2388 /// Return true if the specified operand is an ISD::OR or ISD::XOR node
2389 /// that can be treated as an ISD::ADD node.
2390 /// or(x,y) == add(x,y) iff haveNoCommonBitsSet(x,y)
2391 /// xor(x,y) == add(x,y) iff isMinSignedConstant(y) && !NoWrap
2392 /// If \p NoWrap is true, this will not match ISD::XOR.
2393 LLVM_ABI bool isADDLike(SDValue Op, bool NoWrap = false) const;
2394
2395 /// Return true if the specified operand is an ISD::ADD with a ConstantSDNode
2396 /// on the right-hand side, or if it is an ISD::OR with a ConstantSDNode that
2397 /// is guaranteed to have the same semantics as an ADD. This handles the
2398 /// equivalence:
2399 /// X|Cst == X+Cst iff X&Cst = 0.
2401
2402 /// Determine floating-point class information about \p Op. For vectors, the
2403 /// known FP classes are those shared by every demanded vector element.
2404 /// \p InterestedClasses is a hint for which FP classes we care about;
2405 /// the implementation may bail out early if it can determine that
2406 /// none of the interested classes are possible.
2408 FPClassTest InterestedClasses,
2409 unsigned Depth = 0) const;
2410
2411 /// Determine floating-point class information about \p Op. The
2412 /// DemandedElts argument allows us to only collect the known FP classes
2413 /// that are shared by the requested vector elements.
2414 /// \p InterestedClasses is a hint for which FP classes we care about.
2416 const APInt &DemandedElts,
2417 FPClassTest InterestedClasses,
2418 unsigned Depth = 0) const;
2419
2420 /// Test whether the given SDValue (or all elements of it, if it is a
2421 /// vector) is known to never be NaN in \p DemandedElts. If \p SNaN is true,
2422 /// returns if \p Op is known to never be a signaling NaN (it may still be a
2423 /// qNaN).
2424 LLVM_ABI bool isKnownNeverNaN(SDValue Op, const APInt &DemandedElts,
2425 bool SNaN = false, unsigned Depth = 0) const;
2426
2427 /// Test whether the given SDValue (or all elements of it, if it is a
2428 /// vector) is known to never be NaN. If \p SNaN is true, returns if \p Op is
2429 /// known to never be a signaling NaN (it may still be a qNaN).
2430 LLVM_ABI bool isKnownNeverNaN(SDValue Op, bool SNaN = false,
2431 unsigned Depth = 0) const;
2432
2433 /// \returns true if \p Op is known to never be a signaling NaN in \p
2434 /// DemandedElts.
2435 bool isKnownNeverSNaN(SDValue Op, const APInt &DemandedElts,
2436 unsigned Depth = 0) const {
2437 return isKnownNeverNaN(Op, DemandedElts, true, Depth);
2438 }
2439
2440 /// \returns true if \p Op is known to never be a signaling NaN.
2441 bool isKnownNeverSNaN(SDValue Op, unsigned Depth = 0) const {
2442 return isKnownNeverNaN(Op, true, Depth);
2443 }
2444
2445 /// Test whether the given floating point SDValue is known to never be
2446 /// positive or negative zero.
2448
2449 /// Test whether the given SDValue is known to contain non-zero value(s).
2450 LLVM_ABI bool isKnownNeverZero(SDValue Op, unsigned Depth = 0) const;
2451
2452 /// Test whether the given SDValue is known to contain non-zero value(s).
2453 /// The DemandedElts argument limits the check to the requested vector
2454 /// elements.
2455 LLVM_ABI bool isKnownNeverZero(SDValue Op, const APInt &DemandedElts,
2456 unsigned Depth = 0) const;
2457
2458 /// Test whether the given float value is known to be positive. +0.0, +inf and
2459 /// +nan are considered positive, -0.0, -inf and -nan are not.
2461
2462 /// Check if a use of a float value is insensitive to signed zeros.
2463 LLVM_ABI bool canIgnoreSignBitOfZero(const SDUse &Use) const;
2464
2465 /// Check if \p Op has no-signed-zeros, or all users (limited to checking two
2466 /// for compile-time performance) are insensitive to signed zeros.
2468
2469 /// Test whether two SDValues are known to compare equal. This
2470 /// is true if they are the same value, or if one is negative zero and the
2471 /// other positive zero.
2472 LLVM_ABI bool isEqualTo(SDValue A, SDValue B) const;
2473
2474 /// Return true if A and B have no common bits set. As an example, this can
2475 /// allow an 'add' to be transformed into an 'or'.
2477
2478 /// Test whether \p V has a splatted value for all the demanded elements.
2479 ///
2480 /// On success \p UndefElts will indicate the elements that have UNDEF
2481 /// values instead of the splat value, this is only guaranteed to be correct
2482 /// for \p DemandedElts.
2483 ///
2484 /// NOTE: The function will return true for a demanded splat of UNDEF values.
2485 LLVM_ABI bool isSplatValue(SDValue V, const APInt &DemandedElts,
2486 APInt &UndefElts, unsigned Depth = 0) const;
2487
2488 /// Test whether \p V has a splatted value.
2489 LLVM_ABI bool isSplatValue(SDValue V, bool AllowUndefs = false) const;
2490
2491 /// If V is a splatted value, return the source vector and its splat index.
2492 LLVM_ABI SDValue getSplatSourceVector(SDValue V, int &SplatIndex);
2493
2494 /// If V is a splat vector, return its scalar source operand by extracting
2495 /// that element from the source vector. If LegalTypes is true, this method
2496 /// may only return a legally-typed splat value. If it cannot legalize the
2497 /// splatted value it will return SDValue().
2498 LLVM_ABI SDValue getSplatValue(SDValue V, bool LegalTypes = false);
2499
2500 /// If a SHL/SRA/SRL node \p V has shift amounts that are all less than the
2501 /// element bit-width of the shift node, return the valid constant range.
2502 LLVM_ABI std::optional<ConstantRange>
2503 getValidShiftAmountRange(SDValue V, const APInt &DemandedElts,
2504 unsigned Depth) const;
2505
2506 /// If a SHL/SRA/SRL node \p V has a uniform shift amount
2507 /// that is less than the element bit-width of the shift node, return it.
2508 LLVM_ABI std::optional<unsigned>
2509 getValidShiftAmount(SDValue V, const APInt &DemandedElts,
2510 unsigned Depth = 0) const;
2511
2512 /// If a SHL/SRA/SRL node \p V has a uniform shift amount
2513 /// that is less than the element bit-width of the shift node, return it.
2514 LLVM_ABI std::optional<unsigned>
2515 getValidShiftAmount(SDValue V, unsigned Depth = 0) const;
2516
2517 /// If a SHL/SRA/SRL node \p V has shift amounts that are all less than the
2518 /// element bit-width of the shift node, return the minimum possible value.
2519 LLVM_ABI std::optional<unsigned>
2520 getValidMinimumShiftAmount(SDValue V, const APInt &DemandedElts,
2521 unsigned Depth = 0) const;
2522
2523 /// If a SHL/SRA/SRL node \p V has shift amounts that are all less than the
2524 /// element bit-width of the shift node, return the minimum possible value.
2525 LLVM_ABI std::optional<unsigned>
2526 getValidMinimumShiftAmount(SDValue V, 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 maximum possible value.
2530 LLVM_ABI std::optional<unsigned>
2531 getValidMaximumShiftAmount(SDValue V, const APInt &DemandedElts,
2532 unsigned Depth = 0) const;
2533
2534 /// If a SHL/SRA/SRL node \p V has shift amounts that are all less than the
2535 /// element bit-width of the shift node, return the maximum possible value.
2536 LLVM_ABI std::optional<unsigned>
2537 getValidMaximumShiftAmount(SDValue V, unsigned Depth = 0) const;
2538
2539 /// Match a binop + shuffle pyramid that represents a horizontal reduction
2540 /// over the elements of a vector starting from the EXTRACT_VECTOR_ELT node /p
2541 /// Extract. The reduction must use one of the opcodes listed in /p
2542 /// CandidateBinOps and on success /p BinOp will contain the matching opcode.
2543 /// Returns the vector that is being reduced on, or SDValue() if a reduction
2544 /// was not matched. If \p AllowPartials is set then in the case of a
2545 /// reduction pattern that only matches the first few stages, the extracted
2546 /// subvector of the start of the reduction is returned.
2548 ArrayRef<ISD::NodeType> CandidateBinOps,
2549 bool AllowPartials = false);
2550
2551 /// Utility function used by legalize and lowering to
2552 /// "unroll" a vector operation by splitting out the scalars and operating
2553 /// on each element individually. If the ResNE is 0, fully unroll the vector
2554 /// op. If ResNE is less than the width of the vector op, unroll up to ResNE.
2555 /// If the ResNE is greater than the width of the vector op, unroll the
2556 /// vector op and fill the end of the resulting vector with UNDEFS.
2557 LLVM_ABI SDValue UnrollVectorOp(SDNode *N, unsigned ResNE = 0);
2558
2559 /// Like UnrollVectorOp(), but for the [US](ADD|SUB|MUL)O family of opcodes.
2560 /// This is a separate function because those opcodes have two results.
2561 LLVM_ABI std::pair<SDValue, SDValue>
2562 UnrollVectorOverflowOp(SDNode *N, unsigned ResNE = 0);
2563
2564 /// Return true if loads are next to each other and can be
2565 /// merged. Check that both are nonvolatile and if LD is loading
2566 /// 'Bytes' bytes from a location that is 'Dist' units away from the
2567 /// location that the 'Base' load is loading from.
2569 unsigned Bytes, int Dist) const;
2570
2571 /// Infer alignment of a load / store address. Return std::nullopt if it
2572 /// cannot be inferred.
2574
2575 /// Split the scalar node with EXTRACT_ELEMENT using the provided VTs and
2576 /// return the low/high part.
2577 LLVM_ABI std::pair<SDValue, SDValue> SplitScalar(const SDValue &N,
2578 const SDLoc &DL,
2579 const EVT &LoVT,
2580 const EVT &HiVT);
2581
2582 /// Compute the VTs needed for the low/hi parts of a type
2583 /// which is split (or expanded) into two not necessarily identical pieces.
2584 LLVM_ABI std::pair<EVT, EVT> GetSplitDestVTs(const EVT &VT) const;
2585
2586 /// Compute the VTs needed for the low/hi parts of a type, dependent on an
2587 /// enveloping VT that has been split into two identical pieces. Sets the
2588 /// HisIsEmpty flag when hi type has zero storage size.
2589 LLVM_ABI std::pair<EVT, EVT> GetDependentSplitDestVTs(const EVT &VT,
2590 const EVT &EnvVT,
2591 bool *HiIsEmpty) const;
2592
2593 /// Split the vector with EXTRACT_SUBVECTOR using the provided
2594 /// VTs and return the low/high part.
2595 LLVM_ABI std::pair<SDValue, SDValue> SplitVector(const SDValue &N,
2596 const SDLoc &DL,
2597 const EVT &LoVT,
2598 const EVT &HiVT);
2599
2600 /// Split the vector with EXTRACT_SUBVECTOR and return the low/high part.
2601 std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL) {
2602 EVT LoVT, HiVT;
2603 std::tie(LoVT, HiVT) = GetSplitDestVTs(N.getValueType());
2604 return SplitVector(N, DL, LoVT, HiVT);
2605 }
2606
2607 /// Split the explicit vector length parameter of a VP operation.
2608 LLVM_ABI std::pair<SDValue, SDValue> SplitEVL(SDValue N, EVT VecVT,
2609 const SDLoc &DL);
2610
2611 /// Split the node's operand with EXTRACT_SUBVECTOR and
2612 /// return the low/high part.
2613 std::pair<SDValue, SDValue> SplitVectorOperand(const SDNode *N, unsigned OpNo)
2614 {
2615 return SplitVector(N->getOperand(OpNo), SDLoc(N));
2616 }
2617
2618 /// Widen the vector up to the next power of two using INSERT_SUBVECTOR.
2619 LLVM_ABI SDValue WidenVector(const SDValue &N, const SDLoc &DL);
2620
2621 /// Append the extracted elements from Start to Count out of the vector Op in
2622 /// Args. If Count is 0, all of the elements will be extracted. The extracted
2623 /// elements will have type EVT if it is provided, and otherwise their type
2624 /// will be Op's element type.
2627 unsigned Start = 0, unsigned Count = 0,
2628 EVT EltVT = EVT());
2629
2630 /// Compute the default alignment value for the given type.
2631 LLVM_ABI Align getEVTAlign(EVT MemoryVT) const;
2632
2633 /// Test whether the given value is a constant int or similar node.
2634 LLVM_ABI bool
2636 bool AllowOpaques = true) const;
2637
2638 /// Test whether the given value is a constant FP or similar node.
2640
2641 /// \returns true if \p N is any kind of constant or build_vector of
2642 /// constants, int or float. If a vector, it may not necessarily be a splat.
2647
2648 /// Check if a value \op N is a constant using the target's BooleanContent for
2649 /// its type.
2650 LLVM_ABI std::optional<bool> isBoolConstant(SDValue N) const;
2651
2652 /// Set CallSiteInfo to be associated with Node.
2653 void addCallSiteInfo(const SDNode *Node, CallSiteInfo &&CallInfo) {
2654 SDEI[Node].CSInfo = std::move(CallInfo);
2655 }
2656 /// Return CallSiteInfo associated with Node, or a default if none exists.
2657 CallSiteInfo getCallSiteInfo(const SDNode *Node) {
2658 auto I = SDEI.find(Node);
2659 return I != SDEI.end() ? std::move(I->second).CSInfo : CallSiteInfo();
2660 }
2661 /// Set HeapAllocSite to be associated with Node.
2663 SDEI[Node].HeapAllocSite = MD;
2664 }
2665 /// Return HeapAllocSite associated with Node, or nullptr if none exists.
2667 auto I = SDEI.find(Node);
2668 return I != SDEI.end() ? I->second.HeapAllocSite : nullptr;
2669 }
2670 /// Set PCSections to be associated with Node.
2671 void addPCSections(const SDNode *Node, MDNode *MD) {
2672 SDEI[Node].PCSections = MD;
2673 }
2674 /// Set MMRAMetadata to be associated with Node.
2675 void addMMRAMetadata(const SDNode *Node, MDNode *MMRA) {
2676 SDEI[Node].MMRA = MMRA;
2677 }
2678 /// Return PCSections associated with Node, or nullptr if none exists.
2680 auto It = SDEI.find(Node);
2681 return It != SDEI.end() ? It->second.PCSections : nullptr;
2682 }
2683 /// Return the MMRA MDNode associated with Node, or nullptr if none
2684 /// exists.
2686 auto It = SDEI.find(Node);
2687 return It != SDEI.end() ? It->second.MMRA : nullptr;
2688 }
2689 /// Set CalledGlobal to be associated with Node.
2690 void addCalledGlobal(const SDNode *Node, const GlobalValue *GV,
2691 unsigned OpFlags) {
2692 SDEI[Node].CalledGlobal = {GV, OpFlags};
2693 }
2694 /// Return CalledGlobal associated with Node, or a nullopt if none exists.
2695 std::optional<CalledGlobalInfo> getCalledGlobal(const SDNode *Node) {
2696 auto I = SDEI.find(Node);
2697 return I != SDEI.end()
2698 ? std::make_optional(std::move(I->second).CalledGlobal)
2699 : std::nullopt;
2700 }
2701 /// Set NoMergeSiteInfo to be associated with Node if NoMerge is true.
2702 void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge) {
2703 if (NoMerge)
2704 SDEI[Node].NoMerge = NoMerge;
2705 }
2706 /// Return NoMerge info associated with Node.
2707 bool getNoMergeSiteInfo(const SDNode *Node) const {
2708 auto I = SDEI.find(Node);
2709 return I != SDEI.end() ? I->second.NoMerge : false;
2710 }
2711
2712 /// Copy extra info associated with one node to another.
2713 LLVM_ABI void copyExtraInfo(SDNode *From, SDNode *To);
2714
2715 /// Return the current function's default denormal handling kind for the given
2716 /// floating point type.
2718 return MF->getDenormalMode(VT.getFltSemantics());
2719 }
2720
2721 LLVM_ABI bool shouldOptForSize() const;
2722
2723 /// Get the (commutative) neutral element for the given opcode, if it exists.
2724 LLVM_ABI SDValue getNeutralElement(unsigned Opcode, const SDLoc &DL, EVT VT,
2725 SDNodeFlags Flags);
2726
2727 /// Some opcodes may create immediate undefined behavior when used with some
2728 /// values (integer division-by-zero for example). Therefore, these operations
2729 /// are not generally safe to move around or change.
2730 bool isSafeToSpeculativelyExecute(unsigned Opcode) const {
2731 switch (Opcode) {
2732 case ISD::SDIV:
2733 case ISD::SREM:
2734 case ISD::SDIVREM:
2735 case ISD::UDIV:
2736 case ISD::UREM:
2737 case ISD::UDIVREM:
2738 return false;
2739 default:
2740 return true;
2741 }
2742 }
2743
2744 /// Check if the provided node is save to speculatively executed given its
2745 /// current arguments. So, while `udiv` the opcode is not safe to
2746 /// speculatively execute, a given `udiv` node may be if the denominator is
2747 /// known nonzero.
2749 switch (N->getOpcode()) {
2750 case ISD::UDIV:
2751 return isKnownNeverZero(N->getOperand(1));
2752 default:
2753 return isSafeToSpeculativelyExecute(N->getOpcode());
2754 }
2755 }
2756
2757 LLVM_ABI SDValue makeStateFunctionCall(unsigned LibFunc, SDValue Ptr,
2758 SDValue InChain, const SDLoc &DLoc);
2759
2760private:
2761#ifndef NDEBUG
2762 void verifyNode(SDNode *N) const;
2763#endif
2764 void InsertNode(SDNode *N);
2765 bool RemoveNodeFromCSEMaps(SDNode *N);
2766 void AddModifiedNodeToCSEMaps(SDNode *N);
2767 SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op, void *&InsertPos);
2768 SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op1, SDValue Op2,
2769 void *&InsertPos);
2770 SDNode *FindModifiedNodeSlot(SDNode *N, ArrayRef<SDValue> Ops,
2771 void *&InsertPos);
2772 SDNode *UpdateSDLocOnMergeSDNode(SDNode *N, const SDLoc &loc);
2773
2774 void DeleteNodeNotInCSEMaps(SDNode *N);
2775 void DeallocateNode(SDNode *N);
2776
2777 void allnodes_clear();
2778
2779 /// Look up the node specified by ID in CSEMap. If it exists, return it. If
2780 /// not, return the insertion token that will make insertion faster. This
2781 /// overload is for nodes other than Constant or ConstantFP, use the other one
2782 /// for those.
2783 SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos);
2784
2785 /// Look up the node specified by ID in CSEMap. If it exists, return it. If
2786 /// not, return the insertion token that will make insertion faster. Performs
2787 /// additional processing for constant nodes.
2788 SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, const SDLoc &DL,
2789 void *&InsertPos);
2790
2791 /// Maps to auto-CSE operations.
2792 std::vector<CondCodeSDNode*> CondCodeNodes;
2793
2794 std::vector<SDNode*> ValueTypeNodes;
2795 std::map<EVT, SDNode*, EVT::compareRawBits> ExtendedValueTypeNodes;
2796 StringMap<SDNode*> ExternalSymbols;
2797
2798 std::map<std::pair<std::string, unsigned>, SDNode *> TargetExternalSymbols;
2800
2801 FlagInserter *Inserter = nullptr;
2802};
2803
2804template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> {
2806
2808 return nodes_iterator(G->allnodes_begin());
2809 }
2810
2812 return nodes_iterator(G->allnodes_end());
2813 }
2814};
2815
2816} // end namespace llvm
2817
2818#endif // LLVM_CODEGEN_SELECTIONDAG_H
return SDValue()
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
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:849
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:213
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition Compiler.h:661
@ 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)
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.
ArrayRef - 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:1065
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:123
Implements a dense probed hash-table based set.
Definition DenseSet.h:279
FoldingSetNodeIDRef - This class describes a reference to an interned FoldingSetNodeID,...
Definition FoldingSet.h:172
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition FoldingSet.h:209
FoldingSet - This template class is used to instantiate a specialized implementation of the folding s...
Definition FoldingSet.h:535
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.
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:1080
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.
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 getVPZeroExtendInReg(SDValue Op, SDValue Mask, SDValue EVL, const SDLoc &DL, EVT VT)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value.
LLVM_ABI SDValue getShiftAmountOperand(EVT LHSTy, SDValue Op)
Return the specified value casted to the target's desired shift amount type.
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 AAMDNodes &AAInfo=AAMDNodes())
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 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 getNeutralElement(unsigned Opcode, const SDLoc &DL, EVT VT, SDNodeFlags Flags)
Get the (commutative) neutral element for the given opcode, if it exists.
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.
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 SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands,...
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 SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVol, bool AlwaysInline, const CallInst *CI, std::optional< bool > OverrideTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo=AAMDNodes(), BatchAAResults *BatchAA=nullptr)
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.
LLVM_ABI SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
LLVM_ABI SDValue getVPZExtOrTrunc(const SDLoc &DL, EVT VT, SDValue Op, SDValue Mask, SDValue EVL)
Convert a vector-predicated Op, which must be an integer vector, to the vector-type VT,...
const STC & getSubtarget() const
SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
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 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 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()
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 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.
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
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 getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
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 getCommutedVectorShuffle(const ShuffleVectorSDNode &SV)
Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to the shuffle node in input but with swa...
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 bool isGuaranteedNotToBeUndefOrPoison(SDValue Op, bool PoisonOnly=false, unsigned Depth=0) const
Return true if this function can prove that Op is never poison and, if PoisonOnly is false,...
LLVM_ABI SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
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
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
allnodes_iterator allnodes_end()
SDDbgInfo::DbgLabelIterator DbgLabelBegin() const
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 KnownFPClass computeKnownFPClass(SDValue Op, FPClassTest InterestedClasses, unsigned Depth=0) const
Determine floating-point class information about Op.
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 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 getVPLogicalNOT(const SDLoc &DL, SDValue Val, SDValue Mask, SDValue EVL, EVT VT)
Create a vector-predicated logical NOT operation as (VP_XOR Val, BooleanOne, Mask,...
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.
LLVM_ABI bool isKnownNeverZeroFloat(SDValue Op) const
Test whether the given floating point SDValue is known to never be positive or negative zero.
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 Alignment, 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 getVPPtrExtOrTrunc(const SDLoc &DL, EVT VT, SDValue Op, SDValue Mask, SDValue EVL)
Convert a vector-predicated Op, which must be of integer type, to the vector-type integer type VT,...
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 bool canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts, bool PoisonOnly=false, bool ConsiderFlags=true, unsigned Depth=0) const
Return true if Op can create undef or poison from non-undef & non-poison operands.
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 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.
SDValue getSetCCVP(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Mask, SDValue EVL)
Helper function to make it easier to build VP_SETCCs if you just have an ISD::CondCode instead of an ...
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.
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:339
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:133
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.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
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:819
@ STRICT_FSETCC
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only.
Definition ISDOpcodes.h:511
@ 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:600
@ ANY_EXTEND
ANY_EXTEND - Used for integer types. The high bits are undefined.
Definition ISDOpcodes.h:853
@ SIGN_EXTEND_VECTOR_INREG
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
Definition ISDOpcodes.h:910
@ 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:844
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
Definition ISDOpcodes.h:796
@ 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:672
@ 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:614
@ EXTRACT_VECTOR_ELT
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
Definition ISDOpcodes.h:576
@ 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:850
@ SELECT_CC
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
Definition ISDOpcodes.h:811
@ ANY_EXTEND_VECTOR_INREG
ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register any-extension of the low la...
Definition ISDOpcodes.h:899
@ 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:805
@ INSERT_VECTOR_ELT
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL.
Definition ISDOpcodes.h:565
@ ZERO_EXTEND_VECTOR_INREG
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
Definition ISDOpcodes.h:921
@ 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:556
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:532
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:408
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().
FunctionAddr VTableAddr Count
Definition InstrProf.h:139
GlobalAddressSDNode MostAlignedSDNode
The SDNode class with the greatest alignment requirement.
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:82
CombineLevel
Definition DAGCombine.h:15
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
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:870
#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
DefaultFoldingSetTrait - This class provides default implementations for FoldingSetTrait implementati...
Definition FoldingSet.h:115
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:182
EVT getVectorElementType() const
Given a vector type, return the type of each element.
Definition ValueTypes.h:336
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:344
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
Definition ValueTypes.h:316
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)
FoldingSetTrait - This trait class is used to define behavior of how to "profile" (in the FoldingSet ...
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
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