Yul Optimizer: reduce switches with const arguments

This commit is contained in:
Mathias Baumann
2019-02-28 15:43:10 +01:00
parent e9543d83c7
commit c686a65876
8 changed files with 118 additions and 1 deletions
+3
View File
@@ -18,6 +18,7 @@
#include <libyul/optimiser/ASTWalker.h>
#include <libyul/optimiser/DataFlowAnalyzer.h>
#include <libdevcore/Common.h>
namespace yul
{
@@ -29,6 +30,7 @@ namespace yul
* - remove if with false condition
* - turn switch with single case into if
* - replace switch with only default case with pop(expression) and body
* - replace switch with const expr with matching case body
* - remove for with false condition
*
* Prerequisites: Disambiguator
@@ -46,6 +48,7 @@ private:
void simplify(std::vector<Statement>& _statements);
bool expressionAlwaysTrue(Expression const& _expression);
bool expressionAlwaysFalse(Expression const& _expression);
boost::optional<dev::u256> hasLiteralValue(Expression const& _expression) const;
};
}