Jlm
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 
9 #include <jlm/rvsdg/lambda.hpp>
10 #include <jlm/rvsdg/Phi.hpp>
12 
13 namespace jlm::rvsdg
14 {
15 class DeltaNode;
16 class GammaNode;
17 class Graph;
18 class LambdaNode;
19 class Output;
20 class StructuralNode;
21 class ThetaNode;
22 class Region;
23 }
24 
25 namespace jlm::llvm
26 {
27 
44 {
45  class Context;
46  class Statistics;
47 
48 public:
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 
69 private:
70  void
71  MarkRegion(const rvsdg::Region & region);
72 
73  void
74  MarkOutput(const jlm::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  std::unique_ptr<Context> Context_;
101 };
102 
103 }
104 
105 #endif
Dead Node Elimination context class.
Dead Node Elimination statistics class.
Dead Node Elimination Optimization.
void SweepRegion(rvsdg::Region &region) const
void SweepGamma(rvsdg::GammaNode &gammaNode) const
void SweepStructuralNode(rvsdg::StructuralNode &node) const
static void SweepDelta(rvsdg::DeltaNode &deltaNode)
void run(rvsdg::Region &region)
void MarkOutput(const jlm::rvsdg::Output &output)
void Run(rvsdg::RvsdgModule &module, util::StatisticsCollector &statisticsCollector) override
Perform RVSDG transformation.
std::unique_ptr< Context > Context_
void SweepRvsdg(rvsdg::Graph &rvsdg) const
void SweepLambda(rvsdg::LambdaNode &lambdaNode) const
void SweepTheta(rvsdg::ThetaNode &thetaNode) const
~DeadNodeElimination() noexcept override
void MarkRegion(const rvsdg::Region &region)
void SweepPhi(rvsdg::PhiNode &phiNode) const
Represents an RVSDG transformation.
Global memory state passed between functions.