Go to the documentation of this file.
15 #ifndef LLVM_ADT_DIRECTEDGRAPH_H
16 #define LLVM_ADT_DIRECTEDGRAPH_H
28 template <
class NodeType,
class EdgeType>
class DGEdge {
59 bool isEqualTo(
const EdgeType &
E)
const {
return this == &
E; }
62 EdgeType &
getDerived() {
return *
static_cast<EdgeType *
>(
this); }
64 return *
static_cast<const EdgeType *
>(
this);
73 template <
class NodeType,
class EdgeType>
class DGNode {
98 return M.isEqualTo(
N);
118 assert(EL.empty() &&
"Expected the list of edges to be empty.");
120 if (
E->getTargetNode() ==
N)
154 return *
static_cast<const NodeType *
>(
this);
161 Edges, [&
N](
const EdgeType *
E) {
return E->getTargetNode() ==
N; });
227 assert(EL.empty() &&
"Expected the list of edges to be empty.");
232 Node->findEdgesTo(
N, TempList);
252 Node->findEdgesTo(
N, EL);
254 Node->removeEdge(*
E);
268 assert((
E.getTargetNode() == Dst) &&
269 "Target of the given edge does not match Dst.");
270 return Src.addEdge(
E);
280 #endif // LLVM_ADT_DIRECTEDGRAPH_H
void clear()
Clear the outgoing edges.
This is an optimization pass for GlobalISel generic memory operations.
iterator erase(const_iterator CI)
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
DirectedGraph(NodeType &N)
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 ...
bool operator==(const DGEdge &E) const
Static polymorphism: delegate implementation (via isEqualTo) to the derived class.
const NodeType & getDerived() const
bool isEqualTo(const NodeType &N) const
DGNode(const DGNode< NodeType, EdgeType > &N)
Represent a node in the directed graph.
typename vector_type::const_iterator iterator
friend bool operator!=(const NodeType &M, const NodeType &N)
const_iterator begin() const
typename vector_type::const_iterator const_iterator
const EdgeType & getDerived() const
DirectedGraph(const DGraphType &G)
const_iterator end() const
bool findIncomingEdgesToNode(const NodeType &N, SmallVectorImpl< EdgeType * > &EL) const
Collect in EL all edges that are coming into node N.
bool remove(const value_type &X)
Remove an item from the set vector.
DGEdge(const DGEdge< NodeType, EdgeType > &E)
typename NodeListTy::const_iterator const_iterator
DGNode(DGNode< NodeType, EdgeType > &&N)
iterator begin()
Get an iterator to the beginning of the SetVector.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
bool hasEdgeTo(const NodeType &N) const
Test whether there is an edge that goes from this node to N.
typename NodeListTy::iterator iterator
const_iterator end() const
void setTargetNode(const NodeType &N)
Set the target node this edge connects to.
friend bool operator==(const NodeType &M, const NodeType &N)
Static polymorphism: delegate implementation (via isEqualTo) to the derived class.
const EdgeListTy & getEdges() const
Retrieve the outgoing edges for the node.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
iterator findNode(const NodeType &N)
const_iterator begin() const
DGNode(EdgeType &E)
Create a node with a single outgoing edge E.
DGEdge(NodeType &N)
Create an edge pointing to the given node N.
const NodeType & getTargetNode() const
Retrieve the target node this edge connects to.
static cl::opt< ITMode > IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT), cl::ZeroOrMore, cl::values(clEnumValN(DefaultIT, "arm-default-it", "Generate any type of IT block"), clEnumValN(RestrictedIT, "arm-restrict-it", "Disallow complex IT blocks")))
typename SuperClass::const_iterator const_iterator
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
DGNode< NodeType, EdgeType > & operator=(const DGNode< NodeType, EdgeType > &N)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
const EdgeType & front() const
bool insert(const value_type &X)
Insert a new element into the SetVector.
NodeType & getTargetNode()
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
typename EdgeListTy::const_iterator const_iterator
DGNode< NodeType, EdgeType > & operator=(const DGNode< NodeType, EdgeType > &&N)
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
void clear()
Completely clear the SetVector.
const EdgeType & back() const
const_iterator findNode(const NodeType &N) const
Find the given node N in the table.
const NodeType & front() const
const T & front() const
Return the first element of the SetVector.
DirectedGraph(DGraphType &&RHS)
bool addNode(NodeType &N)
Add the given node N to the graph if it is not already present.
const_iterator findEdgeTo(const NodeType &N) const
Find an edge to N.
iterator end()
Get an iterator to the end of the SetVector.
bool isEqualTo(const EdgeType &E) const
DGEdge< NodeType, EdgeType > & operator=(const DGEdge< NodeType, EdgeType > &E)
typename SuperClass::iterator iterator
typename EdgeListTy::iterator iterator
void removeEdge(EdgeType &E)
Remove the given edge E from this node, if it exists.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool removeNode(NodeType &N)
Remove the given node N from the graph.
const T & back() const
Return the last element of the SetVector.
bool operator!=(const DGEdge &E) const
Represent an edge in the directed graph.
const NodeType & back() const
bool addEdge(EdgeType &E)
Add the given edge E to this node, if it doesn't exist already.
DGraphType & operator=(const DGraphType &G)
DGraphType & operator=(const DGraphType &&G)
bool findEdgesTo(const NodeType &N, SmallVectorImpl< EdgeType * > &EL) const
Collect in EL, all the edges from this node to N.