#include <Graph.h>
Definition at line 34 of file Graph.h.
◆ Graph()
◆ ~Graph()
Definition at line 92 of file Graph.cpp.
93{
94 for (auto &node : _ops)
95 {
96 delete node;
97 }
98}
◆ accept()
void mir::Graph::accept |
( |
IVisitor * |
visitor | ) |
|
◆ copyOpWithInputs()
Operation * mir::Graph::copyOpWithInputs |
( |
Operation * |
old_op, |
|
|
const std::vector< Operation::Output * > & |
inputs |
|
) |
| |
|
inline |
◆ create()
template<typename T , typename... Args>
Operation * mir::Graph::create |
( |
Args &&... |
args | ) |
|
|
inline |
Definition at line 41 of file Graph.h.
42 {
43 auto op = new T(std::forward<Args>(args)...);
44 op->setId(_last_node_id++);
45 registerOp(op);
46 return op;
47 }
◆ getInputs()
std::vector< ops::InputOp * > mir::Graph::getInputs |
( |
| ) |
const |
|
inline |
Returns all graph input nodes.
- Returns
- vector containing all graph input nodes
Definition at line 73 of file Graph.h.
◆ getNodes()
std::unordered_set< Operation * > mir::Graph::getNodes |
( |
| ) |
const |
|
inline |
◆ getOutputs()
Returns all graph output nodes.
- Returns
- vector containing all graph output nodes
Definition at line 79 of file Graph.h.
◆ removeNode()
void mir::Graph::removeNode |
( |
Operation * |
op | ) |
|
remove node from graph, along with its links in other nodes
- Parameters
-
Definition at line 117 of file Graph.cpp.
118{
119#ifndef NDEBUG
121 {
122 assert(
output.getUses().empty() &&
"Trying to remove a node that has uses.");
123 }
124#endif
125
126 for (std::size_t i = 0; i < op->getNumInputs(); ++i)
127 {
128 op->getInput(i)->removeUse(Operation::Use(op, i));
129 }
130
131 if (op->getType() == Operation::Type::input)
132 _inputs.erase(
133 std::remove(_inputs.begin(), _inputs.end(), op));
134
135 if (op->getType() == Operation::Type::output)
136 _outputs.erase(
137 std::remove(_outputs.begin(), _outputs.end(), op));
138
139 _ops.erase(op);
140 delete op;
141}
std::vector< ops::OutputOp * > getOutputs() const
Returns all graph output nodes.
References mir::Operation::getInput(), mir::Operation::getNumInputs(), mir::Operation::getOutputs(), mir::Operation::getType(), and mir::Operation::Output::removeUse().
Referenced by replaceNode().
◆ replaceNode()
Subsitude node in graph with another keeping all edges.
- Parameters
-
op | Node to subsitude |
with | Node to place instead |
Definition at line 111 of file Graph.cpp.
112{
113 replaceUsages(op, with);
115}
void removeNode(Operation *op)
remove node from graph, along with its links in other nodes
References removeNode().
The documentation for this class was generated from the following files: