LLVM 20.0.0git
|
Directed graph. More...
#include "llvm/ADT/DirectedGraph.h"
Public Types | |
using | iterator = typename NodeListTy::iterator |
using | const_iterator = typename NodeListTy::const_iterator |
using | DGraphType = DirectedGraph< NodeType, EdgeType > |
Public Member Functions | |
DirectedGraph ()=default | |
DirectedGraph (NodeType &N) | |
DirectedGraph (const DGraphType &G) | |
DirectedGraph (DGraphType &&RHS) | |
DGraphType & | operator= (const DGraphType &G) |
DGraphType & | operator= (const DGraphType &&G) |
const_iterator | begin () const |
const_iterator | end () const |
iterator | begin () |
iterator | end () |
const NodeType & | front () const |
NodeType & | front () |
const NodeType & | back () const |
NodeType & | back () |
size_t | size () const |
const_iterator | findNode (const NodeType &N) const |
Find the given node N in the table. | |
iterator | findNode (const NodeType &N) |
bool | addNode (NodeType &N) |
Add the given node N to the graph if it is not already present. | |
bool | findIncomingEdgesToNode (const NodeType &N, SmallVectorImpl< EdgeType * > &EL) const |
Collect in EL all edges that are coming into node N . | |
bool | removeNode (NodeType &N) |
Remove the given node N from the graph. | |
bool | connect (NodeType &Src, NodeType &Dst, EdgeType &E) |
Assuming nodes Src and Dst are already in the graph, connect node Src to node Dst using the provided edge E . | |
Protected Types | |
using | NodeListTy = SmallVector< NodeType *, 10 > |
using | EdgeListTy = SmallVector< EdgeType *, 10 > |
Protected Attributes | |
NodeListTy | Nodes |
Directed graph.
The graph is represented by a table of nodes. Each node contains a (possibly empty) list of outgoing edges. Each edge contains the target node it connects to.
Definition at line 173 of file DirectedGraph.h.
using llvm::DirectedGraph< NodeType, EdgeType >::const_iterator = typename NodeListTy::const_iterator |
Definition at line 179 of file DirectedGraph.h.
using llvm::DirectedGraph< NodeType, EdgeType >::DGraphType = DirectedGraph<NodeType, EdgeType> |
Definition at line 180 of file DirectedGraph.h.
|
protected |
Definition at line 176 of file DirectedGraph.h.
using llvm::DirectedGraph< NodeType, EdgeType >::iterator = typename NodeListTy::iterator |
Definition at line 178 of file DirectedGraph.h.
|
protected |
Definition at line 175 of file DirectedGraph.h.
|
default |
|
inlineexplicit |
Definition at line 183 of file DirectedGraph.h.
References llvm::DirectedGraph< NodeType, EdgeType >::addNode(), and N.
|
inline |
Definition at line 184 of file DirectedGraph.h.
|
inline |
Definition at line 185 of file DirectedGraph.h.
|
inline |
Add the given node N
to the graph if it is not already present.
Definition at line 217 of file DirectedGraph.h.
References llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::DirectedGraph< NodeType, EdgeType >::findNode(), N, llvm::DirectedGraph< NodeType, EdgeType >::Nodes, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::DataDependenceGraph::addNode(), and llvm::DirectedGraph< NodeType, EdgeType >::DirectedGraph().
|
inline |
Definition at line 202 of file DirectedGraph.h.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
|
inline |
Definition at line 201 of file DirectedGraph.h.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
|
inline |
Definition at line 197 of file DirectedGraph.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
|
inline |
Definition at line 195 of file DirectedGraph.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
Referenced by llvm::GraphTraits< const DataDependenceGraph * >::nodes_begin(), and llvm::GraphTraits< DataDependenceGraph * >::nodes_begin().
|
inline |
Assuming nodes Src
and Dst
are already in the graph, connect node Src
to node Dst
using the provided edge E
.
Return true if Src
is not already connected to Dst
via E
, and false otherwise.
Definition at line 265 of file DirectedGraph.h.
References assert(), E, llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::DirectedGraph< NodeType, EdgeType >::findNode(), and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
Referenced by llvm::DDGBuilder::createDefUseEdge(), llvm::DDGBuilder::createMemoryEdge(), llvm::DDGBuilder::createRootedEdge(), and llvm::DDGBuilder::mergeNodes().
|
inline |
Definition at line 198 of file DirectedGraph.h.
References llvm::SmallVectorTemplateCommon< T, typename >::end(), and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
|
inline |
Definition at line 196 of file DirectedGraph.h.
References llvm::SmallVectorTemplateCommon< T, typename >::end(), and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
Referenced by llvm::GraphTraits< const DataDependenceGraph * >::nodes_end(), and llvm::GraphTraits< DataDependenceGraph * >::nodes_end().
|
inline |
Collect in EL
all edges that are coming into node N
.
Return true if at least one edge was found, and false otherwise.
Definition at line 226 of file DirectedGraph.h.
References llvm::append_range(), assert(), llvm::SmallVectorImpl< T >::clear(), llvm::SmallVectorBase< Size_T >::empty(), N, and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
|
inline |
Definition at line 211 of file DirectedGraph.h.
References llvm::DirectedGraph< NodeType, EdgeType >::findNode(), and N.
|
inline |
Find the given node N
in the table.
Definition at line 207 of file DirectedGraph.h.
References llvm::find_if(), N, and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
Referenced by llvm::DirectedGraph< NodeType, EdgeType >::addNode(), llvm::DirectedGraph< NodeType, EdgeType >::connect(), llvm::DirectedGraph< NodeType, EdgeType >::findNode(), and llvm::DirectedGraph< NodeType, EdgeType >::removeNode().
|
inline |
Definition at line 200 of file DirectedGraph.h.
References llvm::SmallVectorTemplateCommon< T, typename >::front(), and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
|
inline |
Definition at line 199 of file DirectedGraph.h.
References llvm::SmallVectorTemplateCommon< T, typename >::front(), and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
|
inline |
Definition at line 190 of file DirectedGraph.h.
References G, and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
|
inline |
Definition at line 186 of file DirectedGraph.h.
References G, and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
|
inline |
Remove the given node N
from the graph.
If the node has incoming or outgoing edges, they are also removed. Return true if the node was found and then removed, and false if the node was not found in the graph to begin with.
Definition at line 243 of file DirectedGraph.h.
References E, llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::SmallVectorImpl< T >::erase(), llvm::DirectedGraph< NodeType, EdgeType >::findNode(), IT, N, and llvm::DirectedGraph< NodeType, EdgeType >::Nodes.
Referenced by llvm::DDGBuilder::mergeNodes().
|
inline |
Definition at line 204 of file DirectedGraph.h.
References llvm::DirectedGraph< NodeType, EdgeType >::Nodes, and llvm::SmallVectorBase< Size_T >::size().
|
protected |
Definition at line 275 of file DirectedGraph.h.
Referenced by llvm::DirectedGraph< NodeType, EdgeType >::addNode(), llvm::DirectedGraph< NodeType, EdgeType >::back(), llvm::DirectedGraph< NodeType, EdgeType >::begin(), llvm::DirectedGraph< NodeType, EdgeType >::connect(), llvm::DirectedGraph< NodeType, EdgeType >::end(), llvm::DirectedGraph< NodeType, EdgeType >::findIncomingEdgesToNode(), llvm::DirectedGraph< NodeType, EdgeType >::findNode(), llvm::DirectedGraph< NodeType, EdgeType >::front(), llvm::DirectedGraph< NodeType, EdgeType >::operator=(), llvm::DirectedGraph< NodeType, EdgeType >::removeNode(), llvm::DirectedGraph< NodeType, EdgeType >::size(), and llvm::DataDependenceGraph::~DataDependenceGraph().