aboutsummaryrefslogtreecommitdiffstats
path: root/libyul/optimiser/UnusedPruner.h
diff options
context:
space:
mode:
Diffstat (limited to 'libyul/optimiser/UnusedPruner.h')
-rw-r--r--libyul/optimiser/UnusedPruner.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/libyul/optimiser/UnusedPruner.h b/libyul/optimiser/UnusedPruner.h
index 64e02b35..72279d4a 100644
--- a/libyul/optimiser/UnusedPruner.h
+++ b/libyul/optimiser/UnusedPruner.h
@@ -28,6 +28,7 @@
namespace yul
{
+struct Dialect;
/**
* Optimisation stage that removes unused variables and functions and also
@@ -40,7 +41,11 @@ namespace yul
class UnusedPruner: public ASTModifier
{
public:
- explicit UnusedPruner(Block& _ast, std::set<YulString> const& _externallyUsedFunctions = {});
+ UnusedPruner(
+ Dialect const& _dialect,
+ Block& _ast,
+ std::set<YulString> const& _externallyUsedFunctions = {}
+ );
using ASTModifier::operator();
void operator()(Block& _block) override;
@@ -49,12 +54,17 @@ public:
bool shouldRunAgain() const { return m_shouldRunAgain; }
// Run the pruner until the code does not change anymore.
- static void runUntilStabilised(Block& _ast, std::set<YulString> const& _externallyUsedFunctions = {});
+ static void runUntilStabilised(
+ Dialect const& _dialect,
+ Block& _ast,
+ std::set<YulString> const& _externallyUsedFunctions = {}
+ );
private:
bool used(YulString _name) const;
void subtractReferences(std::map<YulString, size_t> const& _subtrahend);
+ Dialect const& m_dialect;
bool m_shouldRunAgain = false;
std::map<YulString, size_t> m_references;
};