LLVM  10.0.0
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"
17 #include "llvm/ADT/DirectedGraph.h"
21 #include "llvm/IR/Instructions.h"
22 
23 namespace llvm {
24 class DDGNode;
25 class DDGEdge;
29 class LPMUpdater;
30 
31 /// Data Dependence Graph Node
32 /// The graph can represent the following types of nodes:
33 /// 1. Single instruction node containing just one instruction.
34 /// 2. Multiple instruction node where two or more instructions from
35 /// the same basic block are merged into one node.
36 /// 3. Pi-block node which is a group of other DDG nodes that are part of a
37 /// strongly-connected component of the graph.
38 /// A pi-block node contains more than one single or multiple instruction
39 /// nodes. The root node cannot be part of a pi-block.
40 /// 4. Root node is a special node that connects to all components such that
41 /// there is always a path from it to any node in the graph.
42 class DDGNode : public DDGNodeBase {
43 public:
45 
46  enum class NodeKind {
47  Unknown,
50  PiBlock,
51  Root,
52  };
53 
54  DDGNode() = delete;
55  DDGNode(const NodeKind K) : DDGNodeBase(), Kind(K) {}
56  DDGNode(const DDGNode &N) : DDGNodeBase(N), Kind(N.Kind) {}
57  DDGNode(DDGNode &&N) : DDGNodeBase(std::move(N)), Kind(N.Kind) {}
58  virtual ~DDGNode() = 0;
59 
62  Kind = N.Kind;
63  return *this;
64  }
65 
67  DGNode::operator=(std::move(N));
68  Kind = N.Kind;
69  return *this;
70  }
71 
72  /// Getter for the kind of this node.
73  NodeKind getKind() const { return Kind; }
74 
75  /// Collect a list of instructions, in \p IList, for which predicate \p Pred
76  /// evaluates to true when iterating over instructions of this node. Return
77  /// true if at least one instruction was collected, and false otherwise.
78  bool collectInstructions(llvm::function_ref<bool(Instruction *)> const &Pred,
79  InstructionListType &IList) const;
80 
81 protected:
82  /// Setter for the kind of this node.
83  void setKind(NodeKind K) { Kind = K; }
84 
85 private:
86  NodeKind Kind;
87 };
88 
89 /// Subclass of DDGNode representing the root node of the graph.
90 /// There should only be one such node in a given graph.
91 class RootDDGNode : public DDGNode {
92 public:
94  RootDDGNode(const RootDDGNode &N) = delete;
95  RootDDGNode(RootDDGNode &&N) : DDGNode(std::move(N)) {}
97 
98  /// Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
99  static bool classof(const DDGNode *N) {
100  return N->getKind() == NodeKind::Root;
101  }
102  static bool classof(const RootDDGNode *N) { return true; }
103 };
104 
105 /// Subclass of DDGNode representing single or multi-instruction nodes.
106 class SimpleDDGNode : public DDGNode {
107 public:
108  SimpleDDGNode() = delete;
110  SimpleDDGNode(const SimpleDDGNode &N);
112  ~SimpleDDGNode();
113 
116  InstList = N.InstList;
117  return *this;
118  }
119 
121  DDGNode::operator=(std::move(N));
122  InstList = std::move(N.InstList);
123  return *this;
124  }
125 
126  /// Get the list of instructions in this node.
128  assert(!InstList.empty() && "Instruction List is empty.");
129  return InstList;
130  }
132  return const_cast<InstructionListType &>(
133  static_cast<const SimpleDDGNode *>(this)->getInstructions());
134  }
135 
136  /// Get the first/last instruction in the node.
137  Instruction *getFirstInstruction() const { return getInstructions().front(); }
138  Instruction *getLastInstruction() const { return getInstructions().back(); }
139 
140  /// Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
141  static bool classof(const DDGNode *N) {
142  return N->getKind() == NodeKind::SingleInstruction ||
144  }
145  static bool classof(const SimpleDDGNode *N) { return true; }
146 
147 private:
148  /// Append the list of instructions in \p Input to this node.
149  void appendInstructions(const InstructionListType &Input) {
150  setKind((InstList.size() == 0 && Input.size() == 1)
153  InstList.insert(InstList.end(), Input.begin(), Input.end());
154  }
155  void appendInstructions(const SimpleDDGNode &Input) {
156  appendInstructions(Input.getInstructions());
157  }
158 
159  /// List of instructions associated with a single or multi-instruction node.
161 };
162 
163 /// Subclass of DDGNode representing a pi-block. A pi-block represents a group
164 /// of DDG nodes that are part of a strongly-connected component of the graph.
165 /// Replacing all the SCCs with pi-blocks results in an acyclic representation
166 /// of the DDG. For example if we have:
167 /// {a -> b}, {b -> c, d}, {c -> a}
168 /// the cycle a -> b -> c -> a is abstracted into a pi-block "p" as follows:
169 /// {p -> d} with "p" containing: {a -> b}, {b -> c}, {c -> a}
170 class PiBlockDDGNode : public DDGNode {
171 public:
173 
174  PiBlockDDGNode() = delete;
178  ~PiBlockDDGNode();
179 
182  NodeList = N.NodeList;
183  return *this;
184  }
185 
187  DDGNode::operator=(std::move(N));
188  NodeList = std::move(N.NodeList);
189  return *this;
190  }
191 
192  /// Get the list of nodes in this pi-block.
193  const PiNodeList &getNodes() const {
194  assert(!NodeList.empty() && "Node list is empty.");
195  return NodeList;
196  }
198  return const_cast<PiNodeList &>(
199  static_cast<const PiBlockDDGNode *>(this)->getNodes());
200  }
201 
202  /// Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
203  static bool classof(const DDGNode *N) {
204  return N->getKind() == NodeKind::PiBlock;
205  }
206 
207 private:
208  /// List of nodes in this pi-block.
210 };
211 
212 /// Data Dependency Graph Edge.
213 /// An edge in the DDG can represent a def-use relationship or
214 /// a memory dependence based on the result of DependenceAnalysis.
215 /// A rooted edge connects the root node to one of the components
216 /// of the graph.
217 class DDGEdge : public DDGEdgeBase {
218 public:
219  /// The kind of edge in the DDG
220  enum class EdgeKind {
221  Unknown,
222  RegisterDefUse,
223  MemoryDependence,
224  Rooted,
225  Last = Rooted // Must be equal to the largest enum value.
226  };
227 
228  explicit DDGEdge(DDGNode &N) = delete;
229  DDGEdge(DDGNode &N, EdgeKind K) : DDGEdgeBase(N), Kind(K) {}
230  DDGEdge(const DDGEdge &E) : DDGEdgeBase(E), Kind(E.getKind()) {}
231  DDGEdge(DDGEdge &&E) : DDGEdgeBase(std::move(E)), Kind(E.Kind) {}
234  Kind = E.Kind;
235  return *this;
236  }
237 
239  DDGEdgeBase::operator=(std::move(E));
240  Kind = E.Kind;
241  return *this;
242  }
243 
244  /// Get the edge kind
245  EdgeKind getKind() const { return Kind; };
246 
247  /// Return true if this is a def-use edge, and false otherwise.
248  bool isDefUse() const { return Kind == EdgeKind::RegisterDefUse; }
249 
250  /// Return true if this is a memory dependence edge, and false otherwise.
251  bool isMemoryDependence() const { return Kind == EdgeKind::MemoryDependence; }
252 
253  /// Return true if this is an edge stemming from the root node, and false
254  /// otherwise.
255  bool isRooted() const { return Kind == EdgeKind::Rooted; }
256 
257 private:
258  EdgeKind Kind;
259 };
260 
261 /// Encapsulate some common data and functionality needed for different
262 /// variations of data dependence graphs.
263 template <typename NodeType> class DependenceGraphInfo {
264 public:
266 
267  DependenceGraphInfo() = delete;
268  DependenceGraphInfo(const DependenceGraphInfo &G) = delete;
269  DependenceGraphInfo(const std::string &N, const DependenceInfo &DepInfo)
270  : Name(N), DI(DepInfo), Root(nullptr) {}
272  : Name(std::move(G.Name)), DI(std::move(G.DI)), Root(G.Root) {}
273  virtual ~DependenceGraphInfo() {}
274 
275  /// Return the label that is used to name this graph.
276  const StringRef getName() const { return Name; }
277 
278  /// Return the root node of the graph.
279  NodeType &getRoot() const {
280  assert(Root && "Root node is not available yet. Graph construction may "
281  "still be in progress\n");
282  return *Root;
283  }
284 
285 protected:
286  // Name of the graph.
287  std::string Name;
288 
289  // Store a copy of DependenceInfo in the graph, so that individual memory
290  // dependencies don't need to be stored. Instead when the dependence is
291  // queried it is recomputed using @DI.
293 
294  // A special node in the graph that has an edge to every connected component of
295  // the graph, to ensure all nodes are reachable in a graph walk.
296  NodeType *Root = nullptr;
297 };
298 
300 
301 /// Data Dependency Graph
302 class DataDependenceGraph : public DDGBase, public DDGInfo {
304  friend class DDGBuilder;
305 
306 public:
307  using NodeType = DDGNode;
308  using EdgeType = DDGEdge;
309 
310  DataDependenceGraph() = delete;
311  DataDependenceGraph(const DataDependenceGraph &G) = delete;
313  : DDGBase(std::move(G)), DDGInfo(std::move(G)) {}
317 
318  /// If node \p N belongs to a pi-block return a pointer to the pi-block,
319  /// otherwise return null.
320  const PiBlockDDGNode *getPiBlock(const NodeType &N) const;
321 
322 protected:
323  /// Add node \p N to the graph, if it's not added yet, and keep track of the
324  /// root node as well as pi-blocks and their members. Return true if node is
325  /// successfully added.
326  bool addNode(NodeType &N);
327 
328 private:
330 
331  /// Mapping from graph nodes to their containing pi-blocks. If a node is not
332  /// part of a pi-block, it will not appear in this map.
333  PiBlockMapType PiBlockMap;
334 };
335 
336 /// Concrete implementation of a pure data dependence graph builder. This class
337 /// provides custom implementation for the pure-virtual functions used in the
338 /// generic dependence graph build algorithm.
339 ///
340 /// For information about time complexity of the build algorithm see the
341 /// comments near the declaration of AbstractDependenceGraphBuilder.
342 class DDGBuilder : public AbstractDependenceGraphBuilder<DataDependenceGraph> {
343 public:
345  const BasicBlockListType &BBs)
346  : AbstractDependenceGraphBuilder(G, D, BBs) {}
347  DDGNode &createRootNode() final override {
348  auto *RN = new RootDDGNode();
349  assert(RN && "Failed to allocate memory for DDG root node.");
350  Graph.addNode(*RN);
351  return *RN;
352  }
354  auto *SN = new SimpleDDGNode(I);
355  assert(SN && "Failed to allocate memory for simple DDG node.");
356  Graph.addNode(*SN);
357  return *SN;
358  }
359  DDGNode &createPiBlock(const NodeListType &L) final override {
360  auto *Pi = new PiBlockDDGNode(L);
361  assert(Pi && "Failed to allocate memory for pi-block node.");
362  Graph.addNode(*Pi);
363  return *Pi;
364  }
365  DDGEdge &createDefUseEdge(DDGNode &Src, DDGNode &Tgt) final override {
366  auto *E = new DDGEdge(Tgt, DDGEdge::EdgeKind::RegisterDefUse);
367  assert(E && "Failed to allocate memory for edge");
368  Graph.connect(Src, Tgt, *E);
369  return *E;
370  }
371  DDGEdge &createMemoryEdge(DDGNode &Src, DDGNode &Tgt) final override {
373  assert(E && "Failed to allocate memory for edge");
374  Graph.connect(Src, Tgt, *E);
375  return *E;
376  }
377  DDGEdge &createRootedEdge(DDGNode &Src, DDGNode &Tgt) final override {
378  auto *E = new DDGEdge(Tgt, DDGEdge::EdgeKind::Rooted);
379  assert(E && "Failed to allocate memory for edge");
380  assert(isa<RootDDGNode>(Src) && "Expected root node");
381  Graph.connect(Src, Tgt, *E);
382  return *E;
383  }
384 
385  const NodeListType &getNodesInPiBlock(const DDGNode &N) final override {
386  auto *PiNode = dyn_cast<const PiBlockDDGNode>(&N);
387  assert(PiNode && "Expected a pi-block node.");
388  return PiNode->getNodes();
389  }
390 
391  bool shouldCreatePiBlocks() const final override;
392 };
393 
399 
400 //===--------------------------------------------------------------------===//
401 // DDG Analysis Passes
402 //===--------------------------------------------------------------------===//
403 
404 /// Analysis pass that builds the DDG for a loop.
405 class DDGAnalysis : public AnalysisInfoMixin<DDGAnalysis> {
406 public:
407  using Result = std::unique_ptr<DataDependenceGraph>;
409 
410 private:
412  static AnalysisKey Key;
413 };
414 
415 /// Textual printer pass for the DDG of a loop.
416 class DDGAnalysisPrinterPass : public PassInfoMixin<DDGAnalysisPrinterPass> {
417 public:
418  explicit DDGAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}
421 
422 private:
423  raw_ostream &OS;
424 };
425 
426 //===--------------------------------------------------------------------===//
427 // GraphTraits specializations for the DDG
428 //===--------------------------------------------------------------------===//
429 
430 /// non-const versions of the grapth trait specializations for DDG
431 template <> struct GraphTraits<DDGNode *> {
432  using NodeRef = DDGNode *;
433 
435  return &P->getTargetNode();
436  }
437 
438  // Provide a mapped iterator so that the GraphTrait-based implementations can
439  // find the target nodes without having to explicitly go through the edges.
440  using ChildIteratorType =
443 
444  static NodeRef getEntryNode(NodeRef N) { return N; }
446  return ChildIteratorType(N->begin(), &DDGGetTargetNode);
447  }
449  return ChildIteratorType(N->end(), &DDGGetTargetNode);
450  }
451 
453  return N->begin();
454  }
455  static ChildEdgeIteratorType child_edge_end(NodeRef N) { return N->end(); }
456 };
457 
458 template <>
462  return &DG->getRoot();
463  }
465  return DG->begin();
466  }
467  static nodes_iterator nodes_end(DataDependenceGraph *DG) { return DG->end(); }
468 };
469 
470 /// const versions of the grapth trait specializations for DDG
471 template <> struct GraphTraits<const DDGNode *> {
472  using NodeRef = const DDGNode *;
473 
475  return &P->getTargetNode();
476  }
477 
478  // Provide a mapped iterator so that the GraphTrait-based implementations can
479  // find the target nodes without having to explicitly go through the edges.
480  using ChildIteratorType =
483 
484  static NodeRef getEntryNode(NodeRef N) { return N; }
486  return ChildIteratorType(N->begin(), &DDGGetTargetNode);
487  }
489  return ChildIteratorType(N->end(), &DDGGetTargetNode);
490  }
491 
493  return N->begin();
494  }
495  static ChildEdgeIteratorType child_edge_end(NodeRef N) { return N->end(); }
496 };
497 
498 template <>
503  return &DG->getRoot();
504  }
506  return DG->begin();
507  }
509  return DG->end();
510  }
511 };
512 
513 } // namespace llvm
514 
515 #endif // LLVM_ANALYSIS_DDG_H
DataDependenceGraph::const_iterator nodes_iterator
Definition: DDG.h:501
DGEdge< NodeType, EdgeType > & operator=(const DGEdge< NodeType, EdgeType > &E)
Definition: DirectedGraph.h:34
Data Dependency Graph.
Definition: DDG.h:302
DDGEdge(const DDGEdge &E)
Definition: DDG.h:230
static NodeRef getEntryNode(const DataDependenceGraph *DG)
Definition: DDG.h:502
DDGNode & operator=(DDGNode &&N)
Definition: DDG.h:66
NodeType & getRoot() const
Return the root node of the graph.
Definition: DDG.h:279
This class represents lattice values for constants.
Definition: AllocatorList.h:23
static bool classof(const DDGNode *N)
Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
Definition: DDG.h:99
static nodes_iterator nodes_end(DataDependenceGraph *DG)
Definition: DDG.h:467
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
static NodeRef getEntryNode(NodeRef N)
Definition: DDG.h:444
Data Dependency Graph Edge.
Definition: DDG.h:217
Data Dependence Graph Node The graph can represent the following types of nodes:
Definition: DDG.h:42
DataDependenceGraph(DataDependenceGraph &&G)
Definition: DDG.h:312
static ChildIteratorType child_begin(NodeRef N)
Definition: DDG.h:485
virtual ~DependenceGraphInfo()
Definition: DDG.h:273
DDGAnalysisPrinterPass(raw_ostream &OS)
Definition: DDG.h:418
DDGEdge & operator=(DDGEdge &&E)
Definition: DDG.h:238
DDGEdge & createMemoryEdge(DDGNode &Src, DDGNode &Tgt) final override
Definition: DDG.h:371
SimpleDDGNode & operator=(SimpleDDGNode &&N)
Definition: DDG.h:120
static nodes_iterator nodes_end(const DataDependenceGraph *DG)
Definition: DDG.h:508
const NodeType & getTargetNode() const
Retrieve the target node this edge connects to.
Definition: DirectedGraph.h:45
static ChildEdgeIteratorType child_edge_begin(NodeRef N)
Definition: DDG.h:492
const InstructionListType & getInstructions() const
Get the list of instructions in this node.
Definition: DDG.h:127
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLExtras.h:99
virtual ~DDGNode()=0
Definition: DDG.cpp:32
static nodes_iterator nodes_begin(DataDependenceGraph *DG)
Definition: DDG.h:464
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
F(f)
void setKind(NodeKind K)
Setter for the kind of this node.
Definition: DDG.h:83
DependenceInfo - This class is the main dependence-analysis driver.
bool isMemoryDependence() const
Return true if this is a memory dependence edge, and false otherwise.
Definition: DDG.h:251
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
Definition: ISDOpcodes.h:40
std::string Name
Definition: DDG.h:287
static ChildEdgeIteratorType child_edge_begin(NodeRef N)
Definition: DDG.h:452
Concrete implementation of a pure data dependence graph builder.
Definition: DDG.h:342
const_iterator begin() const
DDGEdge(DDGEdge &&E)
Definition: DDG.h:231
Definition: BitVector.h:937
static nodes_iterator nodes_begin(const DataDependenceGraph *DG)
Definition: DDG.h:505
PiBlockDDGNode & operator=(PiBlockDDGNode &&N)
Definition: DDG.h:186
static ChildEdgeIteratorType child_edge_end(NodeRef N)
Definition: DDG.h:455
DDGNode & operator=(const DDGNode &N)
Definition: DDG.h:60
DDGBuilder(DataDependenceGraph &G, DependenceInfo &D, const BasicBlockListType &BBs)
Definition: DDG.h:344
DDGNode & createRootNode() final override
Create the root node of the graph.
Definition: DDG.h:347
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
PiNodeList & getNodes()
Definition: DDG.h:197
DGNode< NodeType, EdgeType > & operator=(const DGNode< NodeType, EdgeType > &N)
Definition: DirectedGraph.h:83
Subclass of DDGNode representing a pi-block.
Definition: DDG.h:170
Instruction * getFirstInstruction() const
Get the first/last instruction in the node.
Definition: DDG.h:137
Key
PAL metadata keys.
bool isRooted() const
Return true if this is an edge stemming from the root node, and false otherwise.
Definition: DDG.h:255
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:373
DDGNode & createPiBlock(const NodeListType &L) final override
Create a pi-block node in the graph representing a group of nodes in an SCC of the graph...
Definition: DDG.h:359
DDGEdge & operator=(const DDGEdge &E)
Definition: DDG.h:232
typename EdgeListTy::const_iterator const_iterator
Definition: DirectedGraph.h:74
This header provides classes for managing per-loop analyses.
static ChildIteratorType child_begin(NodeRef N)
Definition: DDG.h:445
static NodeRef getEntryNode(DataDependenceGraph *DG)
Definition: DDG.h:461
~RootDDGNode()
Definition: DDG.h:96
EdgeKind getKind() const
Get the edge kind.
Definition: DDG.h:245
Textual printer pass for the DDG of a loop.
Definition: DDG.h:416
DDGNode(const NodeKind K)
Definition: DDG.h:55
#define P(N)
SimpleDDGNode & operator=(const SimpleDDGNode &N)
Definition: DDG.h:114
typename DDGNode *::UnknownGraphTypeError NodeRef
Definition: GraphTraits.h:78
const_iterator end() const
Definition: DirectedGraph.h:98
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:154
Represent an edge in the directed graph.
Definition: DirectedGraph.h:27
EdgeKind
The kind of edge in the DDG.
Definition: DDG.h:220
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static ChildIteratorType child_end(NodeRef N)
Definition: DDG.h:488
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:390
static bool classof(const RootDDGNode *N)
Definition: DDG.h:102
const StringRef getName() const
Return the label that is used to name this graph.
Definition: DDG.h:276
NodeKind getKind() const
Getter for the kind of this node.
Definition: DDG.h:73
DDGNode()=delete
Determine the kind of a node from its type.
DDGEdge & createRootedEdge(DDGNode &Src, DDGNode &Tgt) final override
Definition: DDG.h:377
size_t size() const
Definition: SmallVector.h:52
static ChildEdgeIteratorType child_edge_end(NodeRef N)
Definition: DDG.h:495
const versions of the grapth trait specializations for DDG
Definition: DDG.h:471
DDGNode & createFineGrainedNode(Instruction &I) final override
Create an atomic node in the graph given a single instruction.
Definition: DDG.h:353
static DDGNode * DDGGetTargetNode(DGEdge< DDGNode, DDGEdge > *P)
Definition: DDG.h:434
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
std::unique_ptr< DataDependenceGraph > Result
Definition: DDG.h:407
Directed graph.
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:837
InstructionListType & getInstructions()
Definition: DDG.h:131
Encapsulate some common data and functionality needed for different variations of data dependence gra...
Definition: DDG.h:263
Represent a node in the directed graph.
Definition: DirectedGraph.h:70
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
bool isDefUse() const
Return true if this is a def-use edge, and false otherwise.
Definition: DDG.h:248
DDGNode::const_iterator ChildEdgeIteratorType
Definition: DDG.h:482
const_iterator end() const
const PiNodeList & getNodes() const
Get the list of nodes in this pi-block.
Definition: DDG.h:193
Instruction * getLastInstruction() const
Definition: DDG.h:138
const NodeListType & getNodesInPiBlock(const DDGNode &N) final override
Definition: DDG.h:385
const DependenceInfo DI
Definition: DDG.h:292
Subclass of DDGNode representing the root node of the graph.
Definition: DDG.h:91
SmallVector< NodeAddr< NodeBase * >, 4 > NodeList
Definition: RDFGraph.h:512
non-const versions of the grapth trait specializations for DDG
Definition: DDG.h:431
Analysis pass that builds the DDG for a loop.
Definition: DDG.h:405
RootDDGNode(RootDDGNode &&N)
Definition: DDG.h:95
DependenceGraphInfo(const std::string &N, const DependenceInfo &DepInfo)
Definition: DDG.h:269
static const DDGNode * DDGGetTargetNode(const DGEdge< DDGNode, DDGEdge > *P)
Definition: DDG.h:474
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:509
typename EdgeListTy::iterator iterator
Definition: DirectedGraph.h:73
typename NodeListTy::const_iterator const_iterator
const NodeList & List
Definition: RDFGraph.cpp:201
#define I(x, y, z)
Definition: MD5.cpp:58
#define N
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:332
static NodeRef getEntryNode(NodeRef N)
Definition: DDG.h:484
static bool classof(const SimpleDDGNode *N)
Definition: DDG.h:145
DDGNode::iterator ChildEdgeIteratorType
Definition: DDG.h:442
static ChildIteratorType child_end(NodeRef N)
Definition: DDG.h:448
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
Definition: APInt.h:2096
PiBlockDDGNode & operator=(const PiBlockDDGNode &N)
Definition: DDG.h:180
DependenceGraphInfo(DependenceGraphInfo &&G)
Definition: DDG.h:271
Subclass of DDGNode representing single or multi-instruction nodes.
Definition: DDG.h:106
DDGNode(DDGNode &&N)
Definition: DDG.h:57
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
aarch64 promote const
typename NodeListTy::iterator iterator
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:54
DataDependenceGraph::iterator nodes_iterator
Definition: DDG.h:460
A container for analyses that lazily runs them and caches their results.
DDGEdge & createDefUseEdge(DDGNode &Src, DDGNode &Tgt) final override
Definition: DDG.h:365
DDGNode(const DDGNode &N)
Definition: DDG.h:56
static bool classof(const DDGNode *N)
Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
Definition: DDG.h:203
static bool classof(const DDGNode *N)
Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc.
Definition: DDG.h:141
const_iterator begin() const
Definition: DirectedGraph.h:97
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:71
bool collectInstructions(llvm::function_ref< bool(Instruction *)> const &Pred, InstructionListType &IList) const
Collect a list of instructions, in IList, for which predicate Pred evaluates to true when iterating o...
Definition: DDG.cpp:34
DDGEdge(DDGNode &N, EdgeKind K)
Definition: DDG.h:229