diff options
Diffstat (limited to 'libyul/optimiser/Semantics.cpp')
-rw-r--r-- | libyul/optimiser/Semantics.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libyul/optimiser/Semantics.cpp b/libyul/optimiser/Semantics.cpp index 91bb2709..7edf97d7 100644 --- a/libyul/optimiser/Semantics.cpp +++ b/libyul/optimiser/Semantics.cpp @@ -22,6 +22,7 @@ #include <libyul/Exceptions.h> #include <libyul/AsmData.h> +#include <libyul/Dialect.h> #include <libevmasm/SemanticInformation.h> @@ -31,7 +32,13 @@ using namespace std; using namespace dev; using namespace yul; -MovableChecker::MovableChecker(Expression const& _expression) +MovableChecker::MovableChecker(Dialect const& _dialect): + m_dialect(_dialect) +{ +} + +MovableChecker::MovableChecker(Dialect const& _dialect, Expression const& _expression): + MovableChecker(_dialect) { visit(_expression); } @@ -50,8 +57,14 @@ void MovableChecker::operator()(FunctionalInstruction const& _instr) ASTWalker::operator()(_instr); } -void MovableChecker::operator()(FunctionCall const&) +void MovableChecker::operator()(FunctionCall const& _functionCall) { + if (BuiltinFunction const* f = m_dialect.builtin(_functionCall.functionName.name)) + if (f->movable) + { + ASTWalker::operator()(_functionCall); + return; + } m_movable = false; } |