aboutsummaryrefslogtreecommitdiffstats
path: root/libyul/optimiser/UnusedPruner.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-21 01:55:32 +0800
committerchriseth <chris@ethereum.org>2019-01-07 23:41:03 +0800
commit9222eff08fad8e6a0ea7df8b299880f90c68c8b3 (patch)
tree20b9a2e40164fb693ab52e75ad1cd2388d142473 /libyul/optimiser/UnusedPruner.h
parentd9910f2a1258e8d16d7a57905dabcd09db4e6a8d (diff)
downloaddexon-solidity-9222eff08fad8e6a0ea7df8b299880f90c68c8b3.tar.gz
dexon-solidity-9222eff08fad8e6a0ea7df8b299880f90c68c8b3.tar.zst
dexon-solidity-9222eff08fad8e6a0ea7df8b299880f90c68c8b3.zip
Make the dialect available everywhere.
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;
};