Merge pull request #12766 from ethereum/removeUnneededHeader

Remove unneeded header files.
This commit is contained in:
Daniel Kirchner 2022-03-10 13:14:26 +01:00 committed by GitHub
commit 02637d56e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 29 deletions

View File

@ -55,6 +55,30 @@ OptionalStatements replaceConstArgSwitch(Switch& _switchStmt, u256 const& _const
return optional<vector<Statement>>{vector<Statement>{}};
}
optional<u256> hasLiteralValue(Expression const& _expression)
{
if (holds_alternative<Literal>(_expression))
return valueOfLiteral(std::get<Literal>(_expression));
else
return std::optional<u256>();
}
bool expressionAlwaysTrue(Expression const& _expression)
{
if (std::optional<u256> value = hasLiteralValue(_expression))
return *value != 0;
else
return false;
}
bool expressionAlwaysFalse(Expression const& _expression)
{
if (std::optional<u256> value = hasLiteralValue(_expression))
return *value == 0;
else
return false;
}
}
void StructuralSimplifier::run(OptimiserStepContext&, Block& _ast)
@ -103,27 +127,3 @@ void StructuralSimplifier::simplify(std::vector<yul::Statement>& _statements)
}
);
}
bool StructuralSimplifier::expressionAlwaysTrue(Expression const& _expression)
{
if (std::optional<u256> value = hasLiteralValue(_expression))
return *value != 0;
else
return false;
}
bool StructuralSimplifier::expressionAlwaysFalse(Expression const& _expression)
{
if (std::optional<u256> value = hasLiteralValue(_expression))
return *value == 0;
else
return false;
}
std::optional<u256> StructuralSimplifier::hasLiteralValue(Expression const& _expression) const
{
if (holds_alternative<Literal>(_expression))
return valueOfLiteral(std::get<Literal>(_expression));
else
return std::optional<u256>();
}

View File

@ -18,7 +18,6 @@
#pragma once
#include <libyul/optimiser/ASTWalker.h>
#include <libyul/optimiser/DataFlowAnalyzer.h>
#include <libyul/optimiser/OptimiserStep.h>
#include <libsolutil/Common.h>
@ -50,9 +49,6 @@ private:
StructuralSimplifier() = default;
void simplify(std::vector<Statement>& _statements);
bool expressionAlwaysTrue(Expression const& _expression);
bool expressionAlwaysFalse(Expression const& _expression);
std::optional<u256> hasLiteralValue(Expression const& _expression) const;
};
}

View File

@ -25,7 +25,6 @@
#include <libyul/Object.h>
#include <libyul/optimiser/KnowledgeBase.h>
#include <libyul/optimiser/SSAValueTracker.h>
#include <libyul/optimiser/DataFlowAnalyzer.h>
#include <libyul/optimiser/NameDispenser.h>
#include <libyul/optimiser/CommonSubexpressionEliminator.h>
#include <libyul/backends/evm/EVMDialect.h>