Jlm
Loading...
Searching...
No Matches
DeadNodeElimination.hpp
Go to the documentation of this file.
1/*
2 * Copyright 2017 Nico Reißmann <nico.reissmann@gmail.com>
3 * See COPYING for terms of redistribution.
4 */
5
6#ifndef JLM_LLVM_OPT_DEADNODEELIMINATION_HPP
7#define JLM_LLVM_OPT_DEADNODEELIMINATION_HPP
8
10#include <jlm/rvsdg/Phi.hpp>
12
13namespace jlm::rvsdg
14{
15class DeltaNode;
16class GammaNode;
17class Graph;
18class LambdaNode;
19class Output;
20class StructuralNode;
21class ThetaNode;
22class Region;
23}
24
25namespace jlm::llvm
26{
27
44{
45 class Context;
46 class Statistics;
47
48public:
49 ~DeadNodeElimination() noexcept override;
50
52
54
56
58 operator=(const DeadNodeElimination &) = delete;
59
61 operator=(DeadNodeElimination &&) = delete;
62
63 void
64 run(rvsdg::Region & region);
65
66 void
67 Run(rvsdg::RvsdgModule & module, util::StatisticsCollector & statisticsCollector) override;
68
69private:
70 void
71 markRegion(const rvsdg::Region & region);
72
73 void
74 markOutput(const rvsdg::Output & output);
75
76 void
77 sweepRvsdg(rvsdg::Graph & rvsdg) const;
78
79 void
80 sweepRegion(rvsdg::Region & region) const;
81
82 void
83 sweepStructuralNode(rvsdg::StructuralNode & node) const;
84
85 void
86 sweepGamma(rvsdg::GammaNode & gammaNode) const;
87
88 void
89 sweepTheta(rvsdg::ThetaNode & thetaNode) const;
90
91 void
92 sweepLambda(rvsdg::LambdaNode & lambdaNode) const;
93
94 void
95 sweepPhi(rvsdg::PhiNode & phiNode) const;
96
97 static void
98 sweepDelta(rvsdg::DeltaNode & deltaNode);
99
100 static void
101 removeNode(rvsdg::Node & node);
102
103 std::unique_ptr<Context> Context_{};
104};
105
106}
107
108#endif
static jlm::util::StatisticsCollector statisticsCollector
Dead Node Elimination context class.
Dead Node Elimination statistics class.
Dead Node Elimination Optimization.
void sweepStructuralNode(rvsdg::StructuralNode &node) const
static void sweepDelta(rvsdg::DeltaNode &deltaNode)
void sweepGamma(rvsdg::GammaNode &gammaNode) const
void sweepLambda(rvsdg::LambdaNode &lambdaNode) const
void run(rvsdg::Region &region)
void Run(rvsdg::RvsdgModule &module, util::StatisticsCollector &statisticsCollector) override
Perform RVSDG transformation.
std::unique_ptr< Context > Context_
void markRegion(const rvsdg::Region &region)
void sweepPhi(rvsdg::PhiNode &phiNode) const
void sweepRvsdg(rvsdg::Graph &rvsdg) const
~DeadNodeElimination() noexcept override
static void removeNode(rvsdg::Node &node)
void markOutput(const rvsdg::Output &output)
void sweepRegion(rvsdg::Region &region) const
void sweepTheta(rvsdg::ThetaNode &thetaNode) const
Represents an RVSDG transformation.
Global memory state passed between functions.