LLVM 22.0.0git
DDG.h
Go to the documentation of this file.
1//===- llvm/Analysis/DDG.h --------------------------------------*- 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 defines the Data-Dependence Graph (DDG).
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_ANALYSIS_DDG_H
14#define LLVM_ANALYSIS_DDG_H
15
16#include "llvm/ADT/DenseMap.h"
22
23namespace llvm {
24class Function;
25class Loop;
26class LoopInfo;
27class DDGNode;
28class DDGEdge;
32class LPMUpdater;
33
34/// Data Dependence Graph Node
35/// The graph can represent the following types of nodes:
36/// 1. Single instruction node containing just one instruction.
37/// 2. Multiple instruction node where two or more instructions from
38/// the same basic block are merged into one node.
39/// 3. Pi-block node which is a group of other DDG nodes that are part of a
40/// strongly-connected component of the graph.
41/// A pi-block node contains more than one single or multiple instruction
42/// nodes. The root node cannot be part of a pi-block.
43/// 4. Root node is a special node that connects to all components such that
44/// there is always a path from it to any node in the graph.
46public:
48
49 enum class NodeKind {
50 Unknown,
51 SingleInstruction,
52 MultiInstruction,
53 PiBlock,
54 Root,
55 };
56
57 DDGNode() = delete;
58 DDGNode(const NodeKind K) : Kind(K) {}
59 DDGNode(const DDGNode &N) = default;
60 DDGNode(DDGNode &&N) : DDGNodeBase(std::move(N)), Kind(N.Kind) {}
61 virtual ~DDGNode() = 0;
62
64 DGNode::operator=(N);
65 Kind = N.Kind;
66 return *this;
67 }
68
70 DGNode::operator=(std::move(N));
71 Kind = N.Kind;
72 return *this;
73 }
74
75 /// Getter for the kind of this node.
76 NodeKind getKind() const { return Kind; }
77
78 /// Collect a list of instructions, in \p IList, for which predicate \p Pred
79 /// evaluates to true when iterating over instructions of this node. Return
80 /// true if at least one instruction was collected, and false otherwise.
81 bool collectInstructions(llvm::function_ref<bool(Instruction *)> const &Pred,
82 InstructionListType &IList) const;
83
84protected:
85 /// Setter for the kind of this node.
86 void setKind(NodeKind K) { Kind = K; }
87
88private:
89 NodeKind Kind;
90};
91
92/// Subclass of DDGNode representing the root node of the graph.
93/// There should only be one such node in a given graph.
94class RootDDGNode : public DDGNode {
95public:
97 RootDDGNode(const RootDDGNode &N) = delete;
99 ~RootDDGNode() = default;
100
101 /// Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
102 static bool classof(const DDGNode *N) {
103 return N->getKind() == NodeKind::Root;
104 }
105 static bool classof(const RootDDGNode *N) { return true; }
106};
107
108/// Subclass of DDGNode representing single or multi-instruction nodes.
110 friend class DDGBuilder;
111
112public:
113 SimpleDDGNode() = delete;
118
120
122 DDGNode::operator=(std::move(N));
123 InstList = std::move(N.InstList);
124 return *this;
125 }
126
127 /// Get the list of instructions in this node.
129 assert(!InstList.empty() && "Instruction List is empty.");
130 return InstList;
131 }
133 return const_cast<InstructionListType &>(
134 static_cast<const SimpleDDGNode *>(this)->getInstructions());
135 }
136
137 /// Get the first/last instruction in the node.
138 Instruction *getFirstInstruction() const { return getInstructions().front(); }
139 Instruction *getLastInstruction() const { return getInstructions().back(); }
140
141 /// Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
142 static bool classof(const DDGNode *N) {
143 return N->getKind() == NodeKind::SingleInstruction ||
144 N->getKind() == NodeKind::MultiInstruction;
145 }
146 static bool classof(const SimpleDDGNode *N) { return true; }
147
148private:
149 /// Append the list of instructions in \p Input to this node.
150 void appendInstructions(const InstructionListType &Input) {
151 setKind((InstList.size() == 0 && Input.size() == 1)
152 ? NodeKind::SingleInstruction
153 : NodeKind::MultiInstruction);
154 llvm::append_range(InstList, Input);
155 }
156 void appendInstructions(const SimpleDDGNode &Input) {
157 appendInstructions(Input.getInstructions());
158 }
159
160 /// List of instructions associated with a single or multi-instruction node.
161 SmallVector<Instruction *, 2> InstList;
162};
163
164/// Subclass of DDGNode representing a pi-block. A pi-block represents a group
165/// of DDG nodes that are part of a strongly-connected component of the graph.
166/// Replacing all the SCCs with pi-blocks results in an acyclic representation
167/// of the DDG. For example if we have:
168/// {a -> b}, {b -> c, d}, {c -> a}
169/// the cycle a -> b -> c -> a is abstracted into a pi-block "p" as follows:
170/// {p -> d} with "p" containing: {a -> b}, {b -> c}, {c -> a}
172public:
174
175 PiBlockDDGNode() = delete;
176 PiBlockDDGNode(const PiNodeList &List);
180
182
184 DDGNode::operator=(std::move(N));
185 NodeList = std::move(N.NodeList);
186 return *this;
187 }
188
189 /// Get the list of nodes in this pi-block.
190 const PiNodeList &getNodes() const {
191 assert(!NodeList.empty() && "Node list is empty.");
192 return NodeList;
193 }
195 return const_cast<PiNodeList &>(
196 static_cast<const PiBlockDDGNode *>(this)->getNodes());
197 }
198
199 /// Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
200 static bool classof(const DDGNode *N) {
201 return N->getKind() == NodeKind::PiBlock;
202 }
203
204private:
205 /// List of nodes in this pi-block.
206 PiNodeList NodeList;
207};
208
209/// Data Dependency Graph Edge.
210/// An edge in the DDG can represent a def-use relationship or
211/// a memory dependence based on the result of DependenceAnalysis.
212/// A rooted edge connects the root node to one of the components
213/// of the graph.
214class DDGEdge : public DDGEdgeBase {
215public:
216 /// The kind of edge in the DDG
217 enum class EdgeKind {
218 Unknown,
221 Rooted,
222 Last = Rooted // Must be equal to the largest enum value.
223 };
224
225 explicit DDGEdge(DDGNode &N) = delete;
226 DDGEdge(DDGNode &N, EdgeKind K) : DDGEdgeBase(N), Kind(K) {}
227 DDGEdge(const DDGEdge &E) : DDGEdgeBase(E), Kind(E.getKind()) {}
228 DDGEdge(DDGEdge &&E) : DDGEdgeBase(std::move(E)), Kind(E.Kind) {}
229 DDGEdge &operator=(const DDGEdge &E) = default;
230
232 DDGEdgeBase::operator=(std::move(E));
233 Kind = E.Kind;
234 return *this;
235 }
236
237 /// Get the edge kind
238 EdgeKind getKind() const { return Kind; };
239
240 /// Return true if this is a def-use edge, and false otherwise.
241 bool isDefUse() const { return Kind == EdgeKind::RegisterDefUse; }
242
243 /// Return true if this is a memory dependence edge, and false otherwise.
244 bool isMemoryDependence() const { return Kind == EdgeKind::MemoryDependence; }
245
246 /// Return true if this is an edge stemming from the root node, and false
247 /// otherwise.
248 bool isRooted() const { return Kind == EdgeKind::Rooted; }
249
250private:
251 EdgeKind Kind;
252};
253
254/// Encapsulate some common data and functionality needed for different
255/// variations of data dependence graphs.
256template <typename NodeType> class DependenceGraphInfo {
257public:
259
262 DependenceGraphInfo(const std::string &N, const DependenceInfo &DepInfo)
263 : Name(N), DI(DepInfo), Root(nullptr) {}
265 : Name(std::move(G.Name)), DI(std::move(G.DI)), Root(G.Root) {}
266 virtual ~DependenceGraphInfo() = default;
267
268 /// Return the label that is used to name this graph.
269 StringRef getName() const { return Name; }
270
271 /// Return the root node of the graph.
272 NodeType &getRoot() const {
273 assert(Root && "Root node is not available yet. Graph construction may "
274 "still be in progress\n");
275 return *Root;
276 }
277
278 /// Collect all the data dependency infos coming from any pair of memory
279 /// accesses from \p Src to \p Dst, and store them into \p Deps. Return true
280 /// if a dependence exists, and false otherwise.
281 bool getDependencies(const NodeType &Src, const NodeType &Dst,
282 DependenceList &Deps) const;
283
284 /// Return a string representing the type of dependence that the dependence
285 /// analysis identified between the two given nodes. This function assumes
286 /// that there is a memory dependence between the given two nodes.
287 std::string getDependenceString(const NodeType &Src,
288 const NodeType &Dst) const;
289
290protected:
291 // Name of the graph.
292 std::string Name;
293
294 // Store a copy of DependenceInfo in the graph, so that individual memory
295 // dependencies don't need to be stored. Instead when the dependence is
296 // queried it is recomputed using @DI.
298
299 // A special node in the graph that has an edge to every connected component of
300 // the graph, to ensure all nodes are reachable in a graph walk.
301 NodeType *Root = nullptr;
302};
303
305
306/// Data Dependency Graph
309 friend class DDGBuilder;
310
311public:
314
318 : DDGBase(std::move(G)), DDGInfo(std::move(G)) {}
322
323 /// If node \p N belongs to a pi-block return a pointer to the pi-block,
324 /// otherwise return null.
325 const PiBlockDDGNode *getPiBlock(const NodeType &N) const;
326
327protected:
328 /// Add node \p N to the graph, if it's not added yet, and keep track of the
329 /// root node as well as pi-blocks and their members. Return true if node is
330 /// successfully added.
331 bool addNode(NodeType &N);
332
333private:
335
336 /// Mapping from graph nodes to their containing pi-blocks. If a node is not
337 /// part of a pi-block, it will not appear in this map.
338 PiBlockMapType PiBlockMap;
339};
340
341/// Concrete implementation of a pure data dependence graph builder. This class
342/// provides custom implementation for the pure-virtual functions used in the
343/// generic dependence graph build algorithm.
344///
345/// For information about time complexity of the build algorithm see the
346/// comments near the declaration of AbstractDependenceGraphBuilder.
348 : public AbstractDependenceGraphBuilder<DataDependenceGraph> {
349public:
351 const BasicBlockListType &BBs)
354 auto *RN = new RootDDGNode();
355 assert(RN && "Failed to allocate memory for DDG root node.");
356 Graph.addNode(*RN);
357 return *RN;
358 }
360 auto *SN = new SimpleDDGNode(I);
361 assert(SN && "Failed to allocate memory for simple DDG node.");
362 Graph.addNode(*SN);
363 return *SN;
364 }
366 auto *Pi = new PiBlockDDGNode(L);
367 assert(Pi && "Failed to allocate memory for pi-block node.");
368 Graph.addNode(*Pi);
369 return *Pi;
370 }
372 auto *E = new DDGEdge(Tgt, DDGEdge::EdgeKind::RegisterDefUse);
373 assert(E && "Failed to allocate memory for edge");
374 Graph.connect(Src, Tgt, *E);
375 return *E;
376 }
378 auto *E = new DDGEdge(Tgt, DDGEdge::EdgeKind::MemoryDependence);
379 assert(E && "Failed to allocate memory for edge");
380 Graph.connect(Src, Tgt, *E);
381 return *E;
382 }
384 auto *E = new DDGEdge(Tgt, DDGEdge::EdgeKind::Rooted);
385 assert(E && "Failed to allocate memory for edge");
386 assert(isa<RootDDGNode>(Src) && "Expected root node");
387 Graph.connect(Src, Tgt, *E);
388 return *E;
389 }
390
392 auto *PiNode = dyn_cast<const PiBlockDDGNode>(&N);
393 assert(PiNode && "Expected a pi-block node.");
394 return PiNode->getNodes();
395 }
396
397 /// Return true if the two nodes \pSrc and \pTgt are both simple nodes and
398 /// the consecutive instructions after merging belong to the same basic block.
399 bool areNodesMergeable(const DDGNode &Src, const DDGNode &Tgt) const final;
400 void mergeNodes(DDGNode &Src, DDGNode &Tgt) final;
401 bool shouldSimplify() const final;
402 bool shouldCreatePiBlocks() const final;
403};
404
408LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const DDGEdge::EdgeKind K);
410
411//===--------------------------------------------------------------------===//
412// DDG Analysis Passes
413//===--------------------------------------------------------------------===//
414
415/// Analysis pass that builds the DDG for a loop.
417public:
418 using Result = std::unique_ptr<DataDependenceGraph>;
421
422private:
424 LLVM_ABI static AnalysisKey Key;
425};
426
427/// Textual printer pass for the DDG of a loop.
428class DDGAnalysisPrinterPass : public PassInfoMixin<DDGAnalysisPrinterPass> {
429public:
433 LPMUpdater &U);
434 static bool isRequired() { return true; }
435
436private:
438};
439
440//===--------------------------------------------------------------------===//
441// DependenceGraphInfo Implementation
442//===--------------------------------------------------------------------===//
443
444template <typename NodeType>
446 const NodeType &Src, const NodeType &Dst, DependenceList &Deps) const {
447 assert(Deps.empty() && "Expected empty output list at the start.");
448
449 // List of memory access instructions from src and dst nodes.
450 SmallVector<Instruction *, 8> SrcIList, DstIList;
451 auto isMemoryAccess = [](const Instruction *I) {
452 return I->mayReadOrWriteMemory();
453 };
454 Src.collectInstructions(isMemoryAccess, SrcIList);
455 Dst.collectInstructions(isMemoryAccess, DstIList);
456
457 for (auto *SrcI : SrcIList)
458 for (auto *DstI : DstIList)
459 if (auto Dep =
460 const_cast<DependenceInfo *>(&DI)->depends(SrcI, DstI))
461 Deps.push_back(std::move(Dep));
462
463 return !Deps.empty();
464}
465
466template <typename NodeType>
467std::string
469 const NodeType &Dst) const {
470 std::string Str;
472 DependenceList Deps;
473 if (!getDependencies(Src, Dst, Deps))
474 return Str;
475 interleaveComma(Deps, OS, [&](const std::unique_ptr<Dependence> &D) {
476 D->dump(OS);
477 // Remove the extra new-line character printed by the dump
478 // method
479 if (Str.back() == '\n')
480 Str.pop_back();
481 });
482
483 return Str;
484}
485
486//===--------------------------------------------------------------------===//
487// GraphTraits specializations for the DDG
488//===--------------------------------------------------------------------===//
489
490/// non-const versions of the grapth trait specializations for DDG
491template <> struct GraphTraits<DDGNode *> {
492 using NodeRef = DDGNode *;
493
495 return &P->getTargetNode();
496 }
497
498 // Provide a mapped iterator so that the GraphTrait-based implementations can
499 // find the target nodes without having to explicitly go through the edges.
501 mapped_iterator<DDGNode::iterator, decltype(&DDGGetTargetNode)>;
503
504 static NodeRef getEntryNode(NodeRef N) { return N; }
506 return ChildIteratorType(N->begin(), &DDGGetTargetNode);
507 }
509 return ChildIteratorType(N->end(), &DDGGetTargetNode);
510 }
511
513 return N->begin();
514 }
515 static ChildEdgeIteratorType child_edge_end(NodeRef N) { return N->end(); }
516};
517
518template <>
522 return &DG->getRoot();
523 }
525 return DG->begin();
526 }
527 static nodes_iterator nodes_end(DataDependenceGraph *DG) { return DG->end(); }
528};
529
530/// const versions of the grapth trait specializations for DDG
531template <> struct GraphTraits<const DDGNode *> {
532 using NodeRef = const DDGNode *;
533
535 return &P->getTargetNode();
536 }
537
538 // Provide a mapped iterator so that the GraphTrait-based implementations can
539 // find the target nodes without having to explicitly go through the edges.
541 mapped_iterator<DDGNode::const_iterator, decltype(&DDGGetTargetNode)>;
543
544 static NodeRef getEntryNode(NodeRef N) { return N; }
546 return ChildIteratorType(N->begin(), &DDGGetTargetNode);
547 }
549 return ChildIteratorType(N->end(), &DDGGetTargetNode);
550 }
551
553 return N->begin();
554 }
555 static ChildEdgeIteratorType child_edge_end(NodeRef N) { return N->end(); }
556};
557
558template <>
563 return &DG->getRoot();
564 }
566 return DG->begin();
567 }
569 return DG->end();
570 }
571};
572
573} // namespace llvm
574
575#endif // LLVM_ANALYSIS_DDG_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
aarch64 promote const
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_ABI
Definition: Compiler.h:213
This file defines the DenseMap class.
SmallVector< Instruction *, 2 > InstructionListType
This file defines the interface and a base class implementation for a directed graph.
This header provides classes for managing per-loop analyses.
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
#define G(x, y, z)
Definition: MD5.cpp:56
#define P(N)
raw_pwrite_stream & OS
This abstract builder class defines a set of high-level steps for creating DDG-like graphs.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
Textual printer pass for the DDG of a loop.
Definition: DDG.h:428
static bool isRequired()
Definition: DDG.h:434
DDGAnalysisPrinterPass(raw_ostream &OS)
Definition: DDG.h:430
Analysis pass that builds the DDG for a loop.
Definition: DDG.h:416
std::unique_ptr< DataDependenceGraph > Result
Definition: DDG.h:418
Concrete implementation of a pure data dependence graph builder.
Definition: DDG.h:348
DDGNode & createPiBlock(const NodeListType &L) final
Create a pi-block node in the graph representing a group of nodes in an SCC of the graph.
Definition: DDG.h:365
DDGNode & createFineGrainedNode(Instruction &I) final
Create an atomic node in the graph given a single instruction.
Definition: DDG.h:359
DDGBuilder(DataDependenceGraph &G, DependenceInfo &D, const BasicBlockListType &BBs)
Definition: DDG.h:350
DDGEdge & createMemoryEdge(DDGNode &Src, DDGNode &Tgt) final
Definition: DDG.h:377
DDGEdge & createRootedEdge(DDGNode &Src, DDGNode &Tgt) final
Definition: DDG.h:383
DDGNode & createRootNode() final
Create the root node of the graph.
Definition: DDG.h:353
const NodeListType & getNodesInPiBlock(const DDGNode &N) final
Definition: DDG.h:391
DDGEdge & createDefUseEdge(DDGNode &Src, DDGNode &Tgt) final
Definition: DDG.h:371
Data Dependency Graph Edge.
Definition: DDG.h:214
DDGEdge & operator=(DDGEdge &&E)
Definition: DDG.h:231
bool isDefUse() const
Return true if this is a def-use edge, and false otherwise.
Definition: DDG.h:241
bool isRooted() const
Return true if this is an edge stemming from the root node, and false otherwise.
Definition: DDG.h:248
EdgeKind getKind() const
Get the edge kind.
Definition: DDG.h:238
EdgeKind
The kind of edge in the DDG.
Definition: DDG.h:217
DDGEdge(DDGEdge &&E)
Definition: DDG.h:228
bool isMemoryDependence() const
Return true if this is a memory dependence edge, and false otherwise.
Definition: DDG.h:244
DDGEdge(const DDGEdge &E)
Definition: DDG.h:227
DDGEdge(DDGNode &N, EdgeKind K)
Definition: DDG.h:226
DDGEdge(DDGNode &N)=delete
DDGEdge & operator=(const DDGEdge &E)=default
Data Dependence Graph Node The graph can represent the following types of nodes:
Definition: DDG.h:45
DDGNode & operator=(DDGNode &&N)
Definition: DDG.h:69
DDGNode(const DDGNode &N)=default
DDGNode(DDGNode &&N)
Definition: DDG.h:60
NodeKind getKind() const
Getter for the kind of this node.
Definition: DDG.h:76
DDGNode(const NodeKind K)
Definition: DDG.h:58
void setKind(NodeKind K)
Setter for the kind of this node.
Definition: DDG.h:86
DDGNode()=delete
virtual ~DDGNode()=0
DDGNode & operator=(const DDGNode &N)
Definition: DDG.h:63
Represent an edge in the directed graph.
Definition: DirectedGraph.h:28
DGEdge< NodeType, EdgeType > & operator=(const DGEdge< NodeType, EdgeType > &E)
Definition: DirectedGraph.h:35
Represent a node in the directed graph.
Definition: DirectedGraph.h:73
typename EdgeListTy::const_iterator const_iterator
Definition: DirectedGraph.h:77
typename EdgeListTy::iterator iterator
Definition: DirectedGraph.h:76
Data Dependency Graph.
Definition: DDG.h:307
DataDependenceGraph(DataDependenceGraph &&G)
Definition: DDG.h:317
DataDependenceGraph(const DataDependenceGraph &G)=delete
Encapsulate some common data and functionality needed for different variations of data dependence gra...
Definition: DDG.h:256
std::string getDependenceString(const NodeType &Src, const NodeType &Dst) const
Return a string representing the type of dependence that the dependence analysis identified between t...
Definition: DDG.h:468
const DependenceInfo DI
Definition: DDG.h:297
NodeType & getRoot() const
Return the root node of the graph.
Definition: DDG.h:272
DependenceGraphInfo(DependenceGraphInfo &&G)
Definition: DDG.h:264
StringRef getName() const
Return the label that is used to name this graph.
Definition: DDG.h:269
SmallVector< std::unique_ptr< Dependence >, 1 > DependenceList
Definition: DDG.h:258
DependenceGraphInfo(const DependenceGraphInfo &G)=delete
DependenceGraphInfo(const std::string &N, const DependenceInfo &DepInfo)
Definition: DDG.h:262
virtual ~DependenceGraphInfo()=default
NodeType * Root
Definition: DDG.h:301
bool getDependencies(const NodeType &Src, const NodeType &Dst, DependenceList &Deps) const
Collect all the data dependency infos coming from any pair of memory accesses from Src to Dst,...
Definition: DDG.h:445
std::string Name
Definition: DDG.h:292
DependenceInfo - This class is the main dependence-analysis driver.
LLVM_ABI std::unique_ptr< Dependence > depends(Instruction *Src, Instruction *Dst, bool UnderRuntimeAssumptions=false)
depends - Tests for a dependence between the Src and Dst instructions.
Directed graph.
const_iterator begin() const
const_iterator end() const
typename NodeListTy::iterator iterator
typename NodeListTy::const_iterator const_iterator
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:40
Subclass of DDGNode representing a pi-block.
Definition: DDG.h:171
PiBlockDDGNode & operator=(PiBlockDDGNode &&N)
Definition: DDG.h:183
const PiNodeList & getNodes() const
Get the list of nodes in this pi-block.
Definition: DDG.h:190
static bool classof(const DDGNode *N)
Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
Definition: DDG.h:200
PiBlockDDGNode & operator=(const PiBlockDDGNode &N)=default
PiNodeList & getNodes()
Definition: DDG.h:194
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:112
Subclass of DDGNode representing the root node of the graph.
Definition: DDG.h:94
static bool classof(const DDGNode *N)
Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
Definition: DDG.h:102
RootDDGNode(const RootDDGNode &N)=delete
~RootDDGNode()=default
static bool classof(const RootDDGNode *N)
Definition: DDG.h:105
RootDDGNode(RootDDGNode &&N)
Definition: DDG.h:98
Subclass of DDGNode representing single or multi-instruction nodes.
Definition: DDG.h:109
Instruction * getFirstInstruction() const
Get the first/last instruction in the node.
Definition: DDG.h:138
SimpleDDGNode & operator=(const SimpleDDGNode &N)=default
const InstructionListType & getInstructions() const
Get the list of instructions in this node.
Definition: DDG.h:128
SimpleDDGNode & operator=(SimpleDDGNode &&N)
Definition: DDG.h:121
static bool classof(const DDGNode *N)
Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
Definition: DDG.h:142
static bool classof(const SimpleDDGNode *N)
Definition: DDG.h:146
InstructionListType & getInstructions()
Definition: DDG.h:132
Instruction * getLastInstruction() const
Definition: DDG.h:139
bool empty() const
Definition: SmallVector.h:82
void push_back(const T &Elt)
Definition: SmallVector.h:414
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:662
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Definition: STLExtras.h:2155
void interleaveComma(const Container &c, StreamT &os, UnaryFunctor each_fn)
Definition: STLExtras.h:2250
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:1886
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:856
#define N
Determine the kind of a node from its type.
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:93
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:29
DDGNode::iterator ChildEdgeIteratorType
Definition: DDG.h:502
static DDGNode * DDGGetTargetNode(DGEdge< DDGNode, DDGEdge > *P)
Definition: DDG.h:494
static ChildIteratorType child_end(NodeRef N)
Definition: DDG.h:508
static ChildEdgeIteratorType child_edge_begin(NodeRef N)
Definition: DDG.h:512
static ChildEdgeIteratorType child_edge_end(NodeRef N)
Definition: DDG.h:515
static ChildIteratorType child_begin(NodeRef N)
Definition: DDG.h:505
static NodeRef getEntryNode(NodeRef N)
Definition: DDG.h:504
static nodes_iterator nodes_end(DataDependenceGraph *DG)
Definition: DDG.h:527
DataDependenceGraph::iterator nodes_iterator
Definition: DDG.h:520
static nodes_iterator nodes_begin(DataDependenceGraph *DG)
Definition: DDG.h:524
static NodeRef getEntryNode(DataDependenceGraph *DG)
Definition: DDG.h:521
static ChildIteratorType child_end(NodeRef N)
Definition: DDG.h:548
static const DDGNode * DDGGetTargetNode(const DGEdge< DDGNode, DDGEdge > *P)
Definition: DDG.h:534
DDGNode::const_iterator ChildEdgeIteratorType
Definition: DDG.h:542
static ChildEdgeIteratorType child_edge_end(NodeRef N)
Definition: DDG.h:555
static ChildEdgeIteratorType child_edge_begin(NodeRef N)
Definition: DDG.h:552
static NodeRef getEntryNode(NodeRef N)
Definition: DDG.h:544
static ChildIteratorType child_begin(NodeRef N)
Definition: DDG.h:545
static nodes_iterator nodes_begin(const DataDependenceGraph *DG)
Definition: DDG.h:565
DataDependenceGraph::const_iterator nodes_iterator
Definition: DDG.h:561
static NodeRef getEntryNode(const DataDependenceGraph *DG)
Definition: DDG.h:562
static nodes_iterator nodes_end(const DataDependenceGraph *DG)
Definition: DDG.h:568
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:70