#include <RemoveDeadNodeWithQueryPass.h>
◆ name()
const char * logo::RemoveDeadNodeWithQueryPass::name |
( |
void |
| ) |
const |
|
inlinefinalvirtual |
◆ run()
bool logo::RemoveDeadNodeWithQueryPass::run |
( |
loco::Graph * |
graph | ) |
|
|
virtual |
Run the pass.
- Returns
- false if there was nothing changed
Implements logo::Pass.
Definition at line 29 of file RemoveDeadNodeWithQueryPass.cpp.
30{
31
33
34
35 std::set<loco::Node *> candidates;
36
38 {
40 {
41 candidates.insert(node);
42 }
43 }
44
45
46 for (auto it = candidates.begin(); it != candidates.end();)
47 {
48 if (auto service = (*it)->dialect()->service<DeadNodeQueryService>())
49 {
50 if (!service->isDeadNode(*it))
51 {
52 it = candidates.erase(it);
53 continue;
54 }
55 }
56 ++it;
57 }
58
59 for (auto node : candidates)
60 {
61 node->drop();
62 }
63
64 for (auto node : candidates)
65 {
66 g->nodes()->destroy(node);
67 }
68
69 return candidates.size() > 0;
70}
std::set< Node * > all_nodes(Graph *)
Enumerate all the nodes in a given graph.
std::set< loco::Node * > active_nodes(const std::vector< loco::Node * > &roots)
Enumerate all the nodes required to compute "roots".
std::vector< Node * > output_nodes(Graph *)
References loco::active_nodes(), loco::all_nodes(), and loco::output_nodes().
The documentation for this struct was generated from the following files: