Introduce side-effect-free as relaxed version of movable.

This commit is contained in:
chriseth
2019-05-16 12:30:05 +02:00
parent d172b9bf11
commit e8a88b13e4
8 changed files with 56 additions and 11 deletions
+17 -8
View File
@@ -51,21 +51,30 @@ void MovableChecker::operator()(Identifier const& _identifier)
void MovableChecker::operator()(FunctionalInstruction const& _instr)
{
ASTWalker::operator()(_instr);
if (!eth::SemanticInformation::movable(_instr.instruction))
m_movable = false;
else
ASTWalker::operator()(_instr);
if (!eth::SemanticInformation::sideEffectFree(_instr.instruction))
m_sideEffectFree = false;
}
void MovableChecker::operator()(FunctionCall const& _functionCall)
{
ASTWalker::operator()(_functionCall);
if (BuiltinFunction const* f = m_dialect.builtin(_functionCall.functionName.name))
if (f->movable)
{
ASTWalker::operator()(_functionCall);
return;
}
m_movable = false;
{
if (!f->movable)
m_movable = false;
if (!f->sideEffectFree)
m_sideEffectFree = false;
}
else
{
m_movable = false;
m_sideEffectFree = false;
}
}
void MovableChecker::visit(Statement const&)